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