BRL-CAD
overlap.h
Go to the documentation of this file.
1 /* O V E R L A P . H
2  * BRL-CAD
3  *
4  * Copyright (c) 1993-2024 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 /** @file rt/overlap.h
21  *
22  */
23 
24 #ifndef RT_OVERLAP_H
25 #define RT_OVERLAP_H
26 
27 #include "common.h"
28 #include "vmath.h"
29 #include "bu/ptbl.h"
30 #include "rt/defines.h"
31 #include "rt/application.h"
32 #include "rt/ray_partition.h"
33 #include "rt/region.h"
34 
35 __BEGIN_DECLS
36 
37 /**
38  * Default version of a_multioverlap().
39  *
40  * Resolve the overlap of multiple regions within a single partition.
41  * There are no null pointers in the table (they have been compressed
42  * out by our caller). Consider BU_PTBL_LEN(regiontable) overlapping
43  * regions, and reduce to zero or one "claiming" regions, by setting
44  * pointers in the bu_ptbl of non-claiming regions to NULL.
45  *
46  * This default routine reproduces the behavior of BRL-CAD Release 5.0
47  * by considering the regions pairwise and calling the old
48  * a_overlap().
49  *
50  * An application which knew how to handle multiple overlapping air
51  * regions would provide its own very different version of this
52  * routine as the a_multioverlap() handler.
53  *
54  * This routine is for resolving overlaps only, and should not print
55  * any messages in normal operation; a_logoverlap() is for logging.
56  *
57  * InputHdp is the list of partitions up to this point. It allows us
58  * to look at the regions that have come before in deciding what to do
59  */
60 RT_EXPORT extern void rt_default_multioverlap(struct application *ap,
61  struct partition *pp,
62  struct bu_ptbl *regiontable,
63  struct partition *InputHdp);
64 
65 /**
66  * If an application doesn't want any logging from LIBRT, it should
67  * just set ap->a_logoverlap = rt_silent_logoverlap.
68  */
69 RT_EXPORT extern void rt_silent_logoverlap(struct application *ap,
70  const struct partition *pp,
71  const struct bu_ptbl *regiontable,
72  const struct partition *InputHdp);
73 
74 /**
75  * Log a multiplicity of overlaps within a single partition. This
76  * function is intended for logging only, and a_multioverlap() is
77  * intended for resolving the overlap, only. This function can be
78  * replaced by an application setting a_logoverlap().
79  */
80 RT_EXPORT extern void rt_default_logoverlap(struct application *ap,
81  const struct partition *pp,
82  const struct bu_ptbl *regiontable,
83  const struct partition *InputHdp);
84 
85 /**
86  * XXX This routine seems to free things more than once. For a
87  * temporary measure, don't free things.
88  */
89 RT_EXPORT extern void rt_rebuild_overlaps(struct partition *PartHdp,
90  struct application *ap,
91  int rebuild_fastgen_plates_only);
92 
93 /**
94  * Default handler for overlaps in rt_boolfinal().
95  *
96  * Returns -
97  * 0 to eliminate partition with overlap entirely
98  * 1 to retain partition in output list, claimed by reg1
99  * 2 to retain partition in output list, claimed by reg2
100  */
101 RT_EXPORT extern int rt_defoverlap(struct application *ap,
102  struct partition *pp,
103  struct region *reg1,
104  struct region *reg2,
105  struct partition *pheadp);
106 
107 __END_DECLS
108 
109 #endif /* RT_OVERLAP_H */
110 
111 /*
112  * Local Variables:
113  * tab-width: 8
114  * mode: C
115  * indent-tabs-mode: t
116  * c-file-style: "stroustrup"
117  * End:
118  * ex: shiftwidth=4 tabstop=8
119  */
Header file for the BRL-CAD common definitions.
void rt_rebuild_overlaps(struct partition *PartHdp, struct application *ap, int rebuild_fastgen_plates_only)
void rt_silent_logoverlap(struct application *ap, const struct partition *pp, const struct bu_ptbl *regiontable, const struct partition *InputHdp)
void rt_default_logoverlap(struct application *ap, const struct partition *pp, const struct bu_ptbl *regiontable, const struct partition *InputHdp)
int rt_defoverlap(struct application *ap, struct partition *pp, struct region *reg1, struct region *reg2, struct partition *pheadp)
void rt_default_multioverlap(struct application *ap, struct partition *pp, struct bu_ptbl *regiontable, struct partition *InputHdp)
Definition: ptbl.h:53
Definition: region.h:44
fundamental vector, matrix, quaternion math macros