Go to the documentation of this file.00001 #include "pcl/surface/3rdparty/opennurbs/opennurbs.h"
00002 #include "pcl/surface/3rdparty/opennurbs/opennurbs_polyedgecurve.h"
00003
00004 ON_OBJECT_IMPLEMENT(ON_PolyEdgeSegment,ON_CurveProxy,"42F47A87-5B1B-4e31-AB87-4639D78325D6");
00005
00006 ON_PolyEdgeSegment::ON_PolyEdgeSegment()
00007 {
00008 Init();
00009 }
00010
00011 ON_PolyEdgeSegment::~ON_PolyEdgeSegment()
00012 {
00013 Init();
00014 }
00015
00016 void ON_PolyEdgeSegment::Init()
00017 {
00018 m_component_index.UnSet();
00019 m_object_id = ON_nil_uuid;
00020 m_brep = 0;
00021 m_trim = 0;
00022 m_edge = 0;
00023 m_face = 0;
00024 m_surface = 0;
00025 m_edge_domain.Destroy();
00026 m_trim_domain.Destroy();
00027 ON_CurveProxy::SetProxyCurve(0);
00028
00029 ClearEvalCacheHelper();
00030 }
00031
00032 bool ON_PolyEdgeSegment::Create(
00033 const ON_BrepTrim* trim,
00034 const ON_UUID& object_id
00035 )
00036 {
00037 Init();
00038 if ( !trim )
00039 return false;
00040 if ( trim->m_ei >= 0 )
00041 return false;
00042 const ON_Brep* brep = trim->Brep();
00043 if ( !brep )
00044 return false;
00045 const ON_BrepEdge* edge = trim->Edge();
00046 if ( !edge )
00047 return false;
00048 const ON_Curve* c3 = edge->EdgeCurveOf();
00049 if ( !c3 )
00050 return false;
00051 m_brep = brep;
00052 m_trim = trim;
00053 m_edge = edge;
00054 m_face = trim->Face();
00055 if ( m_face )
00056 m_surface = m_face->SurfaceOf();
00057 m_edge_domain = m_edge->Domain();
00058 m_trim_domain = m_trim->Domain();
00059 ON_CurveProxy::SetProxyCurve(
00060 c3,
00061 edge->ProxyCurveDomain()
00062 );
00063 if ( m_edge->ProxyCurveIsReversed() )
00064 ON_CurveProxy::Reverse();
00065 ON_CurveProxy::SetDomain( m_edge_domain[0], m_edge_domain[1] );
00066 m_component_index = trim->ComponentIndex();
00067 m_object_id = object_id;
00068 return true;
00069 }
00070
00071
00072 bool ON_PolyEdgeSegment::ReversedEdgeDir() const
00073 {
00074 bool rc = false;
00075 if ( m_edge )
00076 {
00077 rc = m_edge->ProxyCurveIsReversed() != ON_CurveProxy::ProxyCurveIsReversed();
00078 }
00079 return rc;
00080 }
00081
00082 bool ON_PolyEdgeSegment::ReversedTrimDir() const
00083 {
00084 bool rc = false;
00085 if ( m_trim && m_edge )
00086 {
00087 rc = ReversedEdgeDir();
00088 if ( m_trim->m_bRev3d )
00089 rc = !rc;
00090 }
00091 return rc;
00092 }
00093
00094 bool ON_PolyEdgeSegment::Create(
00095 const ON_Curve* curve,
00096 const ON_UUID& object_id
00097 )
00098 {
00099
00100 Init();
00101 if ( !curve )
00102 return false;
00103 const ON_BrepEdge* edge = ON_BrepEdge::Cast(curve);
00104 if ( edge )
00105 {
00106 const ON_Brep* brep = edge->Brep();
00107 if ( !brep )
00108 return false;
00109 const ON_Curve* c3 = edge->EdgeCurveOf();
00110 if ( !c3 )
00111 return false;
00112 m_edge = edge;
00113 m_brep = brep;
00114 m_component_index = edge->ComponentIndex();
00115 m_edge_domain = m_edge->Domain();
00116 m_trim_domain = m_trim->Domain();
00117 ON_CurveProxy::SetProxyCurve(
00118 c3,
00119 edge->ProxyCurveDomain()
00120 );
00121 if ( m_edge->ProxyCurveIsReversed() )
00122 ON_CurveProxy::Reverse();
00123 ON_CurveProxy::SetDomain( m_edge_domain[0], m_edge_domain[1] );
00124 }
00125 else
00126 {
00127 ON_CurveProxy::SetProxyCurve(const_cast<ON_Curve*>(curve));
00128 }
00129 m_object_id = object_id;
00130 return true;
00131 }
00132
00133 const ON_BrepEdge* ON_PolyEdgeSegment::Edge() const
00134 {
00135 return m_edge;
00136 }
00137
00138 const ON_BrepTrim* ON_PolyEdgeSegment::Trim() const
00139 {
00140 return m_trim;
00141 }
00142
00143 const ON_Brep* ON_PolyEdgeSegment::Brep() const
00144 {
00145 return m_brep;
00146 }
00147
00148 const ON_BrepFace* ON_PolyEdgeSegment::Face() const
00149 {
00150 return m_face;
00151 }
00152
00153 const ON_Surface* ON_PolyEdgeSegment::Surface() const
00154 {
00155 return m_surface;
00156 }
00157
00158 ON_Surface::ISO ON_PolyEdgeSegment::IsoType() const
00159 {
00160 return m_trim ? m_trim->m_iso : ON_Surface::not_iso;
00161 }
00162
00163 ON_Interval ON_PolyEdgeSegment::EdgeDomain() const
00164 {
00165 return m_edge_domain;
00166 }
00167
00168 ON_Interval ON_PolyEdgeSegment::TrimDomain() const
00169 {
00170 return m_trim_domain;
00171 }
00172
00173 void ON_PolyEdgeSegment::ClearEvalCacheHelper()
00174 {
00175 m_t = ON_UNSET_VALUE;
00176 m_edge_t = ON_UNSET_VALUE;
00177 m_trim_t = ON_UNSET_VALUE;
00178 m_srf_uv[0] = ON_UNSET_VALUE;
00179 m_srf_uv[1] = ON_UNSET_VALUE;
00180 m_trim_hint = 0;
00181 m_edge_hint = 0;
00182 m_evsrf_hint[0] = 0;
00183 m_evsrf_hint[1] = 0;
00184 m_evsrf_uv[0] = ON_UNSET_VALUE;
00185 m_evsrf_uv[1] = ON_UNSET_VALUE;
00186 m_evsrf_pt = ON_UNSET_POINT;
00187 }
00188
00189 double ON_PolyEdgeSegment::EdgeParameter(double t) const
00190 {
00191 double edge_t = ON_UNSET_VALUE;
00192 if ( m_edge )
00193 {
00194 if ( m_t == t && m_edge_t != ON_UNSET_VALUE )
00195 edge_t = m_edge_t;
00196 else
00197 {
00198 ON_PolyEdgeSegment* p = const_cast<ON_PolyEdgeSegment*>(this);
00199 if ( t != m_t )
00200 {
00201 p->m_t = t;
00202 p->m_trim_t = ON_UNSET_VALUE;
00203 p->m_srf_uv[0] = ON_UNSET_VALUE;
00204 p->m_srf_uv[1] = ON_UNSET_VALUE;
00205 }
00206 ON_Interval d = Domain();
00207 bool bReversedEdgeDir = ReversedEdgeDir();
00208 if ( bReversedEdgeDir || m_edge_domain != d )
00209 {
00210 double s = d.NormalizedParameterAt(t);
00211 if ( bReversedEdgeDir )
00212 s = 1.0 - s;
00213 edge_t = m_edge_domain.ParameterAt(s);
00214 }
00215 else
00216 edge_t = t;
00217 p->m_edge_t = edge_t;
00218 }
00219 }
00220 return edge_t;
00221 }
00222
00223
00224 ON_OBJECT_IMPLEMENT(ON_PolyEdgeCurve,ON_PolyCurve,"39FF3DD3-FE0F-4807-9D59-185F0D73C0E4");
00225
00226 ON_PolyEdgeCurve::ON_PolyEdgeCurve()
00227 {
00228 }
00229
00230 ON_PolyEdgeCurve::~ON_PolyEdgeCurve()
00231 {
00232 }
00233
00234 ON_BOOL32 ON_PolyEdgeCurve::SetStartPoint( ON_3dPoint start_point )
00235 {
00236 return false;
00237 }
00238
00239 ON_BOOL32 ON_PolyEdgeCurve::SetEndPoint( ON_3dPoint end_point )
00240 {
00241 return false;
00242 }
00243
00244 ON_BOOL32 ON_PolyEdgeCurve::ChangeClosedCurveSeam( double t )
00245 {
00246
00247
00248 if ( SegmentCount() == 1 )
00249 {
00250
00251
00252
00253 if ( !IsClosed() )
00254 return false;
00255
00256 ON_Interval crvd = Domain();
00257 double s = crvd.NormalizedParameterAt(t);
00258
00259 if ( s <= ON_SQRT_EPSILON || s >= (1.0 - ON_SQRT_EPSILON) )
00260 {
00261 s = fmod(s,1.0);
00262 if ( s < 0.0 )
00263 s += 1.0;
00264 if ( fabs(s) <= ON_SQRT_EPSILON || fabs(1.0-s) <= ON_SQRT_EPSILON )
00265 {
00266
00267 if ( t != crvd[0] )
00268 {
00269 DestroyRuntimeCache();
00270 SetDomain(t,t+crvd.Length() );
00271
00272 }
00273 return true;
00274 }
00275 return false;
00276 }
00277
00278 ON_PolyEdgeSegment* left_seg = SegmentCurve(0);
00279 if ( 0 == left_seg )
00280 return false;
00281
00282 DestroyRuntimeCache();
00283
00284 ON_Curve* left = left_seg;
00285 ON_Curve* right = 0;
00286 double segt = SegmentCurveParameter(t);
00287 if ( !left_seg->Split(segt,left,right) )
00288 return false;
00289 SetDomain(crvd[0],t);
00290
00291 ON_PolyEdgeSegment* right_seg = ON_PolyEdgeSegment::Cast(right);
00292 if ( 0 == right_seg )
00293 return false;
00294 Append(right_seg);
00295
00296 double st[3];
00297 st[0] = crvd[0];
00298 st[1] = t;
00299 st[2] = crvd[1];
00300 SetParameterization( st );
00301 }
00302
00303
00304
00305 ON_BOOL32 rc = ON_PolyCurve::ChangeClosedCurveSeam(t);
00306
00307
00308
00309 return rc;
00310 }
00311
00312 ON_BOOL32 ON_PolyEdgeCurve::PrependAndMatch(ON_Curve*)
00313 {
00314 return false;
00315 }
00316
00317
00318 ON_BOOL32 ON_PolyEdgeCurve::AppendAndMatch(ON_Curve*)
00319 {
00320 return false;
00321 }
00322
00323 ON_Curve* ON_PolyEdgeSegment::DuplicateCurve() const
00324 {
00325 return ON_CurveProxy::DuplicateCurve();
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339 }
00340
00341 ON_Curve* ON_PolyEdgeCurve::DuplicateCurve() const
00342 {
00343 return ON_PolyCurve::DuplicateCurve();
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381 }
00382
00383 ON_BOOL32 ON_PolyEdgeSegment::IsClosed(void) const
00384 {
00385 ON_BOOL32 rc = ON_CurveProxy::IsClosed();
00386 if ( !rc
00387 && m_edge
00388 && m_edge->m_vi[0] == m_edge->m_vi[1]
00389 && m_edge->ProxyCurve() == ProxyCurve()
00390 && m_edge->ProxyCurveDomain() == ProxyCurveDomain()
00391 && 0 != ProxyCurve()
00392 && ProxyCurve()->Domain() == ProxyCurveDomain()
00393 )
00394 {
00395 rc = m_edge->IsClosed();
00396 }
00397 return rc;
00398 }
00399
00400
00401
00402 ON_BOOL32 ON_PolyEdgeCurve::Remove( int segment_index )
00403 {
00404 ON_BOOL32 rc = ON_PolyCurve::Remove( segment_index);
00405
00406
00407 return rc;
00408 }
00409 ON_BOOL32 ON_PolyEdgeCurve::Remove( )
00410 {
00411 return Remove(Count()-1);
00412 }
00413
00414 ON_BOOL32 ON_PolyEdgeCurve::IsClosed(void) const
00415 {
00416 ON_BOOL32 rc = ON_PolyCurve::IsClosed();
00417
00418 if ( !rc && SegmentCount() > 1 )
00419 {
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 const ON_PolyEdgeSegment* seg0 = SegmentCurve(0);
00430 const ON_PolyEdgeSegment* seg1 = SegmentCurve(SegmentCount()-1);
00431
00432 const ON_BrepEdge* edge0 = seg0->Edge();
00433 const ON_BrepEdge* edge1 = seg1->Edge();
00434
00435 if ( edge0 && edge1 && edge0->Brep() == edge1->Brep() )
00436 {
00437
00438
00439
00440
00441
00442
00443 int evi0 = seg0->ReversedEdgeDir() ? 1 : 0;
00444 int evi1 = seg1->ReversedEdgeDir() ? 0 : 1;
00445 double et0 = seg0->EdgeParameter(seg0->Domain()[0]);
00446 double et1 = seg1->EdgeParameter(seg1->Domain()[1]);
00447 if ( et0 != ON_UNSET_VALUE && et1 != ON_UNSET_VALUE )
00448 {
00449 ON_Interval edom0 = edge0->Domain();
00450 ON_Interval edom1 = edge1->Domain();
00451 if ( et0 == edom0[evi0] && et1 == edom1[evi1] )
00452 {
00453
00454
00455 if ( edge0->m_vi[evi0] == edge1->m_vi[evi1] )
00456 {
00457
00458 rc = true;
00459 }
00460 }
00461 else if ( edge0 == edge1
00462 && fabs(et0-et1) <= ON_ZERO_TOLERANCE
00463 && edom0.Includes(et0,true)
00464 && edom1.Includes(et1,true)
00465 )
00466 {
00467
00468
00469
00470
00471
00472 rc = true;
00473 }
00474 }
00475 }
00476 }
00477
00478 return rc;
00479 }
00480
00481 bool ON_PolyEdgeCurve::Create( const ON_BrepTrim* trim, const ON_UUID& object_id )
00482 {
00483 bool rc = false;
00484 Destroy();
00485
00486 if ( trim )
00487 {
00488 ON_PolyEdgeSegment* segment = new ON_PolyEdgeSegment();
00489 rc = segment->Create(trim,object_id);
00490 if (rc )
00491 Append(segment);
00492 else
00493 delete segment;
00494 }
00495 return rc;
00496 }
00497
00498 bool ON_PolyEdgeCurve::Create( const ON_Curve* curve, const ON_UUID& object_id )
00499 {
00500 bool rc = false;
00501 Destroy();
00502
00503 if ( curve )
00504 {
00505 ON_PolyEdgeSegment* segment = new ON_PolyEdgeSegment();
00506 rc = segment->Create(curve,object_id);
00507 if (rc )
00508 Append(segment);
00509 else
00510 delete segment;
00511 }
00512 return rc;
00513 }
00514
00515 int ON_PolyEdgeCurve::SegmentCount() const
00516 {
00517 return ON_PolyCurve::Count();
00518 }
00519
00520 ON_PolyEdgeSegment* ON_PolyEdgeCurve::SegmentCurve(
00521 int segment_index
00522 ) const
00523 {
00524 return ON_PolyEdgeSegment::Cast(ON_PolyCurve::SegmentCurve(segment_index));
00525 }
00526
00527
00528 ON_PolyEdgeSegment* ON_PolyEdgeCurve::operator[](int segment_index) const
00529 {
00530 return SegmentCurve(segment_index);
00531 }
00532
00533 void ON_PolyEdgeCurve::DestroyRuntimeCache( bool bDelete )
00534 {
00535
00536 ON_PolyCurve::DestroyRuntimeCache(bDelete);
00537 }
00538
00539 void ON_PolyEdgeSegment::DestroyRuntimeCache( bool bDelete )
00540 {
00541 ClearEvalCacheHelper();
00542 ON_CurveProxy::DestroyRuntimeCache(bDelete);
00543 }
00544
00545
00546 ON_BOOL32 ON_PolyEdgeCurve::Prepend( ON_PolyEdgeSegment* new_segment )
00547 {
00548 DestroyRuntimeCache();
00549 ON_BOOL32 rc = false;
00550 if ( new_segment )
00551 {
00552 if ( Count() > 0 )
00553 {
00554
00555
00556 ON_Interval cdom = Domain();
00557 ON_Interval sdom = new_segment->Domain();
00558 if ( sdom[1] != cdom[0] )
00559 {
00560 sdom[0] = cdom[0] - sdom.Length();
00561 sdom[1] = cdom[0];
00562 new_segment->SetDomain(sdom[0],sdom[1]);
00563 }
00564 }
00565 rc = ON_PolyCurve::Prepend(new_segment);
00566 }
00567 return rc;
00568 }
00569
00570 ON_BOOL32 ON_PolyEdgeCurve::Append( ON_PolyEdgeSegment* new_segment )
00571 {
00572 DestroyRuntimeCache();
00573 ON_BOOL32 rc = false;
00574 if ( new_segment )
00575 {
00576
00577 if ( Count() > 0 )
00578 {
00579
00580
00581 ON_Interval cdom = Domain();
00582 ON_Interval sdom = new_segment->Domain();
00583 if ( sdom[0] != cdom[1] )
00584 {
00585 sdom[1] = cdom[1] + sdom.Length();
00586 sdom[0] = cdom[1];
00587 new_segment->SetDomain(sdom[0],sdom[1]);
00588 }
00589 }
00590 rc = ON_PolyCurve::Append(new_segment);
00591 }
00592 return rc;
00593 }
00594
00595 ON_BOOL32 ON_PolyEdgeCurve::Insert(
00596 int segment_index,
00597 ON_PolyEdgeSegment* new_segment
00598 )
00599 {
00600 DestroyRuntimeCache();
00601 ON_BOOL32 rc = false;
00602 if ( segment_index > 0 )
00603 {
00604
00605 rc = ON_PolyCurve::Insert(segment_index,new_segment);
00606 if ( rc )
00607 {
00608 int i;
00609 for ( i = segment_index; i < Count(); i++ )
00610 {
00611 ON_PolyEdgeSegment* seg = SegmentCurve(i);
00612 ON_Interval d = SegmentDomain(i);
00613 seg->SetDomain(d[0],d[1]);
00614 }
00615 }
00616 }
00617 else if ( segment_index == 0 )
00618 rc = Prepend(new_segment);
00619 return rc;
00620 }
00621
00622 const ON_BrepEdge* ON_PolyEdgeCurve::EdgeAt(double t) const
00623 {
00624 ON_PolyEdgeSegment* seg = SegmentCurve( SegmentIndex(t) );
00625 return seg ? seg->Edge() : 0;
00626 }
00627
00628 const ON_BrepTrim* ON_PolyEdgeCurve::TrimAt(double t) const
00629 {
00630 ON_PolyEdgeSegment* seg = SegmentCurve( SegmentIndex(t) );
00631 return seg ? seg->Trim() : 0;
00632 }
00633
00634 const ON_Brep* ON_PolyEdgeCurve::BrepAt(double t) const
00635 {
00636 ON_PolyEdgeSegment* seg = SegmentCurve( SegmentIndex(t) );
00637 return seg ? seg->Brep() : 0;
00638 }
00639
00640 const ON_BrepFace* ON_PolyEdgeCurve::FaceAt(double t) const
00641 {
00642 ON_PolyEdgeSegment* seg = SegmentCurve( SegmentIndex(t) );
00643 return seg ? seg->Face() : 0;
00644 }
00645
00646 const ON_Surface* ON_PolyEdgeCurve::SurfaceAt(double t) const
00647 {
00648 ON_PolyEdgeSegment* seg = SegmentCurve( SegmentIndex(t) );
00649 return seg ? seg->Surface() : 0;
00650 }
00651
00652 ON_Surface::ISO ON_PolyEdgeCurve::IsoType( double t) const
00653 {
00654 ON_PolyEdgeSegment* seg = SegmentCurve( SegmentIndex(t) );
00655 return seg ? seg->IsoType() : ON_Surface::not_iso;
00656 }
00657
00658
00659 double ON_PolyEdgeCurve::EdgeParameter(double t) const
00660 {
00661 double edge_t = ON_UNSET_VALUE;
00662 int segment_index = SegmentIndex(t);
00663 ON_PolyEdgeSegment* seg = SegmentCurve( segment_index );
00664 if ( seg )
00665 {
00666 ON_Interval pdom = SegmentDomain(segment_index);
00667 ON_Interval sdom = seg->Domain();
00668 if ( sdom != pdom )
00669 {
00670 double s = pdom.NormalizedParameterAt(t);
00671 t = sdom.ParameterAt(s);
00672 }
00673 edge_t = seg->EdgeParameter(t);
00674 }
00675 return edge_t;
00676 }
00677
00678
00679 bool ON_PolyEdgeCurve::ContainsAnyEdges() const
00680 {
00681 int i, count = SegmentCount();
00682 for( i = 0; i < count; i++)
00683 {
00684 ON_PolyEdgeSegment* segment = SegmentCurve(i);
00685 if( 0 != segment && NULL != segment->Edge())
00686 {
00687 return true;
00688 }
00689 }
00690 return false;
00691 }
00692
00693
00694 bool ON_PolyEdgeCurve::ContainsAllEdges() const
00695 {
00696 int i, count = SegmentCount();
00697 for( i = 0; i < count; i++)
00698 {
00699 ON_PolyEdgeSegment* segment = SegmentCurve(i);
00700 if( NULL == segment || NULL == segment->Edge())
00701 {
00702 return false;
00703 }
00704 }
00705 return true;
00706 }
00707
00708 int ON_PolyEdgeCurve::FindEdge( const ON_BrepEdge* edge) const
00709 {
00710 int rc = -1;
00711 if ( 0 != edge )
00712 {
00713 int i, count = SegmentCount();
00714 for( i = 0; i < count; i++)
00715 {
00716 ON_PolyEdgeSegment* segment = SegmentCurve(i);
00717 if ( 0 != segment && edge == segment->Edge() )
00718 {
00719 rc = i;
00720 break;
00721 }
00722 }
00723 }
00724 return rc;
00725 }
00726
00727 int ON_PolyEdgeCurve::FindTrim( const ON_BrepTrim* trim) const
00728 {
00729 int rc = -1;
00730 if ( 0 != trim )
00731 {
00732 int i, count = SegmentCount();
00733 for( i = 0; i < count; i++)
00734 {
00735 ON_PolyEdgeSegment* segment = SegmentCurve(i);
00736 if ( 0 != segment && trim == segment->Trim() )
00737 {
00738 rc = i;
00739 break;
00740 }
00741 }
00742 }
00743 return rc;
00744 }
00745
00746 int ON_PolyEdgeCurve::FindCurve( const ON_Curve* curve) const
00747 {
00748 int rc = -1;
00749 if ( 0 != curve )
00750 {
00751 int i, count = SegmentCount();
00752 for( i = 0; i < count; i++)
00753 {
00754 ON_PolyEdgeSegment* segment = SegmentCurve(i);
00755 if ( 0 != segment
00756 && (curve == segment || curve == segment->ProxyCurve() || curve == segment->Edge()) )
00757 {
00758 rc = i;
00759 break;
00760 }
00761 }
00762 }
00763 return rc;
00764 }
00765
00766 ON_BOOL32 ON_PolyEdgeSegment::Write( ON_BinaryArchive& archive ) const
00767 {
00768 bool rc = archive.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,0);
00769 if (!rc)
00770 return false;
00771 for(;;)
00772 {
00773 rc = archive.WriteUuid(m_object_id);
00774 if (!rc) break;
00775 rc = archive.WriteComponentIndex(m_component_index);
00776 if (!rc) break;
00777 rc = archive.WriteInterval(m_edge_domain);
00778 if (!rc) break;
00779 rc = archive.WriteInterval(m_trim_domain);
00780 if (!rc) break;
00781 bool b = ON_CurveProxy::ProxyCurveIsReversed();
00782 rc = archive.WriteBool(b);
00783 if (!rc) break;
00784 rc = archive.WriteInterval(ON_CurveProxy::Domain());
00785 if (!rc) break;
00786 rc = archive.WriteInterval(ON_CurveProxy::ProxyCurveDomain());
00787 if (!rc) break;
00788
00789 break;
00790 }
00791 if ( !archive.EndWrite3dmChunk() )
00792 rc = false;
00793 return rc;
00794 }
00795
00796 ON_BOOL32 ON_PolyEdgeSegment::Read( ON_BinaryArchive& archive )
00797 {
00798 Init();
00799 int major_version = 0;
00800 int minor_version = 0;
00801 bool rc = archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&major_version,&minor_version);
00802 if (!rc)
00803 return false;
00804 for(;;)
00805 {
00806 rc = (1 == major_version);
00807 if ( !rc )
00808 break;
00809
00810 rc = archive.ReadUuid(m_object_id);
00811 if (!rc) break;
00812 rc = archive.ReadComponentIndex(m_component_index);
00813 if (!rc) break;
00814 rc = archive.ReadInterval(m_edge_domain);
00815 if (!rc) break;
00816 rc = archive.ReadInterval(m_trim_domain);
00817 if (!rc) break;
00818
00819
00820 bool bReversed = false;
00821 rc = archive.ReadBool(&bReversed);
00822 if (!rc) break;
00823 ON_Interval this_domain;
00824 rc = archive.ReadInterval(this_domain);
00825 if (!rc) break;
00826 ON_Interval real_curve_domain;
00827 rc = archive.ReadInterval(real_curve_domain);
00828 if (!rc) break;
00829
00830 if ( bReversed)
00831 ON_CurveProxy::Reverse();
00832 ON_CurveProxy::SetDomain(this_domain);
00833 ON_CurveProxy::SetProxyCurveDomain(real_curve_domain);
00834
00835 break;
00836 }
00837 if ( !archive.EndRead3dmChunk() )
00838 rc = false;
00839 return rc;
00840 }
00841