BRL-CAD
Loading...
Searching...
No Matches
plane.h
Go to the documentation of this file.
1/* P L A N E . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2025 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20
21/*----------------------------------------------------------------------*/
22/** @addtogroup bg_plane
23 *
24 * Plane structures (from src/librt/plane.h) and plane/line/point calculations
25 *
26 * TODO - this API may need to be simplified. A lot of the closest point
27 * calculations, for example, should probably just concern themselves with the
28 * calculation itself and leave any tolerance based questions to a separate
29 * step.
30 */
31/** @{ */
32/* @file plane.h */
33
34#ifndef BG_PLANE_H
35#define BG_PLANE_H
36
37#include "common.h"
38#include "vmath.h"
39#include "bn/tol.h"
40#include "bg/defines.h"
41
42__BEGIN_DECLS
43
44
45#define MAXPTS 4 /**< All we need are 4 points */
46#define pl_A pl_points[0] /**< Synonym for A point */
48struct plane_specific {
49 size_t pl_npts; /**< number of points on plane */
50 point_t pl_points[MAXPTS]; /**< Actual points on plane */
51 vect_t pl_Xbasis; /**< X (B-A) vector (for 2d coords) */
52 vect_t pl_Ybasis; /**< Y (C-A) vector (for 2d coords) */
53 vect_t pl_N; /**< Unit-length Normal (outward) */
54 fastf_t pl_NdotA; /**< Normal dot A */
55 fastf_t pl_2d_x[MAXPTS]; /**< X 2d-projection of points */
56 fastf_t pl_2d_y[MAXPTS]; /**< Y 2d-projection of points */
57 fastf_t pl_2d_com[MAXPTS]; /**< pre-computed common-term */
58 struct plane_specific *pl_forw; /**< Forward link */
59 char pl_code[MAXPTS+1]; /**< Face code string. Decorative. */
60};
61
62/**
63 * Describe the tri_specific structure.
64 *
65 * DEPRECATED - removing this as public API. (marked 7.42.0)
66 */
67struct tri_specific {
68 point_t tri_A; /**< triangle vertex (A) */
69 vect_t tri_BA; /**< B - A (second point) */
70 vect_t tri_CA; /**< C - A (third point) */
71 vect_t tri_wn; /**< facet normal (non-unit) */
72 vect_t tri_N; /**< unit normal vector */
73 fastf_t *tri_normals; /**< unit vertex normals A, B, C (this is malloced storage) */
74 int tri_surfno; /**< solid specific surface number */
75 struct tri_specific *tri_forw; /**< Next facet */
76};
77
80/**
81 * A more memory conservative version
82 */
83struct tri_float_specific {
84 float tri_A[3]; /**< triangle vertex (A) */
85 float tri_BA[3]; /**< B - A (second point) */
86 float tri_CA[3]; /**< C - A (third point) */
87 float tri_wn[3]; /**< facet normal (non-unit) */
88 float tri_N[3]; /**< unit normal vector */
89 signed char *tri_normals; /**< unit vertex normals A, B, C (this is malloced storage) */
90 int tri_surfno; /**< solid specific surface number */
91 struct tri_float_specific *tri_forw;/**< Next facet */
92};
93
96
97/**
98 *@brief
99 * Calculate the square of the distance of closest approach for two
100 * lines.
101 *
102 * The lines are specified as a point and a vector each. The vectors
103 * need not be unit length. P and d define one line; Q and e define
104 * the other.
105 *
106 * @return 0 - normal return
107 * @return 1 - lines are parallel, dist[0] is set to 0.0
108 *
109 * Output values:
110 * dist[0] is the parametric distance along the first line P + dist[0] * d of the PCA
111 * dist[1] is the parametric distance along the second line Q + dist[1] * e of the PCA
112 * dist[3] is the square of the distance between the points of closest approach
113 * pt1 is the point of closest approach on the first line
114 * pt2 is the point of closest approach on the second line
115 *
116 * This algorithm is based on expressing the distance squared, taking
117 * partials with respect to the two unknown parameters (dist[0] and
118 * dist[1]), setting the two partials equal to 0, and solving the two
119 * simultaneous equations
120 */
121BG_EXPORT extern int bg_distsq_line3_line3(fastf_t dist[3],
123 vect_t d,
124 point_t Q,
125 vect_t e,
126 point_t pt1,
127 point_t pt2);
128
129/**
130 * Find the distance from a point P to a line described by the
131 * endpoint A and direction dir, and the point of closest approach
132 * (PCA).
133 *
134 @code
135 // P
136 // *
137 // /.
138 // / .
139 // / .
140 // / . (dist)
141 // / .
142 // / .
143 // *------*-------->
144 // A PCA dir
145 @endcode
146 * There are three distinct cases, with these return codes -
147 * 0 => P is within tolerance of point A. *dist = 0, pca=A.
148 * 1 => P is within tolerance of line. *dist = 0, pca=computed.
149 * 2 => P is "above/below" line. *dist=|PCA-P|, pca=computed.
150 *
151 * TODO: For efficiency, a version of this routine that provides the
152 * distance squared would be faster.
153 */
154BG_EXPORT extern int bg_dist_pnt3_line3(fastf_t *dist,
155 point_t pca,
156 const point_t a,
157 const point_t p,
158 const vect_t dir,
159 const struct bn_tol *tol);
160
161/**
162 * calculate intersection or closest approach of a line and a line
163 * segment.
164 *
165 * returns:
166 * -2 -> line and line segment are parallel and collinear.
167 * -1 -> line and line segment are parallel, not collinear.
168 * 0 -> intersection between points a and b.
169 * 1 -> intersection outside a and b.
170 * 2 -> closest approach is between a and b.
171 * 3 -> closest approach is outside a and b.
172 *
173 * dist[0] is actual distance from p in d direction to
174 * closest portion of segment.
175 * dist[1] is ratio of distance from a to b (0.0 at a, and 1.0 at b),
176 * dist[1] may be less than 0 or greater than 1.
177 * For return values less than 0, closest approach is defined as
178 * closest to point p.
179 * Direction vector, d, must be unit length.
180 *
181 */
182BG_EXPORT extern int bg_dist_line3_lseg3(fastf_t *dist,
183 const fastf_t *p,
184 const fastf_t *d,
185 const fastf_t *a,
186 const fastf_t *b,
187 const struct bn_tol *tol);
188
189/**
190 * Calculate closest approach of two lines
191 *
192 * returns:
193 * -2 -> lines are parallel and do not intersect
194 * -1 -> lines are parallel and collinear
195 * 0 -> lines intersect
196 * 1 -> lines do not intersect
197 *
198 * For return values less than zero, dist is not set. For return
199 * values of 0 or 1, dist[0] is the distance from p1 in the d1
200 * direction to the point of closest approach for that line. Similar
201 * for the second line. d1 and d2 must be unit direction vectors.
202 *
203 * XXX How is this different from bg_isect_line3_line3() ?
204 * XXX Why are the calling sequences just slightly different?
205 * XXX Can we pick the better one, and get rid of the other one?
206 * XXX If not, can we document how they differ?
207 */
208BG_EXPORT extern int bg_dist_line3_line3(fastf_t dist[2],
209 const point_t p1,
210 const point_t p2,
211 const vect_t d1,
212 const vect_t d2,
213 const struct bn_tol *tol);
214
215/**
216 *@brief
217 * Find the distance from a point P to a line segment described by the
218 * two endpoints A and B, and the point of closest approach (PCA).
219 @verbatim
220 *
221 * P
222 * *
223 * /.
224 * / .
225 * / .
226 * / . (dist)
227 * / .
228 * / .
229 * *------*--------*
230 * A PCA B
231 @endverbatim
232 *
233 * @return 0 P is within tolerance of lseg AB. *dist isn't 0: (SPECIAL!!!)
234 * *dist = parametric dist = |PCA-A| / |B-A|. pca=computed.
235 * @return 1 P is within tolerance of point A. *dist = 0, pca=A.
236 * @return 2 P is within tolerance of point B. *dist = 0, pca=B.
237 * @return 3 P is to the "left" of point A. *dist=|P-A|, pca=A.
238 * @return 4 P is to the "right" of point B. *dist=|P-B|, pca=B.
239 * @return 5 P is "above/below" lseg AB. *dist=|PCA-P|, pca=computed.
240 *
241 * This routine was formerly called bn_dist_pnt_lseg().
242 *
243 * XXX For efficiency, a version of this routine that provides the
244 * XXX distance squared would be faster.
245 */
246BG_EXPORT extern int bg_dist_pnt3_lseg3(fastf_t *dist,
247 point_t pca,
248 const point_t a,
249 const point_t b,
250 const point_t p,
251 const struct bn_tol *tol);
252
253/**
254 * PRIVATE: This is a new API and should be considered unpublished.
255 *
256 * Find the square of the distance from a point P to a line segment described
257 * by the two endpoints A and B.
258 *
259 * P
260 * *
261 * /.
262 * / .
263 * / .
264 * / . (dist)
265 * / .
266 * / .
267 * *------*--------*
268 * A PCA B
269 *
270 * There are six distinct cases, with these return codes -
271 * Return code precedence: 1, 2, 0, 3, 4, 5
272 *
273 * 0 P is within tolerance of lseg AB. *dist = 0.
274 * 1 P is within tolerance of point A. *dist = 0.
275 * 2 P is within tolerance of point B. *dist = 0.
276 * 3 PCA is within tolerance of A. *dist = |P-A|**2.
277 * 4 PCA is within tolerance of B. *dist = |P-B|**2.
278 * 5 P is "above/below" lseg AB. *dist=|PCA-P|**2.
279 *
280 * If both P and PCA and not within tolerance of lseg AB use
281 * these return codes -
282 *
283 * 3 PCA is to the left of A. *dist = |P-A|**2.
284 * 4 PCA is to the right of B. *dist = |P-B|**2.
285 *
286 * This function is a test version of "bn_distsq_pnt3_lseg3".
287 *
288 */
289BG_EXPORT extern int bg_distsq_pnt3_lseg3_v2(fastf_t *distsq,
290 const fastf_t *a,
291 const fastf_t *b,
292 const fastf_t *p,
293 const struct bn_tol *tol);
294
295/**
296 * @brief
297 * Check to see if three points are collinear.
298 *
299 * The algorithm is designed to work properly regardless of the order
300 * in which the points are provided.
301 *
302 * @return 1 If 3 points are collinear
303 * @return 0 If they are not
304 */
305BG_EXPORT extern int bg_3pnts_collinear(point_t a,
306 point_t b,
308 const struct bn_tol *tol);
309
310/**
311 * @return 1 if the two points are equal, within the tolerance
312 * @return 0 if the two points are not "the same"
313 */
314BG_EXPORT extern int bg_pnt3_pnt3_equal(const point_t a,
315 const point_t b,
316 const struct bn_tol *tol);
317
318/**
319 *@brief
320 * Find the distance from a point P to a line segment described by the
321 * two endpoints A and B, and the point of closest approach (PCA).
322 @verbatim
323 * P
324 * *
325 * /.
326 * / .
327 * / .
328 * / . (dist)
329 * / .
330 * / .
331 * *------*--------*
332 * A PCA B
333 @endverbatim
334 * There are six distinct cases, with these return codes -
335 * @return 0 P is within tolerance of lseg AB. *dist isn't 0: (SPECIAL!!!)
336 * *dist = parametric dist = |PCA-A| / |B-A|. pca=computed.
337 * @return 1 P is within tolerance of point A. *dist = 0, pca=A.
338 * @return 2 P is within tolerance of point B. *dist = 0, pca=B.
339 * @return 3 P is to the "left" of point A. *dist=|P-A|**2, pca=A.
340 * @return 4 P is to the "right" of point B. *dist=|P-B|**2, pca=B.
341 * @return 5 P is "above/below" lseg AB. *dist=|PCA-P|**2, pca=computed.
342 *
343 *
344 * Patterned after bg_dist_pnt3_lseg3().
345 */
346BG_EXPORT extern int bg_dist_pnt2_lseg2(fastf_t *dist_sq,
347 fastf_t pca[2],
348 const point_t a,
349 const point_t b,
350 const point_t p,
351 const struct bn_tol *tol);
352
353/**
354 *@brief
355 * Intersect two 3D line segments, defined by two points and two
356 * vectors. The vectors are unlikely to be unit length.
357 *
358 *
359 * @return -3 missed
360 * @return -2 missed (line segments are parallel)
361 * @return -1 missed (collinear and non-overlapping)
362 * @return 0 hit (line segments collinear and overlapping)
363 * @return 1 hit (normal intersection)
364 *
365 * @param[out] dist
366 * The value at dist[] is set to the parametric distance of the
367 * intercept dist[0] is parameter along p, range 0 to 1, to
368 * intercept. dist[1] is parameter along q, range 0 to 1, to
369 * intercept. If within distance tolerance of the endpoints,
370 * these will be exactly 0.0 or 1.0, to ease the job of caller.
371 *
372 * CLARIFICATION: This function 'bn_isect_lseg3_lseg3'
373 * returns distance values scaled where an intersect at the start
374 * point of the line segment (within tol->dist) results in 0.0
375 * and when the intersect is at the end point of the line
376 * segment (within tol->dist), the result is 1.0. Intersects
377 * before the start point return a negative distance. Intersects
378 * after the end point result in a return value > 1.0.
379 *
380 * Special note: when return code is "0" for co-linearity, dist[1] has
381 * an alternate interpretation: it's the parameter along p (not q)
382 * which takes you from point p to the point (q + qdir), i.e., it's
383 * the endpoint of the q linesegment, since in this case there may be
384 * *two* intersections, if q is contained within span p to (p + pdir).
385 *
386 * @param p point 1
387 * @param pdir direction-1
388 * @param q point 2
389 * @param qdir direction-2
390 * @param tol tolerance values
391 */
392BG_EXPORT extern int bg_isect_lseg3_lseg3(fastf_t *dist,
393 const point_t p, const vect_t pdir,
394 const point_t q, const vect_t qdir,
395 const struct bn_tol *tol);
396
397BG_EXPORT extern int bg_lseg3_lseg3_parallel(const point_t sg1pt1, const point_t sg1pt2,
398 const point_t sg2pt1, const point_t sg2pt2,
399 const struct bn_tol *tol);
400
401/**
402 * Intersect two line segments, each in given in parametric form:
403 *
404 * X = p0 + pdist * pdir_i (i.e. line p0->p1)
405 * and
406 * X = q0 + qdist * qdir_i (i.e. line q0->q1)
407 *
408 * The input vectors 'pdir_i' and 'qdir_i' must NOT be unit vectors
409 * for this function to work correctly. The magnitude of the direction
410 * vectors indicates line segment length.
411 *
412 * The 'pdist' and 'qdist' values returned from this function are the
413 * actual distance to the intersect (i.e. not scaled). Distances may
414 * be negative, see below.
415 *
416 * @return -2 no intersection, lines are parallel.
417 * @return -1 no intersection
418 * @return 0 lines are co-linear (pdist and qdist returned) (see below)
419 * @return 1 intersection found (pdist and qdist returned) (see below)
420 *
421 * @param p0 point 1
422 * @param u direction 1
423 * @param q0 point 2
424 * @param v direction 2
425 * @param tol tolerance values
426 * @param[out] s (distances to intersection) (see below)
427 * @param[out] t (distances to intersection) (see below)
428 *
429 * When return = 1, pdist is the distance along line p0->p1 to the
430 * intersect with line q0->q1. If the intersect is along p0->p1 but
431 * in the opposite direction of vector pdir_i (i.e. occurring before
432 * p0 on line p0->p1) then the distance will be negative. The value
433 * if qdist is the same as pdist except it is the distance along line
434 * q0->q1 to the intersect with line p0->p1.
435 *
436 * When return code = 0 for co-linearity, pdist and qdist have a
437 * different meaning. pdist is the distance from point p0 to point q0
438 * and qdist is the distance from point p0 to point q1. If point q0
439 * occurs before point p0 on line segment p0->p1 then pdist will be
440 * negative. The same occurs for the distance to point q1.
441 */
442BG_EXPORT extern int bg_isect_line3_line3(fastf_t *s, fastf_t *t,
443 const point_t p0,
444 const vect_t u,
445 const point_t q0,
446 const vect_t v,
447 const struct bn_tol *tol);
448
449/**
450 * @brief
451 * Returns non-zero if the 3 lines are collinear to within tol->dist
452 * over the given distance range.
453 *
454 * Range should be at least one model diameter for most applications.
455 * 1e5 might be OK for a default for "vehicle sized" models.
456 *
457 * The direction vectors do not need to be unit length.
458 */
459BG_EXPORT extern int bg_2line3_colinear(const point_t p1,
460 const vect_t d1,
461 const point_t p2,
462 const vect_t d2,
463 double range,
464 const struct bn_tol *tol);
465
466/**
467 * @brief
468 * Intersect a point P with the line segment defined by two distinct
469 * points A and B.
470 *
471 * @return -2 P on line AB but outside range of AB,
472 * dist = distance from A to P on line.
473 * @return -1 P not on line of AB within tolerance
474 * @return 1 P is at A
475 * @return 2 P is at B
476 * @return 3 P is on AB, dist = distance from A to P on line.
477 @verbatim
478 B *
479 |
480 P'*-tol-*P
481 | / _
482 dist / /|
483 | / /
484 | / / AtoP
485 |/ /
486 A * /
487
488 tol = distance limit from line to pt P;
489 dist = distance from A to P'
490 @endverbatim
491*/
492BG_EXPORT extern int bg_isect_pnt2_lseg2(fastf_t *dist,
493 const point_t a,
494 const point_t b,
495 const point_t p,
496 const struct bn_tol *tol);
497
498/**
499 *@brief
500 * Intersect a line in parametric form:
501 *
502 * X = P + t * D
503 *
504 * with a line segment defined by two distinct points A and B=(A+C).
505 *
506 * XXX probably should take point B, not vector C. Sigh.
507 *
508 * @return -4 A and B are not distinct points
509 * @return -3 Lines do not intersect
510 * @return -2 Intersection exists, but outside segment, < A
511 * @return -1 Intersection exists, but outside segment, > B
512 * @return 0 Lines are co-linear (special meaning of dist[1])
513 * @return 1 Intersection at vertex A
514 * @return 2 Intersection at vertex B (A+C)
515 * @return 3 Intersection between A and B
516 *
517 * Implicit Returns -
518 * @param dist When explicit return >= 0, t is the parameter that describes
519 * the intersection of the line and the line segment.
520 * The actual intersection coordinates can be found by
521 * solving P + t * D. However, note that for return codes
522 * 1 and 2 (intersection exactly at a vertex), it is
523 * strongly recommended that the original values passed in
524 * A or B are used instead of solving P + t * D, to prevent
525 * numeric error from creeping into the position of
526 * the endpoints.
527 *
528 * @param p point of first line
529 * @param d direction of first line
530 * @param a point of second line
531 * @param c direction of second line
532 * @param tol tolerance values
533 */
534BG_EXPORT extern int bg_isect_line2_lseg2(fastf_t *dist,
535 const point_t p,
536 const vect_t d,
537 const point_t a,
538 const vect_t c,
539 const struct bn_tol *tol);
540
541/**
542 *@brief
543 * Intersect two 2D line segments, defined by two points and two
544 * vectors. The vectors are unlikely to be unit length.
545 *
546 * @return -2 missed (line segments are parallel)
547 * @return -1 missed (collinear and non-overlapping)
548 * @return 0 hit (line segments collinear and overlapping)
549 * @return 1 hit (normal intersection)
550 *
551 * @param dist The value at dist[] is set to the parametric distance of the
552 * intercept.
553 *@n dist[0] is parameter along p, range 0 to 1, to intercept.
554 *@n dist[1] is parameter along q, range 0 to 1, to intercept.
555 *@n If within distance tolerance of the endpoints, these will be
556 * exactly 0.0 or 1.0, to ease the job of caller.
557 *
558 * Special note: when return code is "0" for co-linearity, dist[1] has
559 * an alternate interpretation: it's the parameter along p (not q)
560 * which takes you from point p to the point (q + qdir), i.e., its
561 * the endpoint of the q linesegment, since in this case there may be
562 * *two* intersections, if q is contained within span p to (p + pdir).
563 * And either may be -10 if the point is outside the span.
564 *
565 * @param p point 1
566 * @param pdir direction1
567 * @param q point 2
568 * @param qdir direction2
569 * @param tol tolerance values
570 */
571BG_EXPORT extern int bg_isect_lseg2_lseg2(fastf_t *dist,
572 const point_t p,
573 const vect_t pdir,
574 const point_t q,
575 const vect_t qdir,
576 const struct bn_tol *tol);
577
578/**
579 * Intersect two lines, each in given in parametric form:
580 @verbatim
581
582 X = P + t * D
583 and
584 X = A + u * C
585
586 @endverbatim
587 *
588 * While the parametric form is usually used to denote a ray (i.e.,
589 * positive values of the parameter only), in this case the full line
590 * is considered.
591 *
592 * The direction vectors C and D need not have unit length.
593 *
594 * @return -1 no intersection, lines are parallel.
595 * @return 0 lines are co-linear
596 *@n dist[0] gives distance from P to A,
597 *@n dist[1] gives distance from P to (A+C) [not same as below]
598 * @return 1 intersection found (t and u returned)
599 *@n dist[0] gives distance from P to isect,
600 *@n dist[1] gives distance from A to isect.
601 *
602 * @param dist When explicit return > 0, dist[0] and dist[1] are the
603 * line parameters of the intersection point on the 2 rays. The
604 * actual intersection coordinates can be found by substituting either
605 * of these into the original ray equations.
606 *
607 * @param p point of first line
608 * @param d direction of first line
609 * @param a point of second line
610 * @param c direction of second line
611 * @param tol tolerance values
612 *
613 * Note that for lines which are very nearly parallel, but not quite
614 * parallel enough to have the determinant go to "zero", the
615 * intersection can turn up in surprising places. (e.g. when
616 * det=1e-15 and det1=5.5e-17, t=0.5)
617 */
618BG_EXPORT extern int bg_isect_line2_line2(fastf_t *dist,
619 const point_t p,
620 const vect_t d,
621 const point_t a,
622 const vect_t c,
623 const struct bn_tol *tol);
624
625/**
626 * @brief
627 * Returns distance between two points.
628 */
629BG_EXPORT extern double bg_dist_pnt3_pnt3(const point_t a,
630 const point_t b);
632/**
633 * Check to see if three points are all distinct, i.e., ensure that
634 * there is at least sqrt(dist_tol_sq) distance between every pair of
635 * points.
636 *
637 * @return 1 If all three points are distinct
638 * @return 0 If two or more points are closer together than dist_tol_sq
639 */
640BG_EXPORT extern int bg_3pnts_distinct(const point_t a,
641 const point_t b,
642 const point_t c,
643 const struct bn_tol *tol);
644
645/**
646 * Check to see if the points are all distinct, i.e., ensure that
647 * there is at least sqrt(dist_tol_sq) distance between every pair of
648 * points.
649 *
650 * @return 1 If all the points are distinct
651 * @return 0 If two or more points are closer together than dist_tol_sq
652 */
653BG_EXPORT extern int bg_npnts_distinct(const int npts,
654 const point_t *pts,
655 const struct bn_tol *tol);
656
657/**
658 * Find the equation of a plane that contains three points. Note that
659 * normal vector created is expected to point out (see vmath.h), so
660 * the vector from A to C had better be counter-clockwise (about the
661 * point A) from the vector from A to B. This follows the BRL-CAD
662 * outward-pointing normal convention, and the right-hand rule for
663 * cross products.
664 *
665 @verbatim
666 *
667 * C
668 * *
669 * |\
670 * | \
671 * ^ N | \
672 * | \ | \
673 * | \ | \
674 * |C-A \ | \
675 * | \ | \
676 * | \ | \
677 * \| \
678 * *---------*
679 * A B
680 * ----->
681 * B-A
682 @endverbatim
683 *
684 * If the points are given in the order A B C (e.g.,
685 * *counter*-clockwise), then the outward pointing surface normal:
686 *
687 * N = (B-A) x (C-A).
688 *
689 * @return 0 OK
690 * @return -1 Failure. At least two of the points were not distinct,
691 * or all three were collinear.
692 *
693 * @param[out] plane The plane equation is stored here.
694 * @param[in] a point 1
695 * @param[in] b point 2
696 * @param[in] c point 3
697 * @param[in] tol Tolerance values for doing calculation
698 */
699BG_EXPORT extern int bg_make_plane_3pnts(plane_t plane,
700 const point_t a,
701 const point_t b,
702 const point_t c,
703 const struct bn_tol *tol);
704
705/**
706 *@brief
707 * Given the description of three planes, compute the point of intersection, if
708 * any. The direction vectors of the planes need not be of unit length.
709 *
710 * Find the solution to a system of three equations in three unknowns:
711 @verbatim
712 * Px * Ax + Py * Ay + Pz * Az = -A3;
713 * Px * Bx + Py * By + Pz * Bz = -B3;
714 * Px * Cx + Py * Cy + Pz * Cz = -C3;
715 *
716 * OR
717 *
718 * [ Ax Ay Az ] [ Px ] [ -A3 ]
719 * [ Bx By Bz ] * [ Py ] = [ -B3 ]
720 * [ Cx Cy Cz ] [ Pz ] [ -C3 ]
721 *
722 @endverbatim
723 *
724 * @return 0 OK
725 * @return -1 Failure. Intersection is a line or plane.
726 *
727 * @param[out] pt The point of intersection is stored here.
728 * @param a plane 1
729 * @param b plane 2
730 * @param c plane 3
731 */
732
733BG_EXPORT extern int bg_make_pnt_3planes(point_t pt,
734 const plane_t a,
735 const plane_t b,
736 const plane_t c);
737
738/**
739 * Intersect an infinite line (specified in point and direction vector
740 * form) with a plane that has an outward pointing normal. The
741 * direction vector need not have unit length. The first three
742 * elements of the plane equation must form a unit length vector.
743 *
744 * @return -2 missed (ray is outside halfspace)
745 * @return -1 missed (ray is inside)
746 * @return 0 line lies on plane
747 * @return 1 hit (ray is entering halfspace)
748 * @return 2 hit (ray is leaving)
749 *
750 * @param[out] dist set to the parametric distance of the intercept
751 * @param[in] pt origin of ray
752 * @param[in] dir direction of ray
753 * @param[in] plane equation of plane
754 * @param[in] tol tolerance values
755 */
756BG_EXPORT extern int bg_isect_line3_plane(fastf_t *dist,
757 const point_t pt,
758 const vect_t dir,
759 const plane_t plane,
760 const struct bn_tol *tol);
761
762/**
763 *@brief
764 * Given two planes, find the line of intersection between them, if
765 * one exists. The line of intersection is returned in parametric
766 * line (point & direction vector) form.
767 *
768 * In order that all the geometry under consideration be in "front" of
769 * the ray, it is necessary to pass the minimum point of the model
770 * RPP. If this convention is unnecessary, just pass (0, 0, 0) as
771 * rpp_min.
772 *
773 * @return 0 success, line of intersection stored in 'pt' and 'dir'
774 * @return -1 planes are coplanar
775 * @return -2 planes are parallel but not coplanar
776 * @return -3 error, should be intersection but unable to find
777 *
778 * @param[out] pt Starting point of line of intersection
779 * @param[out] dir Direction vector of line of intersection (unit length)
780 * @param[in] a plane 1 (normal must be unit length)
781 * @param[in] b plane 2 (normal must be unit length)
782 * @param[in] rpp_min minimum point of model RPP
783 * @param[in] tol tolerance values
784 */
785BG_EXPORT extern int bg_isect_2planes(point_t pt,
786 vect_t dir,
787 const plane_t a,
788 const plane_t b,
789 const vect_t rpp_min,
790 const struct bn_tol *tol);
791BG_EXPORT extern int bg_isect_2lines(fastf_t *t,
792 fastf_t *u,
793 const point_t p,
794 const vect_t d,
795 const point_t a,
796 const vect_t c,
797 const struct bn_tol *tol);
798
799/**
800 *@brief
801 * Intersect a line in parametric form:
802 *
803 * X = P + t * D
804 *
805 * with a line segment defined by two distinct points A and B.
806 *
807 *
808 * @return -4 A and B are not distinct points
809 * @return -3 Intersection exists, < A (t is returned)
810 * @return -2 Intersection exists, > B (t is returned)
811 * @return -1 Lines do not intersect
812 * @return 0 Lines are co-linear (t for A is returned)
813 * @return 1 Intersection at vertex A
814 * @return 2 Intersection at vertex B
815 * @return 3 Intersection between A and B
816 *
817 * @par Implicit Returns -
818 *
819 * t When explicit return >= 0, t is the parameter that describes the
820 * intersection of the line and the line segment. The actual
821 * intersection coordinates can be found by solving P + t * D.
822 * However, note that for return codes 1 and 2 (intersection exactly
823 * at a vertex), it is strongly recommended that the original values
824 * passed in A or B are used instead of solving P + t * D, to prevent
825 * numeric error from creeping into the position of the endpoints.
826 *
827 * XXX should probably be called bg_isect_line3_lseg3()
828 * XXX should probably be changed to return dist[2]
829 */
830BG_EXPORT extern int bg_isect_line_lseg(fastf_t *t, const point_t p,
831 const vect_t d,
832 const point_t a,
833 const point_t b,
834 const struct bn_tol *tol);
835
836/**
837 * Given a parametric line defined by PT + t * DIR and a point A,
838 * return the closest distance between the line and the point.
839 *
840 * 'dir' need not have unit length.
841 *
842 * Find parameter for PCA along line with unitized DIR:
843 * d = VDOT(f, dir) / MAGNITUDE(dir);
844 * Find distance g from PCA to A using Pythagoras:
845 * g = sqrt(MAGSQ(f) - d**2)
846 *
847 * Return -
848 * Distance
849 */
850BG_EXPORT extern double bg_dist_line3_pnt3(const point_t pt,
851 const vect_t dir,
852 const point_t a);
853
854/**
855 * Given a parametric line defined by PT + t * DIR and a point A,
856 * return the square of the closest distance between the line and the
857 * point.
858 *
859 * 'dir' need not have unit length.
860 *
861 * Return -
862 * Distance squared
863 */
864BG_EXPORT extern double bg_distsq_line3_pnt3(const point_t pt,
865 const vect_t dir,
866 const point_t a);
867
868/**
869 *@brief
870 * Given a parametric line defined by PT + t * DIR, return the closest
871 * distance between the line and the origin.
872 *
873 * 'dir' need not have unit length.
874 *
875 * @return Distance
876 */
877BG_EXPORT extern double bg_dist_line_origin(const point_t pt,
878 const vect_t dir);
880/**
881 *@brief
882 * Given a parametric line defined by PT + t * DIR and a point A,
883 * return the closest distance between the line and the point.
884 *
885 * 'dir' need not have unit length.
886 *
887 * @return Distance
888 */
889BG_EXPORT extern double bg_dist_line2_point2(const point_t pt,
890 const vect_t dir,
891 const point_t a);
892
893/**
894 *@brief
895 * Given a parametric line defined by PT + t * DIR and a point A,
896 * return the closest distance between the line and the point,
897 * squared.
898 *
899 * 'dir' need not have unit length.
900 *
901 * @return
902 * Distance squared
903 */
904BG_EXPORT extern double bg_distsq_line2_point2(const point_t pt,
905 const vect_t dir,
906 const point_t a);
907
908/**
909 *@brief
910 * Returns the area of a triangle. Algorithm by Jon Leech 3/24/89.
911 */
912BG_EXPORT extern double bg_area_of_triangle(const point_t a,
913 const point_t b,
914 const point_t c);
915
916/**
917 *@brief
918 * Intersect a point P with the line segment defined by two distinct
919 * points A and B.
920 *
921 * @return -2 P on line AB but outside range of AB,
922 * dist = distance from A to P on line.
923 * @return -1 P not on line of AB within tolerance
924 * @return 1 P is at A
925 * @return 2 P is at B
926 * @return 3 P is on AB, dist = distance from A to P on line.
927 @verbatim
928 B *
929 |
930 P'*-tol-*P
931 | / _
932 dist / /|
933 | / /
934 | / / AtoP
935 |/ /
936 A * /
937
938 tol = distance limit from line to pt P;
939 dist = parametric distance from A to P' (in terms of A to B)
940 @endverbatim
941 *
942 * @param p point
943 * @param a start of lseg
944 * @param b end of lseg
945 * @param tol tolerance values
946 * @param[out] dist parametric distance from A to P' (in terms of A to B)
947 */
948BG_EXPORT extern int bg_isect_pnt_lseg(fastf_t *dist,
949 const point_t a,
950 const point_t b,
951 const point_t p,
952 const struct bn_tol *tol);
953
954BG_EXPORT extern double bg_dist_pnt_lseg(point_t pca,
955 const point_t a,
956 const point_t b,
957 const point_t p,
958 const struct bn_tol *tol);
959
960/**
961 *@brief
962 * Transform a bounding box (RPP) by the given 4x4 matrix. There are
963 * 8 corners to the bounding RPP. Each one needs to be transformed
964 * and min/max'ed. This is not minimal, but does fully contain any
965 * internal object, using an axis-aligned RPP.
966 */
967BG_EXPORT extern void bg_rotate_bbox(point_t omin,
968 point_t omax,
969 const mat_t mat,
970 const point_t imin,
971 const point_t imax);
972
973/**
974 *@brief
975 * Transform a plane equation by the given 4x4 matrix.
976 */
977BG_EXPORT extern void bg_rotate_plane(plane_t oplane,
978 const mat_t mat,
979 const plane_t iplane);
980
981/**
982 *@brief
983 * Test if two planes are identical. If so, their dot products will
984 * be either +1 or -1, with the distance from the origin equal in
985 * magnitude.
986 *
987 * @return -1 not coplanar, parallel but distinct
988 * @return 0 not coplanar, not parallel. Planes intersect.
989 * @return 1 coplanar, same normal direction
990 * @return 2 coplanar, opposite normal direction
991 */
992BG_EXPORT extern int bg_coplanar(const plane_t a,
993 const plane_t b,
994 const struct bn_tol *tol);
995
996
997
998/**
999 *@brief
1000 * Test if a set of points are coplanar. Note: if 0 < pt_cnt <=3 the point(s)
1001 * are trivially coplanar, and 1 will be returned.
1002 *
1003 * @return -1 error
1004 * @return 0 not coplanar
1005 * @return 1 coplanar
1006 */
1007BG_EXPORT extern int bg_coplanar_pts(const point_t *pts,
1008 int pt_cnt,
1009 const struct bn_tol *tol);
1010
1011
1012/**
1013 * Using two perpendicular vectors (x_dir and y_dir) which lie in the
1014 * same plane as 'vec', return the angle (in radians) of 'vec' from
1015 * x_dir, going CCW around the perpendicular x_dir CROSS y_dir.
1016 *
1017 * Trig note -
1018 *
1019 * theta = atan2(x, y) returns an angle in the range -pi to +pi.
1020 * Here, we need an angle in the range of 0 to 2pi. This could be
1021 * implemented by adding 2pi to theta when theta is negative, but this
1022 * could have nasty numeric ambiguity right in the vicinity of theta =
1023 * +pi, which is a very critical angle for the applications using this
1024 * routine.
1025 *
1026 * So, an alternative formulation is to compute gamma = atan2(-x, -y),
1027 * and then theta = gamma + pi. Now, any error will occur in the
1028 * vicinity of theta = 0, which can be handled much more readily.
1029 *
1030 * If theta is negative, or greater than two pi, wrap it around.
1031 * These conditions only occur if there are problems in atan2().
1032 *
1033 * @return vec == x_dir returns 0,
1034 * @return vec == y_dir returns pi/2,
1035 * @return vec == -x_dir returns pi,
1036 * @return vec == -y_dir returns 3*pi/2.
1037 *
1038 * In all cases, the returned value is between 0 and bg_twopi.
1039 */
1040BG_EXPORT extern double bg_angle_measure(vect_t vec,
1041 const vect_t x_dir,
1042 const vect_t y_dir);
1043
1044/**
1045 *@brief
1046 * Return the parametric distance t of a point X along a line defined
1047 * as a ray, i.e. solve X = P + t * D. If the point X does not lie on
1048 * the line, then t is the distance of the perpendicular projection of
1049 * point X onto the line.
1050 */
1051BG_EXPORT extern double bg_dist_pnt3_along_line3(const point_t p,
1052 const vect_t d,
1053 const point_t x);
1054
1055/**
1056 *@brief
1057 * Return the parametric distance t of a point X along a line defined
1058 * as a ray, i.e. solve X = P + t * D. If the point X does not lie on
1059 * the line, then t is the distance of the perpendicular projection of
1060 * point X onto the line.
1061 */
1062BG_EXPORT extern double bg_dist_pnt2_along_line2(const point_t p,
1063 const vect_t d,
1064 const point_t x);
1065
1066/**
1067 *
1068 * @return 1 if left <= mid <= right
1069 * @return 0 if mid is not in the range.
1070 */
1071BG_EXPORT extern int bg_between(double left,
1072 double mid,
1073 double right,
1074 const struct bn_tol *tol);
1075
1076/**
1077 * @return 0 No intersection
1078 * @return 1 Intersection, 'inter' has intersect point.
1079 */
1080BG_EXPORT extern int bg_does_ray_isect_tri(const point_t pt,
1081 const vect_t dir,
1082 const point_t V,
1083 const point_t A,
1084 const point_t B,
1085 point_t inter);
1086
1087/**
1088 *@brief
1089 * Classify a halfspace, specified by its plane equation, against a
1090 * bounding RPP.
1091 *
1092 * @return BG_CLASSIFY_INSIDE
1093 * @return BG_CLASSIFY_OVERLAPPING
1094 * @return BG_CLASSIFY_OUTSIDE
1095 */
1096BG_EXPORT extern int bg_hlf_class(const plane_t half_eqn,
1097 const vect_t min, const vect_t max,
1098 const struct bn_tol *tol);
1099
1100
1101#define BG_CLASSIFY_UNIMPLEMENTED 0x0000
1102#define BG_CLASSIFY_INSIDE 0x0001
1103#define BG_CLASSIFY_OVERLAPPING 0x0002
1104#define BG_CLASSIFY_OUTSIDE 0x0003
1107/**
1108 *@brief
1109 * Calculates the point that is the minimum distance from all the
1110 * planes in the "planes" array. If the planes intersect at a single
1111 * point, that point is the solution.
1112 *
1113 * The method used here is based on:
1114
1115 * An expression for the distance from a point to a plane is:
1116 * VDOT(pt, plane)-plane[H].
1117 * Square that distance and sum for all planes to get the "total"
1118 * distance.
1119 * For minimum total distance, the partial derivatives of this
1120 * expression (with respect to x, y, and z) must all be zero.
1121 * This produces a set of three equations in three unknowns (x, y, z).
1122
1123 * This routine sets up the three equations as [matrix][pt] = [hpq]
1124 * and solves by inverting "matrix" into "inverse" and
1125 * [pt] = [inverse][hpq].
1126 *
1127 * There is likely a more economical solution rather than matrix
1128 * inversion, but bg_mat_inv was handy at the time.
1129 *
1130 * Checks if these planes form a singular matrix and returns.
1131 *
1132 * @return 0 - all is well
1133 * @return 1 - planes form a singular matrix (no solution)
1134 */
1135BG_EXPORT extern int bg_isect_planes(point_t pt,
1136 const plane_t planes[],
1137 const size_t pl_count);
1138
1139
1140/**
1141 * @brief
1142 * Given an origin and a normal, create a plane_t.
1143 */
1144BG_EXPORT extern int bg_plane_pt_nrml(plane_t *p, point_t pt, vect_t nrml);
1145
1147 * @brief
1148 * Calculates the best fit plane for a set of points
1149 *
1150 * Use SVD algorithm from Soderkvist to fit a plane to vertex points
1151 * https://www.ltu.se/cms_fs/1.51590!/svd-fitting.pdf
1152 *
1153 * Returns a center point and a normal direction for the plane
1154 */
1155BG_EXPORT extern int bg_fit_plane(point_t *c, vect_t *n, size_t npnts, point_t *pnts);
1156
1158 * @brief
1159 * Find the closest U,V point on the plane p to 3d point pt.
1160 */
1161BG_EXPORT extern int bg_plane_closest_pt(fastf_t *u, fastf_t *v, plane_t *p, point_t *pt);
1162
1164 * @brief
1165 * Return the 3D point on the plane at parametric coordinates u, v.
1166 */
1167BG_EXPORT extern int bg_plane_pt_at(point_t *pt, plane_t *p, fastf_t u, fastf_t v);
1168
1170
1171__END_DECLS
1172
1173#endif /* BG_PLANE_H */
1174/** @} */
1175/*
1176 * Local Variables:
1177 * mode: C
1178 * tab-width: 8
1179 * indent-tabs-mode: t
1180 * c-file-style: "stroustrup"
1181 * End:
1182 * ex: shiftwidth=4 tabstop=8
1183 */
Header file for the BRL-CAD common definitions.
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 vecto...
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.
int bg_pnt3_pnt3_equal(const point_t a, const point_t b, 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_plane_pt_nrml(plane_t *p, point_t pt, vect_t nrml)
Given an origin and a normal, create a plane_t.
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:
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,...
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...
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.
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_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....
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...
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_isect_line3_plane(fastf_t *dist, const point_t pt, const vect_t dir, const plane_t plane, const struct bn_tol *tol)
void bg_rotate_plane(plane_t oplane, const mat_t mat, const plane_t iplane)
Transform a plane equation by the given 4x4 matrix.
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 th...
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...
double bg_dist_pnt3_pnt3(const point_t a, const point_t b)
Returns distance between two points.
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.
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.
int bg_3pnts_distinct(const point_t a, const point_t b, const point_t c, const struct bn_tol *tol)
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_make_plane_3pnts(plane_t plane, const point_t a, const point_t b, const point_t c, const struct bn_tol *tol)
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)
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.
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.
#define MAXPTS
Definition plane.h:46
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.
double bg_distsq_line3_pnt3(const point_t pt, const vect_t dir, const point_t a)
double bg_dist_line3_pnt3(const point_t pt, const vect_t dir, const point_t a)
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...
int bg_between(double left, double mid, double right, 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....
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.
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,...
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,...
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,...
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_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)
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:
double bg_angle_measure(vect_t vec, const vect_t x_dir, const vect_t y_dir)
int bg_npnts_distinct(const int npts, const point_t *pts, const struct bn_tol *tol)
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 th...
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.
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_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...
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_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.
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_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...
void float float int * n
Definition tig.h:74
void int char int int double * min
Definition tig.h:182
void int * c
Definition tig.h:139
void float * x
Definition tig.h:72
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition vmath.h:349
double fastf_t
fastest 64-bit (or larger) floating point type
Definition vmath.h:334
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition vmath.h:370
fastf_t plane_t[ELEMENTS_PER_PLANE]
Definition of a plane equation.
Definition vmath.h:397
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition vmath.h:355
Definition tol.h:72
char pl_code[MAXPTS+1]
Definition plane.h:60
fastf_t pl_2d_x[MAXPTS]
Definition plane.h:56
fastf_t pl_2d_com[MAXPTS]
Definition plane.h:58
size_t pl_npts
Definition plane.h:50
struct plane_specific * pl_forw
Definition plane.h:59
vect_t pl_Xbasis
Definition plane.h:52
vect_t pl_Ybasis
Definition plane.h:53
fastf_t pl_NdotA
Definition plane.h:55
point_t pl_points[MAXPTS]
Definition plane.h:51
fastf_t pl_2d_y[MAXPTS]
Definition plane.h:57
vect_t pl_N
Definition plane.h:54
float tri_A[3]
Definition plane.h:85
float tri_BA[3]
Definition plane.h:86
signed char * tri_normals
Definition plane.h:90
float tri_wn[3]
Definition plane.h:88
float tri_N[3]
Definition plane.h:89
struct tri_float_specific * tri_forw
Definition plane.h:92
float tri_CA[3]
Definition plane.h:87
int tri_surfno
Definition plane.h:75
fastf_t * tri_normals
Definition plane.h:74
vect_t tri_N
Definition plane.h:73
vect_t tri_BA
Definition plane.h:70
vect_t tri_CA
Definition plane.h:71
vect_t tri_wn
Definition plane.h:72
point_t tri_A
Definition plane.h:69
struct tri_specific * tri_forw
Definition plane.h:76
fundamental vector, matrix, quaternion math macros