Point Cloud Library (PCL)  1.14.1-dev
opennurbs_brep.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 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 ////////////////////////////////////////////////////////////////
18 //
19 // Definition of b-rep and its parts
20 //
21 ////////////////////////////////////////////////////////////////
22 
23 #if !defined(OPENNURBS_BREP_INC_)
24 #define OPENNURBS_BREP_INC_
25 
26 class ON_BrepTrim;
27 class ON_BrepEdge;
28 class ON_BrepLoop;
29 class ON_BrepFace;
30 
31 
32 // TEMPORARY DEFINES SO I DON'T BREAK THE BUILD
33 #define m_vertex_user_i m_vertex_user.i
34 #define m_trim_user_i m_trim_user.i
35 #define m_edge_user_i m_edge_user.i
36 #define m_loop_user_i m_loop_user.i
37 #define m_face_user_i m_face_user.i
38 
39 // Description:
40 // Brep vertex information is stored in ON_BrepVertex classes.
41 // ON_Brep.m_V[] is an array of all the vertices in the brep.
42 //
43 // If a vertex is a point on a face, then brep.m_E[m_ei]
44 // will be an edge with no 3d curve. This edge will have
45 // a single trim with type ON_BrepTrim::ptonsrf. There
46 // will be a loop containing this single trim.
47 // Use ON_Brep::NewPointOnFace() to create vertices that are
48 // points on faces.
49 class ON_CLASS ON_BrepVertex : public ON_Point
50 {
51  ON_OBJECT_DECLARE(ON_BrepVertex);
52 
53 public:
54  // Union available for application use.
55  // The constructor zeros m_vertex_user.
56  // The value is of m_vertex_user is not saved in 3DM
57  // archives and may be changed by some computations.
59 
60  // index of the vertex in the ON_Brep.m_V[] array
62 
63  /////////////////////////////////////////////////////////////////
64  // Construction
65  //
66  // In general, you should not directly create ON_BrepVertex classes.
67  // Use ON_Brep::NewVertex instead.
70  int // vertex index
71  );
73 
74  // virtual ON_Object::SizeOf override
75  unsigned int SizeOf() const;
76 
77  // virtual ON_Object::DataCRC override
78  ON__UINT32 DataCRC(ON__UINT32 current_remainder) const;
79 
80  /*
81  Description:
82  Tests an object to see if its data members are correctly
83  initialized.
84  Parameters:
85  text_log - [in] if the object is not valid and text_log
86  is not NULL, then a brief englis description of the
87  reason the object is not valid is appened to the log.
88  The information appended to text_log is suitable for
89  low-level debugging purposes by programmers and is
90  not intended to be useful as a high level user
91  interface tool.
92  Returns:
93  @untitled table
94  true object is valid
95  false object is invalid, uninitialized, etc.
96  Remarks:
97  Overrides virtual ON_Object::IsValid
98  */
99  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
100 
101  // virtual ON_Object::Dump() override
102  void Dump( ON_TextLog& ) const; // for debugging
103 
104  // virtual ON_Object::Write() override
105  ON_BOOL32 Write( ON_BinaryArchive& ) const;
106 
107  // virtual ON_Object::Read() override
108  ON_BOOL32 Read( ON_BinaryArchive& );
109 
110  // virtual ON_Geometry::ComponentIndex() override
111  ON_COMPONENT_INDEX ComponentIndex() const;
112 
113  /////////////////////////////////////////////////////////////////
114  // Interface
115 
116  // Description:
117  // Set vertex location.
118  // Parameters:
119  // point - [in] 3d vertex location
120  bool SetPoint(
121  const ON_3dPoint& // point
122  );
123 
124  // Returns:
125  // Vertex location.
126  ON_3dPoint Point() const;
127 
128  // Returns:
129  // value of ON_BrepVertex::m_tolerance
130  // Remarks:
131  // Use ON_Brep::SetVertexTolerance( ON_BrepVertex& ) to set tolerances.
132  double Tolerance() const;
133 
134  // Returns:
135  // number of edges that begin or end at this vertex.
136  int EdgeCount() const;
137 
138  /////////////////////////////////////////////////////////////////
139  // Implementation
140 
141  // indices of edges starting/ending at this vertex
142  //
143  // For closed edges, edge.m_vi[0] = edge.m_vi[1] and
144  // edge.m_edge_index appears twice in the m_ei[] array.
145  // The first occurance of edge.m_edge_index in m_ei[]
146  // is for the closed edge starting the vertex.
147  // The second occurance of edge,m_edge_index in m_ei[]
148  // is for the closed edge ending at the vertex.
149  // C.f. ON_Brep::Next/PrevEdge().
151 
152  // accuracy of vertex point (>=0.0 or ON_UNSET_VALUE)
153  //
154  // A value of ON_UNSET_VALUE indicates that the
155  // tolerance should be computed.
156  //
157  // A value of 0.0 indicates that the distance
158  // from the vertex to any applicable edge or trim
159  // end is <= ON_ZERO_TOLERANCE
160  //
161  // If an edge begins or ends at this vertex,
162  // then the distance from the vertex's
163  // 3d point to the appropriate end of the
164  // edge's 3d curve must be <= this tolerance.
165  //
166  // If a trim begins or ends at this vertex,
167  // then the distance from the vertex's 3d point
168  // to the 3d point on the surface obtained by
169  // evaluating the surface at the appropriate
170  // end of the trimming curve must be <= this
171  // tolerance.
172  double m_tolerance;
173 
174 private:
175  ON_BrepVertex( const ON_BrepVertex& ); // no implementation
176 
177 };
178 
179 /*
180 Description:
181  Brep edge information is stored in ON_BrepEdge classes.
182  ON_Brep.m_E[] is an array of all the edges in the brep.
183 
184  An ON_BrepEdge is derived from ON_CurveProxy so the the
185  edge can supply easy to use evaluation tools via
186  the ON_Curve virtual member functions.
187 
188  Note well that the domains and orientations of the curve
189  m_C3[edge.m_c3i] and the edge as a curve may not
190  agree.
191 */
192 class ON_CLASS ON_BrepEdge : public ON_CurveProxy
193 {
194  ON_OBJECT_DECLARE(ON_BrepEdge);
195 public:
196 
197  // Union available for application use.
198  // The constructor zeros m_edge_user.
199  // The value is of m_edge_user is not saved in 3DM
200  // archives and may be changed by some computations.
202 
203  // index of edge in ON_Brep.m_E[] array
205 
206 
207  // virtual ON_Curve::IsClosed override
208  ON_BOOL32 IsClosed() const;
209 
210  /////////////////////////////////////////////////////////////////
211  // Construction
212  //
213  // In general, you should not directly create ON_BrepEdge classes.
214  // Use ON_Brep::NewVertex instead.
216  ON_BrepEdge(int); // edge index
218 
219  // virtual ON_Object function
220  // The ON_BrepEdge override returns ON::curve_object.
221  ON::object_type ObjectType() const;
222 
223  /*
224  Returns:
225  Brep this edge belongs to.
226  */
227  ON_Brep* Brep() const;
228 
229 
230  /*
231  Parameters:
232  eti - [in] index into the edge's m_ti[] array.
233  Returns:
234  The trim brep.m_T[edge.m_ti[eti]];
235  */
236  ON_BrepTrim* Trim( int eti ) const;
237 
238  /*
239  Returns:
240  Number of trims attached to this edge.
241  */
242  int TrimCount() const;
243 
244  /*
245  Parameters:
246  evi - [in] 0 or 1
247  Returns:
248  Brep vertex at specified end of the edge.
249  */
250  ON_BrepVertex* Vertex(int evi) const;
251 
252  // virtual ON_Object::SizeOf override
253  unsigned int SizeOf() const;
254 
255  // virtual ON_Object::DataCRC override
256  ON__UINT32 DataCRC(ON__UINT32 current_remainder) const;
257 
258  /*
259  Description:
260  Tests an object to see if its data members are correctly
261  initialized.
262  Parameters:
263  text_log - [in] if the object is not valid and text_log
264  is not NULL, then a brief englis description of the
265  reason the object is not valid is appened to the log.
266  The information appended to text_log is suitable for
267  low-level debugging purposes by programmers and is
268  not intended to be useful as a high level user
269  interface tool.
270  Returns:
271  @untitled table
272  true object is valid
273  false object is invalid, uninitialized, etc.
274  Remarks:
275  Overrides virtual ON_Object::IsValid
276  */
277  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
278 
279  // virtual ON_Object::Dump() override
280  void Dump( ON_TextLog& ) const; // for debugging
281 
282  // virtual ON_Object::Write() override
283  ON_BOOL32 Write( ON_BinaryArchive& ) const;
284 
285  // virtual ON_Object::Read() override
286  ON_BOOL32 Read( ON_BinaryArchive& );
287 
288  // virtual ON_Geometry::ComponentIndex() override
289  ON_COMPONENT_INDEX ComponentIndex() const;
290 
291  // virtual ON_Curve::Reverse override
292  ON_BOOL32 Reverse();
293 
294  // virtual ON_Curve::SetStartPoint override
295  ON_BOOL32 SetStartPoint(
296  ON_3dPoint start_point
297  );
298 
299  // virtual ON_Curve::SetEndPoint override
300  ON_BOOL32 SetEndPoint(
301  ON_3dPoint end_point
302  );
303 
304  /////////////////////////////////////////////////////////////////
305  // Implementation
306 
307  /*
308  Returns:
309  brep.m_C3[] index of the 3d curve geometry used by this edge
310  or -1.
311  */
312  int EdgeCurveIndexOf() const;
313 
314  /*
315  Returns:
316  3d curve geometry used by this edge or NULL.
317  */
318  const ON_Curve* EdgeCurveOf() const;
319 
320  /*
321  Description:
322  Expert user tool that replaces the 3d curve geometry
323  of an edge
324  Parameters;
325  c3i - [in] brep 3d curve index of new curve
326  Returns:
327  True if successful.
328  Example:
329 
330  ON_Curve* pCurve = ...;
331  int c3i = brep.AddEdgeCurve(pCurve);
332  edge.ChangeEdgeCurve(c3i);
333 
334  Remarks:
335  Sets m_c3i, calls SetProxyCurve, cleans runtime caches.
336  */
338  int c3i
339  );
340 
341  /*
342  Description:
343  When an edge is modified, the m_pline[].e values need
344  to be set to ON_UNSET_VALUE by calling UnsetPlineEdgeParameters().
345  */
347 
348  // index of 3d curve in m_C3[] array
349  // (edge.m_curve also points to m_C3[m_c3i])
350  int m_c3i;
351 
352  // indices of starting/ending vertex
353  //
354  // For closed edges, m_vi[0] = m_vi[1] and m_edge_index
355  // appears twice in the m_V[m_vi[0]].m_ei[] array.
356  // The first occurance of m_edge_index in m_V[m_vi[0]].m_ei[]
357  // is for the closed edge starting the vertex. The second
358  // occurance of m_edge_index in m_V[m_vi[0]].m_ei[]
359  // is for the closed edge edge ending at the vertex.
360  // C.f. ON_Brep::Next/PrevEdge().
361  int m_vi[2];
362 
363  // indices of Trims that use this edge
365 
366  // accuracy of edge curve (>=0.0 or ON_UNSET_VALUE)
367  //
368  // A value of ON_UNSET_VALUE indicates that the
369  // tolerance should be computed.
370  //
371  // The maximum distance from the edge's 3d curve
372  // to any surface of a face that has this edge as
373  // a portion of its boundary must be <= this
374  // tolerance.
375  double m_tolerance;
376 
377 private:
378  friend class ON_Brep;
379  ON_Brep* m_brep; // so isolated edge class edge can get at it's 3d curve
380  ON_BrepEdge( const ON_BrepEdge& ); // no implementation
381 };
382 
384 {
385  ON_2dPoint p; // 2d surface parameter space point
386  double t; // corresponding trim curve parameter
387  double e; // corresponding edge curve parameter (ON_UNSET_VALUE if unknown)
388 };
389 
390 #if defined(ON_DLL_TEMPLATE)
391 // This stuff is here because of a limitation in the way Microsoft
392 // handles templates and DLLs. See Microsoft's knowledge base
393 // article ID Q168958 for details.
394 #pragma warning( push )
395 #pragma warning( disable : 4231 )
396 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_BrepTrimPoint>;
397 #pragma warning( pop )
398 #endif
399 
400 
401 /*
402 Description:
403  Brep trim information is stored in ON_BrepTrim classes.
404  ON_Brep.m_T[] is an array of all the trim in the brep.
405 
406  An ON_BrepTrim is derived from ON_CurveProxy so the the
407  trim can supply easy to use evaluation tools via
408  the ON_Curve virtual member functions.
409 
410  Note well that the domains and orientations of the curve
411  m_C2[trim.m_c2i] and the trin as a curve may not
412  agree.
413 */
414 class ON_CLASS ON_BrepTrim : public ON_CurveProxy
415 {
416  ON_OBJECT_DECLARE(ON_BrepTrim);
417 
418 public:
419  void DestroyRuntimeCache( bool bDelete = true );
420 
421  // virtual ON_Object::SizeOf override
422  unsigned int SizeOf() const;
423 
424  // Union available for application use.
425  // The constructor zeros m_trim_user.
426  // The value is of m_trim_user is not saved in 3DM
427  // archives and may be changed by some computations.
429 
430  int m_trim_index; // index of trim in ON_Brep.m_T[] array
431 
432  // types of trim - access through m_type member. Also see m_iso and ON_Surface::ISO
433  enum TYPE
434  {
435  unknown = 0,
436  boundary = 1, // trim is connected to an edge, is part of an outer,
437  // inner or slit loop, and is the only trim connected
438  // to the edge.
439  mated = 2, // trim is connected to an edge, is part of an outer,
440  // inner or slit loop, no other trim from the same
441  // loop is connected to the edge, and at least one
442  // trim from a different loop is connected to the edge.
443  seam = 3, // trim is connected to an edge, is part of an outer,
444  // inner or slit loop, and one other trim from the
445  // same loop is connected to the edge.
446  // (There can be other mated trims that are also
447  // connected to the edge. For example, the non-mainfold
448  // edge that results when a surface edge lies in the
449  // middle of another surface.) Non-mainfold "cuts"
450  // have seam trims too.
451  singular = 4, // trim is part of an outer loop, the trim's 2d curve
452  // runs along the singular side of a surface, and the
453  // trim is NOT connected to an edge. (There is no 3d
454  // edge because the surface side is singular.)
455  crvonsrf = 5, // trim is connected to an edge, is the only trim in
456  // a crfonsrf loop, and is the only trim connected to
457  // the edge.
458  ptonsrf = 6, // trim is a point on a surface, trim.m_pbox is records
459  // surface parameters, and is the only trim
460  // in a ptonsrf loop. This trim is not connected
461  // to an edge and has no 2d curve.
462  slit = 7, // 17 Nov 2006 - reserved for future use
463  // currently an invalid value
464  trim_type_count = 8,
465  force_32_bit_trim_type = 0xFFFFFFFF
466  };
467 
468  /////////////////////////////////////////////////////////////////
469  // Construction
470  //
471  // In general, you should not directly create ON_BrepTrim classes.
472  // Use ON_Brep::NewTrim instead.
474  ON_BrepTrim(int); // trim index
476 
477  /*
478  Returns:
479  Brep that this trim belongs to.
480  */
481  ON_Brep* Brep() const;
482 
483  /*
484  Returns:
485  Brep loop that this trim belongs to.
486  */
487  ON_BrepLoop* Loop() const;
488 
489  /*
490  Returns:
491  Brep face this trim belongs to.
492  */
493  ON_BrepFace* Face() const;
494 
495  /*
496  Returns:
497  Brep edge this trim uses or belongs to. This will
498  be NULL for singular trims.
499  */
500  ON_BrepEdge* Edge() const;
501 
502  /*
503  Parameters:
504  tvi - [in] 0 or 1
505  Returns:
506  Brep vertex at specified end of the trim.
507  */
508  ON_BrepVertex* Vertex(int tvi) const;
509 
510  /////////////////////////////////////////////////////////////////
511  // ON_Object overrides
512  //
513  // (Trims are purely topologicial - geometry queries should be
514  // directed at the trim's 2d curve or the trim's edge's 3d curve.)
515 
516  /*
517  Description:
518  Tests an object to see if its data members are correctly
519  initialized.
520  Parameters:
521  text_log - [in] if the object is not valid and text_log
522  is not NULL, then a brief englis description of the
523  reason the object is not valid is appened to the log.
524  The information appended to text_log is suitable for
525  low-level debugging purposes by programmers and is
526  not intended to be useful as a high level user
527  interface tool.
528  Returns:
529  @untitled table
530  true object is valid
531  false object is invalid, uninitialized, etc.
532  Remarks:
533  Overrides virtual ON_Object::IsValid
534  */
535  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
536 
537  void Dump( ON_TextLog& ) const; // for debugging
538 
539  ON_BOOL32 Write( ON_BinaryArchive& ) const;
540 
541  ON_BOOL32 Read( ON_BinaryArchive& );
542 
543  // virtual ON_Geometry::ComponentIndex() override
544  ON_COMPONENT_INDEX ComponentIndex() const;
545 
546  // virtual ON_Curve::Reverse override
547  // Reverses curve - caller must make sure trim's m_bRev3d
548  // flags are properly updated. Use
549  // ON_Brep::FlipTrim to reverse and trim and update all
550  // m_bRev3d informtion.
551  ON_BOOL32 Reverse();
552 
553  // virtual ON_Curve::SetStartPoint override
554  ON_BOOL32 SetStartPoint(
555  ON_3dPoint start_point
556  );
557 
558  // virtual ON_Curve::SetEndPoint override
559  ON_BOOL32 SetEndPoint(
560  ON_3dPoint end_point
561  );
562 
563  /////////////////////////////////////////////////////////////////
564  // Interface
565 
566  /*
567  Description:
568  Expert user tool that replaces the 2d curve geometry
569  of a trim
570  Parameters;
571  c2i - [in] brep 2d curve index of new curve
572  Returns:
573  True if successful.
574  Example:
575 
576  ON_Curve* pCurve = ...;
577  int c2i = brep.AddTrimCurve(pCurve);
578  trim.ChangeTrimCurve(c2i);
579 
580  Remarks:
581  Sets m_c2i, calls SetProxyCurve, cleans runtime caches,
582  and updates m_pbox.
583  */
584  bool ChangeTrimCurve( int c2i );
585 
586  /*
587  Description:
588  Destroy parameter space information.
589  Currently, this involves destroying m_pline
590  and m_pbox. Parameter space information should
591  be destroyed when the location of a trim
592  curve is changed.
593  */
595 
596  /*
597  Description:
598  Expert user function.
599  Removes a trim from an edge.
600  Parameters:
601  bRemoveFromStartVertex - [in] if true, the trim
602  is removed from its start vertex by setting
603  m_vi[0] to -1.
604  bRemoveFromEndVertex - [in] if true, the trim
605  is removed from its start vertex by setting
606  m_vi[1] to -1.
607  Remarks:
608  If the trim is attached to an edge (m_ei>=0), then
609  the trim is removed from the edge and the edge's
610  m_ti[] list. The trim's m_bRev3d and tolerance values
611  are not changed.
612  */
614  bool bRemoveFromStartVertex,
615  bool bRemoveFromEndVertex
616  );
617 
618  /*
619  Description:
620  Expert user function.
621  Attaches a trim to an edge.
622  Parameters:
623  edge_index - [in] index of an edge.
624  bRev3d - [in] value for trim's m_bRev3d field.
625  Remarks:
626  If the trim is attached to an edge (m_ei>=0), then
627  the trim is removed from the edge and the edge's
628  m_ti[] list. The trim's tolerance values are not
629  changed.
630  */
632  int edge_index,
633  bool bRev3d
634  );
635 
636  /*
637  Returns:
638  2d curve geometry used by this trim or NULL
639  */
640  const ON_Curve* TrimCurveOf() const;
641 
642  /*
643  Returns:
644  3d curve geometry used by this trim or NULL.
645  */
646  const ON_Curve* EdgeCurveOf() const;
647 
648  /*
649  Returns:
650  3d surface geometry used by this trim or NULL
651  */
652  const ON_Surface* SurfaceOf() const;
653 
654  /*
655  Returns:
656  brep.m_C2[] 2d curve index of the 2d curve geometry used by
657  this trim or -1.
658  */
659  int TrimCurveIndexOf() const;
660 
661  /*
662  Returns:
663  brep.m_C3[] 3d curve index of the 3d curve geometry used by
664  this trim or -1.
665  */
666  int EdgeCurveIndexOf() const;
667 
668  /*
669  Returns:
670  brep.m_S[] surface index of the 3d surface geometry used by
671  this trim or -1.
672  */
673  int SurfaceIndexOf() const;
674 
675  /*
676  Returns:
677  brep.m_F[] face index of the face used by this trim or -1.
678  */
679  int FaceIndexOf() const;
680 
681  /*
682  Returns:
683  True if the trim satisfies these four criteria.
684  1) is part of a loop
685  2) is connected to a 3d edge
686  3) one other trim from the same loop is connected to the edge
687  4) The 2d trim curve for the other trim is the reverse
688  of the 2d trim curve for this trim.
689  Remarks:
690  In order for IsSlit() to work correctly, the m_type and m_iso
691  fields must be set correctly. In V4 SR1, this function will
692  be removed and ON_BrepTrim::slit will be added as a type.
693  */
694  bool IsSlit() const;
695 
696  /*
697  Returns:
698  True if the trim satisfies these four criteria.
699  1) is part of a loop
700  2) is connected to a 3d edge
701  3) one other trim from the same loop is connected to the edge
702  4) the 2d trim curve for this trim lies along the side of
703  the face's parameter space and the 2d curve for the other
704  trim lies on the opposite side of the face's parameter
705  space.
706  Remarks:
707  In order for IsSeam() to work correctly, the m_type and m_iso
708  fields must be set correctly. In V4 SR1, this function will
709  be removed and ON_BrepTrim::slit will be added as a type.
710  */
711  bool IsSeam() const;
712 
713  /*
714  Description:
715  Expert user tool that tranforms all the parameter space (2d)
716  trimming curves in this loop. Only 2d curve geometry is
717  changed. The caller is responsible for reversing loops,
718  toggle m_bRev, flags, etc.
719  Parameters:
720  xform - [in] Transformation applied to 2d curve geometry.
721  Returns
722  True if successful. If false is returned, the brep
723  may be invalid.
724  */
725  bool TransformTrim( const ON_Xform& xform );
726 
727  // index of the 2d parameter space trimming curve
728  int m_c2i;
729 
730  // index of 3d edge (-1 if ON_BrepTrim is singular)
731  int m_ei;
732 
733  // Indices of start/end vertices. Trims along singular
734  // sides and trims that correspond to closed 3d edges
735  // have m_vi[0] = m_vi[1]. Note that singular trims
736  // and trims on the closed edge of a closed surface can
737  // have an open 2d trimming curve and still have
738  // m_vi[0] = m_vi[1].
739  int m_vi[2];
740 
741  // true if the 2d trim and 3d edge have opposite orientations.
742  bool m_bRev3d;
743 
746 
747  // index of loop that uses this trim
748  int m_li;
749 
750  // The values in m_tolerance[] record the accuracy of
751  // the parameter space trimming curves.
752  //
753  // Remarks:
754  // m_tolerance[0] = accuracy of parameter space curve
755  // in first ( "u" ) parameter
756  //
757  // m_tolerance[1] = accuracy of parameter space curve
758  // in second ( "v" ) parameter
759  //
760  // A value of ON_UNSET_VALUE indicates that the
761  // tolerance should be computed. If the value >= 0.0,
762  // then the tolerance is set. If the value is
763  // ON_UNSET_VALUE, then the tolrance needs to be
764  // computed.
765  //
766  // If the trim is not singular, then the trim must
767  // have an edge. If P is a 3d point on the edge's
768  // curve and surface(u,v) = Q is the point on the
769  // surface that is closest to P, then there must
770  // be a parameter t in the interval [m_t[0], m_t[1]]
771  // such that
772  //
773  // |u - curve2d(t)[0]| <= m_tolerance[0]
774  //
775  // and
776  //
777  // |v - curve2d(t)[1]| <= m_tolerance[1]
778  //
779  // If P is the 3d point for the vertex brep.m_V[m_vi[k]]
780  // and (uk,vk) is the corresponding end of the trim's
781  // parameter space curve, then there must be a surface
782  // parameter (u,v) such that:
783  //
784  // * the distance from the 3d point surface(u,v) to P
785  // is <= brep.m_V[m_vi[k]].m_tolerance,
786  // * |u-uk| <= m_tolerance[0].
787  // * |v-vk| <= m_tolerance[1].
788  double m_tolerance[2];
789 
790  // Runtime polyline approximation of trimming curve.
791  // This information is not saved in 3DM archives.
793 
794  /*
795  Description:
796  When an edge is modified, the m_pline[].e values need
797  to be set to ON_UNSET_VALUE by calling UnsetPlineEdgeParameters().
798  */
800 
801  // Runtime parameter space trimming curve bounding box.
802  // This information is not saved in 3DM archives.
804 
805 public:
806  // values stored in legacy file formats - ignore
807 
808  void m__legacy_flags_Set(int,int); // used internally - ignore
809  bool m__legacy_flags_Get(int*,int*) const; // used internally - ignore
810  double m__legacy_2d_tol; // used internally - ignore
811  double m__legacy_3d_tol; // used internally - ignore
812  int m__legacy_flags; // used internally - ignore
813 
814 private:
815  friend class ON_Brep;
816  ON_Brep* m_brep; // so isolated edge class edge can get at it's 3d curve
817  ON_BrepTrim( const ON_BrepTrim& ); // no implementation
818 };
819 
820 class ON_CLASS ON_BrepLoop : public ON_Geometry
821 {
822  ON_OBJECT_DECLARE(ON_BrepLoop);
823 
824 public:
825  void DestroyRuntimeCache( bool bDelete = true );
826 
827  // virtual ON_Geometry overrides
828  // A loop is derived from ON_Geometry so that is can
829  // be passed around to things that expect ON_Geometry
830  // pointers. It is not a very useful stand-alone object.
831 
832  /*
833  Description:
834  virtual ON_Geometry::Dimension() override.
835  Returns:
836  2
837  */
838  int Dimension() const;
839 
840  // virtual ON_Geometry::GetBBox() override.
841  ON_BOOL32 GetBBox(
842  double* boxmin,
843  double* boxmax,
844  int bGrowBox = false
845  ) const;
846 
847  // virtual ON_Geometry::Transform() override.
848  ON_BOOL32 Transform(
849  const ON_Xform& xform
850  );
851 public:
852  /*
853  Returns:
854  Brep that the loop belongs to.
855  */
856  ON_Brep* Brep() const;
857 
858  /*
859  Returns:
860  Brep face this loop belongs to.
861  */
862  ON_BrepFace* Face() const;
863 
864  /*
865  Parameters:
866  lti - [in] index into the loop's m_ti[] array.
867  Returns:
868  The trim brep.m_T[loop.m_ti[lti]];
869  */
870  ON_BrepTrim* Trim( int lti ) const;
871 
872  /*
873  Returns:
874  Number of trims in this loop.
875  */
876  int TrimCount() const;
877 
878  // Union available for application use.
879  // The constructor zeros m_loop_user.
880  // The value is of m_loop_user is not saved in 3DM
881  // archives and may be changed by some computations.
883 
884  int m_loop_index; // index of loop in ON_Brep.m_L[] array
885 
886  enum TYPE {
887  unknown = 0,
888  outer = 1, // 2d loop curves form a simple closed curve with a counterclockwise orientation
889  inner = 2, // 2d loop curves form a simple closed curve with a clockwise orientation
890  slit = 3, // always closed - used internally during splitting operations
891  crvonsrf = 4, // "loop" is a curveonsrf made from a single
892  // (open or closed) trim that is has type ON_BrepTrim::crvonsrf.
893  ptonsrf = 5, // "loop" is a ptonsrf made from a single
894  // trim that is has type ON_BrepTrim::ptonsrf.
895  type_count = 6
896  };
897 
899  ON_BrepLoop(int); // loop index
901 
902  /////////////////////////////////////////////////////////////////
903  // ON_Object overrides
904  //
905  // (Loops and trims are purely topologicial - geometry queries should be
906  // directed at the trim's 2d curve or the trim's edge's 3d curve.)
907 
908  // virtual ON_Object::SizeOf override
909  unsigned int SizeOf() const;
910 
911  /*
912  Description:
913  Tests an object to see if its data members are correctly
914  initialized.
915  Parameters:
916  text_log - [in] if the object is not valid and text_log
917  is not NULL, then a brief englis description of the
918  reason the object is not valid is appened to the log.
919  The information appended to text_log is suitable for
920  low-level debugging purposes by programmers and is
921  not intended to be useful as a high level user
922  interface tool.
923  Returns:
924  @untitled table
925  true object is valid
926  false object is invalid, uninitialized, etc.
927  Remarks:
928  Overrides virtual ON_Object::IsValid
929  */
930  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
931 
932  void Dump( ON_TextLog& ) const; // for debugging
933 
934  ON_BOOL32 Write( ON_BinaryArchive& ) const;
935 
936  ON_BOOL32 Read( ON_BinaryArchive& );
937 
938  // virtual ON_Geometry::ComponentIndex() override
939  ON_COMPONENT_INDEX ComponentIndex() const;
940 
941  /////////////////////////////////////////////////////////////////
942  // Interface
943 
944  //////////
945  // Returns the index i such that loop.m_ti[i] = trim.m_trim_index.
946  // Returns -1 if the trim is not in this loop
947  int IndexOfTrim( const ON_BrepTrim& ) const;
948 
949  /*
950  Returns:
951  brep.m_S[] surface index of the 3d surface geometry used by
952  this loop or -1.
953  */
954  int SurfaceIndexOf() const;
955 
956  /*
957  Returns:
958  Pointer to the surface geometry used by the loop.
959  */
960  const ON_Surface* SurfaceOf() const;
961 
962  /*
963  Description:
964  Expert user tool that tranforms all the parameter space (2d)
965  trimming curves in this loop. Only 2d curve geometry is
966  changed. The caller is responsible for reversing loops,
967  toggle m_bRev, flags, etc.
968  Parameters:
969  xform - [in] Transformation applied to 2d curve geometry.
970  Returns
971  True if successful. If false is returned, the brep
972  may be invalid.
973  */
974  bool TransformTrim( const ON_Xform& xform );
975 
976  ON_SimpleArray<int> m_ti; // trim indices
978  int m_fi; // index of face that uses this loop
979 
980  //////////
981  // parameter space trimming loop bounding box
982  // runtime information - not saved
984 private:
985  friend class ON_Brep;
986  ON_Brep* m_brep;
987  ON_BrepLoop(const ON_BrepLoop&); // no implementation
988 };
989 
990 class ON_CLASS ON_BrepFace : public ON_SurfaceProxy
991 {
992  ON_OBJECT_DECLARE(ON_BrepFace);
993 
994 public:
995  void DestroyRuntimeCache( bool bDelete = true );
996 
997  // Union available for application use.
998  // The constructor zeros m_face_user.
999  // The value is of m_face_user is not saved in 3DM
1000  // archives and may be changed by some computations.
1002 
1003  int m_face_index; // index of face in ON_Brep.m_F[] array
1004 
1009 
1010  /*
1011  Returns:
1012  Brep that the face belongs to.
1013  */
1014  ON_Brep* Brep() const;
1015 
1016  /*
1017  Parameters:
1018  fli - [in] index into the face's m_li[] array.
1019  Returns:
1020  The loop brep.m_L[face.m_li[fli]];
1021  */
1022  ON_BrepLoop* Loop( int fli ) const;
1023 
1024  /*
1025  Returns:
1026  Number of loops in this face.
1027  */
1028  int LoopCount() const;
1029 
1030  /*
1031  Returns:
1032  Outer boundary loop for this face.
1033  */
1035 
1036  /*
1037  Parameters:
1038  dir
1039  1: side with underlying surface normal
1040  pointing into the topology region
1041  -1: side with underlying surface normal
1042  pointing out of the topology region
1043  Returns:
1044  Brep region topology face side. If the region
1045  topology has not be created by calling
1046  ON_Brep::RegionToplogy(), then NULL is returned.
1047  */
1048  class ON_BrepFaceSide* FaceSide(int dir) const;
1049 
1050 
1051  /////////////////////////////////////////////////////////////////
1052  // ON_Object overrides
1053  //
1054  // (Faces are purely topologicial - geometry queries should be
1055  // directed at the face's 3d surface.)
1056 
1057  // virtual ON_Object::SizeOf override
1058  unsigned int SizeOf() const;
1059 
1060  // virtual ON_Object::DataCRC override
1061  ON__UINT32 DataCRC(ON__UINT32 current_remainder) const;
1062 
1063  /*
1064  Description:
1065  Tests an object to see if its data members are correctly
1066  initialized.
1067  Parameters:
1068  text_log - [in] if the object is not valid and text_log
1069  is not NULL, then a brief englis description of the
1070  reason the object is not valid is appened to the log.
1071  The information appended to text_log is suitable for
1072  low-level debugging purposes by programmers and is
1073  not intended to be useful as a high level user
1074  interface tool.
1075  Returns:
1076  @untitled table
1077  true object is valid
1078  false object is invalid, uninitialized, etc.
1079  Remarks:
1080  Overrides virtual ON_Object::IsValid
1081  */
1082  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
1083 
1084  void Dump( ON_TextLog& ) const; // for debugging
1085 
1086  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1087 
1088  ON_BOOL32 Read( ON_BinaryArchive& );
1089 
1090  // virtual ON_Geometry::ComponentIndex() override
1091  ON_COMPONENT_INDEX ComponentIndex() const;
1092 
1093  // virtual ON_Geometry::ClearBoundingBox() override
1095 
1096  // virtual ON_Geometry::GetBBox() override
1097  ON_BOOL32 GetBBox( // returns true if successful
1098  double*, // minimum
1099  double*, // maximum
1100  ON_BOOL32 = false // true means grow box
1101  ) const;
1102 
1103  /*
1104  Description:
1105  This is an override of the virtual ON_Surface::Reverse
1106  function. It toggles the face's m_bRev flag so the abstract
1107  orientation of the face does not change.
1108  Parameters:
1109  dir - [in] 0 = reverse "s" parameter, 1 = reverse "t" parameter
1110  The domain changes from [a,b] to [-a,-b]
1111  Returns:
1112  True if successful.
1113  Remarks:
1114  The range of the face's trimming curves and the orientation direction
1115  of then loops are changed so that the resulting face is still valid.
1116  */
1117  ON_BOOL32 Reverse(
1118  int dir
1119  );
1120 
1121  /*
1122  Description:
1123  This is an override of the virtual ON_Surface::Transpose
1124  function. It toggles the face's m_bRev flag so the abstract
1125  orientation of the face does not change.
1126  Returns:
1127  True if successful.
1128  Remarks:
1129  The range of the face's trimming curves and the orientation direction
1130  of then loops are changed so that the resulting face is still valid.
1131  */
1132  ON_BOOL32 Transpose();
1133 
1134  /*
1135  Description:
1136  This is an override of the virtual ON_Surface::SetDomain
1137  function.
1138  Parameters:
1139  dir - [in] 0 = set "u" domain, 1 = set "v" domain.
1140  t0 - [in]
1141  t1 - [in] t0 < t1 The new domain is the interval (t0,t1)
1142  Returns:
1143  True if successful.
1144  */
1145  ON_BOOL32 SetDomain(
1146  int dir,
1147  double t0,
1148  double t1
1149  );
1150 
1151  /*
1152  //////////
1153  // Change the domain of a face
1154  // This changes the parameterization of the face's surface and transforms
1155  // the "u" and "v" coordinates of all the face's parameter space trimming
1156  // curves. The locus of the face is not changed.
1157  */
1159  ON_Interval udom,
1160  ON_Interval vdom
1161  );
1162 
1163  /////////////////////////////////////////////////////////////////
1164  // Rendering Interface
1165  //int MaterialIndex() const; // if -1, use parent's material definition
1166  //void SetMaterialIndex(int);
1167 
1168  // If true is returne, then ~ON_BrepFace will delete mesh.
1169  bool SetMesh( ON::mesh_type, ON_Mesh* mesh );
1170 
1171  const ON_Mesh* Mesh( ON::mesh_type mesh_type ) const;
1172 
1173  /*
1174  Description:
1175  Destroy meshes used to render and analyze surface and polysrf
1176  objects.
1177  Parameters:
1178  mesh_type - [in] type of mesh to destroy
1179  bDeleteMesh - [in] if true, cached mesh is deleted.
1180  If false, pointer to cached mesh is just set to NULL.
1181  See Also:
1182  CRhinoObject::GetMeshes
1183  CRhinoObject::MeshCount
1184  CRhinoObject::IsMeshable
1185  */
1186  void DestroyMesh( ON::mesh_type mesh_type, bool bDeleteMesh = true );
1187 
1188  /////////////////////////////////////////////////////////////////
1189  // "Expert" Interface
1190 
1191  /*
1192  Description:
1193  Expert user tool that tranforms all the parameter space (2d)
1194  trimming curves on this face. Only 2d curve geometry is
1195  changed. The caller is responsible for reversing loops,
1196  toggle m_bRev, flags, etc.
1197  Parameters:
1198  xform - [in] Transformation applied to 2d curve geometry.
1199  Returns
1200  True if successful. If false is returned, the brep
1201  may be invalid.
1202  */
1203  bool TransformTrim( const ON_Xform& xform );
1204 
1205  /*
1206  Description:
1207  Expert user tool that replaces the 3d surface geometry
1208  use by the face.
1209  Parameters;
1210  si - [in] brep surface index of new surface
1211  bTransformTrimCurves - [in]
1212  If unsure, then pass true.
1213  If the surface's domain has changed and you are certain
1214  its parameterization still jibes with the trim curve
1215  locations, then pass false.
1216  Returns:
1217  True if successful.
1218  Example:
1219 
1220  ON_Surface* pSurface = ...;
1221  int si = brep.AddSurface(pSurface);
1222  face.ChangeSurface(si);
1223 
1224  Remarks:
1225  If the face had a surface and new surface has a different
1226  shape, then you probably want to call something like
1227  ON_Brep::RebuildEdges() to move the 3d edge curves so they
1228  will lie on the new surface. This doesn't delete the old
1229  surface; call ON_Brep::CullUnusedSurfaces() or ON_Brep::Compact
1230  to remove unused surfaces.
1231  See Also:
1232  ON_Brep::RebuildEdges
1233  ON_Brep::CullUnusedSurfaces
1234  */
1236  int si
1237  );
1239  int si,
1240  bool bTransformTrimCurves
1241  );
1242 
1243  /*
1244  Returns:
1245  brep.m_S[] surface index of the 3d surface geometry used by
1246  this face or -1.
1247  */
1248  int SurfaceIndexOf() const;
1249 
1250  /*
1251  Returns:
1252  Pointer to the surface geometry used by the face.
1253  */
1254  const ON_Surface* SurfaceOf() const;
1255 
1256  ON_SimpleArray<int> m_li; // loop indices (outer loop is m_li[0])
1257  int m_si; // index of surface in b-rep m_S[] array
1258  bool m_bRev; // true if face orientation is opposite
1259  // of natural surface orientation
1260 
1261  // m_face_material_channel provides a way to have individual
1262  // brep faces use a rendering material that is different
1263  // from the rendering material used by the parent brep.
1264  // If m_face_material_channel is zero
1265  // channel and m_face_material_channel.m_j is the back face
1266  // materal. The default is (0,0) which indicates the face
1267  // should use the parent brep's material.
1268  // If "mat" is the brep's rendering material and
1269  // 0 < m_material_channel.m_i < mat.m_material_channel.Count(),
1270  // then this face should use the material with id
1271  // mat.m_material_channel[face.m_material_channel.m_i-1].m_id.
1272  // If m_material_channel.m_i or the id is invalid in any way,
1273  // then the default should be used.
1275 
1276  // Persistent id for this face. Default is ON_nil_uuid.
1278 private:
1279  ON_BoundingBox m_bbox; // 3d bounding box
1280  ON_Interval m_domain[2]; // rectangular bounds of 2d curves
1281  ON_Mesh* m_render_mesh;
1282  ON_Mesh* m_analysis_mesh;
1283  ON_Mesh* m_preview_mesh;
1284  //int m_material_index; // if 0 (default), ON_Brep's object attributes
1285  // // determine material.
1286 private:
1287  friend class ON_Brep;
1288  ON_Brep* m_brep;
1289  ON_BrepFace( const ON_BrepFace& );
1290 };
1291 
1292 class ON_CLASS ON_BrepFaceSide : public ON_Object
1293 {
1294  ON_OBJECT_DECLARE(ON_BrepFaceSide);
1295 public:
1296  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
1297 
1298  // Union available for application use.
1299  // The constructor zeros m_faceside_user.
1300  // The value is of m_faceside_user is not saved in 3DM
1301  // archives and may be changed by some computations.
1303 
1304  // index of face side in ON_BrepRegionTopology.m_FS[] array
1306 
1310 
1311  ON_BOOL32 Write(ON_BinaryArchive& binary_archive) const;
1312  ON_BOOL32 Read(ON_BinaryArchive& binary_archive);
1313 
1314 
1315  /*
1316  Returns:
1317  Brep this face side belongs to.
1318  */
1319  ON_Brep* Brep() const;
1320 
1321  /*
1322  Returns:
1323  Region topology this face side belongs to.
1324  */
1326 
1327  /*
1328  Returns:
1329  Region the face side belongs to.
1330  */
1331  class ON_BrepRegion* Region() const;
1332 
1333  /*
1334  Returns:
1335  Face this side belongs to.
1336  */
1337  class ON_BrepFace* Face() const;
1338 
1339  /*
1340  Returns:
1341  +1: underlying geometric surface normal points
1342  into region.
1343  -1: underlying geometric surface normal points
1344  out of region.
1345  */
1347 
1348 public:
1349  int m_ri; // region index
1350  // m_ri = -1 indicates this faceside overlaps
1351  // another faceside. Generally this is a flaw
1352  // in an ON_Brep.
1353  int m_fi; // face index
1354  int m_srf_dir; // 1 ON_BrepFace's surface normal points into region
1355  // -1 ON_BrepFace's surface normal points out of region
1356 
1357 private:
1358  friend class ON_Brep;
1360  ON_BrepRegionTopology* m_rtop;
1361  ON_BrepFaceSide( const ON_BrepFaceSide& );
1362 };
1363 
1364 class ON_CLASS ON_BrepRegion : public ON_Object
1365 {
1366  ON_OBJECT_DECLARE(ON_BrepRegion);
1367 public:
1368  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
1369 
1370  // Union available for application use.
1371  // The constructor zeros m_region_user.
1372  // The value is of m_region_user is not saved in 3DM
1373  // archives and may be changed by some computations.
1375 
1376  // index of region in ON_BrepRegionTopology.m_R[] array
1378 
1382 
1383  ON_BOOL32 Write(ON_BinaryArchive& binary_archive) const;
1384  ON_BOOL32 Read(ON_BinaryArchive& binary_archive);
1385 
1386  /*
1387  Returns:
1388  Brep this region belongs to.
1389  */
1390  ON_Brep* Brep() const;
1391 
1392  /*
1393  Returns:
1394  Region topology this region belongs to.
1395  */
1397 
1398  /*
1399  Parameter:
1400  rfsi - [in] index into the region's m_fsi[] array.
1401  Returns:
1402  The face side in rtop.m_FS[m_fsi[rsi]], where
1403  rtop is the ON_BrepRegionTopology class this
1404  region belongs to.
1405  */
1406  ON_BrepFaceSide* FaceSide(int rfsi) const;
1407 
1408  /*
1409  Returns:
1410  True if the region is finite.
1411  */
1412  bool IsFinite() const;
1413 
1414  /*
1415  Returns:
1416  Region bounding box.
1417  */
1418  const ON_BoundingBox& BoundingBox() const;
1419 
1420  ON_SimpleArray<int> m_fsi; // indices of face sides
1421  int m_type; // 0 = infinte, 1 = bounded
1423 
1424  /*
1425  Description:
1426  Get the boundary of a region as a brep object.
1427  If the region is finite, the boundary will be a closed
1428  manifold brep. The boundary may have more than one
1429  connected component.
1430  Parameters:
1431  brep - [in] if not NULL, the brep form is put into
1432  this brep.
1433  Returns: the region boundary as a brep or NULL if the
1434  calculation fails.
1435  */
1436  ON_Brep* RegionBoundaryBrep( ON_Brep* brep = NULL ) const;
1437 
1438 private:
1439  friend class ON_Brep;
1441  ON_BrepRegionTopology* m_rtop;
1442  ON_BrepRegion( const ON_BrepRegion& );
1443 };
1444 
1445 #if defined(ON_DLL_TEMPLATE)
1446 // This stuff is here because of a limitation in the way Microsoft
1447 // handles templates and DLLs. See Microsoft's knowledge base
1448 // article ID Q168958 for details.
1449 #pragma warning( push )
1450 #pragma warning( disable : 4231 )
1451 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_BrepVertex>;
1452 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepVertex>;
1453 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_BrepEdge>;
1454 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepEdge>;
1455 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_BrepTrim>;
1456 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepTrim>;
1457 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_BrepLoop>;
1458 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepLoop>;
1459 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_BrepFace>;
1460 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepFace>;
1461 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepFaceSide>;
1462 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_BrepRegion>;
1463 #pragma warning( pop )
1464 #endif
1465 
1467 {
1468 public:
1471 
1472  ON_BOOL32 Read( ON_BinaryArchive& );
1473  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1474 
1475  unsigned int SizeOf() const;
1476 };
1477 
1479 {
1480 public:
1483  ON_BOOL32 Read( ON_BinaryArchive& );
1484  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1485 
1486  unsigned int SizeOf() const;
1487 };
1488 
1490 {
1491 public:
1494  ON_BOOL32 Read( ON_BinaryArchive& );
1495  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1496 
1497  unsigned int SizeOf() const;
1498 };
1499 
1501 {
1502 public:
1505  ON_BOOL32 Read( ON_BinaryArchive& );
1506  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1507 
1508  unsigned int SizeOf() const;
1509 };
1510 
1512 {
1513 public:
1516  ON_BOOL32 Read( ON_BinaryArchive& );
1517  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1518 
1519  unsigned int SizeOf() const;
1520 };
1521 
1523 {
1524 public:
1527 
1529  bool Write( ON_BinaryArchive& ) const;
1530 
1531  unsigned int SizeOf() const;
1532 };
1533 
1535 {
1536 public:
1539 
1541  bool Write( ON_BinaryArchive& ) const;
1542 
1543  unsigned int SizeOf() const;
1544 };
1545 
1547 {
1548 public:
1553 
1556 
1557  ON_Brep* Brep() const;
1558  bool IsValid( ON_TextLog* text_log = 0 ) const;
1560  bool Write( ON_BinaryArchive& ) const;
1561 
1562  unsigned int SizeOf() const;
1563 
1564 private:
1566  friend class ON_Brep;
1567  ON_Brep* m_brep;
1568 };
1569 
1570 class ON_CLASS ON_Brep : public ON_Geometry
1571 {
1572  ON_OBJECT_DECLARE(ON_Brep);
1573 
1574 public:
1575  // virtual ON_Object::DestroyRuntimeCache override
1576  void DestroyRuntimeCache( bool bDelete = true );
1577 
1578  // virtual ON_Object::SizeOf override
1579  unsigned int SizeOf() const;
1580 
1581  // virtual ON_Object::DataCRC override
1582  ON__UINT32 DataCRC(ON__UINT32 current_remainder) const;
1583 
1584  // virtual ON_Geometry override
1585  bool EvaluatePoint( const class ON_ObjRef& objref, ON_3dPoint& P ) const;
1586 
1587 public:
1588 
1589 
1590  /*
1591  Description:
1592  Use ON_Brep::New() instead of new ON_Brep() when writing
1593  Rhino plug-ins (or when openNURBS is used as a Microsoft
1594  DLL and you need to create a new ON_Brep in a different
1595  .EXE or .DLL).
1596  Example:
1597 
1598  // bad - ON_Brep* pBrep = new ON_Brep();
1599  ON_Brep* pBrep = ON_Brep::New(); // good
1600  ...
1601  delete pBrep;
1602  pBrep = NULL;
1603 
1604  Returns:
1605  Pointer to an ON_Brep. Destroy by calling delete.
1606  Remarks:
1607  When openNURBS is used as a Microsoft DLL, the CL.EXE
1608  compiler uses local vtables for classes that are new-ed
1609  in other executables but uses the ordinary vtable for
1610  for classes that are allocated in functions like
1611  ON_BrepCylinder(), ON_NurbsSurfaceQuadrilateral(),
1612  ON_Cylinder::RevSurfaceForm(NULL), etc.
1613  Using static New() functions like ON_Brep::New() insures
1614  that identical classes has the same vtable and makes
1615  all code run identically.
1616  */
1617  static ON_Brep* New();
1618 
1619  /*
1620  Description:
1621  Use ON_Brep::New(const ON_Brep& src) instead
1622  of new ON_Brep(const ON_Brep& src).
1623  Returns:
1624  Pointer to an ON_Brep. Destroy by calling delete.
1625  Remarks:
1626  See static ON_Brep* ON_Brep::New() for details.
1627  */
1628  static ON_Brep* New(const ON_Brep&);
1629 
1630  // Construction
1633  ON_Brep(const ON_Brep&);
1635 
1636  // Override of virtual ON_Object::MemoryRelocate
1638 
1639 
1640  /*
1641  Description:
1642  See if this and other are same brep geometry.
1643  Parameters:
1644  other - [in] other brep
1645  tolerance - [in] tolerance to use when comparing
1646  control points.
1647  Returns:
1648  true if breps are the same
1649  */
1651  const ON_Brep& other,
1652  double tolerance = ON_ZERO_TOLERANCE
1653  ) const;
1654 
1655  /////////////////////////////////////////////////////////////////
1656  // construction/destruction helpers
1657 
1658  // returns Brep to state it has after default construction
1659  void Destroy();
1660 
1661  // call if memory pool used by b-rep members becomes invalid
1663 
1664  /*
1665  Description:
1666  Calculates polygon mesh approximation of the brep
1667  and appends one mesh for each face to the mesh_list[]
1668  array.
1669  Parameters:
1670  mp - [in] meshing parameters
1671  mesh_list - [out] meshes are appended to this array.
1672  Returns:
1673  Number of meshes appended to mesh_list[] array.
1674  */
1676  const ON_MeshParameters& mp,
1677  ON_SimpleArray<ON_Mesh*>& mesh_list
1678  ) const;
1679 
1680  /*
1681  Description:
1682  Destroy meshes used to render and analyze brep.
1683  Parameters:
1684  mesh_type - [in] type of mesh to destroy
1685  bDeleteMesh - [in] if true, cached meshes are deleted.
1686  If false, pointers to cached meshes are just set to NULL.
1687  See Also:
1688  ON_Brep::GetMesh
1689  ON_BrepFace::DestroyMesh
1690  ON_BrepFace::Mesh
1691  ON_BrepFace::SetMesh
1692  */
1693  void DestroyMesh( ON::mesh_type mesh_type, bool bDeleteMesh = true );
1694 
1695  /*
1696  Description:
1697  Get cached meshes used to render and analyze brep.
1698  Parameters:
1699  mesh_type - [in] type of mesh to get
1700  meshes - [out] meshes are appended to this array. The ON_Brep
1701  owns these meshes so they cannot be modified.
1702  Returns:
1703  Number of meshes added to array. (Same as m_F.Count())
1704  See Also:
1705  ON_Brep::DestroyMesh
1706  ON_BrepFace::DestroyMesh
1707  ON_BrepFace::Mesh
1708  ON_BrepFace::SetMesh
1709  */
1710  int GetMesh( ON::mesh_type mesh_type, ON_SimpleArray< const ON_Mesh* >& meshes ) const;
1711 
1712  /*
1713  Description:
1714  Create a brep from a surface. The resulting surface has an outer
1715  boundary made from four trims. The trims are ordered so that
1716  they run along the south, east, north, and then west side of the
1717  surface's parameter space.
1718  Parameters:
1719  pSurface - [in] pointer to a surface. The brep will manage this
1720  pointer and delete it in ~ON_Brep.
1721  Returns:
1722  @untitled table
1723  true successful
1724  When true is returned, the pSurface pointer is added to the
1725  brep's m_S[] array and it will be deleted by the brep's
1726  destructor.
1727  false
1728  brep cannot be created from this surface.
1729  When false is returned, then the caller is responsible
1730  for deleting pSurface unless it was previously added
1731  to the brep's m_S[] array.
1732  Remarks:
1733  The surface class must be created with new so that the
1734  delete in ~ON_Brep will not cause a crash.
1735  */
1736  bool Create(
1737  ON_Surface*& pSurface
1738  );
1739 
1740  bool Create(
1741  ON_NurbsSurface*& pNurbsSurface
1742  );
1743 
1744  bool Create(
1745  ON_PlaneSurface*& pPlaneSurface
1746  );
1747 
1748  bool Create(
1749  ON_RevSurface*& pRevSurface
1750  );
1751 
1752  bool Create(
1753  ON_SumSurface*& pSumSurface
1754  );
1755 
1756  /*
1757  Description:
1758  Tests an object to see if its data members are correctly
1759  initialized.
1760  Parameters:
1761  text_log - [in] if the object is not valid and text_log
1762  is not NULL, then a brief englis description of the
1763  reason the object is not valid is appened to the log.
1764  The information appended to text_log is suitable for
1765  low-level debugging purposes by programmers and is
1766  not intended to be useful as a high level user
1767  interface tool.
1768  Returns:
1769  @untitled table
1770  true object is valid
1771  false object is invalid, uninitialized, etc.
1772  Remarks:
1773  Overrides virtual ON_Object::IsValid
1774  See Also:
1775  ON_Brep::SetTolerancesAndFlags
1776  */
1777  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
1778 
1779  /*
1780  Description:
1781  Tests the brep to see if its topology information is
1782  valid.
1783  Parameters:
1784  text_log - [in] if the brep topology is not valid and
1785  text_log is not NULL, then a brief english
1786  description of the problem is appended to the log.
1787  The information appended to text_log is suitable for
1788  low-level debugging purposes by programmers and is
1789  not intended to be useful as a high level user
1790  interface tool.
1791  Returns:
1792  @untitled table
1793  true brep topology is valid
1794  false brep topology is not valid
1795  Remarks:
1796  ON_Brep::IsValidTopology can be called at any time.
1797  See Also:
1798  ON_Brep::IsValid
1799  ON_Brep::IsValidGeometry
1800  ON_Brep::IsValidTolerancesAndFlags
1801  */
1802  bool IsValidTopology( ON_TextLog* text_log = NULL ) const;
1803 
1804 
1805  /*
1806  Description:
1807  Expert user function that tests the brep to see if its
1808  geometry information is valid. The value of
1809  brep.IsValidTopology() must be true before
1810  brep.IsValidGeometry() can be safely called.
1811  Parameters:
1812  text_log - [in] if the brep geometry is not valid and
1813  text_log is not NULL, then a brief english
1814  description of the problem is appended to the log.
1815  The information appended to text_log is suitable for
1816  low-level debugging purposes by programmers and is
1817  not intended to be useful as a high level user
1818  interface tool.
1819  Returns:
1820  @untitled table
1821  true brep geometry is valid
1822  false brep geometry is not valid
1823  Remarks:
1824  ON_Brep::IsValidTopology must be true before you can
1825  safely call ON_Brep::IsValidGeometry.
1826  See Also:
1827  ON_Brep::IsValid
1828  ON_Brep::IsValidTopology
1829  ON_Brep::IsValidTolerancesAndFlags
1830  */
1831  bool IsValidGeometry( ON_TextLog* text_log = NULL ) const;
1832 
1833  /*
1834  Description:
1835  Expert user function that tests the brep to see if its
1836  tolerances and flags are valid. The values of
1837  brep.IsValidTopology() and brep.IsValidGeometry() must
1838  be true before brep.IsValidTolerancesAndFlags() can
1839  be safely called.
1840  Parameters:
1841  text_log - [in] if the brep tolerance or flags are not
1842  valid and text_log is not NULL, then a brief english
1843  description of the problem is appended to the log.
1844  The information appended to text_log is suitable for
1845  low-level debugging purposes by programmers and is
1846  not intended to be useful as a high level user
1847  interface tool.
1848  Returns:
1849  @untitled table
1850  true brep tolerance and flags are valid
1851  false brep tolerance and flags are not valid
1852  Remarks:
1853  ON_Brep::IsValidTopology and ON_Brep::IsValidGeometry
1854  must be true before you can safely call
1855  ON_Brep::IsValidTolerancesAndFlags.
1856  See Also:
1857  ON_Brep::IsValid
1858  ON_Brep::IsValidTopology
1859  ON_Brep::IsValidGeometry
1860  */
1861  bool IsValidTolerancesAndFlags( ON_TextLog* text_log = NULL ) const;
1862 
1863  // Description:
1864  // Tests brep to see if it is valid for
1865  // saving in V2 3DM archives.
1866  // Returns:
1867  // true if brep is valid for V2 3DM archives.
1868  // Remarks:
1869  // V2 breps could not have dangling curves.
1870  bool IsValidForV2() const;
1871  bool IsValidForV2( const ON_BrepTrim& ) const;
1872  bool IsValidForV2( const ON_BrepEdge& ) const;
1873 
1874  // virtual ON_Objet::Dump() override
1875  void Dump( ON_TextLog& ) const; // for debugging
1876 
1877  // virtual ON_Objet::Write() override
1878  ON_BOOL32 Write( ON_BinaryArchive& ) const;
1879 
1880  // virtual ON_Objet::Read() override
1881  ON_BOOL32 Read( ON_BinaryArchive& );
1882 
1883  // virtual ON_Objet::ObjectType() override
1884  ON::object_type ObjectType() const;
1885 
1886  // virtual ON_Geometry::Dimension() override
1887  int Dimension() const;
1888 
1889  // virtual ON_Geometry::ClearBoundingBox() override
1891 
1892  // virtual ON_Geometry::GetBBox() override
1893  ON_BOOL32 GetBBox( // returns true if successful
1894  double*, // minimum
1895  double*, // maximum
1896  ON_BOOL32 = false // true means grow box
1897  ) const;
1898 
1899  // virtual ON_Geometry::Transform() override
1900  ON_BOOL32 Transform(
1901  const ON_Xform&
1902  );
1903 
1904  // virtual ON_Geometry::SwapCoordinates() override
1905  ON_BOOL32 SwapCoordinates(
1906  int, int // indices of coords to swap
1907  );
1908 
1909  // virtual ON_Geometry::HasBrepForm() override
1910  ON_BOOL32 HasBrepForm() const; // returns true
1911 
1912  /*
1913  Description:
1914  If possible, BrepForm() creates a brep form of the
1915  ON_Geometry.
1916  Parameters:
1917  brep - [in] if not NULL, brep is used to store the brep
1918  form of the geometry.
1919  Result:
1920  If brep is not NULL, then brep = this, otherwise
1921  a duplicate of this is returned.
1922  Remarks:
1923  Override of virtual ON_Geometry::BrepForm
1924  */
1925  ON_Brep* BrepForm( ON_Brep* brep = NULL ) const;
1926 
1927  /////////////////////////////////////////////////////////////////
1928  // Creation Interface
1929 
1930  // These add a new geometry piece to the b-rep and return the
1931  // index that should be used to reference the geometry.
1932  // -1 is returned if the input is not acceptable.
1933  // ~ON_Brep() will delete the geometry.
1934  int AddTrimCurve( ON_Curve* ); // 2d curve used by ON_BrepTrim
1935  int AddEdgeCurve( ON_Curve* ); // 3d curve used by ON_BrepEdge
1936  int AddSurface( ON_Surface* ); // 3d surface used by ON_BrepFace
1937 
1938  // Description:
1939  // Set 3d curve geometry used by a b-rep edge.
1940  // Parameters:
1941  // edge - [in]
1942  // c3_index - [in] index of 3d curve in m_C3[] array
1943  // sub_domain - [in] if not NULL, sub_domain is an increasing
1944  // sub interval of m_C3[c3_index]->Domain().
1945  // Returns:
1946  // true if successful.
1948  ON_BrepEdge& edge,
1949  int c3_index,
1950  const ON_Interval* sub_domain = NULL
1951  );
1952 
1953  // Description:
1954  // Set 2d curve geometry used by a b-rep trim.
1955  // Parameters:
1956  // trim - [in]
1957  // c2_index - [in] index of 2d curve in m_C2[] array
1958  // sub_domain - [in] if not NULL, sub_domain is an increasing
1959  // sub interval of m_C2[c2_index]->Domain().
1960  // Returns:
1961  // true if successful.
1963  ON_BrepTrim& trim,
1964  int c2_index,
1965  const ON_Interval* sub_domain = NULL
1966  );
1967 
1968  // These add a new topology piece to the b-rep and return a
1969  // reference that is intended to be used for initialization.
1972  ON_3dPoint vertex_point,
1973  double vertex_tolerance = ON_UNSET_VALUE
1974  );
1975 
1977  int = -1 // 3d curve index
1978  );
1980  ON_BrepVertex&, // start vertex
1981  ON_BrepVertex&, // end vertex
1982  int = -1, // 3d curve index
1983  const ON_Interval* = NULL, // sub_domain
1984  double edge_tolerance = ON_UNSET_VALUE
1985  );
1986 
1987  /*
1988  Description:
1989  Add a new face to a brep. An incomplete face is added.
1990  The caller must create and fill in the loops used by
1991  the face.
1992  Parameters:
1993  si - [in] index of surface in brep's m_S[] array
1994  Returns:
1995  Reference to new face.
1996  Remarks:
1997  Adding a new face may grow the dynamic m_F array. When
1998  this happens pointers and references to memory in the
1999  previous m_F[] array may become invalid. Use face indices
2000  if this is an issue.
2001  Example:
2002  See ON_BrepBox and ON_BrepSphere source code.
2003  See Also:
2004  ON_Brep::AddSurface
2005  */
2007  int si = -1
2008  );
2009 
2010  /*
2011  Description:
2012  Add a new face to a brep. This creates a complete face with
2013  new vertices at the surface corners, new edges along the surface
2014  boundary, etc. The loop of the returned face has four trims that
2015  correspond to the south, east, north, and west side of the
2016  surface in that order. If you use this version of NewFace to
2017  add an exiting brep, then you are responsible for using a tool
2018  like ON_Brep::JoinEdges() to hook the new face to its
2019  neighbors.
2020  Parameters:
2021  surface - [in] surface is copied.
2022  Returns:
2023  Pointer to new face.
2024  Remarks:
2025  Adding a new face may grow the dynamic arrays used to store
2026  vertices, edges, faces, loops, and trims. When these dyamic
2027  arrays are grown, any pointers and references to memory in
2028  the previous arrays may become invalid. Use indices
2029  if this is an issue.
2030  See Also:
2031  ON_Brep::JoinEdges
2032  ON_Brep::AddSurface
2033  */
2035  const ON_Surface& surface
2036  );
2037 
2038  /*
2039  Description:
2040  Add a new face to brep. This version is for expert users.
2041  Parameters:
2042  pSurface - [in] the returned face will have an outer loop
2043  that goes around the edges of the surface.
2044  vid - [in/out] four vertex indices that specify the vertices at
2045  the (sw,se,nw,ne) corners. If the input value
2046  of a vertex index is -1, then the vertex will be
2047  created.
2048  eid - [in/out] four edge indices that specify the edges for
2049  the (south,east,north,west) sides. If the input value
2050  of an edge index is -1, then the edge will be created.
2051  bRev3d - [in/out] four values of the trim m_bRev3d flags of
2052  the (south,east,north,west) sides.
2053  Returns:
2054  Pointer to the new face or NULL if input is not valid.
2055  If null is returned, then the caller must delete pSurace
2056  unless it was previously added to the brep's m_S[] array.
2057  Remarks:
2058  Adding a new face may grow the dynamic m_F array. When
2059  this happens pointers and references to memory in the
2060  previous m_F[] array may become invalid. Use face indices
2061  if this is an issue.
2062  Example:
2063  See ON_BrepBox and ON_BrepSphere source code.
2064  See Also:
2065  ON_Brep::AddSurface
2066  ON_Brep::AddFace( int si )
2067  ON_Brep::Create( ON_Surface*& )
2068  */
2070  ON_Surface* pSurface,
2071  int vid[4],
2072  int eid[4],
2073  ON_BOOL32 bRev3d[4]
2074  );
2075 
2076  /*
2077  Description:
2078  Add a new face to the brep whose surface geometry is a
2079  ruled surface between two edges.
2080  Parameters:
2081  edgeA - [in] The south side of the face's surface will
2082  run along edgeA.
2083  bRevEdgeA - [in] true if the new face's outer boundary
2084  orientation along edgeA is opposite the orientation
2085  of edgeA.
2086  edgeB - [in] The north side of the face's surface will
2087  run along edgeA.
2088  bRevEdgeB - [in] true if the new face's outer boundary
2089  orientation along edgeB is opposite the orientation
2090  of edgeB.
2091  Returns:
2092  A pointer to the new face or a NULL if the new face could
2093  not be created.
2094  */
2096  const ON_BrepEdge& edgeA,
2097  bool bRevEdgeA,
2098  const ON_BrepEdge& edgeB,
2099  bool bRevEdgeB
2100  );
2101 
2102  /*
2103  Description:
2104  Add a new face to the brep whose surface geometry is a
2105  ruled cone with the edge as the base and the vertex as
2106  the apex point.
2107  Parameters:
2108  vertex - [in] The apex of the cone will be at this vertex.
2109  The north side of the surface's parameter
2110  space will be a singular point at the vertex.
2111  edge - [in] The south side of the face's surface will
2112  run along this edge.
2113  bRevEdge - [in] true if the new face's outer boundary
2114  orientation along the edge is opposite the
2115  orientation of edge.
2116  Returns:
2117  A pointer to the new face or a NULL if the new face could
2118  not be created.
2119  */
2121  const ON_BrepVertex& vertex,
2122  const ON_BrepEdge& edge,
2123  bool bRevEdge
2124  );
2125 
2126  /*
2127  Description:
2128  Create a new outer boundary loop that runs along the edges
2129  of the underlying surface.
2130  Returns:
2131  New outer boundary loop.
2132  */
2134 
2135  /*
2136  Description:
2137  Create a new boundary loop on a face. After you get this
2138  ON_BrepLoop, you still need to create the vertices, edges,
2139  and trims that define the loop.
2140  Returns:
2141  New loop that needs to be filled in.
2142  */
2144 
2145  /*
2146  Description:
2147  Create a new outer boundary loop that runs along the sides
2148  of the face's surface. All the necessary trims, edges,
2149  and vertices are created and added to the brep.
2150  Parameters:
2151  face_index - [in] index of face that needs an outer boundary
2152  that runs along the sides of its surface.
2153  Returns:
2154  New outer boundary loop that is complete.
2155  */
2156  ON_BrepLoop* NewOuterLoop( int face_index );
2157 
2158  /*
2159  Description:
2160  Add a new face to brep. This version is for expert users.
2161  Parameters:
2162  face_index - [in] index of face that will get a new outer
2163  loop running around the sides of the face's
2164  underlying surface.
2165  vid - [in/out] four vertex indices that specify the vertices at
2166  the (sw,se,nw,ne) corners. If the input value
2167  of a vertex index is -1, then the vertex will be
2168  created.
2169  eid - [in/out] four edge indices that specify the edges for
2170  the (south,east,north,west) sides. If the input value
2171  of an edge index is -1, then the edge will be created.
2172  bRev3d - [in/out] four values of the trim m_bRev3d flags of
2173  the (south,east,north,west) sides.
2174  Returns:
2175  Pointer to the new loop or NULL if input is not valid.
2176  Remarks:
2177  Adding a new loop may grow the dynamic m_L array. When
2178  this happens pointers and references to memory in the
2179  previous m_L[] array may become invalid. Use face indices
2180  if this is an issue.
2181  See Also:
2182  ON_Brep::NewFace
2183  */
2185  int face_index,
2186  int vid[4],
2187  int eid[4],
2188  ON_BOOL32 bRev3d[4]
2189  );
2190 
2191  /*
2192  Description:
2193  Add a planar trimming loop to a planar face.
2194  Parameters:
2195  face_index - [in] index of planar face. The underlying
2196  suface must be an ON_PlaneSurface.
2197  loop_type - [in] type of loop to add. If loop_type is
2198  ON_BrepLoop::unknown, then the loop direction is tested
2199  and the the new loops type will be set to
2200  ON_BrepLoop::outer or ON_BrepLoop::inner. If the loop_type
2201  is ON_BrepLoop::outer, then the direction of the new loop
2202  is tested and flipped if it is clockwise. If the loop_type
2203  is ON_BrepLoop::inner, then the direction of the new loop
2204  is tested and flipped if it is counter-clockwise.
2205  boundary - [in] a list of 3d curves that form a simple (no self
2206  intersections) closed curve. These curves define the 3d
2207  edge geometry and should be near the planar surface.
2208  bDuplicateCurves - [in] If true, then duplicates of the curves
2209  in the boundary array are added to the brep. If false, the
2210  curves in the boundary array are added to the brep and will
2211  be deleted by ON_Brep::~ON_Brep.
2212  Returns:
2213  true if successful. The new loop will be brep.m_L.Last().
2214  */
2216  int face_index,
2217  ON_BrepLoop::TYPE loop_type,
2218  ON_SimpleArray<ON_Curve*>& boundary,
2219  ON_BOOL32 bDuplicateCurves = true
2220  );
2221 
2222 
2223  /*
2224  Description:
2225  Add a new trim that will be part of an inner, outer, or slit loop
2226  to the brep.
2227  Parameters:
2228  c2i - [in] index of 2d trimming curve
2229  Returns:
2230  new trim
2231  Example:
2232  int c2i = brep->AddTrimCurve( p2dCurve );
2233  ON_BrepTrim& trim = NewTrim( edge, bRev3d, loop, c2i );
2234  trim.m_ei = ...;
2235  trim.m_li = ...;
2236  trim.m_tolerance[0] = ...;
2237  trim.m_tolerance[1] = ...;
2238  trim.m_type = ...;
2239  trim.m_iso = ...;
2240  Remarks:
2241  You should set the trim's ON_BrepTrim::m_tolerance, ON_BrepTrim::m_type,
2242  ON_BrepTrim::m_iso, ON_BrepTrim::m_li, and ON_BrepTrim::m_ei values.
2243  In general, you should try to use the
2244  ON_BrepTrim::NewTrim( edge, bRev3d, loop, c2i ) version of NewTrim.
2245  If you want to add a singular trim, use ON_Brep::NewSingularTrim.
2246  If you want to add a crvonsrf trim, use ON_Brep::NewCurveOnFace.
2247  If you want to add a ptonsrf trim, use ON_Brep::NewPointOnFace.
2248  See Also:
2249  ON_Brep::SetTrimTypeFlags
2250  ON_Brep::SetTrimIsoFlags
2251  ON_Brep::NewSingularTrim
2252  ON_Brep::NewPointOnFace
2253  ON_Brep::NewCurveOnFace
2254  */
2256  int c2i = -1
2257  );
2258 
2259  /*
2260  Description:
2261  Add a new trim that will be part of an inner, outer, or slit loop
2262  to the brep.
2263  Parameters:
2264  bRev3d - [in] ON_BrepTrim::m_bRev3d value. true if the
2265  edge and trim have opposite directions.
2266  loop - [in] trim is appended to this loop
2267  c2i - [in] index of 2d trimming curve
2268  Returns:
2269  new trim
2270  Example:
2271  int c2i = brep->AddTrimCurve( p2dCurve );
2272  ON_BrepTrim& trim = NewTrim( edge, bRev3d, loop, c2i );
2273  trim.m_ei = ...;
2274  trim.m_tolerance[0] = ...;
2275  trim.m_tolerance[1] = ...;
2276  trim.m_type = ...;
2277  trim.m_iso = ...;
2278  Remarks:
2279  You should set the trim's ON_BrepTrim::m_tolerance, ON_BrepTrim::m_type,
2280  ON_BrepTrim::m_iso, and ON_BrepTrim::m_ei values.
2281  In general, you should try to use the
2282  ON_BrepTrim::NewTrim( edge, bRev3d, loop, c2i ) version of NewTrim.
2283  If you want to add a singular trim, use ON_Brep::NewSingularTrim.
2284  If you want to add a crvonsrf trim, use ON_Brep::NewCurveOnFace.
2285  If you want to add a ptonsrf trim, use ON_Brep::NewPointOnFace.
2286  See Also:
2287  ON_Brep::SetTrimTypeFlags
2288  ON_Brep::SetTrimIsoFlags
2289  ON_Brep::NewSingularTrim
2290  ON_Brep::NewPointOnFace
2291  ON_Brep::NewCurveOnFace
2292  */
2294  ON_BOOL32 bRev3d,
2295  ON_BrepLoop& loop,
2296  int c2i = -1
2297  );
2298 
2299  /*
2300  Description:
2301  Add a new trim that will be part of an inner, outer, or slit loop
2302  to the brep.
2303  Parameters:
2304  edge - [in] 3d edge associated with this trim
2305  bRev3d - [in] ON_BrepTrim::m_bRev3d value. true if the
2306  edge and trim have opposite directions.
2307  c2i - [in] index of 2d trimming curve
2308  Returns:
2309  new trim
2310  Example:
2311  int c2i = brep->AddTrimCurve( p2dCurve );
2312  ON_BrepTrim& trim = NewTrim( edge, bRev3d, c2i );
2313  trim.m_li = ...;
2314  trim.m_tolerance[0] = ...;
2315  trim.m_tolerance[1] = ...;
2316  trim.m_type = ...;
2317  trim.m_iso = ...;
2318  Remarks:
2319  You should set the trim's ON_BrepTrim::m_tolerance,
2320  ON_BrepTrim::m_type, ON_BrepTrim::m_iso,
2321  and ON_BrepTrim::m_li values.
2322  In general, you should try to use the
2323  ON_BrepTrim::NewTrim( edge, bRev3d, loop, c2i ) version of NewTrim.
2324  If you want to add a singular trim, use ON_Brep::NewSingularTrim.
2325  If you want to add a crvonsrf trim, use ON_Brep::NewCurveOnFace.
2326  If you want to add a ptonsrf trim, use ON_Brep::NewPointOnFace.
2327  See Also:
2328  ON_Brep::SetTrimTypeFlags
2329  ON_Brep::SetTrimIsoFlags
2330  ON_Brep::NewSingularTrim
2331  ON_Brep::NewPointOnFace
2332  ON_Brep::NewCurveOnFace
2333  */
2335  ON_BrepEdge& edge,
2336  ON_BOOL32 bRev3d,
2337  int c2i = -1
2338  );
2339 
2340  /*
2341  Description:
2342  Add a new trim that will be part of an inner, outer, or slit loop
2343  to the brep.
2344  Parameters:
2345  edge - [in] 3d edge associated with this trim
2346  bRev3d - [in] ON_BrepTrim::m_bRev3d value. true if the
2347  edge and trim have opposite directions.
2348  loop - [in] trim is appended to this loop
2349  c2i - [in] index of 2d trimming curve
2350  Returns:
2351  new trim
2352  Example:
2353  int c2i = brep->AddTrimCurve( p2dCurve );
2354  ON_BrepTrim& trim = brep->NewTrim( edge, bRev3d, loop, c2i );
2355  trim.m_tolerance[0] = ...;
2356  trim.m_tolerance[1] = ...;
2357  Remarks:
2358  You should set the trim's ON_BrepTrim::m_tolerance values.
2359  If c2i is -1, you must set the trim's ON_BrepTrim::m_iso values.
2360  This version of NewTrim sets the trim.m_type value. If the
2361  input edge or loop are not currently valid, then you may
2362  need to adjust the trim.m_type value.
2363  If you want to add a singular trim, use ON_Brep::NewSingularTrim.
2364  If you want to add a crvonsrf trim, use ON_Brep::NewCurveOnFace.
2365  If you want to add a ptonsrf trim, use ON_Brep::NewPointOnFace.
2366  See Also:
2367  ON_Brep::SetTrimTypeFlags
2368  ON_Brep::SetTrimIsoFlags
2369  ON_Brep::NewSingularTrim
2370  ON_Brep::NewPointOnFace
2371  ON_Brep::NewCurveOnFace
2372  */
2374  ON_BrepEdge& edge,
2375  ON_BOOL32 bRev3d,
2376  ON_BrepLoop& loop,
2377  int c2i = -1
2378  );
2379 
2380  /*
2381  Description:
2382  Add a new singular trim to the brep.
2383  Parameters:
2384  vertex - [in] vertex along collapsed surface edge
2385  loop - [in] trim is appended to this loop
2386  iso - [in] one of ON_Surface::S_iso, ON_Surface::E_iso,
2387  ON_Surface::N_iso, or ON_Surface::W_iso.
2388  c2i - [in] index of 2d trimming curve
2389  Returns:
2390  new trim
2391  See Also:
2392  ON_Brep::NewTrim
2393  */
2395  const ON_BrepVertex& vertex,
2396  ON_BrepLoop& loop,
2397  ON_Surface::ISO iso,
2398  int c2i = -1
2399  );
2400 
2401  /*
2402  Description:
2403  Adds a new point on face to the brep.
2404  Parameters:
2405  face - [in] face that vertex lies on
2406  s,t - [in] surface parameters
2407  Returns:
2408  new vertex that represents the point on face.
2409  Remarks:
2410  If a vertex is a point on a face, then brep.m_E[m_ei]
2411  will be an edge with no 3d curve. This edge will have
2412  a single trim with type ON_BrepTrim::ptonsrf. There
2413  will be a loop containing this single trim.
2414  */
2416  ON_BrepFace& face,
2417  double s,
2418  double t
2419  );
2420 
2421  /*
2422  Description:
2423  Add a new curve on face to the brep.
2424  Parameters:
2425  face - [in] face that curve lies on
2426  edge - [in] 3d edge associated with this curve on surface
2427  bRev3d - [in] true if the 3d edge and the 2d parameter space
2428  curve have opposite directions.
2429  c2i - [in] index of 2d curve in face's parameter space
2430  Returns:
2431  new trim that represents the curve on surface
2432  Remarks:
2433  You should set the trim's ON_BrepTrim::m_tolerance and
2434  ON_BrepTrim::m_iso values.
2435  */
2437  ON_BrepFace& face,
2438  ON_BrepEdge& edge,
2439  ON_BOOL32 bRev3d = false,
2440  int c2i = -1
2441  );
2442 
2443  // appends a copy of brep to this and updates
2444  // indices of appended brep parts. Duplicates are not removed.
2445  void Append(
2446  const ON_Brep& // brep
2447  );
2448 
2449  // This function can be used to compute vertex information for a
2450  // b-rep when everything but the m_V array is properly filled in.
2451  // It is intended to be used when creating a ON_Brep from a
2452  // definition that does not include explicit vertex information.
2453  void SetVertices(void);
2454 
2455  // This function can be used to set the ON_BrepTrim::m_iso
2456  // flag. It is intended to be used when creating a ON_Brep from
2457  // a definition that does not include compatible parameter space
2458  // type information.
2459  // See Also: ON_BrepSetFlagsAndTolerances
2460  bool SetTrimIsoFlags(); // sets all trim iso flags
2464 
2465 
2466  /*
2467  Description:
2468  Calculate the type (singular, mated, boundary, etc.) of
2469  an ON_BrepTrim object.
2470  Parameters:
2471  trim - [in]
2472  bLazy - [in] if true and trim.m_type is set to something other
2473  than ON_BrepTrim::unknown, then no calculation is
2474  performed and the value of trim.m_type is returned.
2475  If false, the value of trim.m_type is ignored and is caluculated.
2476  Returns:
2477  Type of trim.
2478  Remarks:
2479  The trim must be connected to a valid loop.
2480  See Also:
2481  ON_Brep::SetTrimTypeFlags
2482  */
2484  const ON_BrepTrim& trim,
2485  ON_BOOL32 bLazy = true
2486  ) const;
2487 
2488  // This function can be used to set the ON_BrepTrim::m_type
2489  // flag. If the optional bLazy argument is true, then only
2490  // trims with m_type = unknown are set.
2491  // See Also: ON_BrepSetFlagsAndTolerances
2492  bool SetTrimTypeFlags( ON_BOOL32 bLazy = false ); // sets all trim iso flags
2493  bool SetTrimTypeFlags( ON_BrepFace&, ON_BOOL32 bLazy = false );
2494  bool SetTrimTypeFlags( ON_BrepLoop&, ON_BOOL32 bLazy = false );
2495  bool SetTrimTypeFlags( ON_BrepTrim&, ON_BOOL32 bLazy = false );
2496 
2497  // GetTrim2dStart() evaluates the start of the
2498  // parameter space (2d) trim curve.
2500  int trim_index, // index of ON_BrepTrim in m_T[] array
2501  ON_2dPoint&
2502  ) const;
2503 
2504  // GetTrim2dEnd() evaluates end of the
2505  // parameter space (2d) trim curve.
2507  int, // index of ON_BrepTrim in m_T[] array
2508  ON_2dPoint&
2509  ) const;
2510 
2511  // GetTrim3dStart() evaluates the 3d surface at the start of the
2512  // parameter space (2d) trim curve.
2514  int, // index of ON_BrepTrim in m_T[] array
2515  ON_3dPoint&
2516  ) const;
2517 
2518  // GetTrim3dEnd() evaluates the 3d surface at the end of the
2519  // parameter space (2d) trim curve.
2521  int, // index of ON_BrepTrim in m_T[] array
2522  ON_3dPoint&
2523  ) const;
2524 
2525  // This function examines the 2d parameter space curves and returns
2526  // the loop's type based on their orientation. Use this function for
2527  // debugging loop orientation problems.
2529 
2530  // These set the various tolerances. The optional ON_BOOL32 argument
2531  // is called bLazy. If bLazy is false, the tolerance is recomputed
2532  // from its definition. If bLazy is true, the tolerance is computed
2533  // only if its current value is negative.
2534  bool SetVertexTolerance( ON_BrepVertex& vertex, ON_BOOL32 bLazy = false ) const;
2535  virtual
2536  bool SetTrimTolerance( ON_BrepTrim& trim, ON_BOOL32 bLazy = false ) const;
2537  virtual
2538  bool SetEdgeTolerance( ON_BrepEdge& edge, ON_BOOL32 bLazy = false ) const;
2539 
2540  /*
2541  Description:
2542  Set the brep's vertex tolerances.
2543  Parameters:
2544  bLazy - [in] if true, only vertex tolerances with the value
2545  ON_UNSET_VALUE will be set. If false, the vertex tolerance
2546  is recomputed from the geometry in the brep.
2547  Returns:
2548  true if successful.
2549  See Also:
2550  ON_Brep::SetVertexTolerance
2551  ON_Brep::SetTrimTolerance
2552  ON_Brep::SetEdgeTolerance
2553  ON_Brep::SetVertexTolerances
2554  ON_Brep::SetTrimTolerances
2555  ON_Brep::SetEdgeTolerances
2556  ON_Brep::SetTolerancesAndFlags
2557  */
2558  bool SetVertexTolerances( ON_BOOL32 bLazy = false );
2559 
2560  /*
2561  Description:
2562  Set the brep's trim tolerances.
2563  Parameters:
2564  bLazy - [in] if true, only trim tolerances with the value
2565  ON_UNSET_VALUE will be set. If false, the trim tolerance
2566  is recomputed from the geometry in the brep.
2567  Returns:
2568  true if successful.
2569  See Also:
2570  ON_Brep::SetVertexTolerance
2571  ON_Brep::SetTrimTolerance
2572  ON_Brep::SetEdgeTolerance
2573  ON_Brep::SetVertexTolerances
2574  ON_Brep::SetTrimTolerances
2575  ON_Brep::SetEdgeTolerances
2576  ON_Brep::SetTolerancesAndFlags
2577  */
2578  bool SetTrimTolerances( ON_BOOL32 bLazy = false );
2579 
2580  /*
2581  Description:
2582  Set the brep's edge tolerances.
2583  Parameters:
2584  bLazy - [in] if true, only edge tolerances with the value
2585  ON_UNSET_VALUE will be set. If false, the edge tolerance
2586  is recomputed from the geometry in the brep.
2587  Returns:
2588  true if successful.
2589  See Also:
2590  ON_Brep::SetVertexTolerance
2591  ON_Brep::SetTrimTolerance
2592  ON_Brep::SetEdgeTolerance
2593  ON_Brep::SetVertexTolerances
2594  ON_Brep::SetTrimTolerances
2595  ON_Brep::SetEdgeTolerances
2596  ON_Brep::SetTolerancesAndFlags
2597  */
2598  bool SetEdgeTolerances( ON_BOOL32 bLazy = false );
2599 
2600 
2601  /*
2602  Description:
2603  Set the trim parameter space bounding box (trim.m_pbox).
2604  Parameters:
2605  trim - [in]
2606  bLazy - [in] if true and trim.m_pbox is valid, then
2607  the box is not set.
2608  Returns:
2609  true if trim ends up with a valid bounding box.
2610  */
2611  virtual
2612  bool SetTrimBoundingBox( ON_BrepTrim& trim, ON_BOOL32 bLazy=false );
2613 
2614  /*
2615  Description:
2616  Set the loop parameter space bounding box (loop.m_pbox).
2617  Parameters:
2618  loop - [in]
2619  bLazy - [in] if true and loop trim trim.m_pbox is valid,
2620  then that trim.m_pbox is not recalculated.
2621  Returns:
2622  true if loop ends up with a valid bounding box.
2623  */
2624  virtual
2625  bool SetTrimBoundingBoxes( ON_BrepLoop& loop, ON_BOOL32 bLazy=false );
2626 
2627 
2628  /*
2629  Description:
2630  Set the loop and trim parameter space bounding boxes
2631  for every loop and trim in the face
2632  Parameters:
2633  face - [in]
2634  bLazy - [in] if true and trim trim.m_pbox is valid,
2635  then that trim.m_pbox is not recalculated.
2636  Returns:
2637  true if all the face's loop and trim parameter space bounding
2638  boxes are valid.
2639  */
2640  virtual
2641  bool SetTrimBoundingBoxes( ON_BrepFace& face, ON_BOOL32 bLazy=false );
2642 
2643  /*
2644  Description:
2645  Set the loop and trim parameter space bounding boxes
2646  for every loop and trim in the brep.
2647  Parameters:
2648  bLazy - [in] if true and trim trim.m_pbox is valid,
2649  then that trim.m_pbox is not recalculated.
2650  Returns:
2651  true if all the loop and trim parameter space bounding boxes
2652  are valid.
2653  */
2654  virtual
2655  bool SetTrimBoundingBoxes( ON_BOOL32 bLazy=false );
2656 
2657  /*
2658  Description:
2659  Set tolerances and flags in a brep
2660  Parameters:
2661  bLazy - [in] if true, only flags and tolerances that are not
2662  set will be calculated.
2663  bSetVertexTolerances - [in] true to compute vertex.m_tolerance values
2664  bSetEdgeTolerances - [in] true to compute edge.m_tolerance values
2665  bSetTrimTolerances - [in] true to compute trim.m_tolerance[0,1] values
2666  bSetTrimIsoFlags - [in] true to compute trim.m_iso values
2667  bSetTrimTypeFlags - [in] true to compute trim.m_type values
2668  bSetLoopTypeFlags - [in] true to compute loop.m_type values
2669  bSetTrimBoxes - [in] true to compute trim.m_pbox values
2670  See Also:
2671  ON_Brep::SetVertexTolerance
2672  ON_Brep::SetEdgeTolerance
2673  ON_Brep::SetTrimTolerance
2674  ON_Brep::SetTrimTypeFlags
2675  ON_Brep::SetTrimIsoFlags
2676  ON_Brep::ComputeLoopType
2677  ON_Brep::SetTrimBoundingBox
2678  ON_Brep::SetTrimBoundingBoxes
2679  */
2681  ON_BOOL32 bLazy = false,
2682  ON_BOOL32 bSetVertexTolerances = true,
2683  ON_BOOL32 bSetEdgeTolerances = true,
2684  ON_BOOL32 bSetTrimTolerances = true,
2685  ON_BOOL32 bSetTrimIsoFlags = true,
2686  ON_BOOL32 bSetTrimTypeFlags = true,
2687  ON_BOOL32 bSetLoopTypeFlags = true,
2688  ON_BOOL32 bSetTrimBoxes = true
2689  );
2690 
2691 
2692  /////////////////////////////////////////////////////////////////
2693  // Query Interface
2694 
2695  /*
2696  Description:
2697  Determine how many brep faces reference m_S[surface_index].
2698  Parameters:
2699  surface_index - [in] index of the surface in m_S[] array
2700  max_count - [in] counting stops if max_count > 0 and
2701  at least max_count faces use the surface.
2702  Returns:
2703  Number of brep faces that reference the surface.
2704  */
2706  int surface_index,
2707  int max_count=0 )
2708  const;
2709  /*
2710  Description:
2711  Determine how many brep edges reference m_C3[c3_index].
2712  Parameters:
2713  c3_index - [in] index of the 3d curve in m_C3[] array
2714  max_count - [in] counting stops if max_count > 0 and
2715  at least max_count edges use the 3d curve.
2716  Returns:
2717  Number of brep edges that reference the 3d curve.
2718  */
2720  int c3_index,
2721  int max_count=0 )
2722  const;
2723 
2724  /*
2725  Description:
2726  Determine how many brep trims reference m_C2[c2_index].
2727  Parameters:
2728  c2_index - [in] index of the 2d curve in m_C2[] array
2729  max_count - [in] counting stops if max_count > 0 and
2730  at least max_count trims use the 2d curve.
2731  Returns:
2732  Number of brep trims that reference the 2d curve.
2733  */
2735  int c2_index,
2736  int max_count=0 )
2737  const;
2738 
2739  /*
2740  Description:
2741  Get a single 3d curve that traces the entire loop
2742  Parameters:
2743  loop - [in] loop whose 3d curve should be duplicated
2744  bRevCurveIfFaceRevIsTrue - [in] If false, the returned
2745  3d curve has an orientation compatible with the
2746  2d curve returned by Loop2dCurve().
2747  If true and the m_bRev flag of the loop's face
2748  is true, then the returned curve is reversed.
2749  Returns:
2750  A pointer to a 3d ON_Curve. The caller must delete
2751  this curve.
2752  */
2754  const ON_BrepLoop& loop,
2755  ON_BOOL32 bRevCurveIfFaceRevIsTrue = false
2756  ) const;
2757 
2758  /*
2759  Description:
2760  Get a list of 3d curves that trace the non-seam edge
2761  portions of an entire loop
2762  Parameters:
2763  loop - [in] loop whose 3d curve should be duplicated
2764  curve_list - [out] 3d curves are appended to this list
2765  bRevCurveIfFaceRevIsTrue - [in] If false, the returned
2766  3d curves have an orientation compatible with the
2767  2d curve returned by Loop2dCurve().
2768  If true and the m_bRev flag of the loop's face
2769  is true, then the returned curves are reversed.
2770  Returns:
2771  Number of curves appended to curve_list.
2772  */
2774  const ON_BrepLoop& loop,
2775  ON_SimpleArray<ON_Curve*>& curve_list,
2776  ON_BOOL32 bRevCurveIfFaceRevIsTrue = false
2777  ) const;
2778 
2779 
2780  /*
2781  Description:
2782  Get a 3d curve that traces the entire loop
2783  Parameters:
2784  loop - [in] loop whose 2d curve should be duplicated
2785  Returns:
2786  A pointer to a 2d ON_Curve. The caller must delete
2787  this curve.
2788  */
2789  ON_Curve* Loop2dCurve( const ON_BrepLoop& loop ) const;
2790 
2791  /*
2792  Description:
2793  Determine orientation of a brep.
2794  Returns:
2795  @untitle table
2796  +2 brep is a solid but orientation cannot be computed
2797  +1 brep is a solid with outward facing normals
2798  -1 brep is a solid with inward facing normals
2799  0 brep is not a solid
2800  Remarks:
2801  The base class implementation returns 2 or 0. This
2802  function is overridden in the Rhino SDK and returns
2803  +1, -1, or 0.
2804  See Also:
2805  ON_Brep::IsSolid
2806  */
2807  virtual
2808  int SolidOrientation() const;
2809 
2810  /*
2811  Description:
2812  Test brep to see if it is a solid. (A "solid" is
2813  a closed oriented manifold.)
2814  Returns:
2815  @untitled table
2816  true brep is a solid
2817  fals brep is not a solid
2818  See Also:
2819  ON_Brep::SolidOrientation
2820  ON_Brep::IsManifold
2821  */
2822  bool IsSolid() const;
2823 
2824  /*
2825  Description:
2826  Test brep to see if it is an oriented manifold.
2827  Parameters:
2828  pbIsOriented - [in] if not null, *pbIsOriented is set
2829  to true if b-rep is an oriented manifold and false
2830  if brep is not an oriented manifold.
2831  pbHasBoundary - [in] if not null, *pbHasBoundary is set
2832  to true if b-rep has a boundary edge and false if
2833  brep does not have a boundary edge.
2834  Returns:
2835  true brep is a manifold
2836  fals brep is not a manifold
2837  See Also:
2838  ON_Brep::IsSolid
2839  */
2840  bool IsManifold( // returns true if b-rep is an oriented manifold
2841  ON_BOOL32* pbIsOriented = NULL,
2842  ON_BOOL32* pbHasBoundary = NULL
2843  ) const;
2844 
2845  /*
2846  Description:
2847  Determine if P is inside Brep. This question only makes sense
2848  when the brep is a closed manifold. This function does not
2849  not check for closed or manifold, so result is not valid in
2850  those cases. Intersects a line through P with brep, finds
2851  the intersection point Q closest to P, and looks at face
2852  normal at Q. If the point Q is on an edge or the intersection
2853  is not transverse at Q, then another line is used.
2854  Parameters:
2855  P - [in] 3d point
2856  tolerance - [in] 3d distance tolerance used for intersection
2857  and determining strict inclusion.
2858  bStrictlInside - [in] If bStrictlInside is true, then this
2859  function will return false if the distance from P is within
2860  tolerance of a brep face.
2861  Returns:
2862  True if P is in, false if not. See parameter bStrictlyIn.
2863  */
2865  ON_3dPoint P,
2866  double tolerance,
2867  bool bStrictlyInside
2868  ) const;
2869 
2870 
2871  bool IsSurface() const; // returns true if the b-rep has a single face
2872  // and that face is geometrically the same
2873  // as the underlying surface. I.e., the face
2874  // has trivial trimming. In this case, the
2875  // surface is m_S[0].
2876  // The flag m_F[0].m_bRev records
2877  // the correspondence between the surface's
2878  // natural parametric orientation and the
2879  // orientation of the b-rep.
2880 
2881 
2882  bool FaceIsSurface( // returns true if the face has a single
2883  int // index of face // outer boundary and that boundary runs
2884  ) const; // along the edges of the underlying surface.
2885  // In this case the geometry of the surface
2886  // is the same as the geometry of the face.
2887  // If FaceIsSurface() is true, then
2888  // m_S[m_F[face_index].m_si] is the surface.
2889  // The flag m_F[face_index].m_bRev records
2890  // the correspondence between the surface's
2891  // natural parametric orientation and the
2892  // orientation of face in the b-rep.
2893 
2894  bool LoopIsSurfaceBoundary( // returns true if the loop's trims all run
2895  int // index of loop // along the edge's of the underlying surface's
2896  ) const; // parameter space.
2897 
2898  /////////////////////////////////////////////////////////////////
2899  // Modification Interface
2900 
2901  //////////
2902  // Clears all ON_BrepFace.m_bRev flags by ON_BrepFace::Transpose
2903  // on each face with a true m_bRev.
2905 
2906  //////////
2907  // Change the domain of a trim's 2d curve. This changes only the
2908  // parameterization of the 2d trimming curve; the locus of the
2909  // 2d trimming curve is not changed.
2911  int, // index of trim in m_T[] array
2912  const ON_Interval&
2913  );
2914 
2915  //////////
2916  // Change the domain of an edge. This changes only the
2917  // parameterization of the 3d edge curve; the locus of the
2918  // 3d edge curve is not changed.
2920  int, // index of edge in m_E[] array
2921  const ON_Interval&
2922  );
2923 
2924  // Reverses entire brep orientation of all faces by toggling
2925  // value of all face's ON_BrepFace::m_bRev flag.
2926  void Flip();
2927 
2928  // reverses orientation of a face by toggling ON_BrepFace::m_bRev
2930 
2931  // Reverses orientation of trimming loop.
2932  // This function is intended to be used by brep experts and does
2933  // does NOT modify ON_BrepLoop::m_type. You should make sure
2934  // ON_BrepLoop::m_type jibes with the loop's direction. (Outer loops
2935  // should be counter-clockwise and inner loops should be clockwise.)
2936  // You can use ON_Brep::LoopDirection() to determine the direction of
2937  // a loop.
2938  void FlipLoop(ON_BrepLoop&); // reverses orientation of trimming loop
2939 
2940  // LoopDirection() examines the 2d trimming curve geometry that defines
2941  // the loop and returns
2942  //
2943  // @untitled table
2944  // +1 the loop is a counter-clockwise loop.
2945  // -1 the loop is a clockwise loop.
2946  // 0 the loop is not a continuous closed loop.
2947  //
2948  // Since LoopDirection() calculates its result based on the 2d trimming
2949  // curve geometry, it can be use to set ON_BrepLoop::m_type to outer/inner
2950  // when translating from data definition where this distinction is murky.
2951  int LoopDirection( const ON_BrepLoop& ) const;
2952 
2953 
2954  /*
2955  Description:
2956  Sort the face.m_li[] array by loop type
2957  (outer, inner, slit, crvonsrf, ptonsrf)
2958  Parameters:
2959  face - [in/out] face whose m_li[] array should be sorted.
2960  Returns:
2961  @untitled table
2962  true success
2963  false failure - no loops or loops with unset loop.m_type
2964  See Also:
2965  ON_Brep::ComputeLoopType
2966  ON_Brep::LoopDirection
2967  */
2968  bool SortFaceLoops( ON_BrepFace& face ) const;
2969 
2970  /*
2971  Description:
2972  Expert user function.
2973  See Also:
2974  ON_Brep::JoinEdges
2975  */
2976  bool CombineCoincidentVertices(ON_BrepVertex&, ON_BrepVertex&); // moves information to first vertex and deletes second
2977 
2978  /*
2979  Description:
2980  Expert user function.
2981  See Also:
2982  ON_Brep::JoinEdges
2983  */
2984  bool CombineCoincidentEdges(ON_BrepEdge&, ON_BrepEdge&); // moves information to first edge and deletes second
2985 
2986  /*
2987  Description:
2988  Expert user function.
2989  Combines contiguous edges into a single edge. The edges
2990  must share a common vertex, then angle between the edge
2991  tangents are the common vertex must be less than or
2992  equal to angle_tolerance_radians, and any associated
2993  trims must be contiguous in there respective boundaries.
2994  Parameters;
2995  edge_index0 - [in]
2996  edge_index1 - [in]
2997  angle_tolerance_radians - [in]
2998  Returns:
2999  Pointer to the new edge or NULL if the edges cannot
3000  be combined into a single edge.
3001  Remarks:
3002  The input edges are deleted but are still in the
3003  brep's m_E[] arrays. Use ON_Brep::Compact to remove
3004  the unused edges.
3005  */
3007  int edge_index0,
3008  int edge_iindex1,
3009  double angle_tolerance_radians = ON_PI/180.0
3010  );
3011 
3012  // These remove a topology piece from a b-rep but do not
3013  // rearrange the arrays that hold the brep objects. The
3014  // deleted objects have their indices set to -1. Deleting
3015  // an object that is connected to other objects will
3016  // modify thos objects.
3018  void DeleteEdge(ON_BrepEdge& edge, ON_BOOL32 bDeleteEdgeVertices); // pass true to delete vertices used only by edge
3019  void DeleteTrim(ON_BrepTrim& trim, ON_BOOL32 bDeleteTrimEdges); // pass true to delete edges and vertices used only by trim
3020  void DeleteLoop(ON_BrepLoop& loop, ON_BOOL32 bDeleteLoopEdges); // pass true to delete edges and vertices used only by trim
3021  void DeleteFace(ON_BrepFace& face, ON_BOOL32 bDeleteFaceEdges); // pass true to delete edges and vertices used only by face
3022  void DeleteSurface(int s_index);
3023  void Delete2dCurve(int c2_index);
3024  void Delete3dCurve(int c3_index);
3025 
3026  // Description:
3027  // Set m_vertex_user.i, m_edge_user.i, m_face_user.i, m_loop_user.i,
3028  // and m_trim_user.i values of faces of component including
3029  // m_F[face_index] to label. Numbering starts at 1.
3030  // Parameters:
3031  // face_index - [in] index of face in component
3032  // label - [in] value for m_*_user.i
3033  // Returns:
3034  // Remarks:
3035  // Chases through trim lists of face edges to find adjacent faces.
3036  // Does NOT check for vertex-vertex connections
3038  int face_index,
3039  int label
3040  );
3041 
3042  /*
3043  Description:
3044  Set m_vertex_user.i, m_edge_user.i, m_face_user.i, m_loop_user.i,
3045  and m_trim_user.i values values to distinguish connected components.
3046  Parameters:
3047  Returns:
3048  number of connected components
3049  Remarks:
3050  For each face in the ith component, sets m_face_user.i to i>0.
3051  Chases through trim lists of face edges to find adjacent faces.
3052  Numbering starts at 1. Does NOT check for vertex-vertex connections.
3053  See Also:
3054  ON_Brep::GetConnectedComponents
3055  */
3057 
3058  /*
3059  Description:
3060  If this brep has two or more connected components,
3061  then duplicates of the connected components are appended
3062  to the components[] array.
3063  Parameters:
3064  components - [in] connected components are appended to this array.
3065  bDuplicateMeshes - [in] if true, any meshes on this brep are copied
3066  to the output breps.
3067  Returns:
3068  Number of connected components appended to components[] or zero
3069  if this brep has only one connected component.
3070  See Also:
3071  ON_Brep::GetConnectedComponents
3072  */
3074  ON_SimpleArray< ON_Brep* >& components,
3075  bool bDuplicateMeshes
3076  ) const;
3077 
3078  /*
3079  Description:
3080  Copy a subset of this brep.
3081  Parameters:
3082  subfi_count - [in] length of sub_fi[] array.
3083  sub_fi - [in] array of face indices in this
3084  brep to copy. (If any values inf sub_fi[]
3085  are out of range or if sub_fi[] contains
3086  duplicates, this function will return null.)
3087  sub_brep - [in] if this pointer is not null,
3088  then the subbrep will be created in this
3089  class.
3090  Returns:
3091  If the input is valid, a pointer to the
3092  subbrep is returned. If the input is not
3093  valid, null is returned. The faces in
3094  in the subbrep's m_F array are in the same
3095  order as they were specified in sub_fi[].
3096  */
3098  int subfi_count,
3099  const int* sub_fi,
3100  ON_Brep* sub_brep = 0
3101  ) const;
3102 
3103  ///////////////////////////////////////////////////////////////////////
3104  //
3105  // region topology
3106  //
3107  bool HasRegionTopology() const;
3108 
3109  /*
3110  Description:
3111  Get region topology information:
3112  In order to keep the ON_Brep class efficient, rarely used
3113  region topology information is not maintained. If you
3114  require this information, call RegionTopology().
3115  */
3117 
3118  /*
3119  Description:
3120  Get region topology information:
3121  In order to keep the ON_Brep class efficient, rarely used
3122  region topology information is not maintained. If you
3123  require this information, call RegionTopology().
3124  */
3126  // Description:
3127  // Duplicate a single brep face.
3128  // Parameters:
3129  // face_index - [in] index of face to duplicate
3130  // bDuplicateMeshes - [in] if true, any attached meshes are duplicated
3131  // Returns:
3132  // Single face brep.
3133  // Remarks:
3134  // The m_vertex_user.i, m_edge_user.i, m_face_user.i, m_loop_user.i,
3135  // and m_trim_user.i values of the returned brep are are set to the
3136  // indices of the objects they duplicate.
3137  // See Also:
3138  // ON_Brep::DeleteFace, ON_Brep::ExtractFace
3140  int face_index,
3141  ON_BOOL32 bDuplicateMeshes
3142  ) const;
3143 
3144  // Description:
3145  // Duplicate a a subset of a brep
3146  // Parameters:
3147  // face_count - [in] length of face_index[] array
3148  // face_index - [in] array of face indices
3149  // bDuplicateMeshes - [in] if true, any attached meshes are duplicated
3150  // Returns:
3151  // A brep made by duplicating the faces listed in the face_index[] array.
3152  // Remarks:
3153  // The m_vertex_user.i, m_edge_user.i, m_face_user.i, m_loop_user.i,
3154  // and m_trim_user.i values of the returned brep are are set to the
3155  // indices of the objects they duplicate.
3156  // See Also:
3157  // ON_Brep::DuplicateFace
3159  int face_count,
3160  const int* face_index,
3161  ON_BOOL32 bDuplicateMeshes
3162  ) const;
3163 
3164  // Description:
3165  // Extract a face from a brep.
3166  // Parameters:
3167  // face_index - [in] index of face to extract
3168  // Returns:
3169  // Single face brep.
3170  // See Also:
3171  // ON_Brep::DeleteFace, ON_Brep::DuplicateFace
3173  int face_index
3174  );
3175 
3176 
3177  /*
3178  Description:
3179  Standardizes the relationship between an ON_BrepEdge
3180  and the 3d curve it uses. When done, the edge will
3181  be the only edge that references its 3d curve, the
3182  domains of the edge and 3d curve will be the same,
3183  and the edge will use the entire locus of the 3d curve.
3184  Parameters:
3185  edge_index - [in] index of edge to standardize.
3186  bAdjustEnds - [in] if true, move edge curve endpoints to vertices
3187  See Also:
3188  ON_Brep::StandardizeEdgeCurves
3189  ON_Brep::Standardize
3190  */
3191  bool StandardizeEdgeCurve( int edge_index, bool bAdjustEnds );
3192 
3193 
3194  /*
3195  Description:
3196  Expert user only. Same as above, but to be used when the edge
3197  curve use count is known for the edge.
3198  Standardizes the relationship between an ON_BrepEdge
3199  and the 3d curve it uses. When done, the edge will
3200  be the only edge that references its 3d curve, the
3201  domains of the edge and 3d curve will be the same,
3202  and the edge will use the entire locus of the 3d curve.
3203  Parameters:
3204  edge_index - [in] index of edge to standardize.
3205  bAdjustEnds - [in] if true, move edge curve endpoints to vertices
3206  EdgeCurveUse - [in] if > 1, then the edge curve for this edge is used by more than one
3207  edge. if 1, then the edge curve is used only for this edge.
3208  If <= 0, then use count is unknown.
3209  See Also:
3210  ON_Brep::StandardizeEdgeCurves
3211  ON_Brep::Standardize
3212  */
3213  bool StandardizeEdgeCurve( int edge_index, bool bAdjustEnds, int EdgeCurveUse );
3214 
3215 
3216  /*
3217  Description:
3218  Standardize all edges in the brep.
3219  Parameters:
3220  bAdjustEnds - [in] if true, move edge curve endpoints to vertices
3221  See Also:
3222  ON_Brep::StandardizeEdgeCurve
3223  ON_Brep::Standardize
3224  */
3225  void StandardizeEdgeCurves( bool bAdjustEnds );
3226 
3227  /*
3228  Description:
3229  Standardizes the relationship between an ON_BrepTrim
3230  and the 2d curve it uses. When done, the trim will
3231  be the only trim that references its 2d curve, the
3232  domains of the trim and 2d curve will be the same,
3233  and the trim will use the entire locus of the 2d curve.
3234  Parameters:
3235  trim_index - [in] index of trim to standardize.
3236  See Also:
3237  ON_Brep::StandardizeTrimCurves
3238  ON_Brep::Standardize
3239  */
3240  bool StandardizeTrimCurve( int trim_index );
3241 
3242  /*
3243  Description:
3244  Standardize all trims in the brep.
3245  See Also:
3246  ON_Brep::StandardizeTrimCurve
3247  ON_Brep::Standardize
3248  */
3250 
3251  /*
3252  Description:
3253  Standardizes the relationship between an ON_BrepFace
3254  and the 3d surface it uses. When done, the face will
3255  be the only face that references its 3d surface, and
3256  the orientations of the face and 3d surface will be
3257  the same.
3258  Parameters:
3259  face_index - [in] index of face to standardize.
3260  See Also:
3261  ON_Brep::StardardizeFaceSurfaces
3262  ON_Brep::Standardize
3263  */
3264  bool StandardizeFaceSurface( int face_index );
3265 
3266  /*
3267  Description:
3268  Standardize all faces in the brep.
3269  See Also:
3270  ON_Brep::StandardizeFaceSurface
3271  ON_Brep::Standardize
3272  */
3274 
3275  // misspelled function name is obsolete
3276  ON_DEPRECATED void StardardizeFaceSurfaces();
3277 
3278  /*
3279  Description:
3280  Standardize all trims, edges, and faces in the brep.
3281  Remarks:
3282  After standardizing, there may be unused curves and surfaces
3283  in the brep. Call ON_Brep::Compact to remove these unused
3284  curves and surfaces.
3285  See Also:
3286  ON_Brep::StandardizeTrimCurves
3287  ON_Brep::StandardizeEdgeCurves
3288  ON_Brep::StandardizeFaceSurface
3289  ON_Brep::Compact
3290  */
3291  void Standardize();
3292 
3293 
3294  /*
3295  Description:
3296  Sometimes the ON_Surface used by a face extends far
3297  beyond the face's outer boundary. ShrinkSurface uses
3298  ON_Surface::Trim to remove portions of the surface that
3299  extend beyond the face's outer boundary loop.
3300  Parameters:
3301  face - [in] face to test and whose surface should be shrunk.
3302  DisableSide - [in] This is a bit field. A set bit indicates not to shrink
3303  the surface on a given side. The default of 0 enables shrinking
3304  on all four sides.
3305  @table
3306  value meaning
3307  0x0001 Dont shrink on the west side of domain.
3308  0x0002 Dont shrink on the south side of domain.
3309  0x0004 Dont shrink on the east side of domain.
3310  0x0008 Dont shrink on the north side of domain.
3311  Returns:
3312  @untitled table
3313  true successful
3314  false failure
3315  Remarks:
3316  If a surface needs to be shrunk it is copied. After shrinking,
3317  you may want to call ON_Brep::CullUnusedSurfaces to remove
3318  any unused surfaces.
3319  See Also:
3320  ON_Brep::ShrinkSurfaces
3321  ON_Brep::CullUnusedSurfaces
3322  */
3323  bool ShrinkSurface( ON_BrepFace& face, int DisableSide=0 );
3324 
3325  /*
3326  Description:
3327  Sometimes the ON_Surface used by a face extends far
3328  beyond the face's outer boundary. ShrinkSurfaces calls
3329  ON_Shrink::ShrinkSurface on each face to remove portions
3330  of surfaces that extend beyond their face's outer boundary
3331  loop.
3332  Returns:
3333  @untitled table
3334  true successful
3335  false failure
3336  Remarks:
3337  If a surface needs to be shrunk it is copied. After shrinking,
3338  you may want to call ON_Brep::CullUnusedSurfaces to remove
3339  any unused surfaces.
3340  See Also:
3341  ON_Brep::ShrinkSurface
3342  ON_Brep::CullUnusedSurfaces
3343  */
3345 
3346  /*
3347  Description:
3348  Uses the CullUnused*() members to delete any unreferenced
3349  objects from arrays, reindexes as needed, and shrinks
3350  arrays to minimum required size.
3351  See Also:
3352  ON_Brep::CullUnusedFaces
3353  ON_Brep::CullUnusedLoops
3354  ON_Brep::CullUnusedTrims
3355  ON_Brep::CullUnusedEdges
3356  ON_Brep::CullUnusedVertices
3357  ON_Brep::CullUnused3dCurves
3358  ON_Brep::CullUnused2dCurves
3359  ON_Brep::CullUnusedSurfaces
3360  */
3361  bool Compact();
3362 
3363  bool CullUnusedFaces(); // culls faces with m_face_index == -1
3364  bool CullUnusedLoops(); // culls loops with m_loop_index == -1
3365  bool CullUnusedTrims(); // culls trims with m_trim_index == -1
3366  bool CullUnusedEdges(); // culls edges with m_edge_index == -1
3367  bool CullUnusedVertices(); // culls vertices with m_vertex_index == -1
3368  bool CullUnused3dCurves(); // culls 2d curves not referenced by a trim
3369  bool CullUnused2dCurves(); // culls 3d curves not referenced by an edge
3370  bool CullUnusedSurfaces(); // culls surfaces not referenced by a face
3371 
3372  /////////////////////////////////////////////////////////////////
3373  // Navigation Interface
3374 
3375  // for moving around loops - returns trim index of prev/next trim in loop
3377  int // index of current trim (m_trim_index)
3378  ) const;
3380  int // index of current trim (m_trim_index)
3381  ) const;
3382 
3383  /*
3384  Description:
3385  This is a simple tool for getting running through the edges
3386  that begin and end at a vertex.
3387  Parameters:
3388  current_edge_index - [in]
3389  endi - [in] 0 = use the edge start vertex, 1 = use the edge end vertex
3390  prev_endi - [out] 0 if previous edge begins at the vertex,
3391  1 if previous edge ends at the vertex
3392  Returns:
3393  edge index of the previous edge or -1 if there is only one edge
3394  that begins or ends at the vertex.
3395  Remarks:
3396  This is a tool that simplifies searching through the
3397  ON_BrepVertex.m_ei[] array.
3398  The edges are in no particular order.
3399  See Also:
3400  ON_Brep::NextEdge
3401  */
3403  int current_edge_index,
3404  int endi,
3405  int* prev_endi = NULL
3406  ) const;
3407 
3408  /*
3409  Description:
3410  This is a simple tool for getting running through the edges
3411  that begin and end at a vertex.
3412  Parameters:
3413  current_edge_index - [in]
3414  endi - [in] 0 = use the edge start vertex, 1 = use the edge end vertex
3415  next_endi - [out] 0 if next edge begins at the vertex,
3416  1 if next edge ends at the vertex
3417  Returns:
3418  edge index of the next edge or -1 if there is only one edge
3419  that begins or ends at the vertex.
3420  Remarks:
3421  This is a tool that simplifies searching through the
3422  ON_BrepVertex.m_ei[] array.
3423  The edges are in no particular order.
3424  See Also:
3425  ON_Brep::NextEdge
3426  */
3428  int current_edge_index,
3429  int endi,
3430  int* next_endi = NULL
3431  ) const;
3432 
3433  /*
3434  Description:
3435  Get a brep component from its index.
3436  Parameters:
3437  component_index - [in]
3438  Returns:
3439  A const pointer to the component. Do not delete
3440  the returned object. It points to an object managed
3441  by this brep.
3442  See Also:
3443  ON_Brep::Face
3444  ON_Brep::Edge
3445  ON_Brep::Loop
3446  ON_Brep::Trim
3447  ON_Brep::Vertex
3448  */
3450  ON_COMPONENT_INDEX ci
3451  ) const;
3452 
3453  /*
3454  Description:
3455  Get vertex from trim index or component index.
3456  Parameters:
3457  vertex_index - [in] either an index into m_V[] or a component index
3458  of type brep_vertex.
3459  Returns:
3460  If the index is a valid vertex index or a valid vertex component
3461  index, then a pointer to the ON_BrepVertex is returned. Otherwise
3462  NULL is returned.
3463  See Also
3464  ON_Brep::Component( const ON_BrepVertex& )
3465  */
3466  ON_BrepVertex* Vertex( int vertex_index ) const;
3467  ON_BrepVertex* Vertex( ON_COMPONENT_INDEX vertex_index ) const;
3468 
3469  /*
3470  Description:
3471  Get edge from edge index or component index.
3472  Parameters:
3473  edge_index - [in] either an index into m_E[] or a component index
3474  of type brep_edge.
3475  Returns:
3476  If the index is a valid edge index or a valid edge component
3477  index, then a pointer to the ON_BrepEdge is returned. Otherwise
3478  NULL is returned.
3479  See Also
3480  ON_Brep::Component( const ON_BrepEdge& )
3481  */
3482  ON_BrepEdge* Edge( int edge_index ) const;
3483  ON_BrepEdge* Edge( ON_COMPONENT_INDEX edge_index ) const;
3484 
3485  /*
3486  Description:
3487  Get trim from trim index or component index.
3488  Parameters:
3489  trim_index - [in] either an index into m_T[] or a component index
3490  of type brep_trim.
3491  Returns:
3492  If the index is a valid trim index or a valid trim component
3493  index, then a pointer to the ON_BrepTrim is returned. Otherwise
3494  NULL is returned.
3495  See Also
3496  ON_Brep::Component( const ON_BrepTrim& )
3497  */
3498  ON_BrepTrim* Trim( int trim_index ) const;
3499  ON_BrepTrim* Trim( ON_COMPONENT_INDEX trim_index ) const;
3500 
3501  /*
3502  Description:
3503  Get loop from loop index or component index.
3504  Parameters:
3505  loop_index - [in] either an index into m_L[] or a component index
3506  of type brep_loop.
3507  Returns:
3508  If the index is a valid loop index or a valid loop component
3509  index, then a pointer to the ON_BrepLoop is returned. Otherwise
3510  NULL is returned.
3511  See Also
3512  ON_Brep::Component( const ON_BrepLoop& )
3513  */
3514  ON_BrepLoop* Loop( int loop_index ) const;
3515  ON_BrepLoop* Loop( ON_COMPONENT_INDEX loop_index ) const;
3516 
3517  /*
3518  Description:
3519  Get face from face index or component index.
3520  Parameters:
3521  face_index - [in] either an index into m_F[] or a component index
3522  of type brep_face.
3523  Returns:
3524  If the index is a valid face index or a valid face component
3525  index, then a pointer to the ON_BrepFace is returned. Otherwise
3526  NULL is returned.
3527  See Also
3528  ON_Brep::Component( const ON_BrepFace& )
3529  */
3530  ON_BrepFace* Face( int face_index ) const;
3531  ON_BrepFace* Face( ON_COMPONENT_INDEX face_index ) const;
3532 
3533  /*
3534  Description:
3535  remove slit trims and slit boundaries from each face.
3536  Returns:
3537  true if any slits were removed
3538  Remarks:
3539  Caller should call Compact() afterwards.
3540  */
3541  bool RemoveSlits();
3542 
3543  /*
3544  Description:
3545  remove slit trims and slit boundaries from a face.
3546  Parameters:
3547  F - [in] brep face
3548  Returns:
3549  true if any slits were removed
3550  Remarks:
3551  Caller should call Compact() when done.
3552  */
3554 
3555  /*
3556  Description:
3557  If fid0 != fid1 and m_F[fid0] and m_F[fid1] have the same surface (m_si is identical),
3558  and they are joined along a set of edges that do not have any other faces, then this will
3559  combine the two faces into one.
3560  Parameters:
3561  fid0, fid1 - [in] indices into m_F of faces to be merged.
3562  Returns:
3563  id of merged face if faces were successfully merged. -1 if not merged.
3564  Remarks:
3565  Caller should call Compact() when done.
3566  */
3567  int MergeFaces(int fid0, int fid1);
3568 
3569  /*
3570  Description:
3571  Merge all possible faces that have the same m_si
3572  Returns:
3573  true if any faces were successfully merged.
3574  Remarks:
3575  Caller should call Compact() when done.
3576  */
3577  bool MergeFaces();
3578 
3579  /*
3580  Description:
3581  Removes nested polycurves from the m_C2[] and m_C3[] arrays.
3582  Parameters:
3583  bExtractSingleSegments - [in] if true, polycurves with a
3584  single segment are replaced with the segment curve.
3585  bEdges - [in] if true, the m_C3[] array is processed
3586  bTrimCurves - [in] if true, the m_C2[] array is processed.
3587  Returns:
3588  True if any nesting was removed and false if no nesting
3589  was removed.
3590  */
3592  bool bExtractSingleSegments,
3593  bool bEdges = true,
3594  bool bTrimCurves = true
3595  );
3596 
3597  /*
3598  Description:
3599  Expert user tool to collapse a "short" edge to a vertex.
3600  The edge is removed and the topology is repaired
3601  so that everything that used to connect to the edge
3602  connects the specified vertex.
3603  Parameters:
3604  edge_index - [in] index of edge to remove
3605  bCloseTrimGap - [in] if true and the removal of the
3606  edge creates a gap in the parameter space trimming
3607  loop, then the 2d trim curves will be adjusted to
3608  close the gap.
3609  vertex_index - [in] if >= 0, this the edge is collapsed
3610  to this vertex. Otherwise a vertex is automatically
3611  selected or created.
3612  Returns:
3613  True if edge was successfully collapsed.
3614  Remarks:
3615  After you finish cleaning up the brep, you need
3616  to call ON_Brep::Compact() to remove unused edge,
3617  trim, and vertex information from the brep's m_E[],
3618  m_V[], m_T[], m_C2[], and m_C3[] arrays.
3619  */
3621  int edge_index,
3622  bool bCloseTrimGap = true,
3623  int vertex_index = -1
3624  );
3625 
3626  /*
3627  Description:
3628  Expert user tool to move trims and edges from
3629  one vertex to another.
3630  Parameters:
3631  old_vi - [in] index of old vertex
3632  new_vi - [in] index of new vertex
3633  bClearTolerances - [in] if true, then tolerances of
3634  edges and trims that are connected ot the old
3635  vertex are set to ON_UNSET_VALUE.
3636  vertex_index - [in] if >= 0, this the edge is collapsed
3637  to this vertex. Otherwise a vertex is automatically
3638  selected or created.
3639  Returns:
3640  True if successful.
3641  Remarks:
3642  After you finish cleaning up the brep, you need
3643  to call ON_Brep::Compact() to remove unused edge,
3644  trim, and vertex information from the brep's m_E[],
3645  m_V[], m_T[], m_C2[], and m_C3[] arrays.
3646  */
3648  int old_vi,
3649  int new_vi,
3650  bool bClearTolerances
3651  );
3652 
3653  /*
3654  Description:
3655  Expert user tool to remove any gap between adjacent trims.
3656  Parameters:
3657  trim0 - [in]
3658  trim1 - [in]
3659  Returns:
3660  True if successful.
3661  Remarks:
3662  The trims must be in the same trimming loop. The vertex
3663  at the end of trim0 must be the same as the vertex at
3664  the start of trim1. The trim's m_iso and m_type flags
3665  need to be correctly set.
3666  */
3668  ON_BrepTrim& trim0,
3669  ON_BrepTrim& trim1
3670  );
3671 
3672  /*
3673  Description:
3674  Remove edges that are not connected to a face.
3675  Parameters:
3676  bDeleteVertices - [in] if true, then the vertices
3677  at the ends of the wire edges are deleted if
3678  they are not connected to face trimming edges.
3679  Returns:
3680  Number of edges that were removed.
3681  Remarks:
3682  After you finish cleaning up the brep, you need
3683  to call ON_Brep::Compact() to remove unused edge,
3684  trim, and vertex information from the brep's m_E[],
3685  m_V[], m_T[], m_C2[], and m_C3[] arrays.
3686 
3687  If you want to remove wire edges and wiere
3688  After you finish cleaning up the brep, you need
3689  to call ON_Brep::Compact() to remove deleted vertices
3690  from the m_V[] array.
3691  See Also:
3692  ON_Brep::RemoveWireVertices
3693  */
3694  int RemoveWireEdges( bool bDeleteVertices = true );
3695 
3696  /*
3697  Description:
3698  Remove vertices that are not connected to an edge.
3699  Returns:
3700  Number of vertices that were deleted.
3701  Remarks:
3702  After you finish cleaning up the brep, you need
3703  to call ON_Brep::Compact() to remove deleted
3704  vertices from the m_V[] array.
3705  See Also:
3706  ON_Brep::RemoveWireEdges
3707  */
3709 
3710  /////////////////////////////////////////////////////////////////
3711  // "Expert" Interface
3712 
3713  void Set_user(ON_U u); // set every brep m_*_user value to u
3714  void Clear_vertex_user_i(); // zero all brep's m_vertex_user values
3715  void Clear_edge_user_i(int); // zero all brep's m_edge_user values
3716  void Clear_edge_user_i(); // zero all brep's m_edge_user values
3717  void Clear_trim_user_i(); // zero all brep's m_trim_user values
3718  void Clear_loop_user_i(); // zero all brep's m_loop_user values
3719  void Clear_face_user_i(); // zero all brep's m_face_user values
3720  void Clear_user_i(); // zero all brep's m_*_user values
3721 
3722  // Union available for application use.
3723  // The constructor zeros m_brep_user.
3724  // The value is of m_brep_user is not saved in 3DM
3725  // archives and may be changed by some computations.
3727 
3728  // geometry
3729  // (all geometry is deleted by ~ON_Brep(). Pointers can be NULL
3730  // or not referenced. Use Compact() to remove unreferenced geometry.
3731  ON_CurveArray m_C2; // Pointers to parameter space trimming curves
3732  // (used by trims).
3733  ON_CurveArray m_C3; // Pointers to 3d curves (used by edges).
3734  ON_SurfaceArray m_S; // Pointers to parametric surfaces (used by faces)
3735 
3736  // topology
3737  // (all topology is deleted by ~ON_Brep(). Objects can be unreferenced.
3738  // Use Compact() to to remove unreferenced geometry.
3744 
3745 protected:
3746  friend class ON_BrepFace;
3747  friend class ON_BrepRegion;
3748  friend class ON_BrepFaceSide;
3750 
3751  // Never directly set m_is_solid, use calls to IsSolid() and/or
3752  // SolidOrientation() when you need to know the answer to this
3753  // question.
3754  // 0 = unset
3755  // 1 = solid with normals pointing out
3756  // 2 = solid with normals pointing in
3757  // 3 = not solid
3759 
3760  // These are friends so legacy tol values stored in v1 3dm files
3761  // can be used to set brep edge and trimming tolerances with a call
3762  // to ON_Brep::SetTolsFromLegacyValues().
3765  void Initialize();
3766 
3767  // helpers to set ON_BrepTrim::m_iso flag
3768  void SetTrimIsoFlag(int,double[6]);
3769  void SetTrimIsoFlag(int);
3770 
3771  // helpers to create and set vertices
3772  bool SetEdgeVertex(const int, const int, const int );
3773  bool HopAcrossEdge( int&, int& ) const;
3774  bool SetTrimStartVertex( const int, const int);
3775  void SetLoopVertices(const int);
3778 
3779  // helpers for SwapFaceParameters()
3781  int // index of loop
3782  );
3784  int // index of trim
3785  );
3786 
3787  // helpers for validation checking
3788  bool IsValidTrim(int trim_index,ON_TextLog* text_log) const;
3789  bool IsValidTrimTopology(int trim_index,ON_TextLog* text_log) const;
3790  bool IsValidTrimGeometry(int trim_index,ON_TextLog* text_log) const;
3791  bool IsValidTrimTolerancesAndFlags(int trim_index,ON_TextLog* text_log) const;
3792 
3793  bool IsValidLoop(int loop_index,ON_TextLog* text_log) const;
3794  bool IsValidLoopTopology(int loop_index,ON_TextLog* text_log) const;
3795  bool IsValidLoopGeometry(int loop_index,ON_TextLog* text_log) const;
3796  bool IsValidLoopTolerancesAndFlags(int loop_index,ON_TextLog* text_log) const;
3797 
3798  bool IsValidFace(int face_index,ON_TextLog* text_log) const;
3799  bool IsValidFaceTopology(int face_index,ON_TextLog* text_log) const;
3800  bool IsValidFaceGeometry(int face_index,ON_TextLog* text_log) const;
3801  bool IsValidFaceTolerancesAndFlags(int face_index,ON_TextLog* text_log) const;
3802 
3803  bool IsValidEdge(int edge_index,ON_TextLog* text_log) const;
3804  bool IsValidEdgeTopology(int edge_index,ON_TextLog* text_log) const;
3805  bool IsValidEdgeGeometry(int edge_index,ON_TextLog* text_log) const;
3806  bool IsValidEdgeTolerancesAndFlags(int edge_index,ON_TextLog* text_log) const;
3807 
3808  bool IsValidVertex(int vertex_index,ON_TextLog* text_log) const;
3809  bool IsValidVertexTopology(int vertex_index,ON_TextLog* text_log) const;
3810  bool IsValidVertexGeometry(int vertex_index,ON_TextLog* text_log) const;
3811  bool IsValidVertexTolerancesAndFlags(int vertex_index,ON_TextLog* text_log) const;
3812 
3814 
3815  // read helpers to support various versions
3816  bool ReadOld100( ON_BinaryArchive& ); // reads legacy old RhinoIO toolkit b-rep
3817  bool ReadOld101( ON_BinaryArchive& ); // reads legacy Rhino 1.1 b-rep
3818  bool ReadOld200( ON_BinaryArchive&, int ); // reads legacy trimmed surface
3821 
3822  // helpers for reading legacy v1 trimmed surfaces and breps
3829 };
3830 
3831 ///////////////////////////////////////////////////////////////////////////////
3832 //
3833 // brep construction tools
3834 //
3835 
3836 /*
3837 Description:
3838  Create a brep representation of a mesh.
3839 Parameters:
3840  mesh_topology - [in]
3841  bTrimmedTriangles - [in] if true, triangles in the mesh
3842  will be represented by trimmed planes in the brep.
3843  If false, triangles in the mesh will be represented by
3844  untrimmed singular bilinear NURBS surfaces in the brep.
3845  pBrep - [in] If not NULL, this the mesh representation will
3846  be put into this brep.
3847 Example:
3848 
3849  ON_Mesh mesh = ...;
3850  ON_Brep* pBrep = ON_BrepFromMesh( mesh.Topology() );
3851  ...
3852  delete pBrep;
3853 
3854 See Also
3855  ON_BrepFromMesh( const ON_Mesh& mesh, ... );
3856 */
3857 ON_DECL
3858 ON_Brep* ON_BrepFromMesh(
3859  const ON_MeshTopology& mesh_topology,
3860  ON_BOOL32 bTrimmedTriangles = true,
3861  ON_Brep* pBrep = NULL
3862  );
3863 
3864 /*
3865 Description:
3866  Get an ON_Brep definition of a box.
3867 Parameters:
3868  box_corners - [in] 8 points defining the box corners
3869  arranged as the vN lables indicate.
3870 
3871  v7_______e6_____v6
3872  |\ |\
3873  | e7 | e5
3874  | \ ______e4_____\
3875  e11 v4 | v5
3876  | | e10 |
3877  | | | |
3878  v3---|---e2----v2 e9
3879  \ e8 \ |
3880  e3 | e1 |
3881  \ | \ |
3882  \v0_____e0_____\v1
3883 
3884  pBrep - [in] if not NULL, this brep will be used and
3885  returned.
3886 Returns:
3887  An ON_Brep representation of the box with topology
3888 
3889  edge vertices
3890  m_E[ 0] m_V[0], m_V[1]
3891  m_E[ 1] m_V[1], m_V[2]
3892  m_E[ 2] m_V[2], m_V[3]
3893  m_E[ 3] m_V[3], m_V[0]
3894  m_E[ 4] m_V[4], m_V[5]
3895  m_E[ 5] m_V[5], m_V[6]
3896  m_E[ 6] m_V[6], m_V[7]
3897  m_E[ 7] m_V[7], m_V[4]
3898  m_E[ 8] m_V[0], m_V[4]
3899  m_E[ 9] m_V[1], m_V[5]
3900  m_E[10] m_V[2], m_V[6]
3901  m_E[11] m_V[3], m_V[7]
3902 
3903  face boundary edges
3904  m_F[0] +m_E[0] +m_E[9] -m_E[4] -m_E[8]
3905  m_F[1] +m_E[1] +m_E[10] -m_E[5] -m_E[9]
3906  m_F[2] +m_E[2] +m_E[11] -m_E[6] -m_E[10]
3907  m_F[3] +m_E[3] +m_E[8] -m_E[7] -m_E[11]
3908  m_F[4] -m_E[3] -m_E[2] -m_E[1] -m_E[0]
3909 // m_F[5] +m_E[4] +m_E[5] +m_E[6] +m_E[7]
3910 */
3911 ON_DECL
3912 ON_Brep* ON_BrepBox( const ON_3dPoint* box_corners, ON_Brep* pBrep = NULL );
3913 
3914 /*
3915 Description:
3916  Get an ON_Brep definition of a wedge.
3917 Parameters:
3918  corners - [in] 6 points defining the box corners
3919  arranged as the vN lables indicate.
3920 
3921  /v5
3922  /|\
3923  / | \
3924  e5 | e4
3925  / e8 \
3926  /__e3_____\
3927  v3| | |v4
3928  | | |
3929  | /v2 |
3930  e6 / \ e7
3931  | / \ |
3932  | e2 e1|
3933  |/ \|
3934  /____e0___\
3935  v0 v1
3936 
3937  pBrep - [in] if not NULL, this brep will be used and
3938  returned.
3939 Returns:
3940  An ON_Brep representation of the wedge with topology
3941 
3942  edge vertices
3943  m_E[ 0] m_V[0], m_V[1]
3944  m_E[ 1] m_V[1], m_V[2]
3945  m_E[ 2] m_V[2], m_V[0]
3946  m_E[ 3] m_V[3], m_V[4]
3947  m_E[ 4] m_V[4], m_V[5]
3948  m_E[ 5] m_V[5], m_V[0]
3949  m_E[ 6] m_V[0], m_V[3]
3950  m_E[ 7] m_V[1], m_V[4]
3951  m_E[ 8] m_V[2], m_V[5]
3952 
3953  face boundary edges
3954  m_F[0] +m_E[0] +m_E[7] -m_E[3] -m_E[6]
3955  m_F[1] +m_E[1] +m_E[8] -m_E[4] -m_E[7]
3956  m_F[2] +m_E[2] +m_E[6] -m_E[5] -m_E[8]
3957  m_F[3] +m_E[3] +m_E[8] -m_E[7] -m_E[11]
3958  m_F[4] -m_E[2] -m_E[1] -m_E[0]
3959  m_F[5] +m_E[3] +m_E[4] +m_E[5]
3960 */
3961 ON_DECL
3962 ON_Brep* ON_BrepWedge( const ON_3dPoint* corners, ON_Brep* pBrep = NULL );
3963 
3964 /*
3965 Description:
3966  Get an ON_Brep definition of a sphere.
3967 Parameters:
3968  sphere - [in]
3969  pBrep - [in] if not NULL, this brep will be used and
3970  returned.
3971 Returns:
3972  An ON_Brep representation of the sphere with a single face,
3973  a single edge along the seam, and vertices at the north
3974  and south poles.
3975 */
3976 ON_DECL
3977 ON_Brep* ON_BrepSphere( const ON_Sphere& sphere, ON_Brep* pBrep = NULL );
3978 
3979 /*
3980 Description:
3981  Get an ON_Brep definition of a torus.
3982 Parameters:
3983  torus - [in]
3984  pBrep - [in] if not NULL, this brep will be used and
3985  returned.
3986 Returns:
3987  An ON_Brep representation of the torus with a single face
3988  a two edges along the seams.
3989 */
3990 ON_DECL
3991 ON_Brep* ON_BrepTorus( const ON_Torus& torus, ON_Brep* pBrep = NULL );
3992 
3993 /*
3994 Description:
3995  Get an ON_Brep definition of a cylinder.
3996 Parameters:
3997  cylinder - [in] cylinder.IsFinite() must be true
3998  bCapBottom - [in] if true end at cylinder.m_height[0] should be capped
3999  bCapTop - [in] if true end at cylinder.m_height[1] should be capped
4000  pBrep - [in] if not NULL, this brep will be used and
4001  returned.
4002 Returns:
4003  An ON_Brep representation of the cylinder with a single
4004  face for the cylinder, an edge along the cylinder seam,
4005  and vertices at the bottom and top ends of this seam edge.
4006  The optional bottom/top caps are single faces with one
4007  circular edge starting and ending at the bottom/top vertex.
4008 */
4009 ON_DECL
4010 ON_Brep* ON_BrepCylinder( const ON_Cylinder& cylinder,
4011  ON_BOOL32 bCapBottom,
4012  ON_BOOL32 bCapTop,
4013  ON_Brep* pBrep = NULL );
4014 
4015 /*
4016 Description:
4017  Get an ON_Brep definition of a cone.
4018 Parameters:
4019  cylinder - [in] cylinder.IsFinite() must be true
4020  bCapBase - [in] if true the base of the cone should be capped.
4021  pBrep - [in] if not NULL, this brep will be used and
4022  returned.
4023 Returns:
4024  An ON_Brep representation of the cone with a single
4025  face for the cone, an edge along the cone seam,
4026  and vertices at the base and apex ends of this seam edge.
4027  The optional cap is asingle face with one circular edge
4028  starting and ending at the base vertex.
4029 */
4030 ON_DECL
4031 ON_Brep* ON_BrepCone(
4032  const ON_Cone& cone,
4033  ON_BOOL32 bCapBottom,
4034  ON_Brep* pBrep = NULL
4035  );
4036 
4037 /*
4038 Description:
4039  Get an ON_Brep form of a surface of revolution.
4040 Parameters:
4041  pRevSurface - [in] pointer to a surface of revolution.
4042  The brep will manage this pointer and delete it in ~ON_Brep.
4043  bCapStart - [in] if true, the start of the revolute is
4044  not on the axis of revolution, and the surface of revolution
4045  is closed, then a circular cap will be added to close
4046  of the hole at the start of the revolute.
4047  bCapEnd - [in] if true, the end of the revolute is
4048  not on the axis of revolution, and the surface of revolution
4049  is closed, then a circular cap will be added to close
4050  of the hole at the end of the revolute.
4051  pBrep - [in] if not NULL, this brep will be used and
4052  returned.
4053 Returns:
4054  @untitled table
4055  true successful
4056  false brep cannot be created from this surface.
4057 Remarks:
4058  The surface class must be created with new because
4059  it will be destroyed with the delete operator
4060  in ~ON_Brep.
4061 */
4062 ON_DECL
4063 ON_Brep* ON_BrepRevSurface(
4064  ON_RevSurface*& pRevSurface,
4065  ON_BOOL32 bCapStart,
4066  ON_BOOL32 bCapEnd,
4067  ON_Brep* pBrep = NULL
4068  );
4069 
4070 
4071 
4072 /*
4073 Description:
4074  Create an ON_Brep trimmed plane.
4075 Parameters:
4076  plane - [in] plane that will be trimmed.
4077  boundary - [in] a simple (no self intersections) closed
4078  curve that defines the outer boundary of the trimmed
4079  plane. This curve is copied for use in the brep.
4080  pBrep - [in] if not NULL, this brep will be used and returned.
4081 Returns:
4082  An ON_Brep representation of the trimmed plane with a single face.
4083 See Also:
4084  ON_Brep::NewPlanarFaceLoop()
4085 */
4086 ON_DECL
4087 ON_Brep* ON_BrepTrimmedPlane(
4088  const ON_Plane& plane,
4089  const ON_Curve& boundary,
4090  ON_Brep* pBrep = NULL );
4091 
4092 /*
4093 Description:
4094  Get an ON_Brep definition of a trimmed plane.
4095 Parameters:
4096  plane - [in] plane that will be trimmed.
4097  boundary - [in] a list of 3d curves that form a simple
4098  (no self intersections) closed curve that defines the
4099  outer boundary of the trimmed plane.
4100  bDuplicateCurves - [in] if true, duplicates of the
4101  curves in the boundary array are used in the brep. If false
4102  the curves in the boundary array are used in the brep
4103  and the brep's destructor will delete the curves.
4104  pBrep - [in] if not NULL, this brep will be used and
4105  returned.
4106 Returns:
4107  An ON_Brep representation of the trimmed plane with a singe face.
4108 See Also:
4109  ON_Brep::NewPlanarFaceLoop()
4110 */
4111 ON_DECL
4112 ON_Brep* ON_BrepTrimmedPlane(
4113  const ON_Plane& plane,
4114  ON_SimpleArray<ON_Curve*>& boundary,
4115  ON_BOOL32 bDuplicateCurves = true,
4116  ON_Brep* pBrep = NULL );
4117 
4118 
4119 /*
4120 Description:
4121  Extrude a brep
4122 Parameters:
4123  brep - [in/out]
4124  path_curve - [in] path to extrude along.
4125  bCap - [in] if true, the extusion is capped with a translation
4126  of the input brep.
4127 Returns:
4128  True if successful.
4129 See Also:
4130  ON_BrepExtrudeFace
4131  ON_BrepExtrudeLoop
4132  ON_BrepExtrudeEdge
4133  ON_BrepExtrudeVertex
4134  ON_BrepConeFace
4135  ON_BrepConeLoop
4136  ON_BrepConeEdge
4137 Remarks:
4138  The new faces are appended to brep.m_F[]. It is the caller's
4139  responsibility to insure the result does not self intersect.
4140 */
4141 ON_DECL
4142 bool ON_BrepExtrude(
4143  ON_Brep& brep,
4144  const ON_Curve& path_curve,
4145  bool bCap = true
4146  );
4147 
4148 /*
4149 Description:
4150  Extrude a face in a brep.
4151 Parameters:
4152  brep - [in/out]
4153  face_index - [in] index of face to extrude.
4154  path_curve - [in] path to extrude along.
4155  bCap - [in] if true, the extusion is capped with a translation
4156  of the face being extruded.
4157 Example:
4158  Extrude a face along a vector.
4159 
4160  ON_Brep brep = ...;
4161  int face_index = ...;
4162  ON_3dVector v = ...;
4163  ON_LineCurve line_curve( ON_Line( ON_origin, vector ) );
4164  ON_BrepExtrudeFace( brep, face_index, line_curve, true );
4165 
4166 Returns:
4167  @untitled table
4168  0 failure
4169  1 successful - no cap added
4170  2 successful - cap added as last face
4171 See Also:
4172  ON_BrepExtrude
4173  ON_BrepExtrudeLoop
4174  ON_BrepExtrudeEdge
4175  ON_BrepExtrudeVertex
4176  ON_BrepConeFace
4177  ON_BrepConeLoop
4178  ON_BrepConeEdge
4179 Remarks:
4180  The new faces are appended to brep.m_F[]. If a cap is requested
4181  it is the last face in the returned brep.m_F[]
4182 */
4183 ON_DECL
4184 int ON_BrepExtrudeFace(
4185  ON_Brep& brep,
4186  int face_index,
4187  const ON_Curve& path_curve,
4188  bool bCap = true
4189  );
4190 
4191 /*
4192 Description:
4193  Extrude a loop in a brep.
4194 Parameters:
4195  brep - [in/out]
4196  loop_index - [in] index of face to extrude.
4197  path_curve - [in] path to extrude along.
4198  bCap - [in] if true and the loop is closed, the extusion
4199  is capped.
4200 Returns:
4201  @untitled table
4202  0 failure
4203  1 successful - no cap added
4204  2 successful - cap added as last face
4205 See Also:
4206  ON_BrepExtrude
4207  ON_BrepExtrudeFace
4208  ON_BrepExtrudeEdge
4209  ON_BrepExtrudeVertex
4210  ON_BrepConeFace
4211  ON_BrepConeLoop
4212  ON_BrepConeEdge
4213 Remarks:
4214  The new faces are appended to brep.m_F[]. If a cap is requested
4215  it is the last face in the returned brep.m_F[]
4216 */
4217 ON_DECL
4218 int ON_BrepExtrudeLoop(
4219  ON_Brep& brep,
4220  int loop_index,
4221  const ON_Curve& path_curve,
4222  bool bCap = true
4223  );
4224 
4225 /*
4226 Description:
4227  Extrude an edge in a brep.
4228 Parameters:
4229  brep - [in/out]
4230  edge_index - [in] index of face to extrude.
4231  path_curve - [in] path to extrude along.
4232 Returns:
4233  @untitled table
4234  0 failure
4235  1 successful
4236 See Also:
4237  ON_BrepExtrude
4238  ON_BrepExtrudeFace
4239  ON_BrepExtrudeLoop
4240  ON_BrepExtrudeVertex
4241  ON_BrepConeFace
4242  ON_BrepConeLoop
4243  ON_BrepConeEdge
4244 Remarks:
4245  The new face is appended to brep.m_F[].
4246 */
4247 ON_DECL
4248 int ON_BrepExtrudeEdge(
4249  ON_Brep& brep,
4250  int edge_index,
4251  const ON_Curve& path_curve
4252  );
4253 
4254 
4255 /*
4256 Description:
4257  Extrude a vertex in a brep.
4258 Parameters:
4259  brep - [in/out]
4260  vertex_index - [in] index of vertex to extrude.
4261  path_curve - [in] path to extrude along.
4262 Returns:
4263  @untitled table
4264  0 failure
4265  1 successful
4266 See Also:
4267  ON_BrepExtrude
4268  ON_BrepExtrudeFace
4269  ON_BrepExtrudeLoop
4270  ON_BrepExtrudeEdge
4271  ON_BrepConeFace
4272  ON_BrepConeLoop
4273  ON_BrepConeEdge
4274 Remarks:
4275  The new vertex is appended to brep.m_V[] and
4276  the new edge is appended to brep.m_E[].
4277 */
4278 ON_DECL
4279 int ON_BrepExtrudeVertex(
4280  ON_Brep& brep,
4281  int vertex_index,
4282  const ON_Curve& path_curve
4283  );
4284 
4285 
4286 /*
4287 Description:
4288  Cone a face in a brep.
4289 Parameters:
4290  brep - [in/out]
4291  face_index - [in] index of face to extrude.
4292  apex_point - [in] apex of cone.
4293 Returns:
4294  @untitled table
4295  0 failure
4296  1 successful
4297 See Also:
4298  ON_BrepExtrudeFace
4299  ON_BrepExtrudeLoop
4300  ON_BrepExtrudeEdge
4301  ON_BrepExtrudeVertex
4302  ON_BrepConeFace
4303  ON_BrepConeLoop
4304  ON_BrepConeEdge
4305 Remarks:
4306  The new faces are appended to brep.m_F[].
4307 */
4308 ON_DECL
4309 int ON_BrepConeFace(
4310  ON_Brep& brep,
4311  int face_index,
4312  ON_3dPoint apex_point
4313  );
4314 
4315 /*
4316 Description:
4317  Cone a loop in a brep.
4318 Parameters:
4319  brep - [in/out]
4320  loop_index - [in] index of face to extrude.
4321  apex_point - [in] apex of cone.
4322 Returns:
4323  @untitled table
4324  0 failure
4325  1 successful
4326 See Also:
4327  ON_BrepExtrudeFace
4328  ON_BrepExtrudeLoop
4329  ON_BrepExtrudeEdge
4330  ON_BrepExtrudeVertex
4331  ON_BrepConeFace
4332  ON_BrepConeLoop
4333  ON_BrepConeEdge
4334 Remarks:
4335  The new faces are appended to brep.m_F[].
4336 */
4337 ON_DECL
4338 bool ON_BrepConeLoop(
4339  ON_Brep& brep,
4340  int loop_index,
4341  ON_3dPoint apex_point
4342  );
4343 
4344 /*
4345 Description:
4346  Cone an edge in a brep.
4347 Parameters:
4348  brep - [in/out]
4349  edge_index - [in] index of face to extrude.
4350  apex_point - [in] apex of cone.
4351 Returns:
4352  @untitled table
4353  0 failure
4354  1 successful
4355 See Also:
4356  ON_BrepExtrudeFace
4357  ON_BrepExtrudeLoop
4358  ON_BrepExtrudeEdge
4359  ON_BrepExtrudeVertex
4360  ON_BrepConeFace
4361  ON_BrepConeLoop
4362  ON_BrepConeEdge
4363 Remarks:
4364  The new face is appended to brep.m_F[].
4365 */
4366 ON_DECL
4367 int ON_BrepConeEdge(
4368  ON_Brep& brep,
4369  int edge_index,
4370  ON_3dPoint apex_point
4371  );
4372 
4373 //These merge adjacent faces that have the same underlying surface.
4374 ON_DECL
4375 int ON_BrepMergeFaces(ON_Brep& B, int fid0, int fid1);
4376 
4377 ON_DECL
4378 bool ON_BrepMergeFaces(ON_Brep& B);
4379 
4380 //This removes all slit trims from F that are not joined to another face.
4381 //Unlike ON_Brep::RemoveSlits(), this will remove slit pairs from a loop in cases
4382 //that will result in the creation of more loops. Caller is responsible for calling
4383 //ON_Brep::Compact() to get rid of deleted trims and loops.
4384 
4385 ON_DECL
4386 bool ON_BrepRemoveSlits(ON_BrepFace& F);
4387 
4388 //Merges all possible edges
4389 ON_DECL
4390 void ON_BrepMergeAllEdges(ON_Brep& B);
4391 
4392 /*
4393 Description:
4394  Merges two breps into a single brep. The
4395  result may be non-manifold or have multiple
4396  connected components.
4397 Parameters:
4398  brep0 - [in]
4399  brep1 - [in]
4400  tolerance - [in]
4401 Returns:
4402  Merged brep or NULL if calculation failed.
4403 */
4404 ON_DECL
4405 ON_Brep* ON_MergeBreps(
4406  const ON_Brep& brep0,
4407  const ON_Brep& brep1,
4408  double tolerance
4409  );
4410 
4411 #endif
bool ReadV1_TCODE_LEGACY_FAC(ON_Object **, ON_3dmObjectAttributes *)
bool ReadV1_TCODE_LEGACY_SHL(ON_Object **, ON_3dmObjectAttributes *)
ON_BOOL32 Write(ON_BinaryArchive &) const
ON_BOOL32 Read(ON_BinaryArchive &)
unsigned int SizeOf() const
ON_BOOL32 SetStartPoint(ON_3dPoint start_point)
ON_Brep * Brep() const
int TrimCount() const
ON_BrepVertex * Vertex(int evi) const
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
ON_COMPONENT_INDEX ComponentIndex() const
ON::object_type ObjectType() const
ON_BrepEdge(int)
ON_BOOL32 IsClosed() const
bool ChangeEdgeCurve(int c3i)
void Dump(ON_TextLog &) const
const ON_Curve * EdgeCurveOf() const
ON_BOOL32 Write(ON_BinaryArchive &) const
int EdgeCurveIndexOf() const
ON_SimpleArray< int > m_ti
ON_BOOL32 Reverse()
ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
ON_BrepTrim * Trim(int eti) const
ON_BrepEdge & operator=(const ON_BrepEdge &)
unsigned int SizeOf() const
ON_BOOL32 Read(ON_BinaryArchive &)
double m_tolerance
ON_BOOL32 SetEndPoint(ON_3dPoint end_point)
void UnsetPlineEdgeParameters()
ON_BOOL32 Write(ON_BinaryArchive &) const
ON_BOOL32 Read(ON_BinaryArchive &)
unsigned int SizeOf() const
class ON_BrepFaceSide * FaceSide(int dir) const
ON_BrepLoop * Loop(int fli) const
ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
int SurfaceIndexOf() const
bool TransformTrim(const ON_Xform &xform)
ON_BOOL32 Reverse(int dir)
friend class ON_Brep
ON_BOOL32 Write(ON_BinaryArchive &) const
unsigned int SizeOf() const
int LoopCount() const
bool SetMesh(ON::mesh_type, ON_Mesh *mesh)
ON_BrepFace(int)
ON_BOOL32 Transpose()
bool ChangeSurface(int si)
ON_SimpleArray< int > m_li
ON_BOOL32 Read(ON_BinaryArchive &)
ON_BrepFace & operator=(const ON_BrepFace &)
void ClearBoundingBox()
bool ChangeSurface(int si, bool bTransformTrimCurves)
ON_COMPONENT_INDEX ComponentIndex() const
ON_BrepLoop * OuterLoop() const
ON_Brep * Brep() const
ON_BOOL32 SetDomain(int dir, double t0, double t1)
const ON_Mesh * Mesh(ON::mesh_type mesh_type) const
bool SetDomain(ON_Interval udom, ON_Interval vdom)
void Dump(ON_TextLog &) const
ON_UUID m_face_uuid
int m_face_material_channel
const ON_Surface * SurfaceOf() const
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
ON_BOOL32 GetBBox(double *, double *, ON_BOOL32=false) const
void DestroyRuntimeCache(bool bDelete=true)
void DestroyMesh(ON::mesh_type mesh_type, bool bDeleteMesh=true)
bool Read(ON_BinaryArchive &)
bool Write(ON_BinaryArchive &) const
unsigned int SizeOf() const
class ON_BrepRegion * Region() const
class ON_BrepFace * Face() const
friend class ON_Brep
friend class ON_BrepRegionTopology
ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
int SurfaceNormalDirection() const
ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
class ON_BrepRegionTopology * RegionTopology() const
ON_Brep * Brep() const
ON_BrepFaceSide & operator=(const ON_BrepFaceSide &)
void ClearBoundingBox()
friend class ON_BrepFace
bool SwapTrimParameters(int)
bool CullUnused3dCurves()
bool SortFaceLoops(ON_BrepFace &face) const
ON::object_type ObjectType() const
ON_BrepTrim & NewTrim(int c2i=-1)
bool IsValidEdgeGeometry(int edge_index, ON_TextLog *text_log) const
int EdgeCurveUseCount(int c3_index, int max_count=0) const
ON_BrepFace & NewFace(int si=-1)
bool RemoveSlits(ON_BrepFace &F)
ON_BrepTrim & NewTrim(ON_BrepEdge &edge, ON_BOOL32 bRev3d, ON_BrepLoop &loop, int c2i=-1)
bool IsValidVertexTolerancesAndFlags(int vertex_index, ON_TextLog *text_log) const
bool ReadV1_LegacyTrim(ON_BinaryArchive &, ON_BrepFace &, ON_BrepLoop &)
ON_BrepLoop * Loop(int loop_index) const
ON_BrepEdgeArray m_E
void StandardizeFaceSurfaces()
ON_BOOL32 Read(ON_BinaryArchive &)
bool Create(ON_SumSurface *&pSumSurface)
bool StandardizeFaceSurface(int face_index)
bool SetTrimCurve(ON_BrepTrim &trim, int c2_index, const ON_Interval *sub_domain=NULL)
bool IsValidLoopTopology(int loop_index, ON_TextLog *text_log) const
void MemoryRelocate()
bool ReadV1_LegacyLoopStuff(ON_BinaryArchive &, ON_BrepFace &)
bool ChangeVertex(int old_vi, int new_vi, bool bClearTolerances)
void LabelConnectedComponent(int face_index, int label)
bool ReadV1_LegacyTrimStuff(ON_BinaryArchive &, ON_BrepFace &, ON_BrepLoop &)
ON_BrepFaceArray m_F
ON_BrepTrimArray m_T
ON_BrepLoop * Loop(ON_COMPONENT_INDEX loop_index) const
bool RemoveNesting(bool bExtractSingleSegments, bool bEdges=true, bool bTrimCurves=true)
int GetConnectedComponents(ON_SimpleArray< ON_Brep * > &components, bool bDuplicateMeshes) const
ON_BrepTrim & NewTrim(ON_BrepEdge &edge, ON_BOOL32 bRev3d, int c2i=-1)
void Delete2dCurve(int c2_index)
ON_BrepVertex & NewVertex(ON_3dPoint vertex_point, double vertex_tolerance=ON_UNSET_VALUE)
int RemoveWireVertices()
bool GetTrim2dStart(int trim_index, ON_2dPoint &) const
void Append(const ON_Brep &)
int RemoveWireEdges(bool bDeleteVertices=true)
void Clear_edge_user_i(int)
int MergeFaces(int fid0, int fid1)
void SetTolerancesBoxesAndFlags(ON_BOOL32 bLazy=false, ON_BOOL32 bSetVertexTolerances=true, ON_BOOL32 bSetEdgeTolerances=true, ON_BOOL32 bSetTrimTolerances=true, ON_BOOL32 bSetTrimIsoFlags=true, ON_BOOL32 bSetTrimTypeFlags=true, ON_BOOL32 bSetLoopTypeFlags=true, ON_BOOL32 bSetTrimBoxes=true)
void DestroyRuntimeCache(bool bDelete=true)
ON_Brep * BrepForm(ON_Brep *brep=NULL) const
bool SetEdgeVertex(const int, const int, const int)
ON_BrepFace * NewRuledFace(const ON_BrepEdge &edgeA, bool bRevEdgeA, const ON_BrepEdge &edgeB, bool bRevEdgeB)
bool IsPointInside(ON_3dPoint P, double tolerance, bool bStrictlyInside) const
bool GetTrim2dEnd(int, ON_2dPoint &) const
bool CullUnusedTrims()
bool IsManifold(ON_BOOL32 *pbIsOriented=NULL, ON_BOOL32 *pbHasBoundary=NULL) const
bool IsDuplicate(const ON_Brep &other, double tolerance=ON_ZERO_TOLERANCE) const
bool CullUnused2dCurves()
void Standardize()
bool CombineCoincidentVertices(ON_BrepVertex &, ON_BrepVertex &)
bool CullUnusedSurfaces()
bool IsValidFaceGeometry(int face_index, ON_TextLog *text_log) const
ON_BOOL32 HasBrepForm() const
bool IsValidLoop(int loop_index, ON_TextLog *text_log) const
bool Create(ON_RevSurface *&pRevSurface)
void SetVertices(void)
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
bool IsValidForV2() const
ON_BOOL32 GetBBox(double *, double *, ON_BOOL32=false) const
bool SetEdgeDomain(int, const ON_Interval &)
void SetTrimIsoFlag(int)
ON_BrepLoop * NewOuterLoop(int face_index)
bool SetTrimStartVertex(const int, const int)
void DeleteFace(ON_BrepFace &face, ON_BOOL32 bDeleteFaceEdges)
bool IsSolid() const
ON_BrepVertex & NewVertex()
bool IsValidEdgeTolerancesAndFlags(int edge_index, ON_TextLog *text_log) const
ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
void DeleteTrim(ON_BrepTrim &trim, ON_BOOL32 bDeleteTrimEdges)
ON_SurfaceArray m_S
ON_BrepEdge & NewEdge(ON_BrepVertex &, ON_BrepVertex &, int=-1, const ON_Interval *=NULL, double edge_tolerance=ON_UNSET_VALUE)
ON_BrepVertex * Vertex(ON_COMPONENT_INDEX vertex_index) const
ON_BrepFace * NewConeFace(const ON_BrepVertex &vertex, const ON_BrepEdge &edge, bool bRevEdge)
bool IsValidFace(int face_index, ON_TextLog *text_log) const
int SurfaceUseCount(int surface_index, int max_count=0) const
bool SetTrimTolerances(ON_BOOL32 bLazy=false)
bool IsValidForV2(const ON_BrepTrim &) const
ON_BrepTrim * Trim(ON_COMPONENT_INDEX trim_index) const
bool HopAcrossEdge(int &, int &) const
ON_BrepFace * NewFace(const ON_Surface &surface)
int Dimension() const
void Clear_trim_user_i()
void DeleteVertex(ON_BrepVertex &vertex)
int LabelConnectedComponents()
ON_BoundingBox m_bbox
int AddEdgeCurve(ON_Curve *)
bool SwapLoopParameters(int)
int NextEdge(int current_edge_index, int endi, int *next_endi=NULL) const
ON_Curve * Loop2dCurve(const ON_BrepLoop &loop) const
void ClearEdgeVertices()
void StandardizeEdgeCurves(bool bAdjustEnds)
ON_BrepEdge * CombineContiguousEdges(int edge_index0, int edge_iindex1, double angle_tolerance_radians=ON_PI/180.0)
bool SetVertexTolerance(ON_BrepVertex &vertex, ON_BOOL32 bLazy=false) const
void Clear_vertex_user_i()
virtual bool SetEdgeTolerance(ON_BrepEdge &edge, ON_BOOL32 bLazy=false) const
ON_BrepFace * Face(int face_index) const
void Delete3dCurve(int c3_index)
ON_Curve * Loop3dCurve(const ON_BrepLoop &loop, ON_BOOL32 bRevCurveIfFaceRevIsTrue=false) const
virtual bool SetTrimBoundingBoxes(ON_BOOL32 bLazy=false)
void Set_user(ON_U u)
bool SetTrimTypeFlags(ON_BrepTrim &, ON_BOOL32 bLazy=false)
virtual bool SetTrimBoundingBoxes(ON_BrepFace &face, ON_BOOL32 bLazy=false)
void Initialize()
void SetLoopVertices(const int)
ON_BrepLoop::TYPE ComputeLoopType(const ON_BrepLoop &) const
bool ReadV1_LegacyShellStuff(ON_BinaryArchive &)
ON_Brep * SubBrep(int subfi_count, const int *sub_fi, ON_Brep *sub_brep=0) const
bool FaceIsSurface(int) const
int AddSurface(ON_Surface *)
bool CullUnusedLoops()
bool HasRegionTopology() const
void ClearTrimVertices()
bool ShrinkSurface(ON_BrepFace &face, int DisableSide=0)
const ON_Geometry * BrepComponent(ON_COMPONENT_INDEX ci) const
ON_BrepTrim & NewCurveOnFace(ON_BrepFace &face, ON_BrepEdge &edge, ON_BOOL32 bRev3d=false, int c2i=-1)
ON_BrepTrim * Trim(int trim_index) const
bool SetVertexTolerances(ON_BOOL32 bLazy=false)
bool CollapseEdge(int edge_index, bool bCloseTrimGap=true, int vertex_index=-1)
void Dump(ON_TextLog &) const
bool IsSurface() const
bool SetTrimTypeFlags(ON_BOOL32 bLazy=false)
bool GetTrim3dEnd(int, ON_3dPoint &) const
bool IsValidTolerancesAndFlags(ON_TextLog *text_log=NULL) const
ON_BrepLoop & NewLoop(ON_BrepLoop::TYPE loop_type, ON_BrepFace &face)
bool IsValidTrimTolerancesAndFlags(int trim_index, ON_TextLog *text_log) const
ON_Surface * Read100_BrepSurface(ON_BinaryArchive &) const
ON_BrepEdge * Edge(int edge_index) const
bool RemoveSlits()
void Clear_loop_user_i()
bool IsValidVertex(int vertex_index, ON_TextLog *text_log) const
ON_BrepVertexArray m_V
bool FlipReversedSurfaces()
unsigned int SizeOf() const
void DeleteLoop(ON_BrepLoop &loop, ON_BOOL32 bDeleteLoopEdges)
ON_BrepFace * NewFace(ON_Surface *pSurface, int vid[4], int eid[4], ON_BOOL32 bRev3d[4])
bool IsValidTopology(ON_TextLog *text_log=NULL) const
bool SetTrimIsoFlags(ON_BrepTrim &)
ON_BrepLoop & NewLoop(ON_BrepLoop::TYPE)
bool StandardizeEdgeCurve(int edge_index, bool bAdjustEnds)
bool SetTrimTypeFlags(ON_BrepLoop &, ON_BOOL32 bLazy=false)
ON_Curve * Read100_BrepCurve(ON_BinaryArchive &) const
virtual bool SetTrimTolerance(ON_BrepTrim &trim, ON_BOOL32 bLazy=false) const
void DestroyMesh(ON::mesh_type mesh_type, bool bDeleteMesh=true)
ON_Brep * ExtractFace(int face_index)
bool CullUnusedFaces()
bool IsValidLoopGeometry(int loop_index, ON_TextLog *text_log) const
void DeleteEdge(ON_BrepEdge &edge, ON_BOOL32 bDeleteEdgeVertices)
bool NewPlanarFaceLoop(int face_index, ON_BrepLoop::TYPE loop_type, ON_SimpleArray< ON_Curve * > &boundary, ON_BOOL32 bDuplicateCurves=true)
virtual bool SetTrimBoundingBox(ON_BrepTrim &trim, ON_BOOL32 bLazy=false)
bool CullUnusedEdges()
ON_BrepVertex & NewPointOnFace(ON_BrepFace &face, double s, double t)
void Clear_user_i()
bool MergeFaces()
bool ReadOld101(ON_BinaryArchive &)
void Destroy()
bool StandardizeTrimCurve(int trim_index)
bool SetTrimDomain(int, const ON_Interval &)
ON_BOOL32 Transform(const ON_Xform &)
bool SetEdgeTolerances(ON_BOOL32 bLazy=false)
bool GetTrim3dStart(int, ON_3dPoint &) const
bool IsValidVertexGeometry(int vertex_index, ON_TextLog *text_log) const
void Flip()
bool ReadOld100(ON_BinaryArchive &)
friend class ON_BrepFaceSide
ON_BrepLoop * NewOuterLoop(int face_index, int vid[4], int eid[4], ON_BOOL32 bRev3d[4])
bool IsValidVertexTopology(int vertex_index, ON_TextLog *text_log) const
bool Compact()
bool IsValidLoopTolerancesAndFlags(int loop_index, ON_TextLog *text_log) const
ON_Brep(const ON_Brep &)
bool SetEdgeCurve(ON_BrepEdge &edge, int c3_index, const ON_Interval *sub_domain=NULL)
ON_BOOL32 Write(ON_BinaryArchive &) const
bool IsValidFaceTopology(int face_index, ON_TextLog *text_log) const
int Loop3dCurve(const ON_BrepLoop &loop, ON_SimpleArray< ON_Curve * > &curve_list, ON_BOOL32 bRevCurveIfFaceRevIsTrue=false) const
bool ReadV1_LegacyLoop(ON_BinaryArchive &, ON_BrepFace &)
bool IsValidTrimTopology(int trim_index, ON_TextLog *text_log) const
void EmergencyDestroy()
ON_DEPRECATED void StardardizeFaceSurfaces()
void FlipFace(ON_BrepFace &)
ON_U m_brep_user
bool SetTrimIsoFlags(ON_BrepLoop &)
bool IsValidGeometry(ON_TextLog *text_log=NULL) const
ON_BrepTrim & NewSingularTrim(const ON_BrepVertex &vertex, ON_BrepLoop &loop, ON_Surface::ISO iso, int c2i=-1)
bool Create(ON_PlaneSurface *&pPlaneSurface)
bool SetTrimIsoFlags()
bool IsValidTrimGeometry(int trim_index, ON_TextLog *text_log) const
void FlipLoop(ON_BrepLoop &)
int PrevTrim(int) const
bool Create(ON_NurbsSurface *&pNurbsSurface)
int GetMesh(ON::mesh_type mesh_type, ON_SimpleArray< const ON_Mesh * > &meshes) const
int CreateMesh(const ON_MeshParameters &mp, ON_SimpleArray< ON_Mesh * > &mesh_list) const
ON_CurveArray m_C3
int TrimCurveUseCount(int c2_index, int max_count=0) const
void StandardizeTrimCurves()
static ON_Brep * New()
int AddTrimCurve(ON_Curve *)
ON_BrepFace * Face(ON_COMPONENT_INDEX face_index) const
void Clear_face_user_i()
bool SetTrimIsoFlags(ON_BrepFace &)
ON_BrepVertex * Vertex(int vertex_index) const
bool IsValidForV2(const ON_BrepEdge &) const
ON_BrepTrim & NewTrim(ON_BOOL32 bRev3d, ON_BrepLoop &loop, int c2i=-1)
void DestroyRegionTopology()
bool IsValidEdgeTopology(int edge_index, ON_TextLog *text_log) const
ON_CurveArray m_C2
void SetTolsFromLegacyValues()
void SetTrimIsoFlag(int, double[6])
bool IsValidEdge(int edge_index, ON_TextLog *text_log) const
virtual int SolidOrientation() const
bool CombineCoincidentEdges(ON_BrepEdge &, ON_BrepEdge &)
bool ReadV1_LegacyFaceStuff(ON_BinaryArchive &)
const ON_BrepRegionTopology & RegionTopology() const
virtual bool SetTrimBoundingBoxes(ON_BrepLoop &loop, ON_BOOL32 bLazy=false)
ON_Brep * DuplicateFace(int face_index, ON_BOOL32 bDuplicateMeshes) const
ON_BrepTrim::TYPE TrimType(const ON_BrepTrim &trim, ON_BOOL32 bLazy=true) const
void Clear_edge_user_i()
ON_BrepLoopArray m_L
bool ReadOld200(ON_BinaryArchive &, int)
friend class ON_BrepRegion
bool Create(ON_Surface *&pSurface)
ON_Brep & operator=(const ON_Brep &)
ON_BrepEdge * Edge(ON_COMPONENT_INDEX edge_index) const
bool CullUnusedVertices()
bool IsValidFaceTolerancesAndFlags(int face_index, ON_TextLog *text_log) const
bool StandardizeEdgeCurve(int edge_index, bool bAdjustEnds, int EdgeCurveUse)
bool IsValidTrim(int trim_index, ON_TextLog *text_log) const
bool SetTrimTypeFlags(ON_BrepFace &, ON_BOOL32 bLazy=false)
ON_Brep * DuplicateFaces(int face_count, const int *face_index, ON_BOOL32 bDuplicateMeshes) const
static ON_Brep * New(const ON_Brep &)
int PrevEdge(int current_edge_index, int endi, int *prev_endi=NULL) const
bool EvaluatePoint(const class ON_ObjRef &objref, ON_3dPoint &P) const
bool LoopIsSurfaceBoundary(int) const
int LoopDirection(const ON_BrepLoop &) const
bool CloseTrimGap(ON_BrepTrim &trim0, ON_BrepTrim &trim1)
ON_BOOL32 SwapCoordinates(int, int)
void DeleteSurface(int s_index)
bool ShrinkSurfaces()
ON_BrepEdge & NewEdge(int=-1)
int NextTrim(int) const
unsigned int SizeOf() const
ON_BOOL32 Read(ON_BinaryArchive &)
ON_BOOL32 Write(ON_BinaryArchive &) const
ON_BOOL32 Write(ON_BinaryArchive &) const
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
const ON_Surface * SurfaceOf() const
void Dump(ON_TextLog &) const
int SurfaceIndexOf() const
ON_COMPONENT_INDEX ComponentIndex() const
friend class ON_Brep
ON_BrepFace * Face() const
unsigned int SizeOf() const
ON_BOOL32 Read(ON_BinaryArchive &)
bool TransformTrim(const ON_Xform &xform)
ON_BOOL32 Transform(const ON_Xform &xform)
ON_SimpleArray< int > m_ti
ON_BrepTrim * Trim(int lti) const
int Dimension() const
int IndexOfTrim(const ON_BrepTrim &) const
ON_BrepLoop & operator=(const ON_BrepLoop &)
int TrimCount() const
ON_BOOL32 GetBBox(double *boxmin, double *boxmax, int bGrowBox=false) const
void DestroyRuntimeCache(bool bDelete=true)
ON_Brep * Brep() const
ON_BoundingBox m_pbox
ON_BrepLoop(int)
bool Read(ON_BinaryArchive &)
bool Write(ON_BinaryArchive &) const
unsigned int SizeOf() const
ON_BrepRegion & operator=(const ON_BrepRegion &)
ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
friend class ON_Brep
friend class ON_BrepRegionTopology
ON_SimpleArray< int > m_fsi
ON_BrepFaceSide * FaceSide(int rfsi) const
ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
ON_Brep * Brep() const
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
const ON_BoundingBox & BoundingBox() const
ON_BoundingBox m_bbox
class ON_BrepRegionTopology * RegionTopology() const
bool IsFinite() const
ON_Brep * RegionBoundaryBrep(ON_Brep *brep=NULL) const
ON_BrepRegionTopology(const ON_BrepRegionTopology &src)
ON_Brep * Brep() const
ON_BrepRegionTopology & operator=(const ON_BrepRegionTopology &)
ON_BrepFaceSideArray m_FS
unsigned int SizeOf() const
bool Write(ON_BinaryArchive &) const
bool IsValid(ON_TextLog *text_log=0) const
friend class ON_BrepRegionTopologyUserData
bool Read(ON_BinaryArchive &)
ON_BrepRegionArray m_R
unsigned int SizeOf() const
ON_BOOL32 Read(ON_BinaryArchive &)
ON_BOOL32 Write(ON_BinaryArchive &) const
bool IsSlit() const
ON_BrepLoop * Loop() const
int TrimCurveIndexOf() const
ON_BOOL32 SetEndPoint(ON_3dPoint end_point)
ON_BoundingBox m_pbox
ON_BrepTrim & operator=(const ON_BrepTrim &)
const ON_Curve * TrimCurveOf() const
ON_BrepVertex * Vertex(int tvi) const
void DestroyRuntimeCache(bool bDelete=true)
bool TransformTrim(const ON_Xform &xform)
friend class ON_Brep
int EdgeCurveIndexOf() const
void UnsetPlineEdgeParameters()
int SurfaceIndexOf() const
ON_BrepTrim(int)
bool ChangeTrimCurve(int c2i)
ON_Brep * Brep() const
int FaceIndexOf() const
const ON_Surface * SurfaceOf() const
ON_BOOL32 Write(ON_BinaryArchive &) const
bool AttachToEdge(int edge_index, bool bRev3d)
ON_SimpleArray< ON_BrepTrimPoint > m_pline
void m__legacy_flags_Set(int, int)
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
ON_BOOL32 Read(ON_BinaryArchive &)
ON_COMPONENT_INDEX ComponentIndex() const
double m__legacy_3d_tol
double m__legacy_2d_tol
unsigned int SizeOf() const
const ON_Curve * EdgeCurveOf() const
ON_BrepFace * Face() const
bool RemoveFromEdge(bool bRemoveFromStartVertex, bool bRemoveFromEndVertex)
bool m__legacy_flags_Get(int *, int *) const
ON_Surface::ISO m_iso
bool IsSeam() const
ON_BrepEdge * Edge() const
void Dump(ON_TextLog &) const
ON_BOOL32 SetStartPoint(ON_3dPoint start_point)
ON_BOOL32 Reverse()
void DestroyPspaceInformation()
unsigned int SizeOf() const
ON_BOOL32 Write(ON_BinaryArchive &) const
ON_BOOL32 Read(ON_BinaryArchive &)
ON_SimpleArray< int > m_ei
int EdgeCount() const
double Tolerance() const
ON_BOOL32 Write(ON_BinaryArchive &) const
ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
ON_COMPONENT_INDEX ComponentIndex() const
ON_3dPoint Point() const
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
bool SetPoint(const ON_3dPoint &)
ON_BOOL32 Read(ON_BinaryArchive &)
ON_BrepVertex & operator=(const ON_BrepVertex &)
void Dump(ON_TextLog &) const
unsigned int SizeOf() const
@ B
Definition: norms.h:54
@ unknown
Definition: ply.h:98