BRL-CAD
#include "common.h"
#include <stddef.h>
#include <math.h>
#include <string.h>
#include "bio.h"
#include "bu/parallel.h"
#include "bu/cv.h"
#include "vmath.h"
#include "bn.h"
#include "nmg.h"
#include "db.h"
#include "rtgeom.h"
#include "rt/arb_edit.h"
#include "raytrace.h"
#include "nurb.h"
#include "../../librt_private.h"
Include dependency graph for arb8.c:

Go to the source code of this file.

Data Structures

struct  oface
 
struct  aface
 
struct  arb_specific
 
struct  prep_arb
 
struct  arb_info
 

Macros

#define RT_SLOPPY_DOT_TOL   0.0087 /* inspired by RT_DOT_TOL, but less tight (.5 deg) */
 
#define ARB_AO(_t, _a, _i)   offsetof(_t, _a) + sizeof(point_t) * _i + sizeof(point_t) / ELEMENTS_PER_POINT * X
 
#define RT_ARB8_SEG_MISS(SEG)   (SEG).seg_stp=RT_SOLTAB_NULL
 
#define ARB_FACE(vlist_head, arb_pts, a, b, c, d)
 
#define RT_ARB_EDIT_EDGE   0
 
#define RT_ARB_EDIT_POINT   1
 
#define RT_ARB7_MOVE_POINT_5   11
 
#define RT_ARB6_MOVE_POINT_5   8
 
#define RT_ARB6_MOVE_POINT_6   9
 
#define RT_ARB5_MOVE_POINT_5   8
 
#define RT_ARB4_MOVE_POINT_4   3
 

Functions

int rt_arb_get_cgtype (int *cgtype, struct rt_arb_internal *arb, const struct bn_tol *tol, register int *uvec, register int *svec)
 
int rt_arb_std_type (const struct rt_db_internal *ip, const struct bn_tol *tol)
 
void rt_arb_centroid (point_t *cent, const struct rt_db_internal *ip)
 
HIDDEN int rt_arb_add_pt (register pointp_t point, const char *title, struct prep_arb *pap, int ptno, const char *name)
 
HIDDEN int rt_arb_mk_planes (register struct prep_arb *pap, struct rt_arb_internal *aip, const char *name)
 
int rt_arb_bbox (struct rt_db_internal *ip, point_t *min, point_t *max, const struct bn_tol *tol)
 
HIDDEN int rt_arb_setup (struct soltab *stp, struct rt_arb_internal *aip, struct rt_i *rtip, int uv_wanted)
 
int rt_arb_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
 
void rt_arb_print (register const struct soltab *stp)
 
int rt_arb_shot (struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead)
 
void rt_arb_vshot (struct soltab **stp, struct xray **rp, struct seg *segp, int n, struct application *ap)
 
void rt_arb_norm (register struct hit *hitp, struct soltab *stp, register struct xray *rp)
 
void rt_arb_curve (register struct curvature *cvp, register struct hit *hitp, struct soltab *stp)
 
void rt_arb_uv (struct application *ap, struct soltab *stp, register struct hit *hitp, register struct uvcoord *uvp)
 
void rt_arb_free (register struct soltab *stp)
 
int rt_arb_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
int rt_arb_class (const struct soltab *stp, const fastf_t *min, const fastf_t *max, const struct bn_tol *tol)
 
int rt_arb_import4 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
 
int rt_arb_export4 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_arb_import5 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
 
int rt_arb_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_arb_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
 
void rt_arb_ifree (struct rt_db_internal *ip)
 
int rt_arb_tess (struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
 
int rt_arb_tnurb (struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct bn_tol *tol)
 
int rt_arb_calc_points (struct rt_arb_internal *arb, int cgtype, const plane_t planes[6], const struct bn_tol *tol)
 
int rt_arb_check_points (struct rt_arb_internal *arb, int cgtype, const struct bn_tol *tol)
 
int rt_arb_3face_intersect (point_t point, const plane_t *planes, int type, int loc)
 
int rt_arb_calc_planes (struct bu_vls *error_msg_ret, struct rt_arb_internal *arb, int cgtype, plane_t planes[6], const struct bn_tol *tol)
 
int rt_arb_move_edge (struct bu_vls *error_msg_ret, struct rt_arb_internal *arb, vect_t thru, int bp1, int bp2, int end1, int end2, const vect_t dir, plane_t planes[6], const struct bn_tol *tol)
 
int rt_arb_edit (struct bu_vls *error_msg_ret, struct rt_arb_internal *arb, int arb_type, int edit_type, vect_t pos_model, plane_t planes[6], const struct bn_tol *tol)
 
int rt_arb_params (struct pc_pc_set *ps, const struct rt_db_internal *ip)
 
void rt_arb_volume (fastf_t *vol, const struct rt_db_internal *ip)
 
int rt_arb_get_edge_list (const struct rt_db_internal *ip, const short(*edge_list[])[2])
 
int rt_arb_find_e_nearest_pt2 (int *edge, int *vert1, int *vert2, const struct rt_db_internal *ip, const point_t pt2, const mat_t mat, fastf_t ptol)
 

Variables

const struct bu_structparse rt_arb_parse []
 
const short local_arb6_edge_vertex_mapping [10][2]
 
const short local_arb4_edge_vertex_mapping [6][2]
 

Detailed Description

Intersect a ray with an Arbitrary Regular Polyhedron with as many as 8 vertices.

An ARB is a convex volume bounded by 4 (pyramid), 5 (wedge), or 6 (box) planes. This analysis depends on the properties of objects with convex hulls. Let the ray in question be defined such that any point X on the ray may be expressed as X = P + k D. Intersect the ray with each of the planes bounding the ARB as discussed above, and record the values of the parametric distance k along the ray.

With outward pointing normal vectors, note that the ray enters the half-space defined by a plane when D cdot N < 0, is parallel to the plane when D cdot N = 0, and exits otherwise. Find the entry point farthest away from the starting point bold P, i.e. it has the largest value of k among the entry points. The ray enters the solid at this point. Similarly, find the exit point closest to point P, i.e. it has the smallest value of k among the exit points. The ray exits the solid here.

This algorithm is due to Cyrus & Beck, USAF.

Definition in file arb8.c.