BRL-CAD
isect.h
Go to the documentation of this file.
1/* I S E C T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2023 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 nmg_isect
23 */
24/** @{ */
25/** @file nmg/isect.h */
26
27#ifndef NMG_ISECT_H
28#define NMG_ISECT_H
29
30#include "common.h"
31
32#include "vmath.h"
33#include "bu/list.h"
34#include "bn/tol.h"
35#include "nmg/defines.h"
36
37__BEGIN_DECLS
38
40 uint32_t magic;
41 struct bu_ptbl *l1; /**< @brief vertexuses on the line of */
42 struct bu_ptbl *l2; /**< @brief intersection between planes */
43 fastf_t *mag1; /**< @brief Distances along intersection line */
44 fastf_t *mag2; /**< @brief for each vertexuse in l1 and l2. */
45 size_t mag_len; /**< @brief Array size of mag1 and mag2 */
46 struct shell *s1;
47 struct shell *s2;
48 struct faceuse *fu1; /**< @brief null if l1 comes from a wire */
49 struct faceuse *fu2; /**< @brief null if l2 comes from a wire */
50 struct bn_tol tol;
51 int coplanar; /**< @brief a flag */
52 struct edge_g_lseg *on_eg; /**< @brief edge_g for line of intersection */
53 point_t pt; /**< @brief 3D line of intersection */
55 point_t pt2d; /**< @brief 2D projection of isect line */
57 fastf_t *vert2d; /**< @brief Array of 2d vertex projections [index] */
58 size_t maxindex; /**< @brief size of vert2d[] */
59 mat_t proj; /**< @brief Matrix to project onto XY plane */
60 const uint32_t *twod; /**< @brief ptr to face/edge of 2d projection */
61};
62
63/* From nmg_inter.c */
64NMG_EXPORT extern struct vertexuse *nmg_make_dualvu(struct vertex *v,
65 struct faceuse *fu,
66 const struct bn_tol *tol);
67NMG_EXPORT extern struct vertexuse *nmg_enlist_vu(struct nmg_inter_struct *is,
68 const struct vertexuse *vu,
69 struct vertexuse *dualvu,
70 fastf_t dist);
71NMG_EXPORT extern void nmg_isect2d_prep(struct nmg_inter_struct *is,
72 const uint32_t *assoc_use);
73NMG_EXPORT extern void nmg_isect2d_cleanup(struct nmg_inter_struct *is);
74NMG_EXPORT extern void nmg_isect2d_final_cleanup(void);
75NMG_EXPORT extern int nmg_isect_2faceuse(point_t pt,
76 vect_t dir,
77 struct faceuse *fu1,
78 struct faceuse *fu2,
79 const struct bn_tol *tol);
80NMG_EXPORT extern void nmg_isect_vert2p_face2p(struct nmg_inter_struct *is,
81 struct vertexuse *vu1,
82 struct faceuse *fu2);
83NMG_EXPORT extern struct edgeuse *nmg_break_eu_on_v(struct edgeuse *eu1,
84 struct vertex *v2,
85 struct faceuse *fu,
86 struct nmg_inter_struct *is);
87NMG_EXPORT extern void nmg_break_eg_on_v(const struct edge_g_lseg *eg,
88 struct vertex *v,
89 const struct bn_tol *tol);
90NMG_EXPORT extern int nmg_isect_2colinear_edge2p(struct edgeuse *eu1,
91 struct edgeuse *eu2,
92 struct faceuse *fu,
93 struct nmg_inter_struct *is,
94 struct bu_ptbl *l1,
95 struct bu_ptbl *l2);
96NMG_EXPORT extern int nmg_isect_edge2p_edge2p(struct nmg_inter_struct *is,
97 struct edgeuse *eu1,
98 struct edgeuse *eu2,
99 struct faceuse *fu1,
100 struct faceuse *fu2);
101NMG_EXPORT extern int nmg_isect_construct_nice_ray(struct nmg_inter_struct *is,
102 struct faceuse *fu2);
103NMG_EXPORT extern void nmg_enlist_one_vu(struct nmg_inter_struct *is,
104 const struct vertexuse *vu,
105 fastf_t dist);
106NMG_EXPORT extern int nmg_isect_line2_edge2p(struct nmg_inter_struct *is,
107 struct bu_ptbl *list,
108 struct edgeuse *eu1,
109 struct faceuse *fu1,
110 struct faceuse *fu2);
111NMG_EXPORT extern void nmg_isect_line2_vertex2(struct nmg_inter_struct *is,
112 struct vertexuse *vu1,
113 struct faceuse *fu1);
114NMG_EXPORT extern int nmg_isect_two_ptbls(struct nmg_inter_struct *is,
115 const struct bu_ptbl *t1,
116 const struct bu_ptbl *t2);
117NMG_EXPORT extern struct edge_g_lseg *nmg_find_eg_on_line(const uint32_t *magic_p,
118 const point_t pt,
119 const vect_t dir,
120 struct bu_list *vlfree,
121 const struct bn_tol *tol);
122NMG_EXPORT extern int nmg_k0eu(struct vertex *v);
123NMG_EXPORT extern struct vertex *nmg_repair_v_near_v(struct vertex *hit_v,
124 struct vertex *v,
125 const struct edge_g_lseg *eg1,
126 const struct edge_g_lseg *eg2,
127 int bomb,
128 const struct bn_tol *tol);
129NMG_EXPORT extern struct vertex *nmg_search_v_eg(const struct edgeuse *eu,
130 int second,
131 const struct edge_g_lseg *eg1,
132 const struct edge_g_lseg *eg2,
133 struct vertex *hit_v,
134 const struct bn_tol *tol);
135NMG_EXPORT extern struct vertex *nmg_common_v_2eg(struct edge_g_lseg *eg1,
136 struct edge_g_lseg *eg2,
137 const struct bn_tol *tol);
138NMG_EXPORT extern int nmg_is_vertex_on_inter(struct vertex *v,
139 struct faceuse *fu1,
140 struct faceuse *fu2,
141 struct nmg_inter_struct *is,
142 struct bu_list *vlfree);
143NMG_EXPORT extern void nmg_isect_eu_verts(struct edgeuse *eu,
144 struct vertex_g *vg1,
145 struct vertex_g *vg2,
146 struct bu_ptbl *verts,
147 struct bu_ptbl *inters,
148 const struct bn_tol *tol);
149NMG_EXPORT extern void nmg_isect_eu_eu(struct edgeuse *eu1,
150 struct vertex_g *vg1a,
151 struct vertex_g *vg1b,
152 vect_t dir1,
153 struct edgeuse *eu2,
154 struct bu_ptbl *verts,
155 struct bu_ptbl *inters,
156 const struct bn_tol *tol);
157NMG_EXPORT extern void nmg_isect_eu_fu(struct nmg_inter_struct *is,
158 struct bu_ptbl *verts,
159 struct edgeuse *eu,
160 struct faceuse *fu,
161 struct bu_list *vlfree);
162NMG_EXPORT extern void nmg_isect_fu_jra(struct nmg_inter_struct *is,
163 struct faceuse *fu1,
164 struct faceuse *fu2,
165 struct bu_ptbl *eu1_list,
166 struct bu_ptbl *eu2_list,
167 struct bu_list *vlfree);
168NMG_EXPORT extern void nmg_isect_line2_face2pNEW(struct nmg_inter_struct *is,
169 struct faceuse *fu1, struct faceuse *fu2,
170 struct bu_ptbl *eu1_list,
171 struct bu_ptbl *eu2_list,
172 struct bu_list *vlfree);
173NMG_EXPORT extern int nmg_is_eu_on_line3(const struct edgeuse *eu,
174 const point_t pt,
175 const vect_t dir,
176 const struct bn_tol *tol);
177NMG_EXPORT extern struct edge_g_lseg *nmg_find_eg_between_2fg(const struct faceuse *ofu1,
178 const struct faceuse *fu2,
179 struct bu_list *vlfree,
180 const struct bn_tol *tol);
181NMG_EXPORT extern struct edgeuse *nmg_does_fu_use_eg(const struct faceuse *fu1,
182 const uint32_t *eg);
183NMG_EXPORT extern int rt_line_on_plane(const point_t pt,
184 const vect_t dir,
185 const plane_t plane,
186 const struct bn_tol *tol);
187NMG_EXPORT extern void nmg_cut_lu_into_coplanar_and_non(struct loopuse *lu,
188 plane_t pl,
189 struct nmg_inter_struct *is,
190 struct bu_list *vlfree);
191NMG_EXPORT extern void nmg_check_radial_angles(char *str,
192 struct shell *s,
193 struct bu_list *vlfree,
194 const struct bn_tol *tol);
195NMG_EXPORT extern int nmg_faces_can_be_intersected(struct nmg_inter_struct *bs,
196 const struct faceuse *fu1,
197 const struct faceuse *fu2,
198 struct bu_list *vlfree,
199 const struct bn_tol *tol);
200NMG_EXPORT extern void nmg_isect_two_generic_faces(struct faceuse *fu1,
201 struct faceuse *fu2,
202 struct bu_list *vlfree,
203 const struct bn_tol *tol);
204NMG_EXPORT extern void nmg_crackshells(struct shell *s1,
205 struct shell *s2,
206 struct bu_list *vlfree,
207 const struct bn_tol *tol);
208NMG_EXPORT extern int nmg_fu_touchingloops(const struct faceuse *fu);
209
210
211__END_DECLS
212
213#endif /* NMG_ISECT_H */
214/** @} */
215/*
216 * Local Variables:
217 * mode: C
218 * tab-width: 8
219 * indent-tabs-mode: t
220 * c-file-style: "stroustrup"
221 * End:
222 * ex: shiftwidth=4 tabstop=8
223 */
Header file for the BRL-CAD common definitions.
void nmg_isect_line2_face2pNEW(struct nmg_inter_struct *is, struct faceuse *fu1, struct faceuse *fu2, struct bu_ptbl *eu1_list, struct bu_ptbl *eu2_list, struct bu_list *vlfree)
int nmg_isect_2faceuse(point_t pt, vect_t dir, struct faceuse *fu1, struct faceuse *fu2, const struct bn_tol *tol)
void nmg_isect2d_cleanup(struct nmg_inter_struct *is)
struct edge_g_lseg * nmg_find_eg_on_line(const uint32_t *magic_p, const point_t pt, const vect_t dir, struct bu_list *vlfree, const struct bn_tol *tol)
void nmg_cut_lu_into_coplanar_and_non(struct loopuse *lu, plane_t pl, struct nmg_inter_struct *is, struct bu_list *vlfree)
void nmg_isect_eu_verts(struct edgeuse *eu, struct vertex_g *vg1, struct vertex_g *vg2, struct bu_ptbl *verts, struct bu_ptbl *inters, const struct bn_tol *tol)
int nmg_isect_2colinear_edge2p(struct edgeuse *eu1, struct edgeuse *eu2, struct faceuse *fu, struct nmg_inter_struct *is, struct bu_ptbl *l1, struct bu_ptbl *l2)
void nmg_check_radial_angles(char *str, struct shell *s, struct bu_list *vlfree, const struct bn_tol *tol)
void nmg_break_eg_on_v(const struct edge_g_lseg *eg, struct vertex *v, const struct bn_tol *tol)
struct vertex * nmg_common_v_2eg(struct edge_g_lseg *eg1, struct edge_g_lseg *eg2, const struct bn_tol *tol)
int nmg_is_eu_on_line3(const struct edgeuse *eu, const point_t pt, const vect_t dir, const struct bn_tol *tol)
struct edge_g_lseg * nmg_find_eg_between_2fg(const struct faceuse *ofu1, const struct faceuse *fu2, struct bu_list *vlfree, const struct bn_tol *tol)
struct vertexuse * nmg_enlist_vu(struct nmg_inter_struct *is, const struct vertexuse *vu, struct vertexuse *dualvu, fastf_t dist)
void nmg_isect2d_final_cleanup(void)
struct vertexuse * nmg_make_dualvu(struct vertex *v, struct faceuse *fu, const struct bn_tol *tol)
void nmg_isect2d_prep(struct nmg_inter_struct *is, const uint32_t *assoc_use)
void nmg_isect_line2_vertex2(struct nmg_inter_struct *is, struct vertexuse *vu1, struct faceuse *fu1)
int nmg_isect_line2_edge2p(struct nmg_inter_struct *is, struct bu_ptbl *list, struct edgeuse *eu1, struct faceuse *fu1, struct faceuse *fu2)
void nmg_isect_eu_fu(struct nmg_inter_struct *is, struct bu_ptbl *verts, struct edgeuse *eu, struct faceuse *fu, struct bu_list *vlfree)
void nmg_isect_fu_jra(struct nmg_inter_struct *is, struct faceuse *fu1, struct faceuse *fu2, struct bu_ptbl *eu1_list, struct bu_ptbl *eu2_list, struct bu_list *vlfree)
struct vertex * nmg_repair_v_near_v(struct vertex *hit_v, struct vertex *v, const struct edge_g_lseg *eg1, const struct edge_g_lseg *eg2, int bomb, const struct bn_tol *tol)
struct vertex * nmg_search_v_eg(const struct edgeuse *eu, int second, const struct edge_g_lseg *eg1, const struct edge_g_lseg *eg2, struct vertex *hit_v, const struct bn_tol *tol)
struct edgeuse * nmg_break_eu_on_v(struct edgeuse *eu1, struct vertex *v2, struct faceuse *fu, struct nmg_inter_struct *is)
void nmg_isect_eu_eu(struct edgeuse *eu1, struct vertex_g *vg1a, struct vertex_g *vg1b, vect_t dir1, struct edgeuse *eu2, struct bu_ptbl *verts, struct bu_ptbl *inters, const struct bn_tol *tol)
int nmg_isect_two_ptbls(struct nmg_inter_struct *is, const struct bu_ptbl *t1, const struct bu_ptbl *t2)
int nmg_isect_edge2p_edge2p(struct nmg_inter_struct *is, struct edgeuse *eu1, struct edgeuse *eu2, struct faceuse *fu1, struct faceuse *fu2)
void nmg_crackshells(struct shell *s1, struct shell *s2, struct bu_list *vlfree, const struct bn_tol *tol)
int nmg_k0eu(struct vertex *v)
struct edgeuse * nmg_does_fu_use_eg(const struct faceuse *fu1, const uint32_t *eg)
void nmg_isect_vert2p_face2p(struct nmg_inter_struct *is, struct vertexuse *vu1, struct faceuse *fu2)
int nmg_faces_can_be_intersected(struct nmg_inter_struct *bs, const struct faceuse *fu1, const struct faceuse *fu2, struct bu_list *vlfree, const struct bn_tol *tol)
int nmg_is_vertex_on_inter(struct vertex *v, struct faceuse *fu1, struct faceuse *fu2, struct nmg_inter_struct *is, struct bu_list *vlfree)
int nmg_fu_touchingloops(const struct faceuse *fu)
int rt_line_on_plane(const point_t pt, const vect_t dir, const plane_t plane, const struct bn_tol *tol)
void nmg_isect_two_generic_faces(struct faceuse *fu1, struct faceuse *fu2, struct bu_list *vlfree, const struct bn_tol *tol)
int nmg_isect_construct_nice_ray(struct nmg_inter_struct *is, struct faceuse *fu2)
void nmg_enlist_one_vu(struct nmg_inter_struct *is, const struct vertexuse *vu, fastf_t dist)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:345
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:330
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:366
fastf_t plane_t[ELEMENTS_PER_PLANE]
Definition of a plane equation.
Definition: vmath.h:393
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
Definition: tol.h:72
Definition: list.h:131
Definition: ptbl.h:53
Line in 3D space.
Definition: topology.h:326
NMG topological edge usage.
Definition: topology.h:155
struct bu_list l2
member of edge_g's eu_hd2 list
Definition: topology.h:157
NMG topological face usage.
Definition: topology.h:230
NMG topological loop usage.
Definition: topology.h:192
fastf_t * mag1
Distances along intersection line.
Definition: isect.h:43
size_t maxindex
size of vert2d[]
Definition: isect.h:58
point_t pt2d
2D projection of isect line
Definition: isect.h:55
struct bu_ptbl * l2
intersection between planes
Definition: isect.h:42
size_t mag_len
Array size of mag1 and mag2.
Definition: isect.h:45
struct bn_tol tol
Definition: isect.h:50
uint32_t magic
Definition: isect.h:40
fastf_t * mag2
for each vertexuse in l1 and l2.
Definition: isect.h:44
fastf_t * vert2d
Array of 2d vertex projections [index].
Definition: isect.h:57
int coplanar
a flag
Definition: isect.h:51
point_t pt
3D line of intersection
Definition: isect.h:53
struct edge_g_lseg * on_eg
edge_g for line of intersection
Definition: isect.h:52
struct shell * s2
Definition: isect.h:47
struct faceuse * fu2
null if l2 comes from a wire
Definition: isect.h:49
const uint32_t * twod
ptr to face/edge of 2d projection
Definition: isect.h:60
struct bu_ptbl * l1
vertexuses on the line of
Definition: isect.h:41
vect_t dir
Definition: isect.h:54
vect_t dir2d
Definition: isect.h:56
struct shell * s1
Definition: isect.h:46
struct faceuse * fu1
null if l1 comes from a wire
Definition: isect.h:48
mat_t proj
Matrix to project onto XY plane.
Definition: isect.h:59
NMG topological shell.
Definition: topology.h:261
Point in 3D space.
Definition: topology.h:309
NMG topological vertex - the simplest element of the topology system.
Definition: topology.h:98
NMG topological vertex usage.
Definition: topology.h:109
fundamental vector, matrix, quaternion math macros