BRLCAD

Files  
file  plane.c 
Some useful routines for dealing with planes and lines.  
Data Structures  
struct  plane_specific 
struct  tri_specific 
struct  tri_float_specific 
Macros  
#define  BN_CLASSIFY_UNIMPLEMENTED 0x0000 
#define  BN_CLASSIFY_INSIDE 0x0001 
#define  BN_CLASSIFY_OVERLAPPING 0x0002 
#define  BN_CLASSIFY_OUTSIDE 0x0003 
#define  MAXPTS 4 /* All we need are 4 points */ 
Plane structures (from src/librt/plane.h) Holds all the required info for geometric planes. More...  
#define  pl_A pl_points[0] /* Synonym for A point */ 
#define  UNIT_SQ_TOL 1.0e13 
Typedefs  
typedef struct tri_specific  tri_specific_double 
typedef struct tri_float_specific  tri_specific_float 
Functions  
int  bn_distsq_line3_line3 (fastf_t dist[3], point_t P, vect_t d, point_t Q, vect_t e, point_t pt1, point_t pt2) 
Plane/line/point calculations. More...  
int  bn_dist_pt3_line3 (fastf_t *dist, point_t pca, const point_t a, const point_t p, const vect_t dir, const struct bn_tol *tol) 
int  bn_dist_line3_lseg3 (fastf_t *dist, const fastf_t *p, const fastf_t *d, const fastf_t *a, const fastf_t *b, const struct bn_tol *tol) 
int  bn_dist_line3_line3 (fastf_t dist[2], const point_t p1, const point_t p2, const vect_t d1, const vect_t d2, const struct bn_tol *tol) 
int  bn_dist_pt3_lseg3 (fastf_t *dist, point_t pca, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol) 
Find the distance from a point P to a line segment described by the two endpoints A and B, and the point of closest approach (PCA). More...  
int  bn_distsq_pt3_lseg3_v2 (fastf_t *distsq, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol) 
int  bn_3pts_collinear (point_t a, point_t b, point_t c, const struct bn_tol *tol) 
Check to see if three points are collinear. More...  
int  bn_pt3_pt3_equal (const point_t a, const point_t b, const struct bn_tol *tol) 
int  bn_dist_pt2_lseg2 (fastf_t *dist_sq, fastf_t pca[2], const point_t a, const point_t b, const point_t p, const struct bn_tol *tol) 
Find the distance from a point P to a line segment described by the two endpoints A and B, and the point of closest approach (PCA). More...  
int  bn_isect_lseg3_lseg3 (fastf_t *dist, const point_t p, const vect_t pdir, const point_t q, const vect_t qdir, const struct bn_tol *tol) 
Intersect two 3D line segments, defined by two points and two vectors. The vectors are unlikely to be unit length. More...  
int  bn_lseg3_lseg3_parallel (const point_t sg1pt1, const point_t sg1pt2, const point_t sg2pt1, const point_t sg2pt2, const struct bn_tol *tol) 
int  bn_isect_line3_line3 (fastf_t *s, fastf_t *t, const point_t p0, const vect_t u, const point_t q0, const vect_t v, const struct bn_tol *tol) 
int  bn_2line3_colinear (const point_t p1, const vect_t d1, const point_t p2, const vect_t d2, double range, const struct bn_tol *tol) 
Returns nonzero if the 3 lines are collinear to within tol>dist over the given distance range. More...  
int  bn_isect_pt2_lseg2 (fastf_t *dist, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol) 
Intersect a point P with the line segment defined by two distinct points A and B. More...  
int  bn_isect_line2_lseg2 (fastf_t *dist, const point_t p, const vect_t d, const point_t a, const vect_t c, const struct bn_tol *tol) 
Intersect a line in parametric form: More...  
int  bn_isect_lseg2_lseg2 (fastf_t *dist, const point_t p, const vect_t pdir, const point_t q, const vect_t qdir, const struct bn_tol *tol) 
Intersect two 2D line segments, defined by two points and two vectors. The vectors are unlikely to be unit length. More...  
int  bn_isect_line2_line2 (fastf_t *dist, const point_t p, const vect_t d, const point_t a, const vect_t c, const struct bn_tol *tol) 
double  bn_dist_pt3_pt3 (const point_t a, const point_t b) 
Returns distance between two points. More...  
int  bn_3pts_distinct (const point_t a, const point_t b, const point_t c, const struct bn_tol *tol) 
int  bn_npts_distinct (const int npts, const point_t *pts, const struct bn_tol *tol) 
int  bn_mk_plane_3pts (plane_t plane, const point_t a, const point_t b, const point_t c, const struct bn_tol *tol) 
int  bn_mkpoint_3planes (point_t pt, const plane_t a, const plane_t b, const plane_t c) 
Given the description of three planes, compute the point of intersection, if any. The direction vectors of the planes need not be of unit length. More...  
int  bn_isect_line3_plane (fastf_t *dist, const point_t pt, const vect_t dir, const plane_t plane, const struct bn_tol *tol) 
int  bn_isect_2planes (point_t pt, vect_t dir, const plane_t a, const plane_t b, const vect_t rpp_min, const struct bn_tol *tol) 
Given two planes, find the line of intersection between them, if one exists. The line of intersection is returned in parametric line (point & direction vector) form. More...  
int  bn_isect_2lines (fastf_t *t, fastf_t *u, const point_t p, const vect_t d, const point_t a, const vect_t c, const struct bn_tol *tol) 
int  bn_isect_line_lseg (fastf_t *t, const point_t p, const vect_t d, const point_t a, const point_t b, const struct bn_tol *tol) 
Intersect a line in parametric form: More...  
double  bn_dist_line3_pt3 (const point_t pt, const vect_t dir, const point_t a) 
double  bn_distsq_line3_pt3 (const point_t pt, const vect_t dir, const point_t a) 
double  bn_dist_line_origin (const point_t pt, const vect_t dir) 
Given a parametric line defined by PT + t * DIR, return the closest distance between the line and the origin. More...  
double  bn_dist_line2_point2 (const point_t pt, const vect_t dir, const point_t a) 
Given a parametric line defined by PT + t * DIR and a point A, return the closest distance between the line and the point. More...  
double  bn_distsq_line2_point2 (const point_t pt, const vect_t dir, const point_t a) 
Given a parametric line defined by PT + t * DIR and a point A, return the closest distance between the line and the point, squared. More...  
double  bn_area_of_triangle (const point_t a, const point_t b, const point_t c) 
Returns the area of a triangle. Algorithm by Jon Leech 3/24/89. More...  
int  bn_isect_pt_lseg (fastf_t *dist, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol) 
Intersect a point P with the line segment defined by two distinct points A and B. More...  
double  bn_dist_pt_lseg (point_t pca, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol) 
void  bn_rotate_bbox (point_t omin, point_t omax, const mat_t mat, const point_t imin, const point_t imax) 
Transform a bounding box (RPP) by the given 4x4 matrix. There are 8 corners to the bounding RPP. Each one needs to be transformed and min/max'ed. This is not minimal, but does fully contain any internal object, using an axisaligned RPP. More...  
void  bn_rotate_plane (plane_t oplane, const mat_t mat, const plane_t iplane) 
Transform a plane equation by the given 4x4 matrix. More...  
int  bn_coplanar (const plane_t a, const plane_t b, const struct bn_tol *tol) 
Test if two planes are identical. If so, their dot products will be either +1 or 1, with the distance from the origin equal in magnitude. More...  
double  bn_angle_measure (vect_t vec, const vect_t x_dir, const vect_t y_dir) 
double  bn_dist_pt3_along_line3 (const point_t p, const vect_t d, const point_t x) 
Return the parametric distance t of a point X along a line defined as a ray, i.e. solve X = P + t * D. If the point X does not lie on the line, then t is the distance of the perpendicular projection of point X onto the line. More...  
double  bn_dist_pt2_along_line2 (const point_t p, const vect_t d, const point_t x) 
Return the parametric distance t of a point X along a line defined as a ray, i.e. solve X = P + t * D. If the point X does not lie on the line, then t is the distance of the perpendicular projection of point X onto the line. More...  
int  bn_between (double left, double mid, double right, const struct bn_tol *tol) 
int  bn_does_ray_isect_tri (const point_t pt, const vect_t dir, const point_t V, const point_t A, const point_t B, point_t inter) 
int  bn_hlf_class (const plane_t half_eqn, const vect_t min, const vect_t max, const struct bn_tol *tol) 
Classify a halfspace, specified by its plane equation, against a bounding RPP. More...  
int  bn_isect_planes (point_t pt, const plane_t planes[], const size_t pl_count) 
Calculates the point that is the minimum distance from all the planes in the "planes" array. If the planes intersect at a single point, that point is the solution. More...  
double  bn_dist_pt3_pt3 (const fastf_t *a, const fastf_t *b) 
int  bn_pt3_pt3_equal (const fastf_t *a, const fastf_t *b, const struct bn_tol *tol) 
int  bn_pt2_pt2_equal (const fastf_t *a, const fastf_t *b, const struct bn_tol *tol) 
int  bn_3pts_collinear (fastf_t *a, fastf_t *b, fastf_t *c, const struct bn_tol *tol) 
int  bn_3pts_distinct (const fastf_t *a, const fastf_t *b, const fastf_t *c, const struct bn_tol *tol) 
int  bn_mk_plane_3pts (fastf_t *plane, const fastf_t *a, const fastf_t *b, const fastf_t *c, const struct bn_tol *tol) 
int  bn_mkpoint_3planes (fastf_t *pt, const fastf_t *a, const fastf_t *b, const fastf_t *c) 
int  bn_2line3_colinear (const fastf_t *p1, const fastf_t *d1, const fastf_t *p2, const fastf_t *d2, double range, const struct bn_tol *tol) 
int  bn_dist_pt3_line3 (fastf_t *dist, fastf_t *pca, const fastf_t *a, const fastf_t *dir, const fastf_t *p, const struct bn_tol *tol) 
int  bn_dist_line3_line3 (fastf_t *dist, const fastf_t *p1, const fastf_t *d1, const fastf_t *p2, const fastf_t *d2, const struct bn_tol *tol) 
int  bn_isect_line3_plane (fastf_t *dist, const fastf_t *pt, const fastf_t *dir, const fastf_t *plane, const struct bn_tol *tol) 
int  bn_isect_2planes (fastf_t *pt, fastf_t *dir, const fastf_t *a, const fastf_t *b, const fastf_t *rpp_min, const struct bn_tol *tol) 
int  bn_isect_line2_line2 (fastf_t *dist, const fastf_t *p, const fastf_t *d, const fastf_t *a, const fastf_t *c, const struct bn_tol *tol) 
int  bn_isect_line2_lseg2 (fastf_t *dist, const fastf_t *p, const fastf_t *d, const fastf_t *a, const fastf_t *c, const struct bn_tol *tol) 
int  bn_isect_lseg2_lseg2 (fastf_t *dist, const fastf_t *p, const fastf_t *pdir, const fastf_t *q, const fastf_t *qdir, const struct bn_tol *tol) 
int  bn_isect_lseg3_lseg3 (fastf_t *dist, const fastf_t *p, const fastf_t *pdir, const fastf_t *q, const fastf_t *qdir, const struct bn_tol *tol) 
int  bn_isect_line3_line3 (fastf_t *pdist, fastf_t *qdist, const fastf_t *p0, const fastf_t *pdir_i, const fastf_t *q0, const fastf_t *qdir_i, const struct bn_tol *tol) 
int  bn_isect_line_lseg (fastf_t *t, const fastf_t *p, const fastf_t *d, const fastf_t *a, const fastf_t *b, const struct bn_tol *tol) 
double  bn_dist_line3_pt3 (const fastf_t *pt, const fastf_t *dir, const fastf_t *a) 
double  bn_distsq_line3_pt3 (const fastf_t *pt, const fastf_t *dir, const fastf_t *a) 
double  bn_dist_line_origin (const fastf_t *pt, const fastf_t *dir) 
double  bn_dist_line2_point2 (const fastf_t *pt, const fastf_t *dir, const fastf_t *a) 
double  bn_distsq_line2_point2 (const fastf_t *pt, const fastf_t *dir, const fastf_t *a) 
double  bn_area_of_triangle (register const fastf_t *a, register const fastf_t *b, register const fastf_t *c) 
int  bn_isect_pt_lseg (fastf_t *dist, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol) 
int  bn_isect_pt2_lseg2 (fastf_t *dist, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol) 
HIDDEN int  are_equal (fastf_t a_in, fastf_t b_in, fastf_t t) 
int  bn_dist_pt3_lseg3 (fastf_t *dist, fastf_t *pca, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol) 
int  bn_dist_pt2_lseg2 (fastf_t *dist_sq, fastf_t *pca, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol) 
void  bn_rotate_bbox (fastf_t *omin, fastf_t *omax, const fastf_t *mat, const fastf_t *imin, const fastf_t *imax) 
void  bn_rotate_plane (fastf_t *oplane, const fastf_t *mat, const fastf_t *iplane) 
int  bn_coplanar (const fastf_t *a, const fastf_t *b, const struct bn_tol *tol) 
double  bn_angle_measure (fastf_t *vec, const fastf_t *x_dir, const fastf_t *y_dir) 
double  bn_dist_pt3_along_line3 (const fastf_t *p, const fastf_t *d, const fastf_t *x) 
double  bn_dist_pt2_along_line2 (const fastf_t *p, const fastf_t *d, const fastf_t *x) 
int  bn_hlf_class (const fastf_t *half_eqn, const fastf_t *min, const fastf_t *max, const struct bn_tol *tol) 
int  bn_distsq_line3_line3 (fastf_t *dist, fastf_t *P, fastf_t *d_in, fastf_t *Q, fastf_t *e_in, fastf_t *pt1, fastf_t *pt2) 
int  bn_isect_planes (fastf_t *pt, const fastf_t(*planes)[4], const size_t pl_count) 
int  bn_isect_lseg_rpp (fastf_t *a, fastf_t *b, register fastf_t *min, register fastf_t *max) 
#define BN_CLASSIFY_UNIMPLEMENTED 0x0000 
Definition at line 1028 of file plane_calc.h.
Referenced by bn_hlf_class(), and rt_arb_class().
#define BN_CLASSIFY_INSIDE 0x0001 
Definition at line 1029 of file plane_calc.h.
#define BN_CLASSIFY_OVERLAPPING 0x0002 
Definition at line 1030 of file plane_calc.h.
#define BN_CLASSIFY_OUTSIDE 0x0003 
Definition at line 1031 of file plane_calc.h.
Referenced by rt_arb_class(), and rt_ck_overlap().
#define MAXPTS 4 /* All we need are 4 points */ 
Plane structures (from src/librt/plane.h) Holds all the required info for geometric planes.
Definition at line 41 of file plane_struct.h.
Definition at line 42 of file plane_struct.h.
typedef struct tri_specific tri_specific_double 
Definition at line 72 of file plane_struct.h.
typedef struct tri_float_specific tri_specific_float 
Definition at line 88 of file plane_struct.h.
int bn_distsq_line3_line3  (  fastf_t  dist[3], 
point_t  P,  
vect_t  d,  
point_t  Q,  
vect_t  e,  
point_t  pt1,  
point_t  pt2  
) 
Plane/line/point calculations.
Calculate the square of the distance of closest approach for two lines.
The lines are specified as a point and a vector each. The vectors need not be unit length. P and d define one line; Q and e define the other.
Output values: dist[0] is the parametric distance along the first line P + dist[0] * d of the PCA dist[1] is the parametric distance along the second line Q + dist[1] * e of the PCA dist[3] is the square of the distance between the points of closest approach pt1 is the point of closest approach on the first line pt2 is the point of closest approach on the second line
This algorithm is based on expressing the distance squared, taking partials with respect to the two unknown parameters (dist[0] and dist[1]), setting the two partials equal to 0, and solving the two simultaneous equations
Referenced by rt_cline_shot(), and rt_joint_find_selections().
int bn_dist_pt3_line3  (  fastf_t *  dist, 
point_t  pca,  
const point_t  a,  
const point_t  p,  
const vect_t  dir,  
const struct bn_tol *  tol  
) 
Find the distance from a point P to a line described by the endpoint A and direction dir, and the point of closest approach (PCA).
There are three distinct cases, with these return codes  0 => P is within tolerance of point A. *dist = 0, pca=A. 1 => P is within tolerance of line. *dist = 0, pca=computed. 2 => P is "above/below" line. *dist=PCAP, pca=computed.
TODO: For efficiency, a version of this routine that provides the distance squared would be faster.
Referenced by nmg_calc_new_v(), nmg_faces_can_be_intersected(), nmg_get_edge_lines(), nmg_isect_line2_face2pNEW(), nmg_simplify_shell_edges(), and rt_joint_find_selections().
int bn_dist_line3_lseg3  (  fastf_t *  dist, 
const fastf_t *  p,  
const fastf_t *  d,  
const fastf_t *  a,  
const fastf_t *  b,  
const struct bn_tol *  tol  
) 
calculate intersection or closest approach of a line and a line segment.
returns: 2 > line and line segment are parallel and collinear. 1 > line and line segment are parallel, not collinear. 0 > intersection between points a and b. 1 > intersection outside a and b. 2 > closest approach is between a and b. 3 > closest approach is outside a and b.
dist[0] is actual distance from p in d direction to closest portion of segment. dist[1] is ratio of distance from a to b (0.0 at a, and 1.0 at b), dist[1] may be less than 0 or greater than 1. For return values less than 0, closest approach is defined as closest to point p. Direction vector, d, must be unit length.
Definition at line 433 of file plane.c.
References BN_CK_TOL, bn_dist_line3_line3(), and bn_tol::dist.
int bn_dist_line3_line3  (  fastf_t  dist[2], 
const point_t  p1,  
const point_t  p2,  
const vect_t  d1,  
const vect_t  d2,  
const struct bn_tol *  tol  
) 
Calculate closest approach of two lines
returns: 2 > lines are parallel and do not intersect 1 > lines are parallel and collinear 0 > lines intersect 1 > lines do not intersect
For return values less than zero, dist is not set. For return values of 0 or 1, dist[0] is the distance from p1 in the d1 direction to the point of closest approach for that line. Similar for the second line. d1 and d2 must be unit direction vectors.
XXX How is this different from bn_isect_line3_line3() ? XXX Why are the calling sequences just slightly different? XXX Can we pick the better one, and get rid of the other one? XXX If not, can we document how they differ?
Referenced by nmg_dist_to_cross(), and nmg_get_max_edge_inters().
int bn_dist_pt3_lseg3  (  fastf_t *  dist, 
point_t  pca,  
const point_t  a,  
const point_t  b,  
const point_t  p,  
const struct bn_tol *  tol  
) 
Find the distance from a point P to a line segment described by the two endpoints A and B, and the point of closest approach (PCA).
* * P * * * /. * / . * / . * / . (dist) * / . * / . * *** * A PCA B
This routine was formerly called bn_dist_pt_lseg().
XXX For efficiency, a version of this routine that provides the XXX distance squared would be faster.
Referenced by get_pole_dist_to_face(), nmg_break_edge_at_verts(), nmg_cnurb_lseg_coincident(), nmg_isect_eu_verts(), nmg_make_dualvu(), nmg_open_shells_connect(), and rt_ars_tess().
int bn_distsq_pt3_lseg3_v2  (  fastf_t *  distsq, 
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  p,  
const struct bn_tol *  tol  
) 
PRIVATE: This is a new API and should be considered unpublished.
Find the square of the distance from a point P to a line segment described by the two endpoints A and B.
P * /. / . / . / . (dist) / . / . *** A PCA B
There are six distinct cases, with these return codes  Return code precedence: 1, 2, 0, 3, 4, 5
0 P is within tolerance of lseg AB. *dist = 0. 1 P is within tolerance of point A. *dist = 0. 2 P is within tolerance of point B. *dist = 0. 3 PCA is within tolerance of A. *dist = PA**2. 4 PCA is within tolerance of B. *dist = PB**2. 5 P is "above/below" lseg AB. *dist=PCAP**2.
If both P and PCA and not within tolerance of lseg AB use these return codes 
3 PCA is to the left of A. *dist = PA**2. 4 PCA is to the right of B. *dist = PB**2.
This function is a test version of "bn_distsq_pt3_lseg3".
Definition at line 1793 of file plane.c.
References are_equal(), bn_pt3_pt3_equal(), bu_bomb(), bn_tol::dist_sq, SMALL_FASTF, and ZERO.
int bn_3pts_collinear  (  point_t  a, 
point_t  b,  
point_t  c,  
const struct bn_tol *  tol  
) 
Check to see if three points are collinear.
The algorithm is designed to work properly regardless of the order in which the points are provided.
Referenced by nmg_break_long_edges(), nmg_close_shell(), nmg_fu_planeeqn(), nmg_make_connect_faces(), nmg_make_faces_at_vert(), nmg_mc_realize_cube(), nmg_simplify_inter(), rt_ars_tess(), and rt_bot_tess().
int bn_pt3_pt3_equal  (  const point_t  a, 
const point_t  b,  
const struct bn_tol *  tol  
) 
Referenced by draw_Line3D(), nmg_break_all_es_on_v(), nmg_break_eg_on_v(), nmg_classify_pt_loop_new(), nmg_find_pt_in_lu(), nmg_find_pt_in_shell(), nmg_fix_crossed_loops(), nmg_fu_planeeqn(), nmg_isect_eu_fu(), nmg_isect_line2_edge2p(), nmg_isect_vert2p_face2p(), nmg_keu_zl(), nmg_radial_join_eu(), nmg_radial_join_eu_NEW(), nmg_region_both_vfuse(), nmg_region_v_unique(), nmg_remove_short_eus_inter(), nmg_repair_v_near_v(), nmg_simplify_inter(), nmg_split_edges_at_pts(), and rt_bot_vertex_fuse().
int bn_dist_pt2_lseg2  (  fastf_t *  dist_sq, 
fastf_t  pca[2],  
const point_t  a,  
const point_t  b,  
const point_t  p,  
const struct bn_tol *  tol  
) 
Find the distance from a point P to a line segment described by the two endpoints A and B, and the point of closest approach (PCA).
* P * * * /. * / . * / . * / . (dist) * / . * / . * *** * A PCA B
There are six distinct cases, with these return codes 
Patterned after bn_dist_pt3_lseg3().
Referenced by bn_math_cmd(), pnt2d_array_get_dimension(), rt_arb_find_e_nearest_pt2(), and rt_bot_find_e_nearest_pt2().
int bn_isect_lseg3_lseg3  (  fastf_t *  dist, 
const point_t  p,  
const vect_t  pdir,  
const point_t  q,  
const vect_t  qdir,  
const struct bn_tol *  tol  
) 
Intersect two 3D line segments, defined by two points and two vectors. The vectors are unlikely to be unit length.
[out]  dist  The value at dist[] is set to the parametric distance of the intercept dist[0] is parameter along p, range 0 to 1, to intercept. dist[1] is parameter along q, range 0 to 1, to intercept. If within distance tolerance of the endpoints, these will be exactly 0.0 or 1.0, to ease the job of caller. 
CLARIFICATION: This function 'bn_isect_lseg3_lseg3' returns distance values scaled where an intersect at the start point of the line segment (within tol>dist) results in 0.0 and when the intersect is at the end point of the line segment (within tol>dist), the result is 1.0. Intersects before the start point return a negative distance. Intersects after the end point result in a return value > 1.0.
Special note: when return code is "0" for colinearity, dist[1] has an alternate interpretation: it's the parameter along p (not q) which takes you from point p to the point (q + qdir), i.e., it's the endpoint of the q linesegment, since in this case there may be two intersections, if q is contained within span p to (p + pdir).
p  point 1 
pdir  direction1 
q  point 2 
qdir  direction2 
tol  tolerance values 
Referenced by main(), nmg_break_crossed_loops(), nmg_cut_lu_into_coplanar_and_non(), nmg_dist_to_cross(), nmg_fix_overlapping_loops(), nmg_intersect_loops_self(), nmg_isect_eu_eu(), and nmg_isect_potcut_fu().
int bn_lseg3_lseg3_parallel  (  const point_t  sg1pt1, 
const point_t  sg1pt2,  
const point_t  sg2pt1,  
const point_t  sg2pt2,  
const struct bn_tol *  tol  
) 
Definition at line 2532 of file plane.c.
References bn_tol::dist, X, Y, and Z.
Referenced by bn_isect_line3_line3(), bn_mat_fromto(), and nmg_isect_pt_facet().
int bn_isect_line3_line3  (  fastf_t *  s, 
fastf_t *  t,  
const point_t  p0,  
const vect_t  u,  
const point_t  q0,  
const vect_t  v,  
const struct bn_tol *  tol  
) 
Intersect two line segments, each in given in parametric form:
X = p0 + pdist * pdir_i (i.e. line p0>p1) and X = q0 + qdist * qdir_i (i.e. line q0>q1)
The input vectors 'pdir_i' and 'qdir_i' must NOT be unit vectors for this function to work correctly. The magnitude of the direction vectors indicates line segment length.
The 'pdist' and 'qdist' values returned from this function are the actual distance to the intersect (i.e. not scaled). Distances may be negative, see below.
p0  point 1  
pdir_i  direction 1  
q0  point 2  
qdir_i  direction 2  
tol  tolerance values  
[out]  pdist,qdist  (distances to intersection) (see below) When return = 1, pdist is the distance along line p0>p1 to the intersect with line q0>q1. If the intersect is along p0>p1 but in the opposite direction of vector pdir_i (i.e. occurring before p0 on line p0>p1) then the distance will be negative. The value if qdist is the same as pdist except it is the distance along line q0>q1 to the intersect with line p0>p1. When return code = 0 for colinearity, pdist and qdist have a different meaning. pdist is the distance from point p0 to point q0 and qdist is the distance from point p0 to point q1. If point q0 occurs before point p0 on line segment p0>p1 then pdist will be negative. The same occurs for the distance to point q1. 
Referenced by bn_math_cmd(), main(), nmg_classify_pt_loop_new(), nmg_isect_line2_face2pNEW(), and rt_arc2d_to_cnurb().
int bn_2line3_colinear  (  const point_t  p1, 
const vect_t  d1,  
const point_t  p2,  
const vect_t  d2,  
double  range,  
const struct bn_tol *  tol  
) 
Returns nonzero if the 3 lines are collinear to within tol>dist over the given distance range.
Range should be at least one model diameter for most applications. 1e5 might be OK for a default for "vehicle sized" models.
The direction vectors do not need to be unit length.
Referenced by main(), nmg_isect_line2_face2pNEW(), and nmg_repair_v_near_v().
int bn_isect_pt2_lseg2  (  fastf_t *  dist, 
const point_t  a,  
const point_t  b,  
const point_t  p,  
const struct bn_tol *  tol  
) 
Intersect a point P with the line segment defined by two distinct points A and B.
B *  P'*tol*P  / _ dist / /  / /  / / AtoP / / A * / tol = distance limit from line to pt P; dist = distance from A to P'
Referenced by nmg_break_eu_on_v(), and nmg_isect_line2_face2pNEW().
int bn_isect_line2_lseg2  (  fastf_t *  dist, 
const point_t  p,  
const vect_t  d,  
const point_t  a,  
const vect_t  c,  
const struct bn_tol *  tol  
) 
Intersect a line in parametric form:
X = P + t * D
with a line segment defined by two distinct points A and B=(A+C).
XXX probably should take point B, not vector C. Sigh.
Implicit Returns 
dist  When explicit return >= 0, t is the parameter that describes the intersection of the line and the line segment. The actual intersection coordinates can be found by solving P + t * D. However, note that for return codes 1 and 2 (intersection exactly at a vertex), it is strongly recommended that the original values passed in A or B are used instead of solving P + t * D, to prevent numeric error from creeping into the position of the endpoints. 
p  point of first line 
d  direction of first line 
a  point of second line 
c  direction of second line 
tol  tolerance values 
Referenced by nmg_isect_edge2p_edge2p(), and nmg_isect_line2_edge2p().
int bn_isect_lseg2_lseg2  (  fastf_t *  dist, 
const point_t  p,  
const vect_t  pdir,  
const point_t  q,  
const vect_t  qdir,  
const struct bn_tol *  tol  
) 
Intersect two 2D line segments, defined by two points and two vectors. The vectors are unlikely to be unit length.
dist  The value at dist[] is set to the parametric distance of the intercept. dist[0] is parameter along p, range 0 to 1, to intercept. dist[1] is parameter along q, range 0 to 1, to intercept. If within distance tolerance of the endpoints, these will be exactly 0.0 or 1.0, to ease the job of caller. 
Special note: when return code is "0" for colinearity, dist[1] has an alternate interpretation: it's the parameter along p (not q) which takes you from point p to the point (q + qdir), i.e., its the endpoint of the q linesegment, since in this case there may be two intersections, if q is contained within span p to (p + pdir). And either may be 10 if the point is outside the span.
p  point 1 
pdir  direction1 
q  point 2 
qdir  direction2 
tol  tolerance values 
Referenced by ged_polygons_overlap().
int bn_isect_line2_line2  (  fastf_t *  dist, 
const point_t  p,  
const vect_t  d,  
const point_t  a,  
const vect_t  c,  
const struct bn_tol *  tol  
) 
Intersect two lines, each in given in parametric form:
X = P + t * D and X = A + u * C
While the parametric form is usually used to denote a ray (i.e., positive values of the parameter only), in this case the full line is considered.
The direction vectors C and D need not have unit length.
dist  When explicit return > 0, dist[0] and dist[1] are the line parameters of the intersection point on the 2 rays. The actual intersection coordinates can be found by substituting either of these into the original ray equations. 
p  point of first line 
d  direction of first line 
a  point of second line 
c  direction of second line 
tol  tolerance values 
Note that for lines which are very nearly parallel, but not quite parallel enough to have the determinant go to "zero", the intersection can turn up in surprising places. (e.g. when det=1e15 and det1=5.5e17, t=0.5)
Referenced by bn_math_cmd(), nmg_isect_line2_face2pNEW(), and rt_extrude_shot().
double bn_dist_pt3_pt3  (  const point_t  a, 
const point_t  b  
) 
Returns distance between two points.
Referenced by nmg_class_pt_s(), nmg_isect_pt_facet(), nmg_plot_fu(), nmg_repair_v_near_v(), rt_arb_find_e_nearest_pt2(), and rt_bot_surf_area().
int bn_3pts_distinct  (  const point_t  a, 
const point_t  b,  
const point_t  c,  
const struct bn_tol *  tol  
) 
Check to see if three points are all distinct, i.e., ensure that there is at least sqrt(dist_tol_sq) distance between every pair of points.
Referenced by nmg_mc_realize_cube(), rt_ars_tess(), and rt_bot_tess().
int bn_npts_distinct  (  const int  npts, 
const point_t *  pts,  
const struct bn_tol *  tol  
) 
Check to see if the points are all distinct, i.e., ensure that there is at least sqrt(dist_tol_sq) distance between every pair of points.
Definition at line 173 of file plane.c.
References BN_CK_TOL, and bn_tol::dist_sq.
int bn_mk_plane_3pts  (  plane_t  plane, 
const point_t  a,  
const point_t  b,  
const point_t  c,  
const struct bn_tol *  tol  
) 
Find the equation of a plane that contains three points. Note that normal vector created is expected to point out (see vmath.h), so the vector from A to C had better be counterclockwise (about the point A) from the vector from A to B. This follows the BRLCAD outwardpointing normal convention, and the righthand rule for cross products.
* * C * * * \ *  \ * ^ N  \ *  \  \ *  \  \ * CA \  \ *  \  \ *  \  \ * \ \ * ** * A B * > * BA
If the points are given in the order A B C (e.g., counterclockwise), then the outward pointing surface normal:
N = (BA) x (CA).
[out]  plane  The plane equation is stored here. 
[in]  a  point 1 
[in]  b  point 2 
[in]  c  point 3 
[in]  tol  Tolerance values for doing calculation 
Referenced by analyze_arb8(), analyze_ars(), arb_edit(), arb_extrude(), bn_polygon_area(), bn_tri_tri_isect_coplanar(), coplanar_2d_coord_sys(), nmg_close_shell(), nmg_fu_planeeqn(), nmg_polytonmg(), rt_arb_calc_planes(), rt_arb_edit(), rt_arb_volume(), rt_bot_volume(), rt_nurb_shot(), and soup_add_face().
int bn_mkpoint_3planes  (  point_t  pt, 
const plane_t  a,  
const plane_t  b,  
const plane_t  c  
) 
Given the description of three planes, compute the point of intersection, if any. The direction vectors of the planes need not be of unit length.
Find the solution to a system of three equations in three unknowns:
* Px * Ax + Py * Ay + Pz * Az = A3; * Px * Bx + Py * By + Pz * Bz = B3; * Px * Cx + Py * Cy + Pz * Cz = C3; * * OR * * [ Ax Ay Az ] [ Px ] [ A3 ] * [ Bx By Bz ] * [ Py ] = [ B3 ] * [ Cx Cy Cz ] [ Pz ] [ C3 ] *
[out]  pt  The point of intersection is stored here. 
a  plane 1  
b  plane 2  
c  plane 3 
Referenced by _ged_get_solid_keypoint(), bn_polygon_mk_pts_planes(), nmg_calc_new_v(), nmg_dist_to_cross(), nmg_faces_can_be_intersected(), nmg_isect_2faceuse(), nmg_simple_vertex_solve(), rt_arb_3face_intersect(), rt_arbn_bbox(), rt_arbn_plot(), rt_arbn_prep(), and rt_arbn_tess().
int bn_isect_line3_plane  (  fastf_t *  dist, 
const point_t  pt,  
const vect_t  dir,  
const plane_t  plane,  
const struct bn_tol *  tol  
) 
Intersect an infinite line (specified in point and direction vector form) with a plane that has an outward pointing normal. The direction vector need not have unit length. The first three elements of the plane equation must form a unit length vector.
[out]  dist  set to the parametric distance of the intercept 
[in]  pt  origin of ray 
[in]  dir  direction of ray 
[in]  plane  equation of plane 
[in]  tol  tolerance values 
Referenced by bbd_render(), Eplot(), fix_halfs(), isect_ray_faceuse(), isect_ray_planar_face(), isect_ray_snurb_face(), mv_edge(), nmg_get_max_edge_inters(), nmg_isect_eu_fu(), prj_render(), and rt_arb_move_edge().
int bn_isect_2planes  (  point_t  pt, 
vect_t  dir,  
const plane_t  a,  
const plane_t  b,  
const vect_t  rpp_min,  
const struct bn_tol *  tol  
) 
Given two planes, find the line of intersection between them, if one exists. The line of intersection is returned in parametric line (point & direction vector) form.
In order that all the geometry under consideration be in "front" of the ray, it is necessary to pass the minimum point of the model RPP. If this convention is unnecessary, just pass (0, 0, 0) as rpp_min.
[out]  pt  Starting point of line of intersection 
[out]  dir  Direction vector of line of intersection (unit length) 
[in]  a  plane 1 (normal must be unit length) 
[in]  b  plane 2 (normal must be unit length) 
[in]  rpp_min  minimum point of model RPP 
[in]  tol  tolerance values 
Referenced by nmg_get_edge_lines().
int bn_isect_2lines  (  fastf_t *  t, 
fastf_t *  u,  
const point_t  p,  
const vect_t  d,  
const point_t  a,  
const vect_t  c,  
const struct bn_tol *  tol  
) 
int bn_isect_line_lseg  (  fastf_t *  t, 
const point_t  p,  
const vect_t  d,  
const point_t  a,  
const point_t  b,  
const struct bn_tol *  tol  
) 
Intersect a line in parametric form:
X = P + t * D
with a line segment defined by two distinct points A and B.
t When explicit return >= 0, t is the parameter that describes the intersection of the line and the line segment. The actual intersection coordinates can be found by solving P + t * D. However, note that for return codes 1 and 2 (intersection exactly at a vertex), it is strongly recommended that the original values passed in A or B are used instead of solving P + t * D, to prevent numeric error from creeping into the position of the endpoints.
XXX should probably be called bn_isect_line3_lseg3() XXX should probably be changed to return dist[2]
Referenced by isect_ray_lseg().
double bn_dist_line3_pt3  (  const point_t  pt, 
const vect_t  dir,  
const point_t  a  
) 
Given a parametric line defined by PT + t * DIR and a point A, return the closest distance between the line and the point.
'dir' need not have unit length.
Find parameter for PCA along line with unitized DIR: d = VDOT(f, dir) / MAGNITUDE(dir); Find distance g from PCA to A using Pythagoras: g = sqrt(MAGSQ(f)  d**2)
Return  Distance
Referenced by find_metaballpt_nearest_pt(), find_pipept_nearest_pt(), isect_ray_vertexuse(), nmg_assess_vu(), nmg_isect_line2_face2pNEW(), nmg_repair_v_near_v(), and ptbl_vsort().
double bn_distsq_line3_pt3  (  const point_t  pt, 
const vect_t  dir,  
const point_t  a  
) 
Given a parametric line defined by PT + t * DIR and a point A, return the square of the closest distance between the line and the point.
'dir' need not have unit length.
Return  Distance squared
Referenced by main(), nmg_2edgeuse_g_coincident(), nmg_is_eu_on_line3(), nmg_is_vertex_on_inter(), nmg_isect_line2_face2pNEW(), nmg_isect_line2_vertex2(), nmg_search_v_eg(), and rt_brep_find_selections().
double bn_dist_line_origin  (  const point_t  pt, 
const vect_t  dir  
) 
Given a parametric line defined by PT + t * DIR, return the closest distance between the line and the origin.
'dir' need not have unit length.
double bn_dist_line2_point2  (  const point_t  pt, 
const vect_t  dir,  
const point_t  a  
) 
Given a parametric line defined by PT + t * DIR and a point A, return the closest distance between the line and the point.
'dir' need not have unit length.
double bn_distsq_line2_point2  (  const point_t  pt, 
const vect_t  dir,  
const point_t  a  
) 
Given a parametric line defined by PT + t * DIR and a point A, return the closest distance between the line and the point, squared.
'dir' need not have unit length.
double bn_area_of_triangle  (  const point_t  a, 
const point_t  b,  
const point_t  c  
) 
Returns the area of a triangle. Algorithm by Jon Leech 3/24/89.
Referenced by rt_bot_surf_area().
int bn_isect_pt_lseg  (  fastf_t *  dist, 
const point_t  a,  
const point_t  b,  
const point_t  p,  
const struct bn_tol *  tol  
) 
Intersect a point P with the line segment defined by two distinct points A and B.
B *  P'*tol*P  / _ dist / /  / /  / / AtoP / / A * / tol = distance limit from line to pt P; dist = parametric distance from A to P' (in terms of A to B)
p  point  
a  start of lseg  
b  end of lseg  
tol  tolerance values  
[out]  dist  parametric distance from A to P' (in terms of A to B) 
Referenced by cut_unimonotone(), nmg_break_all_es_on_v(), nmg_break_e_on_v(), nmg_isect_line2_edge2p(), and split_face_single().
double bn_dist_pt_lseg  (  point_t  pca, 
const point_t  a,  
const point_t  b,  
const point_t  p,  
const struct bn_tol *  tol  
) 
void bn_rotate_bbox  (  point_t  omin, 
point_t  omax,  
const mat_t  mat,  
const point_t  imin,  
const point_t  imax  
) 
Transform a bounding box (RPP) by the given 4x4 matrix. There are 8 corners to the bounding RPP. Each one needs to be transformed and min/max'ed. This is not minimal, but does fully contain any internal object, using an axisaligned RPP.
Referenced by rt_ebm_bbox(), rt_nmg_idisk(), rt_submodel_prep(), and rt_vol_bbox().
void bn_rotate_plane  (  plane_t  oplane, 
const mat_t  mat,  
const plane_t  iplane  
) 
Transform a plane equation by the given 4x4 matrix.
Referenced by rt_nmg_idisk().
int bn_coplanar  (  const plane_t  a, 
const plane_t  b,  
const struct bn_tol *  tol  
) 
Test if two planes are identical. If so, their dot products will be either +1 or 1, with the distance from the origin equal in magnitude.
Referenced by bn_tri_tri_isect_coplanar(), Eplot(), fix_halfs(), nmg_calc_new_v(), nmg_close_shell(), and nmg_find_isect_faces().
double bn_angle_measure  (  vect_t  vec, 
const vect_t  x_dir,  
const vect_t  y_dir  
) 
Using two perpendicular vectors (x_dir and y_dir) which lie in the same plane as 'vec', return the angle (in radians) of 'vec' from x_dir, going CCW around the perpendicular x_dir CROSS y_dir.
Trig note 
theta = atan2(x, y) returns an angle in the range pi to +pi. Here, we need an angle in the range of 0 to 2pi. This could be implemented by adding 2pi to theta when theta is negative, but this could have nasty numeric ambiguity right in the vicinity of theta = +pi, which is a very critical angle for the applications using this routine.
So, an alternative formulation is to compute gamma = atan2(x, y), and then theta = gamma + pi. Now, any error will occur in the vicinity of theta = 0, which can be handled much more readily.
If theta is negative, or greater than two pi, wrap it around. These conditions only occur if there are problems in atan2().
In all cases, the returned value is between 0 and bn_twopi.
Referenced by nmg_classify_pt_loop_new(), nmg_measure_fu_angle(), nmg_vlblock_euleft(), and nmg_vu_angle_measure().
double bn_dist_pt3_along_line3  (  const point_t  p, 
const vect_t  d,  
const point_t  x  
) 
Return the parametric distance t of a point X along a line defined as a ray, i.e. solve X = P + t * D. If the point X does not lie on the line, then t is the distance of the perpendicular projection of point X onto the line.
Referenced by nmg_break_eg_on_v().
double bn_dist_pt2_along_line2  (  const point_t  p, 
const vect_t  d,  
const point_t  x  
) 
Return the parametric distance t of a point X along a line defined as a ray, i.e. solve X = P + t * D. If the point X does not lie on the line, then t is the distance of the perpendicular projection of point X onto the line.
int bn_between  (  double  left, 
double  mid,  
double  right,  
const struct bn_tol *  tol  
) 
Definition at line 2234 of file plane.c.
References BN_CK_TOL, bu_debug, BU_DEBUG_MATH, bu_log(), and bn_tol::dist.
Referenced by bn_isect_line2_lseg2(), nmg_break_eg_on_v(), and nmg_isect_line2_edge2p().
int bn_does_ray_isect_tri  (  const point_t  pt, 
const vect_t  dir,  
const point_t  V,  
const point_t  A,  
const point_t  B,  
point_t  inter  
) 
int bn_hlf_class  (  const plane_t  half_eqn, 
const vect_t  min,  
const vect_t  max,  
const struct bn_tol *  tol  
) 
Classify a halfspace, specified by its plane equation, against a bounding RPP.
Referenced by rt_arb_class().
int bn_isect_planes  (  point_t  pt, 
const plane_t  planes[],  
const size_t  pl_count  
) 
Calculates the point that is the minimum distance from all the planes in the "planes" array. If the planes intersect at a single point, that point is the solution.
The method used here is based on:
An expression for the distance from a point to a plane is: VDOT(pt, plane)plane[H]. Square that distance and sum for all planes to get the "total" distance. For minimum total distance, the partial derivatives of this expression (with respect to x, y, and z) must all be zero. This produces a set of three equations in three unknowns (x, y, z).
This routine sets up the three equations as [matrix][pt] = [hpq] and solves by inverting "matrix" into "inverse" and [pt] = [inverse][hpq].
There is likely a more economical solution rather than matrix inversion, but bn_mat_inv was handy at the time.
Checks if these planes form a singular matrix and returns.
Referenced by nmg_calc_new_v(), and nmg_complex_vertex_solve().
Definition at line 58 of file plane.c.
References bn_tol::dist_sq, X, Y, and Z.
Referenced by bn_coplanar(), and bn_distsq_pt3_lseg3_v2().
Definition at line 88 of file plane.c.
References BN_CK_TOL, and bn_tol::dist_sq.
Referenced by bn_isect_line2_lseg2().
Definition at line 100 of file plane.c.
References bn_tol::dist_sq, and NEAR_ZERO.
int bn_3pts_distinct  (  const fastf_t *  a, 
const fastf_t *  b,  
const fastf_t *  c,  
const struct bn_tol *  tol  
) 
Definition at line 155 of file plane.c.
References BN_CK_TOL, and bn_tol::dist_sq.
int bn_mk_plane_3pts  (  fastf_t *  plane, 
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  c,  
const struct bn_tol *  tol  
) 
Definition at line 191 of file plane.c.
References BN_CK_TOL, bn_tol::dist_sq, and SMALL_FASTF.
int bn_2line3_colinear  (  const fastf_t *  p1, 
const fastf_t *  d1,  
const fastf_t *  p2,  
const fastf_t *  d2,  
double  range,  
const struct bn_tol *  tol  
) 
Definition at line 281 of file plane.c.
References BN_CK_TOL, bn_distsq_line3_pt3(), bu_bomb(), bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist_sq, and SMALL_FASTF.
int bn_dist_line3_line3  (  fastf_t *  dist, 
const fastf_t *  p1,  
const fastf_t *  d1,  
const fastf_t *  p2,  
const fastf_t *  d2,  
const struct bn_tol *  tol  
) 
Definition at line 375 of file plane.c.
References BN_CK_TOL, bn_dist_line3_pt3(), BN_TOL_DIST, BN_VECT_ARE_PARALLEL, bu_bomb(), bu_log(), bn_tol::dist, bn_tol::dist_sq, and V3ARGS.
Referenced by bn_dist_line3_lseg3().
int bn_isect_line3_plane  (  fastf_t *  dist, 
const fastf_t *  pt,  
const fastf_t *  dir,  
const fastf_t *  plane,  
const struct bn_tol *  tol  
) 
Definition at line 483 of file plane.c.
References BN_CK_TOL, bn_tol::dist, bn_tol::perp, and SMALL_FASTF.
int bn_isect_2planes  (  fastf_t *  pt, 
fastf_t *  dir,  
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  rpp_min,  
const struct bn_tol *  tol  
) 
Definition at line 523 of file plane.c.
References bn_coplanar(), bn_mkpoint_3planes(), SMALL_FASTF, VSET, VSETALL, X, Y, Z, and ZERO.
int bn_isect_line2_line2  (  fastf_t *  dist, 
const fastf_t *  p,  
const fastf_t *  d,  
const fastf_t *  a,  
const fastf_t *  c,  
const struct bn_tol *  tol  
) 
Definition at line 610 of file plane.c.
References BN_CK_TOL, bu_debug, BU_DEBUG_MATH, bu_log(), DETERMINANT_TOL, NEAR_ZERO, bn_tol::para, X, and Y.
Referenced by bn_isect_line2_lseg2(), and bn_isect_lseg2_lseg2().
int bn_isect_line2_lseg2  (  fastf_t *  dist, 
const fastf_t *  p,  
const fastf_t *  d,  
const fastf_t *  a,  
const fastf_t *  c,  
const struct bn_tol *  tol  
) 
Definition at line 764 of file plane.c.
References bn_between(), BN_CK_TOL, bn_dist_pt2_along_line2(), bn_distsq_line2_point2(), bn_isect_line2_line2(), bn_isect_pt2_lseg2(), bn_pt2_pt2_equal(), bu_bomb(), bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist, bn_tol::dist_sq, out, V2PRINT, X, and Y.
int bn_isect_lseg2_lseg2  (  fastf_t *  dist, 
const fastf_t *  p,  
const fastf_t *  pdir,  
const fastf_t *  q,  
const fastf_t *  qdir,  
const struct bn_tol *  tol  
) 
Definition at line 935 of file plane.c.
References BN_CK_TOL, bn_isect_line2_line2(), bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist, and NEAR_ZERO.
int bn_isect_lseg3_lseg3  (  fastf_t *  dist, 
const fastf_t *  p,  
const fastf_t *  pdir,  
const fastf_t *  q,  
const fastf_t *  qdir,  
const struct bn_tol *  tol  
) 
Definition at line 1017 of file plane.c.
References BN_CK_TOL, bn_isect_line3_line3(), bu_bomb(), bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist, NEAR_ZERO, out, SMALL_FASTF, UNLIKELY, and V3ARGS.
int bn_isect_line3_line3  (  fastf_t *  pdist, 
fastf_t *  qdist,  
const fastf_t *  p0,  
const fastf_t *  pdir_i,  
const fastf_t *  q0,  
const fastf_t *  qdir_i,  
const struct bn_tol *  tol  
) 
Definition at line 1173 of file plane.c.
References bn_distsq_line3_pt3(), bn_lseg3_lseg3_parallel(), bu_bomb(), bu_log(), bn_tol::dist_sq, MAX_FASTF, NEAR_ZERO, SMALL_FASTF, UNLIKELY, V3ARGS, and ZERO.
Referenced by bn_isect_line_lseg(), and bn_isect_lseg3_lseg3().
int bn_isect_line_lseg  (  fastf_t *  t, 
const fastf_t *  p,  
const fastf_t *  d,  
const fastf_t *  a,  
const fastf_t *  b,  
const struct bn_tol *  tol  
) 
Definition at line 1321 of file plane.c.
References BN_CK_TOL, bn_distsq_line3_pt3(), bn_isect_line3_line3(), bu_bomb(), code(), bn_tol::dist, bn_tol::dist_sq, NEAR_ZERO, SMALL_FASTF, and UNLIKELY.
Definition at line 1514 of file plane.c.
References bu_debug, BU_DEBUG_MATH, bu_log(), out, and SMALL_FASTF.
Referenced by bn_dist_line3_line3().
Definition at line 1540 of file plane.c.
References bu_debug, BU_DEBUG_MATH, bu_log(), out, SMALL_FASTF, UNLIKELY, and ZERO.
Referenced by bn_2line3_colinear(), bn_isect_line3_line3(), and bn_isect_line_lseg().
Definition at line 1565 of file plane.c.
References SMALL_FASTF.
Definition at line 1579 of file plane.c.
References SMALL_FASTF.
Definition at line 1595 of file plane.c.
References SMALL_FASTF.
Referenced by bn_isect_line2_lseg2().
int bn_isect_pt_lseg  (  fastf_t *  dist, 
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  p,  
const struct bn_tol *  tol  
) 
Definition at line 1634 of file plane.c.
References BN_CK_TOL, bn_tol::dist_sq, and SMALL_FASTF.
int bn_isect_pt2_lseg2  (  fastf_t *  dist, 
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  p,  
const struct bn_tol *  tol  
) 
dist  is distance along line from A to P 
a  is line start point 
b  is line end point 
p  is line intersect point 
Definition at line 1693 of file plane.c.
References BN_CK_TOL, bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist_sq, and V2PRINT.
Referenced by bn_isect_line2_lseg2().
This is a support function for the test function "bn_distsq_pt3_lseg3_v2".
Definition at line 1758 of file plane.c.
References bu_bomb().
Referenced by bn_distsq_pt3_lseg3_v2().
int bn_dist_pt3_lseg3  (  fastf_t *  dist, 
fastf_t *  pca,  
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  p,  
const struct bn_tol *  tol  
) 
Definition at line 1911 of file plane.c.
References BN_CK_TOL, bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist, bn_tol::dist_sq, SMALL_FASTF, UNLIKELY, and V3ARGS.
int bn_dist_pt2_lseg2  (  fastf_t *  dist_sq, 
fastf_t *  pca,  
const fastf_t *  a,  
const fastf_t *  b,  
const fastf_t *  p,  
const struct bn_tol *  tol  
) 
Definition at line 2004 of file plane.c.
References BN_CK_TOL, bu_debug, BU_DEBUG_MATH, bu_log(), bn_tol::dist, bn_tol::dist_sq, and V3ARGS.
Definition at line 2140 of file plane.c.
References BN_CK_TOL, bn_pt3_pt3_equal(), bu_bomb(), NEAR_ZERO, bn_tol::perp, and SMALL_FASTF.
Referenced by bn_isect_2planes().
Definition at line 2215 of file plane.c.
References bu_debug, BU_DEBUG_MATH, and bu_log().
Referenced by bn_isect_line2_lseg2().
Definition at line 2400 of file plane.c.
References bn_mat_determinant(), bn_mat_inv(), bu_debug, BU_DEBUG_MATH, bu_log(), VSET, X, Y, Z, and ZERO.
Intersect a line segment with a rectangular parallelepiped (RPP) that has faces parallel to the coordinate planes (a clipping RPP). The RPP is defined by a minimum point and a maximum point. This is a very close relative to rt_in_rpp() from librt/shoot.c
[in,out]  a  Start point of lseg 
[in,out]  b  End point of lseg 
[in]  min  min point of RPP 
[in]  max  amx point of RPP 
if !0 was returned, "a" and "b" have been clipped to the RPP.
Definition at line 2466 of file plane.c.
References MAX_FASTF, SQRT_SMALL_FASTF, and st.