1 #include <ShapeAnalysis_TransferParametersProj.ixx>
2 #include <Geom2dAdaptor_HCurve.hxx>
3 #include <Geom2d_Curve.hxx>
4 #include <Adaptor3d_CurveOnSurface.hxx>
5 #include <Geom_Surface.hxx>
6 #include <GeomAdaptor_HSurface.hxx>
7 #include <BRep_Tool.hxx>
8 #include <TColStd_HArray1OfReal.hxx>
9 #include <TopLoc_Location.hxx>
10 #include <ShapeAnalysis_Edge.hxx>
11 #include <TColgp_SequenceOfPnt.hxx>
12 #include <ShapeAnalysis_Curve.hxx>
13 #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
14 #include <BRep_TEdge.hxx>
15 #include <BRep_GCurve.hxx>
16 #include <BRep_ListOfCurveRepresentation.hxx>
17 #include <BRep_ListOfCurveRepresentation.hxx>
18 #include <Precision.hxx>
19 #include <ShapeBuild_Edge.hxx>
20 #include <BRep_Builder.hxx>
21 #include <GeomAdaptor_Curve.hxx>
22 #include <ShapeAnalysis.hxx>
23 #include <Geom2d_TrimmedCurve.hxx>
24 #include <Geom2d_OffsetCurve.hxx>
25 #include <Geom2d_BSplineCurve.hxx>
26 #include <BRep_ListOfPointRepresentation.hxx>
27 #include <BRep_TVertex.hxx>
28 #include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
29 #include <BRep_PointRepresentation.hxx>
30 #include <BRep_PointOnSurface.hxx>
31 #include <BRep_PointOnCurve.hxx>
32 #include <BRep_PointOnCurveOnSurface.hxx>
34 #include <ShapeAnalysis_Surface.hxx>
35 //=======================================================================
36 //function : ShapeAnalysis_TransferParametersProj
38 //=======================================================================
40 ShapeAnalysis_TransferParametersProj::ShapeAnalysis_TransferParametersProj()
42 myMaxTolerance = 1; //Precision::Infinite(); ?? pdn
43 myForceProj = Standard_False;
44 myInitOK = Standard_False;
48 //=======================================================================
49 //function : ShapeAnalysis_TransferParametersProj
51 //=======================================================================
53 ShapeAnalysis_TransferParametersProj::ShapeAnalysis_TransferParametersProj(const TopoDS_Edge& E,
56 myMaxTolerance = 1; //Precision::Infinite(); ?? pdn
57 myForceProj = Standard_False;
62 //=======================================================================
65 //=======================================================================
67 void ShapeAnalysis_TransferParametersProj::Init(const TopoDS_Edge& E,
70 myInitOK = Standard_False;
71 ShapeAnalysis_TransferParameters::Init(E,F);
73 myPrecision = BRep_Tool::Tolerance(E); // it is better - skl OCC2851
74 //myPrecision = Precision::Confusion();
76 myCurve = BRep_Tool::Curve (E, myFirst, myLast);
77 if ( myCurve.IsNull() ) { myFirst = 0.; myLast = 1.; return;}
79 if ( F.IsNull() ) return;
81 Standard_Real f2d, l2d;
82 ShapeAnalysis_Edge sae;
83 if(sae.PCurve (E, F, myCurve2d, f2d, l2d, Standard_False)) {
85 Handle(Geom2dAdaptor_HCurve) AC2d = new Geom2dAdaptor_HCurve(myCurve2d,f2d,l2d);
86 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(F,myLocation);
87 Handle(GeomAdaptor_HSurface) AdS = new GeomAdaptor_HSurface(aSurface);
89 Adaptor3d_CurveOnSurface Ad1(AC2d,AdS);
90 myAC3d = Ad1;//new Adaptor3d_CurveOnSurface(AC2d,AdS);
91 myInitOK = Standard_True;
96 //=======================================================================
99 //=======================================================================
101 Handle(TColStd_HSequenceOfReal) ShapeAnalysis_TransferParametersProj::Perform
102 (const Handle(TColStd_HSequenceOfReal)& Knots,
103 const Standard_Boolean To2d)
107 (! myForceProj && myPrecision < myMaxTolerance && BRep_Tool::SameParameter(myEdge)))
108 return ShapeAnalysis_TransferParameters::Perform(Knots,To2d);
110 Handle(TColStd_HSequenceOfReal) resKnots = new TColStd_HSequenceOfReal;
112 Standard_Integer len = Knots->Length();
113 Standard_Real preci = 2*Precision::PConfusion();
115 Standard_Real first = (To2d ? myAC3d.FirstParameter() : myFirst);
116 Standard_Real last = (To2d ? myAC3d.LastParameter() : myLast);
117 Standard_Real maxPar = first;
118 Standard_Real lastPar = last;
119 Standard_Real prevPar = maxPar;
121 Standard_Integer j; // svv Jan 10 2000 : porting on DEC
122 for(j = 1; j <= len; j++) {
123 Standard_Real par = PreformSegment(Knots->Value(j),To2d,prevPar,lastPar);
125 if(prevPar > lastPar)
127 resKnots->Append(par);
132 //pdn correcting on periodic
133 if(myCurve->IsClosed())
134 for(j = len; j >=1; j--)
135 if(resKnots->Value(j) < maxPar)
136 resKnots->SetValue(j,(To2d ? myAC3d.LastParameter() : myCurve->LastParameter())-(len-j)*preci);
139 //pdn correction on range
140 for ( j=1; j <= len; j++ ) {
141 if ( resKnots->Value (j) < first ) resKnots->SetValue ( j, first );
142 if ( resKnots->Value (j) > last ) resKnots->SetValue ( j, last );
149 //=======================================================================
150 //function : PreformSegment
152 //=======================================================================
154 Standard_Real ShapeAnalysis_TransferParametersProj::PreformSegment(const Standard_Real Param,
155 const Standard_Boolean To2d,
156 const Standard_Real First,
157 const Standard_Real Last)
159 Standard_Real linPar = ShapeAnalysis_TransferParameters::Perform(Param, To2d);
161 (! myForceProj && myPrecision < myMaxTolerance && BRep_Tool::SameParameter(myEdge)))
164 Standard_Real linDev, projDev;
166 ShapeAnalysis_Curve sac;
170 gp_Pnt p1 = myCurve->Value(Param).Transformed(myLocation.Inverted());
171 Handle(Adaptor3d_HSurface) AdS = myAC3d.GetSurface();
172 Handle(Geom2dAdaptor_HCurve) AC2d = new Geom2dAdaptor_HCurve(myCurve2d,First,Last);
173 Adaptor3d_CurveOnSurface Ad1(AC2d,AdS);
174 projDev = sac.Project(Ad1,p1,myPrecision,pproj,ppar);//pdn
175 linDev = p1.Distance(Ad1.Value(linPar));
178 gp_Pnt p1 = myAC3d.Value(Param).Transformed(myLocation);
179 projDev = sac.Project(myCurve,p1,myPrecision,pproj,ppar,First,Last,Standard_False);
180 linDev = p1.Distance(myCurve->Value(linPar));
183 if ( linDev <= projDev || (linDev < myPrecision && linDev <= 2 * projDev ) )
189 //=======================================================================
192 //=======================================================================
194 Standard_Real ShapeAnalysis_TransferParametersProj::Perform(const Standard_Real Knot,
195 const Standard_Boolean To2d)
198 (! myForceProj && myPrecision < myMaxTolerance && BRep_Tool::SameParameter(myEdge)))
199 return ShapeAnalysis_TransferParameters::Perform(Knot, To2d);
203 res = PreformSegment(Knot,To2d,myAC3d.FirstParameter(),myAC3d.LastParameter());
205 res = PreformSegment(Knot,To2d,myFirst,myLast);
207 //pdn correction on range
208 Standard_Real first = (To2d ? myAC3d.FirstParameter() : myFirst);
209 Standard_Real last = (To2d ? myAC3d.LastParameter() : myLast);
210 if ( res < first ) res = first;
211 if ( res > last ) res = last;
216 //=======================================================================
217 //function : CorrectParameter
219 //=======================================================================
220 static Standard_Real CorrectParameter(const Handle(Geom2d_Curve) crv,
221 const Standard_Real param)
223 if(crv->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
224 Handle(Geom2d_TrimmedCurve) tmp = Handle(Geom2d_TrimmedCurve)::DownCast (crv);
225 return CorrectParameter(tmp->BasisCurve(),param);
227 else if(crv->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve))) {
228 Handle(Geom2d_OffsetCurve) tmp = Handle(Geom2d_OffsetCurve)::DownCast (crv);
229 return CorrectParameter(tmp->BasisCurve(),param);
231 else if(crv->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve))) {
232 Handle(Geom2d_BSplineCurve) bspline = Handle(Geom2d_BSplineCurve)::DownCast (crv);
233 for(Standard_Integer j = bspline->FirstUKnotIndex(); j <= bspline->LastUKnotIndex(); j++) {
234 Standard_Real valknot = bspline->Knot(j);
235 if( Abs(valknot-param)<Precision::PConfusion() )
243 //=======================================================================
244 //function : TransferRange
246 //=======================================================================
248 void ShapeAnalysis_TransferParametersProj::TransferRange(TopoDS_Edge& newEdge,
249 const Standard_Real prevPar,
250 const Standard_Real currPar,
251 const Standard_Boolean Is2d)
254 (! myForceProj && myPrecision < myMaxTolerance && BRep_Tool::SameParameter(myEdge))) {
255 ShapeAnalysis_TransferParameters::TransferRange(newEdge,prevPar,currPar,Is2d);
260 Standard_Boolean samerange = Standard_True;
262 sbe.CopyRanges(newEdge,myEdge);
265 Standard_Real alpha = 0, beta = 1;
266 Standard_Real preci = Precision::PConfusion();
267 Standard_Real firstPar, lastPar;
268 if(prevPar < currPar) {
277 p1 = myAC3d.Value(firstPar).Transformed(myLocation);
278 p2 = myAC3d.Value(lastPar).Transformed(myLocation);
279 Standard_Real fact = myAC3d.LastParameter() - myAC3d.FirstParameter();
280 if( fact > Epsilon(myAC3d.LastParameter()) ) {
281 alpha = ( firstPar - myAC3d.FirstParameter() ) / fact;
282 beta = ( lastPar - myAC3d.FirstParameter() ) / fact;
286 p1 = myCurve->Value(firstPar);
287 p2 = myCurve->Value(lastPar);
288 Standard_Real fact = myLast - myFirst;
289 if( fact > Epsilon(myLast) ) {
290 alpha = ( firstPar - myFirst ) / fact;
291 beta = ( lastPar - myFirst ) / fact;
294 const Standard_Boolean useLinearFirst = (alpha < preci);
295 const Standard_Boolean useLinearLast = (1-beta < preci);
296 TopLoc_Location EdgeLoc = myEdge.Location();
297 ShapeAnalysis_Curve sac;
299 Standard_Real ppar1,ppar2;
300 BRep_ListOfCurveRepresentation& tolist = (*((Handle(BRep_TEdge)*)&newEdge.TShape()))->ChangeCurves();
301 Handle(BRep_GCurve) toGC;
302 for (BRep_ListIteratorOfListOfCurveRepresentation toitcr (tolist); toitcr.More(); toitcr.Next()) {
303 toGC = Handle(BRep_GCurve)::DownCast(toitcr.Value());
304 if ( toGC.IsNull() ) continue;
305 TopLoc_Location loc = ( EdgeLoc * toGC->Location() ).Inverted();
306 if ( toGC->IsCurve3D() ) {
312 Handle(Geom_Curve) C3d = toGC->Curve3D();
313 if (C3d.IsNull()) continue;
314 Standard_Real first = toGC->First();
315 Standard_Real last = toGC->Last();
316 Standard_Real len = last -first;
317 gp_Pnt ploc1 = p1.Transformed(loc);
318 gp_Pnt ploc2 = p2.Transformed(loc);
319 GeomAdaptor_Curve GAC(C3d,first,last);
320 // CATIA bplseitli.model FAC1155 - Copy: protection for degenerated edges(3d case for symmetry)
321 Standard_Real linFirst = first+alpha*len;
322 Standard_Real linLast = first+beta*len;
323 Standard_Real dist1 = sac.NextProject(linFirst,GAC,ploc1,myPrecision,pproj,ppar1);
324 Standard_Real dist2 = sac.NextProject(linLast,GAC,ploc2,myPrecision,pproj,ppar2);
325 Standard_Boolean useLinear = Abs(ppar1-ppar2) < preci;
327 gp_Pnt pos1 = C3d->Value ( linFirst );
328 gp_Pnt pos2 = C3d->Value ( linLast );
329 Standard_Real d01 = pos1.Distance ( ploc1 );
330 Standard_Real d02 = pos2.Distance ( ploc2 );
331 if ( useLinearFirst || useLinear || d01 <= dist1 || ( d01 < myPrecision && d01 <= 2 * dist1 ) )
333 if ( useLinearLast || useLinear || d02 <= dist2 || ( d02 < myPrecision && d02 <= 2 * dist2 ) )
337 Standard_Real tmpP = ppar2; ppar2 = ppar1; ppar1 = tmpP;
339 if(ppar2-ppar1 < preci) {
340 if(ppar1-toGC->First() < preci)
342 else if(toGC->Last()-ppar2 < preci)
349 toGC->SetRange ( ppar1, ppar2);
350 //if(fabs(ppar1- firstPar) > Precision::PConfusion() ||
351 // fabs(ppar2 - lastPar) >Precision::PConfusion()) // by LSS
352 if(ppar1!=firstPar || ppar2!=lastPar)
353 samerange = Standard_False;
356 else if (toGC->IsCurveOnSurface()) { //continue; ||
358 Standard_Boolean localLinearFirst = useLinearFirst;
359 Standard_Boolean localLinearLast = useLinearLast;
360 Handle(Geom2d_Curve) C2d = toGC->PCurve();
361 Standard_Real first = toGC->First();
362 Standard_Real last = toGC->Last();
363 Standard_Real len = last -first;
364 Handle(Geom2dAdaptor_HCurve) AC2d = new Geom2dAdaptor_HCurve(toGC->PCurve(),first,last);
365 Handle(GeomAdaptor_HSurface) AdS = new GeomAdaptor_HSurface( toGC->Surface());
366 Adaptor3d_CurveOnSurface Ad1(AC2d,AdS);
367 ShapeAnalysis_Curve sac1;
369 //gp_Pnt p1 = Ad1.Value(prevPar);
370 //gp_Pnt p2 = Ad1.Value(currPar);
371 gp_Pnt ploc1 = p1.Transformed(loc);
372 gp_Pnt ploc2 = p2.Transformed(loc);
373 // CATIA bplseitli.model FAC1155 - Copy: protection for degenerated edges
374 Standard_Real linFirst = first+alpha*len;
375 Standard_Real linLast = first+beta*len;
376 Standard_Real dist1 = sac1.NextProject(linFirst, Ad1, ploc1, myPrecision,pproj,ppar1);
377 Standard_Real dist2 = sac1.NextProject(linLast, Ad1, ploc2, myPrecision,pproj,ppar2);
379 Standard_Boolean isFirstOnEnd = (ppar1-first)/len < Precision::PConfusion();
380 Standard_Boolean isLastOnEnd = (last-ppar2)/len < Precision::PConfusion();
381 Standard_Boolean useLinear = Abs(ppar1-ppar2) < Precision::PConfusion();
382 if(isFirstOnEnd && ! localLinearFirst)
383 localLinearFirst = Standard_True;
384 if(isLastOnEnd && ! localLinearLast)
385 localLinearLast = Standard_True;
387 gp_Pnt pos1 = Ad1.Value ( linFirst );
388 gp_Pnt pos2 = Ad1.Value ( linLast );
389 Standard_Real d01 = pos1.Distance ( ploc1 );
390 Standard_Real d02 = pos2.Distance ( ploc2 );
391 if ( localLinearFirst || useLinear || d01 <= dist1 || ( d01 < myPrecision && d01 <= 2 * dist1 ) )
393 if ( localLinearLast || useLinear || d02 <= dist2 || ( d02 < myPrecision && d02 <= 2 * dist2 ) )
397 Standard_Real tmpP = ppar2; ppar2 = ppar1; ppar1 = tmpP;
399 ppar1 = CorrectParameter(C2d,ppar1);
400 ppar2 = CorrectParameter(C2d,ppar2);
401 if(ppar2-ppar1 < preci) {
402 if(ppar1-toGC->First() < preci)
404 else if(toGC->Last()-ppar2 < preci)
411 toGC->SetRange ( ppar1, ppar2);
412 //if(fabs(ppar1 - firstPar) > Precision::PConfusion() ||
413 // fabs(ppar2 -lastPar) > Precision::PConfusion())// by LSS
414 if(ppar1 != firstPar || ppar2 != lastPar)
415 samerange = Standard_False;
418 B.SameRange(newEdge, samerange);
422 //=======================================================================
423 //function : IsSameRange
425 //=======================================================================
427 Standard_Boolean ShapeAnalysis_TransferParametersProj::IsSameRange() const
431 (! myForceProj && myPrecision < myMaxTolerance && BRep_Tool::SameParameter(myEdge)))
432 return ShapeAnalysis_TransferParameters::IsSameRange();
434 return Standard_False;
438 //=======================================================================
439 //function : ForceProjection
441 //=======================================================================
443 Standard_Boolean& ShapeAnalysis_TransferParametersProj::ForceProjection()
448 //=======================================================================
449 //function : CopyNMVertex
451 //=======================================================================
453 TopoDS_Vertex ShapeAnalysis_TransferParametersProj::CopyNMVertex (const TopoDS_Vertex& theV,
454 const TopoDS_Edge& toedge,
455 const TopoDS_Edge& fromedge)
458 if(theV.Orientation() != TopAbs_INTERNAL &&
459 theV.Orientation() != TopAbs_EXTERNAL)
462 TopLoc_Location fromLoc;
464 const Handle(Geom_Curve)& C1 = BRep_Tool::Curve(fromedge,fromLoc,f1,l1);
465 fromLoc = fromLoc.Predivided(theV.Location());
468 Handle(Geom_Curve) C2 = BRep_Tool::Curve(toedge,f2,l2);
470 anewV = TopoDS::Vertex(theV.EmptyCopied());
471 gp_Pnt apv = BRep_Tool::Pnt(anewV);
473 BRep_ListOfPointRepresentation& alistrep =
474 (*((Handle(BRep_TVertex)*)&anewV.TShape()))->ChangePoints();
476 BRep_ListIteratorOfListOfPointRepresentation itpr
477 ((*((Handle(BRep_TVertex)*) &theV.TShape()))->Points());
479 Standard_Real aOldPar = RealLast();
480 Standard_Boolean hasRepr = Standard_False;
481 for ( ;itpr.More(); itpr.Next()) {
482 const Handle(BRep_PointRepresentation)& pr = itpr.Value();
485 if(pr->IsPointOnCurve(C1,fromLoc)) {
486 aOldPar = pr->Parameter();
487 hasRepr =Standard_True;
490 else if(pr->IsPointOnSurface()) {
491 Handle(BRep_PointOnSurface) aOld = Handle(BRep_PointOnSurface)::DownCast(pr);
492 Handle(BRep_PointOnSurface) aPS = new BRep_PointOnSurface(aOld->Parameter(),
496 alistrep.Append(aPS);
499 else if(pr->IsPointOnCurveOnSurface()) {
500 Standard_Boolean found = Standard_False;
501 BRep_ListIteratorOfListOfCurveRepresentation fromitcr
502 ((*((Handle(BRep_TEdge)*)&fromedge.TShape()))->ChangeCurves());
504 for( ;fromitcr.More() && !found; fromitcr.Next()) {
505 Handle(BRep_GCurve) fromGC = Handle(BRep_GCurve)::DownCast(fromitcr.Value());
506 if ( fromGC.IsNull() || !fromGC->IsCurveOnSurface()) continue;
508 TopLoc_Location aL = fromGC->Location();
509 aL.Predivided(theV.Location());
510 Handle(Geom_Surface) surface1 = fromGC->Surface();
511 Handle(Geom2d_Curve) ac2d1 = fromGC->PCurve();
512 if (pr->IsPointOnCurveOnSurface(ac2d1,surface1,aL)) {
513 found = Standard_True;
515 aOldPar = pr->Parameter();
521 if(pr->IsPointOnCurve()) {
522 Handle(BRep_PointOnCurve) aPRep = new BRep_PointOnCurve(pr->Parameter(),pr->Curve(),pr->Location());
523 alistrep.Append(aPRep);
525 else if(pr->IsPointOnCurveOnSurface() ) {
526 Handle(BRep_PointOnCurveOnSurface) aPonCS =
527 new BRep_PointOnCurveOnSurface(pr->Parameter(),pr->PCurve(),pr->Surface(),pr->Location());
528 alistrep.Append(aPonCS);
531 Standard_Real apar = aOldPar;
532 Standard_Real aTol = BRep_Tool::Tolerance(theV);
533 if(!hasRepr || (fabs(f1-f2) > Precision::PConfusion() || fabs(l1-l2)> Precision::PConfusion())) {
535 ShapeAnalysis_Curve sae;
536 Standard_Real adist = sae.Project(C2,apv,Precision::Confusion(),projP,apar);
541 aB.UpdateVertex(anewV,apar,toedge,aTol);
544 Standard_Boolean needUpdate = Standard_False;
545 gp_Pnt aPV = (*((Handle(BRep_TVertex)*)&anewV.TShape()))->Pnt();
546 TopLoc_Location toLoc = toedge.Location();
547 BRep_ListIteratorOfListOfCurveRepresentation toitcr
548 ((*((Handle(BRep_TEdge)*)&toedge.TShape()))->ChangeCurves());
550 for( ;toitcr.More() ; toitcr.Next()) {
551 Handle(BRep_GCurve) toGC = Handle(BRep_GCurve)::DownCast(toitcr.Value());
552 if ( toGC.IsNull() || !toGC->IsCurveOnSurface()) continue;
554 TopLoc_Location aL = (toLoc*toGC->Location()).Predivided(theV.Location());
555 //aL.Predivided(theV.Location());
556 Handle(Geom_Surface) surface1 = toGC->Surface();
557 Handle(Geom2d_Curve) ac2d1 = toGC->PCurve();
558 gp_Pnt2d aP2d = ac2d1->Value(apar);
559 gp_Pnt aP3d = surface1->Value(aP2d.X(),aP2d.Y());
560 aP3d.Transform(aL.Transformation());
561 Standard_Real adist = aPV.Distance(aP3d);
564 needUpdate = Standard_True;
569 aB.UpdateVertex(anewV,aTol);
573 //=======================================================================
574 //function : CopyNMVertex
576 //=======================================================================
578 TopoDS_Vertex ShapeAnalysis_TransferParametersProj::CopyNMVertex (const TopoDS_Vertex& theV,
579 const TopoDS_Face& toFace,
580 const TopoDS_Face& fromFace)
583 if(theV.Orientation() != TopAbs_INTERNAL &&
584 theV.Orientation() != TopAbs_EXTERNAL)
588 TopLoc_Location fromLoc;
589 TopLoc_Location toLoc;
590 Handle(Geom_Surface) fromSurf = BRep_Tool::Surface(fromFace,fromLoc);
591 Handle(Geom_Surface) toSurf = BRep_Tool::Surface(toFace,toLoc);
592 fromLoc = fromLoc.Predivided(theV.Location());
594 anewV = TopoDS::Vertex(theV.EmptyCopied());
595 gp_Pnt apv = BRep_Tool::Pnt(anewV);
598 BRep_ListOfPointRepresentation& alistrep =
599 (*((Handle(BRep_TVertex)*)&anewV.TShape()))->ChangePoints();
601 BRep_ListIteratorOfListOfPointRepresentation itpr
602 ((*((Handle(BRep_TVertex)*) &theV.TShape()))->Points());
604 Standard_Boolean hasRepr = Standard_False;
605 Standard_Real apar1=0., apar2=0.;
606 for ( ;itpr.More(); itpr.Next()) {
607 const Handle(BRep_PointRepresentation)& pr = itpr.Value();
610 TopLoc_Location aLoc = pr->Location();
611 if( pr->IsPointOnCurveOnSurface()) {
612 Handle(BRep_PointOnCurveOnSurface) aPonCS =
613 new BRep_PointOnCurveOnSurface(pr->Parameter(),pr->PCurve(),pr->Surface(),aLoc);
614 alistrep.Append(aPonCS);
616 else if(pr->IsPointOnCurve()) {
617 Handle(BRep_PointOnCurve) aPRep = new BRep_PointOnCurve(pr->Parameter(),pr->Curve(),aLoc);
618 alistrep.Append(aPRep);
620 else if(pr->IsPointOnSurface()) {
621 Handle(BRep_PointOnSurface) aOld = Handle(BRep_PointOnSurface)::DownCast(pr);
623 if(pr->IsPointOnSurface(fromSurf,fromLoc)) {
624 apar1= aOld->Parameter();
625 apar2 = aOld->Parameter2();
626 hasRepr = Standard_True;
629 Handle(BRep_PointOnSurface) aPS = new BRep_PointOnSurface(aOld->Parameter(),
633 alistrep.Append(aPS);
638 Standard_Real aTol = BRep_Tool::Tolerance(anewV);
639 if(!hasRepr || (fromSurf != toSurf || fromLoc != toLoc)) {
640 Handle(Geom_Surface) aS = BRep_Tool::Surface(toFace);
641 Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(aS);
642 gp_Pnt2d aP2d = aSurfTool->ValueOfUV(apv,Precision::Confusion());
646 if(aTol < aSurfTool->Gap())
647 aTol = aSurfTool->Gap() + 0.1*Precision::Confusion();
648 //Handle(BRep_PointOnSurface) aPS = new BRep_PointOnSurface(aP2d.X(),aP2d.Y(),toSurf,toLoc);
649 //alistrep.Append(aPS);
653 aB.UpdateVertex(anewV,apar1,apar2,toFace,aTol);