BRL-CAD
plane_struct.h
Go to the documentation of this file.
1 /* P L A N E _ S T R U C T . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 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 /* @file plane_struct.h */
23 /** @addtogroup plane */
24 /** @{ */
25 
26 /**
27  * @brief
28  * Plane structures (from src/librt/plane.h)
29  * Holds all the required info for geometric planes.
30  */
31 
32 #ifndef BN_PLANE_STRUCT_H
33 #define BN_PLANE_STRUCT_H
34 
35 #include "common.h"
36 #include "vmath.h"
37 #include "bn/defines.h"
38 
40 
41 #define MAXPTS 4 /* All we need are 4 points */
42 #define pl_A pl_points[0] /* Synonym for A point */
43 
45  size_t pl_npts; /* number of points on plane */
46  point_t pl_points[MAXPTS]; /* Actual points on plane */
47  vect_t pl_Xbasis; /* X (B-A) vector (for 2d coords) */
48  vect_t pl_Ybasis; /* Y (C-A) vector (for 2d coords) */
49  vect_t pl_N; /* Unit-length Normal (outward) */
50  fastf_t pl_NdotA; /* Normal dot A */
51  fastf_t pl_2d_x[MAXPTS]; /* X 2d-projection of points */
52  fastf_t pl_2d_y[MAXPTS]; /* Y 2d-projection of points */
53  fastf_t pl_2d_com[MAXPTS]; /* pre-computed common-term */
54  struct plane_specific *pl_forw; /* Forward link */
55  char pl_code[MAXPTS+1]; /* Face code string. Decorative. */
56 };
57 
58 /*
59  * Describe the tri_specific structure.
60  */
61 struct tri_specific {
62  point_t tri_A; /* triangle vertex (A) */
63  vect_t tri_BA; /* B - A (second point) */
64  vect_t tri_CA; /* C - A (third point) */
65  vect_t tri_wn; /* facet normal (non-unit) */
66  vect_t tri_N; /* unit normal vector */
67  fastf_t *tri_normals; /* unit vertex normals A, B, C (this is malloced storage) */
68  int tri_surfno; /* solid specific surface number */
69  struct tri_specific *tri_forw; /* Next facet */
70 };
71 
73 
74 /*
75  * A more memory conservative version
76  */
78  float tri_A[3]; /* triangle vertex (A) */
79  float tri_BA[3]; /* B - A (second point) */
80  float tri_CA[3]; /* C - A (third point) */
81  float tri_wn[3]; /* facet normal (non-unit) */
82  float tri_N[3]; /* unit normal vector */
83  signed char *tri_normals; /* unit vertex normals A, B, C (this is malloced storage) */
84  int tri_surfno; /* solid specific surface number */
85  struct tri_float_specific *tri_forw;/* Next facet */
86 };
87 
89 
91 
92 #endif /* BN_PLANE_STRUCT_H */
93 /** @} */
94 /*
95  * Local Variables:
96  * mode: C
97  * tab-width: 8
98  * indent-tabs-mode: t
99  * c-file-style: "stroustrup"
100  * End:
101  * ex: shiftwidth=4 tabstop=8
102  */
vect_t pl_Ybasis
Definition: plane_struct.h:48
fastf_t pl_2d_com[MAXPTS]
Definition: plane_struct.h:53
vect_t tri_CA
Definition: plane_struct.h:64
Header file for the BRL-CAD common definitions.
vect_t tri_wn
Definition: plane_struct.h:65
signed char * tri_normals
Definition: plane_struct.h:83
char pl_code[MAXPTS+1]
Definition: plane_struct.h:55
fastf_t pl_2d_x[MAXPTS]
Definition: plane_struct.h:51
struct tri_specific * tri_forw
Definition: plane_struct.h:69
#define __BEGIN_DECLS
Definition: common.h:73
fastf_t pl_2d_y[MAXPTS]
Definition: plane_struct.h:52
fastf_t * tri_normals
Definition: plane_struct.h:67
#define MAXPTS
Plane structures (from src/librt/plane.h) Holds all the required info for geometric planes...
Definition: plane_struct.h:41
point_t pl_points[MAXPTS]
Definition: plane_struct.h:46
vect_t tri_N
Definition: plane_struct.h:66
struct plane_specific * pl_forw
Definition: plane_struct.h:54
point_t tri_A
Definition: plane_struct.h:62
struct tri_float_specific * tri_forw
Definition: plane_struct.h:85
#define __END_DECLS
Definition: common.h:74
fastf_t pl_NdotA
Definition: plane_struct.h:50
double fastf_t
Definition: defines.h:300
vect_t tri_BA
Definition: plane_struct.h:63
vect_t pl_Xbasis
Definition: plane_struct.h:47