BRL-CAD
Loading...
Searching...
No Matches
surfacetree.h
Go to the documentation of this file.
1/* S U R F A C E T R E E . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2026 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/** @addtogroup brep_surfacetree
22 *
23 * @brief
24 * Curve Tree.
25 *
26 */
27#ifndef BREP_SURFACETREE_H
28#define BREP_SURFACETREE_H
29
30#include "common.h"
31#ifdef __cplusplus
32extern "C++" {
33/* @cond */
34#include <list>
35#include <queue>
36/* @endcond */
37}
38#endif
39#include "brep/defines.h"
40#include "brep/curvetree.h"
41#include "brep/bbnode.h"
42
43/** @{ */
44/** @file brep/surfacetree.h */
45
46#ifdef __cplusplus
47
49
50extern "C++" {
51namespace brlcad {
52
53 struct SurfaceSplitCache;
54
55 /**
56 * SurfaceTree declaration
57 */
59 public:
62
63 /* Report whether the tree is in a usable state */
64 bool Valid() const {
65 if (!m_root)
66 return false;
67 return true;
68 };
69
71
72 /**
73 * Calculate, using the surface bounding volume hierarchy, a uv
74 * estimate for the closest point on the surface to the point in
75 * 3-space.
76 */
79
80 /**
81 * Return surface
82 */
83 const ON_Surface *getSurface() const;
84 int getSurfacePoint(const ON_3dPoint &pt, ON_2dPoint &uv, const ON_3dPoint &from, double tolerance = BREP_SAME_POINT_TOLERANCE) const;
85
86 /**
87 * Return just the leaves of the surface tree
88 */
90
92
93 private:
94 SurfaceTree(const SurfaceTree &source);
95 SurfaceTree &operator=(const SurfaceTree &source);
96
97 int depth() const;
98 bool isFlat(const ON_Plane frames[9]) const;
99 bool isStraight(const ON_Plane frames[9]) const;
100 bool isFlatU(const ON_Plane frames[9]) const;
101 bool isFlatV(const ON_Plane frames[9]) const;
102 bool hasSplit(const ON_Surface *surf, int dir, const ON_Interval &interval, double &split) const;
103 BBNode *subdivideSurface(const ON_Surface *localsurf, const ON_Interval &u, const ON_Interval &v, ON_Plane frames[9], int depth, int depthLimit, int prev_knot, double within_distance_tol) const;
104 BBNode *surfaceBBox(const ON_Surface *localsurf, bool leaf, const ON_Plane frames[9], const ON_Interval &u, const ON_Interval &v, double within_distance_tol) const;
105
106 const bool m_removeTrimmed;
107 const ON_BrepFace * const m_face;
108 BBNode *m_root;
109 std::queue<ON_Plane *> * const m_f_queue;
110 SurfaceSplitCache * const m_split_cache;
111 };
112
113} /* namespace brlcad */
114} /* extern C++ */
115
117
118#endif
119
120/** @} */
121
122#endif /* BREP_SURFACETREE_H */
123
124/*
125 * Local Variables:
126 * mode: C
127 * tab-width: 8
128 * indent-tabs-mode: t
129 * c-file-style: "stroustrup"
130 * End:
131 * ex: shiftwidth=4 tabstop=8
132 */
SurfaceTree(const ON_BrepFace *face, bool removeTrimmed=true, int depthLimit=BREP_MAX_FT_DEPTH, double within_distance_tol=BREP_EDGE_MISS_TOLERANCE)
const ON_Surface * getSurface() const
bool Valid() const
Definition surfacetree.h:64
ON_2dPoint getClosestPointEstimate(const ON_3dPoint &pt, ON_Interval &u, ON_Interval &v) const
BBNode * getRootNode() const
const CurveTree * m_ctree
Definition surfacetree.h:91
void getLeaves(std::list< const BBNode * > &out_leaves) const
int getSurfacePoint(const ON_3dPoint &pt, ON_2dPoint &uv, const ON_3dPoint &from, double tolerance=BREP_SAME_POINT_TOLERANCE) const
ON_2dPoint getClosestPointEstimate(const ON_3dPoint &pt) const
Definition dvec.h:74
dvec(double s)
Header file for the BRL-CAD common definitions.
#define BREP_SAME_POINT_TOLERANCE
Definition defines.h:180
#define BREP_MAX_FT_DEPTH
Definition defines.h:143
#define BREP_EDGE_MISS_TOLERANCE
Definition defines.h:178
NMG topological face.
Definition topology.h:210