BRL-CAD
plane.h File Reference
#include "common.h"
#include "vmath.h"
#include "bn/tol.h"
#include "bg/defines.h"
Include dependency graph for plane.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  plane_specific
 
struct  tri_specific
 
struct  tri_float_specific
 

Macros

#define MAXPTS   4
 
#define pl_A   pl_points[0]
 
#define BG_CLASSIFY_UNIMPLEMENTED   0x0000
 
#define BG_CLASSIFY_INSIDE   0x0001
 
#define BG_CLASSIFY_OVERLAPPING   0x0002
 
#define BG_CLASSIFY_OUTSIDE   0x0003
 

Typedefs

typedef struct tri_specific tri_specific_double
 
typedef struct tri_float_specific tri_specific_float
 

Functions

int bg_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)
 Calculate the square of the distance of closest approach for two lines. More...
 
int bg_dist_pnt3_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 bg_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 bg_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 bg_dist_pnt3_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 bg_distsq_pnt3_lseg3_v2 (fastf_t *distsq, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol)
 
int bg_3pnts_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 bg_pnt3_pnt3_equal (const point_t a, const point_t b, const struct bn_tol *tol)
 
int bg_dist_pnt2_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 bg_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 bg_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 bg_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 bg_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 non-zero if the 3 lines are collinear to within tol->dist over the given distance range. More...
 
int bg_isect_pnt2_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 bg_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 bg_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 bg_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 bg_dist_pnt3_pnt3 (const point_t a, const point_t b)
 Returns distance between two points. More...
 
int bg_3pnts_distinct (const point_t a, const point_t b, const point_t c, const struct bn_tol *tol)
 
int bg_npnts_distinct (const int npts, const point_t *pts, const struct bn_tol *tol)
 
int bg_make_plane_3pnts (plane_t plane, const point_t a, const point_t b, const point_t c, const struct bn_tol *tol)
 
int bg_make_pnt_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 bg_isect_line3_plane (fastf_t *dist, const point_t pt, const vect_t dir, const plane_t plane, const struct bn_tol *tol)
 
int bg_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 bg_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 bg_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 bg_dist_line3_pnt3 (const point_t pt, const vect_t dir, const point_t a)
 
double bg_distsq_line3_pnt3 (const point_t pt, const vect_t dir, const point_t a)
 
double bg_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 bg_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 bg_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 bg_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 bg_isect_pnt_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 bg_dist_pnt_lseg (point_t pca, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol)
 
void bg_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 axis-aligned RPP. More...
 
void bg_rotate_plane (plane_t oplane, const mat_t mat, const plane_t iplane)
 Transform a plane equation by the given 4x4 matrix. More...
 
int bg_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...
 
int bg_coplanar_pts (const point_t *pts, int pt_cnt, const struct bn_tol *tol)
 Test if a set of points are coplanar. Note: if 0 < pt_cnt <=3 the point(s) are trivially coplanar, and 1 will be returned. More...
 
double bg_angle_measure (vect_t vec, const vect_t x_dir, const vect_t y_dir)
 
double bg_dist_pnt3_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 bg_dist_pnt2_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 bg_between (double left, double mid, double right, const struct bn_tol *tol)
 
int bg_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 bg_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 bg_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...
 
int bg_plane_pt_nrml (plane_t *p, point_t pt, vect_t nrml)
 Given an origin and a normal, create a plane_t. More...
 
int bg_fit_plane (point_t *c, vect_t *n, size_t npnts, point_t *pnts)
 Calculates the best fit plane for a set of points. More...
 
int bg_plane_closest_pt (fastf_t *u, fastf_t *v, plane_t p, point_t pt)
 Find the closest U,V point on the plane p to 3d point pt. More...
 
int bg_plane_pt_at (point_t *pt, plane_t p, fastf_t u, fastf_t v)
 Return the 3D point on the plane at parametric coordinates u, v. More...