QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_pointcloud.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(OPENNURBS_POINTCLOUD_INC_)
17#define OPENNURBS_POINTCLOUD_INC_
18
20//
21// Class ON_PointCloud - unordered set of points
22// ON_PointField - point height field
23//
24
26{
28
29public:
32 int // initial point array capacity
33 );
37
38 ON_3dPoint& operator[](int);
39 const ON_3dPoint& operator[](int) const;
40
41 /*
42 Description:
43 Get a point cloud point from an ON_COMPONENT_INDEX.
44 Parameters:
45 ci - [in] a component index with m_typ set to ON_COMPONENT_INDEX::pointcloud_point
46 and 0 <= m_index and m_index < m_P.Count().
47 Returns:
48 Point at [ci.m_index] or ON_UNSET_POINT if ci is not valid.
49 */
50 ON_3dPoint Point( ON_COMPONENT_INDEX ci ) const;
51
52 void Destroy();
53
54 /*
55 Description:
56 Call when the memory pool used the point cloud's arrays is
57 no longer in existence.
58 */
59 void EmergencyDestroy();
60
61 // virtual ON_Object override
62 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
63
64 // virtual ON_Object override
65 void Dump( ON_TextLog& ) const; // for debugging
66
67 // virtual ON_Object override
69
70 // virtual ON_Object override
72
73 // virtual ON_Object override
74 ON::object_type ObjectType() const;
75
76 // virtual ON_Geometry override
77 int Dimension() const;
78
79 // virtual ON_Geometry override
80 ON_BOOL32 GetBBox( // returns true if successful
81 double*, // minimum
82 double*, // maximum
83 ON_BOOL32 = false // true means grow box
84 ) const;
85
86 // virtual ON_Geometry override
88 ON_BoundingBox& tight_bbox,
89 int bGrowBox = false,
90 const ON_Xform* xform = 0
91 ) const;
92
93 // virtual ON_Geometry override
95 const ON_Xform&
96 );
97
98 // virtual ON_Geometry override
99 bool IsDeformable() const;
100
101 // virtual ON_Geometry override
102 bool MakeDeformable();
103
104 // virtual ON_Geometry override
106 int, int // indices of coords to swap
107 );
108
109 // virtual ON_Geometry override
110 bool Morph( const ON_SpaceMorph& morph );
111
112 // virtual ON_Geometry override
113 bool IsMorphable() const;
114
115 /*
116 Description:
117 Get the index of the point in the point cloud that is closest
118 to P.
119 Parameters:
120 P - [in]
121 closest_point_index - [out]
122 maximum_distance - [in] optional distance constraint.
123 If maximum_distance > 0, then only points Q with
124 |P-Q| <= maximum_distance are tested.
125 Returns:
126 True if a point is found; in which case *closest_point_index
127 is the index of the point. False if no point is found
128 or the input is not valid.
129 See Also:
130 ON_GetClosestPointInPointList
131 */
132 bool GetClosestPoint(
133 ON_3dPoint P,
134 int* closest_point_index,
135 double maximum_distance = 0.0
136 ) const;
137
138
140 // Interface
141 //
142 int PointCount() const;
143 void AppendPoint( const ON_3dPoint& );
144 void InvalidateBoundingBox(); // call if you change values of points
145
146 // for ordered streams
147 void SetOrdered(bool bOrdered); // true if set is ordered stream
148 bool IsOrdered() const; // true if set is ordered stream
149
150 // for height fields
151 bool HasPlane() const; // true if set is height field above a plane
152 void SetPlane( const ON_Plane& );
153 const ON_Plane& Plane();
154 double Height(int);
155
156 /*
157 Returns:
158 True if m_N.Count() == m_P.Count().
159 */
160 bool HasPointNormals() const;
161
162 /*
163 Returns:
164 True if m_C.Count() == m_P.Count().
165 */
166 bool HasPointColors() const;
167
168
169 /*
170 Returns:
171 Number of points that are hidden.
172 */
173 int HiddenPointCount() const;
174
175 /*
176 Description:
177 Destroys the m_H[] array and sets m_hidden_count=0.
178 */
179 void DestroyHiddenPointArray();
180
181 /*
182 Returns:
183 If the point cloud has some hidden points, then an array
184 of length PointCount() is returned and the i-th
185 element is true if the i-th vertex is hidden.
186 If no ponts are hidden, NULL is returned.
187 */
188 const bool* HiddenPointArray() const;
189
190 /*
191 Description:
192 Set the runtime hidden point flag.
193 Parameters:
194 point_index - [in] point vertex index
195 bHidden - [in] true to hide vertex
196 */
197 void SetHiddenPointFlag( int point_index, bool bHidden );
198
199 /*
200 Description:
201 Returns true if the point is hidden. This is a runtime
202 setting that is not saved in 3dm files.
203 Parameters:
204 point_index - [in]
205 Returns:
206 True if the point is hidden.
207 */
208 bool PointIsHidden( int point_index ) const;
209
211 // Implementation
213
215 // Implementation - OPTIONAL point normal
216 // Either m_N[] has zero count or it has the same
217 // count as m_P[], in which case m_N[j] reports
218 // the color assigned to m_P[j].
220
222 // Implementation - OPTIONAL point color
223 // Either m_C[] has zero count or it has the same
224 // count as m_P[], in which case m_P[j] reports
225 // the color assigned to m_P[j].
227
229 // Implementation - RUNTIME point visibility - not saved in 3dm files.
230 // If m_H.Count() = m_P.Count(), then
231 // m_H[j] is true if the point m_P[j]
232 // is hidden. Otherwise, all points are visible.
233 // m_hidden_count = number of true values in the m_H[] array.
236
239 unsigned int m_flags; // bit 1 is set if ordered
240 // bit 2 is set if plane is set
241
242};
243
244#endif
@ Point
Definition RSMetaType.h:50
@ Transform
Definition RSMetaType.h:67
Definition opennurbs_array.h:398
Definition opennurbs_point.h:403
Definition opennurbs_archive.h:152
Definition opennurbs_bounding_box.h:25
Definition opennurbs_geometry.h:36
virtual bool IsDeformable() const
Definition opennurbs_geometry.cpp:205
virtual ON_BOOL32 GetBBox(double *boxmin, double *boxmax, int bGrowBox=false) const =0
virtual bool GetTightBoundingBox(ON_BoundingBox &tight_bbox, int bGrowBox=false, const ON_Xform *xform=0) const
Definition opennurbs_geometry.cpp:98
virtual ON_BOOL32 SwapCoordinates(int i, int j)
Definition opennurbs_geometry.cpp:135
virtual bool MakeDeformable()
Definition opennurbs_geometry.cpp:210
ON_Geometry & operator=(const ON_Geometry &)
Definition opennurbs_geometry.cpp:26
virtual bool Morph(const ON_SpaceMorph &morph)
Definition opennurbs_geometry.cpp:254
virtual int Dimension() const =0
virtual bool IsMorphable() const
Definition opennurbs_geometry.cpp:259
virtual void Dump(ON_TextLog &) const
Definition opennurbs_object.cpp:1695
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
Definition opennurbs_object.cpp:1734
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
Definition opennurbs_object.cpp:1714
virtual ON::object_type ObjectType() const
Definition opennurbs_object.cpp:1616
Definition opennurbs_plane.h:20
Definition opennurbs_pointcloud.h:26
ON_SimpleArray< bool > m_H
Definition opennurbs_pointcloud.h:234
ON_OBJECT_DECLARE(ON_PointCloud)
ON_3dPointArray m_P
Definition opennurbs_pointcloud.h:212
ON_SimpleArray< ON_3dVector > m_N
Definition opennurbs_pointcloud.h:219
unsigned int m_flags
Definition opennurbs_pointcloud.h:239
ON_Plane m_plane
Definition opennurbs_pointcloud.h:237
int m_hidden_count
Definition opennurbs_pointcloud.h:235
ON_SimpleArray< ON_Color > m_C
Definition opennurbs_pointcloud.h:226
ON_BoundingBox m_bbox
Definition opennurbs_pointcloud.h:238
Definition opennurbs_array.h:46
Definition opennurbs_xform.h:1146
Definition opennurbs_textlog.h:20
Definition opennurbs_xform.h:28
#define ON_CLASS
Definition opennurbs_defines.h:91
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362