opennurbs_topology.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_TOPOLOGY_INC_)
18 #define OPENNURBS_TOPOLOGY_INC_
19 
20 
21 class ON_CLASS ON_ComponentAttributes
22 {
23 public:
24 
25 #pragma region RH_C_SHARED_ENUM [ON_ComponentAttributes::EdgeFlags] [Rhino.Geometry.EdgeAttributeFlags] [int]
26 
27  /// <summary>
28  /// <para>ON_EdgeAttributeFlags are used to report attributes of single edge objects, like
29  /// ON_SubDEdge and ON_BrepEdge, and aggregate edge demographics in objects with topology
30  /// like ON_SubD, ON_Mesh and ON_Brep.</para>
31  /// <seealso cref="ON_BrepEdge::ComponentAttributes"/>
32  /// <seealso cref="ON_SubDEdge::ComponentAttributes"/>
33  /// <seealso cref="ON_Brep::AggregateEdgeComponentAttributes"/>
34  /// <seealso cref="ON_Mesh::AggregateEdgeComponentAttributes"/>
35  /// <seealso cref="ON_SubD::AggregateEdgeComponentAttributes"/>
36  /// </summary>
37  enum EdgeFlags : unsigned int
38  {
39  ///<summary>
40  /// The Open bit is set when an edge has distinct start and end vertices.
41  ///</summary>
42  Open = 1,
43 
44  ///<summary>
45  /// The Closed bit is set when an edge begins and ends at the same vertex.
46  ///</summary>
47  Closed = 2,
48 
49  ///<summary>
50  /// The Wire bit when an edge has no faces.
51  ///</summary>
52  Wire = 4,
53 
54  ///<summary>
55  /// The Boundary bit is set when an edge has one face.
56  ///</summary>
57  Boundary = 8,
58 
59  ///<summary>
60  /// The Interior bit is set when an edge has two distinct faces.
61  ///</summary>
62  Interior = 16,
63 
64  ///<summary>
65  /// The Nonmanifold bit is set when an edge has three or more faces.
66  ///</summary>
67  Nonmanifold = 32,
68 
69  ///<summary>
70  /// The Oriented bit is set when an edge has two faces with compatible orientations.
71  ///</summary>
72  Oriented = 64,
73 
74  ///<summary>
75  /// The NotOriented bit is set when an edge has two faces with opposited orientations.
76  ///</summary>
77  NotOriented = 128,
78 
79  ///<summary>
80  /// The Smooth bit is set when an an edge has two faces with a guaranteed surface tangent continuity.
81  ///</summary>
82  Smooth = 256,
83 
84  ///<summary>
85  /// The Crease bit is set when an edge has two faces with a possible surface tangent discontinuity
86  ///</summary>
87  Crease = 512,
88 
89  ///<summary>
90  /// The Dart bit is set when an edge has two faces with a possible surface tangent discontinuity
91  /// at one end and guaranteed surface tangent space continuity at the other end.
92  ///</summary>
93  Dart = 1024,
94 
95  ///<summary>
96  /// The Seam bit is set when an edge has two faces that are identical and the edge is on the parametric boundary of the face's surface.
97  ///</summary>
98  ///<example>
99  /// Parametric surfaces that are cylinders are an example of a situation where seam edges occur.
100  ///</example>
101  Seam = 2048,
102 
103  ///<summary>
104  /// The Slit bit is set when edge has two faces that are identical and the edges is not a seam.
105  ///</summary>
106  Slit = 4096,
107 
108  ///<summary>
109  /// The Slit bit is set when an edge has zero length.
110  ///</summary>
111  Degenerate = 4096,
112 
113  ///<summary>
114  /// The Damaged bit is set when an edge has a critical flaw like missing vertex information.
115  ///</summary>
116  Damaged = 32768,
117 
118  ///<summary>
119  /// Mask can be used to isolate EdgeFlags bits from an unsigned int bit field containing other information.
120  ///</summary>
121  ///<example>
122  /// Determine if two unsigned ints have identical EdgeFlags settings.
123  ///<code>
124  /// unsigned int combined_flags1 = ...;
125  /// unsigned int combined_flags2 = ...;
126  /// unsigned int edge_flags1 = (ON_ComponentAttributes::EdgeFlags::Mask &amp; combined_flags1);
127  /// unsigned int edge_flags2 = (ON_ComponentAttributes::EdgeFlags::Mask &amp; combined_flags2);
128  /// if ( edge_flags1 == edge_flags1)
129  /// {
130  /// ... edges flags are identical ...
131  /// }
132  ///</code>
133  ///</example>
134  Mask = 0xFFFF
135  };
136 
137 #pragma endregion
138 
139  /// <summary>
140  /// Inspects aggregate edge demographics to determine if every edge has exactly two faces and all
141  /// the faces have a compatible orientations.
142  /// </summary>
143  /// <example>
144  /// This sample shows how to determine if an ON_SubD is a solid.
145  /// <code>
146  /// ON_SubD subd = ...;
147  /// if (ON_ComponentAttributes::IsSolid(subd.AggregateEdgeComponentAttributes())
148  /// {
149  /// // subd is a solid
150  /// ...
151  /// }
152  /// </code>
153  /// </example>
154  /// <param name="aggregate_edge_component_attributes">
155  /// Value made by bitwise or of ON_ComponentAttributes::EdgeFlags values for every edge in the object.
156  /// </param>
157  /// <returns>True if every edge has exactly two faces.</returns>
158  /// <seealso cref="ON_Brep::EdgeDemographics"/>
159  /// <seealso cref="ON_SUbD::EdgeDemographics"/>
160  /// <seealso cref="ON_Mesh::EdgeDemographics"/>
161  /// <seealso cref="ON_ComponentAttributes::IsSolid"/>
162  /// <seealso cref="ON_ComponentAttributes::IsNotSolid"/>
163  /// <seealso cref="ON_ComponentAttributes::HasBoundary"/>
164  /// <seealso cref="ON_ComponentAttributes::IsOriented"/>
165  /// <seealso cref="ON_ComponentAttributes::IsNotOriented"/>
166  /// <seealso cref="ON_ComponentAttributes::IsManifold"/>
167  /// <seealso cref="ON_ComponentAttributes::IsNotManifold"/>
168  static bool IsSolid(
169  unsigned int aggregate_edge_component_attributes
170  );
171 
172  /// <summary>
173  /// Inspects aggregate edge demographics to determine if there is a boundary edge.
174  /// </summary>
175  /// <param name="aggregate_edge_component_attributes">
176  /// Value made by bitwise or of ON_ComponentAttributes::EdgeFlags values for every edge in the object.
177  /// </param>
178  /// <returns>True if there is at least one edge that has exactly one face.
179  /// Otherwise, false is returned.
180  ///</returns>
181  static bool HasBoundary(
182  unsigned int aggregate_edge_component_attributes
183  );
184 
185  /// <summary>
186  /// Inspects aggregate edge demographics to determine if the faces have a compatible orientations.
187  /// </summary>
188  /// <param name="aggregate_edge_demographics">
189  /// Value made by bitwise or of ON_ComponentAttributes::EdgeFlags values for every edge in the object.
190  /// </param>
191  /// <returns>If for every edge edge with exactly two faces, those two faces have compatible orientations, then true is returned.
192  /// Otherwise, false is returned.
193  ///</returns>
194  static bool IsOriented(
195  unsigned int aggregate_edge_component_attributes
196  );
197 
198  /// <summary>
199  /// Inspects aggregate edge demographics to determine if the faces have a compatible orientations.
200  /// </summary>
201  /// <param name="aggregate_edge_component_attributes">
202  /// Value made by bitwise or of ON_ComponentAttributes::EdgeFlags values for every edge in the object.
203  /// </param>
204  /// <returns>If there is an edge edge with exactly two faces and those faces have incompatible orientations,
205  /// then true is returned. Otherwise, false is returned.
206  ///</returns>
207  static bool IsNotOriented(
208  unsigned int aggregate_edge_component_attributes
209  );
210 
211  /// <summary>
212  /// Inspects aggregate edge demographics to determine if the object is a manifold, possibly with boundary.
213  /// Face orientation is ignored.
214  /// </summary>
215  /// <param name="aggregate_edge_component_attributes">
216  /// Value made by bitwise or of ON_ComponentAttributes::EdgeFlags values for every edge in the object.
217  /// </param>
218  /// <returns>If every edge has one or two faces, then true is returned.
219  /// If bAllowBoundaryEdges is true and every edge has one or two faces, then true is returned.
220  /// Otherwise, false is returned.
221  ///</returns>
222  static bool IsManifold(
223  unsigned int aggregate_edge_component_attributes
224  );
225 
226  /// <summary>
227  /// Inspects aggregate edge demographics to determine if the object is a not manifold.
228  /// </summary>
229  /// <param name="aggregate_edge_component_attributes">
230  /// Value made by bitwise or of ON_ComponentAttributes::EdgeFlags values for every edge in the object.
231  /// </param>
232  /// <returns>True if there is at least one edge with 3 or more faces or at least one wire edge.</returns>
233  static bool IsNotManifold(
234  unsigned int aggregate_edge_component_attributes
235  );
236 };
237 
238 #endif
Definition: opennurbs_topology.h:21
EdgeFlags
Definition: opennurbs_topology.h:37