1 // File: BRepLib_MakeEdge.cxx
2 // Created: Fri Jul 23 15:51:46 1993
3 // Author: Remi LEQUETTE
5 // Modified: Wed Oct 23 09:17:47 1996
6 // Author: Joelle CHAUVET
8 // check ponctuallity (PRO4896)
10 #include <BRepLib_MakeEdge.ixx>
11 #include <BRepLib.hxx>
12 #include <BRep_Tool.hxx>
13 #include <BRep_Builder.hxx>
15 #include <Geom_Line.hxx>
16 #include <Geom_Circle.hxx>
17 #include <Geom_Ellipse.hxx>
18 #include <Geom_Parabola.hxx>
19 #include <Geom_Hyperbola.hxx>
20 #include <Geom_TrimmedCurve.hxx>
21 #include <Geom2d_TrimmedCurve.hxx>
22 #include <GeomAdaptor_Curve.hxx>
23 #include <Geom2dAdaptor_HCurve.hxx>
24 #include <GeomAdaptor_HSurface.hxx>
25 #include <Adaptor3d_CurveOnSurface.hxx>
26 #include <Extrema_ExtPC.hxx>
29 #include <Precision.hxx>
32 //=======================================================================
34 //purpose : project a vertex on a curve
35 //=======================================================================
37 static Standard_Boolean Project(const Handle(Geom_Curve)& C,
38 const TopoDS_Vertex& V,
41 Standard_Real Eps2 = BRep_Tool::Tolerance(V);
44 gp_Pnt P = BRep_Tool::Pnt(V);
45 GeomAdaptor_Curve GAC(C);
47 // Afin de faire les extremas, on verifie les distances en bout
50 P1 = GAC.Value(GAC.FirstParameter());
51 P2 = GAC.Value(GAC.LastParameter());
52 D1 = P1.SquareDistance(P);
53 D2 = P2.SquareDistance(P);
54 if ( (D1 < D2) && (D1 <= Eps2) ) {
55 p = GAC.FirstParameter();
58 else if ( (D2 < D1) && (D2 <= Eps2) ) {
59 p = GAC.LastParameter();
63 // Sinon, on calcule les extremas.
65 Extrema_ExtPC extrema(P,GAC);
66 if (extrema.IsDone()) {
67 Standard_Integer i, index = 0, n = extrema.NbExt();
68 Standard_Real Dist2 = RealLast(), dist2min;
70 for (i = 1; i <= n; i++) {
71 dist2min = extrema.SquareDistance(i);
72 if (dist2min < Dist2) {
80 p = (extrema.Point(index)).Parameter();
85 return Standard_False;
89 //=======================================================================
91 //purpose : project a vertex on a curve on surface
92 //=======================================================================
94 static Standard_Boolean Project(const Handle(Geom2d_Curve)& C,
95 const Handle(Geom_Surface)& S,
96 const TopoDS_Vertex& V,
99 gp_Pnt P = BRep_Tool::Pnt(V);
100 Standard_Real Eps2 = BRep_Tool::Tolerance(V);
103 Handle(Geom2dAdaptor_HCurve) HG2AHC = new Geom2dAdaptor_HCurve();
105 Handle(GeomAdaptor_HSurface) HGAHS = new GeomAdaptor_HSurface();
107 Adaptor3d_CurveOnSurface ACOS(HG2AHC,HGAHS);
111 P1 = ACOS.Value(ACOS.FirstParameter());
112 P2 = ACOS.Value(ACOS.LastParameter());
113 D1 = P1.SquareDistance(P);
114 D2 = P2.SquareDistance(P);
115 if ( (D1 < D2) && (D1 <= Eps2) ) {
116 p = ACOS.FirstParameter();
117 return Standard_True;
119 else if ( (D2 < D1) && (D2 <= Eps2) ) {
120 p = ACOS.LastParameter();
121 return Standard_True;
125 Extrema_ExtPC extrema(P,ACOS);
127 if (extrema.IsDone()) {
128 Standard_Integer i, index = 0, n = extrema.NbExt();
129 Standard_Real Dist2 = RealLast(), dist2min;
131 for (i = 1; i <= n; i++) {
132 dist2min = extrema.SquareDistance(i);
133 if (dist2min < Dist2) {
140 Extrema_POnCurv POC = extrema.Point(index);
141 if (P.SquareDistance(POC.Value()) <= Precision::Confusion() * Precision::Confusion()) {
143 return Standard_True;
147 return Standard_False;
150 //=======================================================================
151 //function : BRepLib_MakeEdge
153 //=======================================================================
155 BRepLib_MakeEdge::BRepLib_MakeEdge()
158 //=======================================================================
159 //function : BRepLib_MakeEdge
161 //=======================================================================
163 BRepLib_MakeEdge::BRepLib_MakeEdge(const TopoDS_Vertex& V1,
164 const TopoDS_Vertex& V2)
166 gp_Pnt P1 = BRep_Tool::Pnt(V1);
167 gp_Pnt P2 = BRep_Tool::Pnt(V2);
168 Standard_Real l = P1.Distance(P2);
169 if (l <= gp::Resolution()) {
170 myError = BRepLib_LineThroughIdenticPoints;
173 gp_Lin L(P1,gp_Vec(P1,P2));
174 Handle(Geom_Line) GL = new Geom_Line(L);
179 //=======================================================================
180 //function : BRepLib_MakeEdge
182 //=======================================================================
184 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Pnt& P1,
187 Standard_Real l = P1.Distance(P2);
188 if (l <= gp::Resolution()) {
189 myError = BRepLib_LineThroughIdenticPoints;
192 gp_Lin L(P1,gp_Vec(P1,P2));
193 Handle(Geom_Line) GL = new Geom_Line(L);
198 //=======================================================================
199 //function : BRepLib_MakeEdge
201 //=======================================================================
203 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Lin& L)
205 Handle(Geom_Line) GL = new Geom_Line(L);
210 //=======================================================================
211 //function : BRepLib_MakeEdge
213 //=======================================================================
215 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Lin& L,
216 const Standard_Real p1,
217 const Standard_Real p2)
219 Handle(Geom_Line) GL = new Geom_Line(L);
224 //=======================================================================
225 //function : BRepLib_MakeEdge
227 //=======================================================================
229 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Lin& L,
233 Handle(Geom_Line) GL = new Geom_Line(L);
238 //=======================================================================
239 //function : BRepLib_MakeEdge
241 //=======================================================================
243 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Lin& L,
244 const TopoDS_Vertex& V1,
245 const TopoDS_Vertex& V2)
247 Handle(Geom_Line) GL = new Geom_Line(L);
252 //=======================================================================
253 //function : BRepLib_MakeEdge
255 //=======================================================================
257 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Circ& C)
259 Handle(Geom_Circle) GC = new Geom_Circle(C);
264 //=======================================================================
265 //function : BRepLib_MakeEdge
267 //=======================================================================
269 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Circ& C,
270 const Standard_Real p1,
271 const Standard_Real p2)
273 Handle(Geom_Circle) GC = new Geom_Circle(C);
278 //=======================================================================
279 //function : BRepLib_MakeEdge
281 //=======================================================================
283 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Circ& C,
287 Handle(Geom_Circle) GC = new Geom_Circle(C);
292 //=======================================================================
293 //function : BRepLib_MakeEdge
295 //=======================================================================
297 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Circ& C,
298 const TopoDS_Vertex& V1,
299 const TopoDS_Vertex& V2)
301 Handle(Geom_Circle) GC = new Geom_Circle(C);
306 //=======================================================================
307 //function : BRepLib_MakeEdge
309 //=======================================================================
311 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Elips& E)
313 Handle(Geom_Ellipse) GE = new Geom_Ellipse(E);
318 //=======================================================================
319 //function : BRepLib_MakeEdge
321 //=======================================================================
323 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Elips& E,
324 const Standard_Real p1,
325 const Standard_Real p2)
327 Handle(Geom_Ellipse) GE = new Geom_Ellipse(E);
332 //=======================================================================
333 //function : BRepLib_MakeEdge
335 //=======================================================================
337 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Elips& E,
341 Handle(Geom_Ellipse) GE = new Geom_Ellipse(E);
346 //=======================================================================
347 //function : BRepLib_MakeEdge
349 //=======================================================================
351 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Elips& E,
352 const TopoDS_Vertex& V1,
353 const TopoDS_Vertex& V2)
355 Handle(Geom_Ellipse) GE = new Geom_Ellipse(E);
360 //=======================================================================
361 //function : BRepLib_MakeEdge
363 //=======================================================================
365 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Hypr& H)
367 Handle(Geom_Hyperbola) GH = new Geom_Hyperbola(H);
372 //=======================================================================
373 //function : BRepLib_MakeEdge
375 //=======================================================================
377 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Hypr& H,
378 const Standard_Real p1,
379 const Standard_Real p2)
381 Handle(Geom_Hyperbola) GH = new Geom_Hyperbola(H);
386 //=======================================================================
387 //function : BRepLib_MakeEdge
389 //=======================================================================
391 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Hypr& H,
395 Handle(Geom_Hyperbola) GH = new Geom_Hyperbola(H);
400 //=======================================================================
401 //function : BRepLib_MakeEdge
403 //=======================================================================
405 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Hypr& H,
406 const TopoDS_Vertex& V1,
407 const TopoDS_Vertex& V2)
409 Handle(Geom_Hyperbola) GH = new Geom_Hyperbola(H);
414 //=======================================================================
415 //function : BRepLib_MakeEdge
417 //=======================================================================
419 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Parab& P)
421 Handle(Geom_Parabola) GP = new Geom_Parabola(P);
426 //=======================================================================
427 //function : BRepLib_MakeEdge
429 //=======================================================================
431 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Parab& P,
432 const Standard_Real p1,
433 const Standard_Real p2)
435 Handle(Geom_Parabola) GP = new Geom_Parabola(P);
440 //=======================================================================
441 //function : BRepLib_MakeEdge
443 //=======================================================================
445 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Parab& P,
449 Handle(Geom_Parabola) GP = new Geom_Parabola(P);
454 //=======================================================================
455 //function : BRepLib_MakeEdge
457 //=======================================================================
459 BRepLib_MakeEdge::BRepLib_MakeEdge(const gp_Parab& P,
460 const TopoDS_Vertex& V1,
461 const TopoDS_Vertex& V2)
463 Handle(Geom_Parabola) GP = new Geom_Parabola(P);
468 //=======================================================================
469 //function : BRepLib_MakeEdge
471 //=======================================================================
473 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom_Curve)& L)
479 //=======================================================================
480 //function : BRepLib_MakeEdge
482 //=======================================================================
484 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom_Curve)& L,
485 const Standard_Real p1,
486 const Standard_Real p2)
492 //=======================================================================
493 //function : BRepLib_MakeEdge
495 //=======================================================================
497 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom_Curve)& L,
504 //=======================================================================
505 //function : BRepLib_MakeEdge
507 //=======================================================================
509 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom_Curve)& L,
510 const TopoDS_Vertex& V1,
511 const TopoDS_Vertex& V2)
517 //=======================================================================
518 //function : BRepLib_MakeEdge
520 //=======================================================================
522 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom_Curve)& L,
525 const Standard_Real p1,
526 const Standard_Real p2)
532 //=======================================================================
533 //function : BRepLib_MakeEdge
535 //=======================================================================
537 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom_Curve)& L,
538 const TopoDS_Vertex& V1,
539 const TopoDS_Vertex& V2,
540 const Standard_Real p1,
541 const Standard_Real p2)
548 //=======================================================================
549 //function : BRepLib_MakeEdge
551 //=======================================================================
553 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L,
554 const Handle(Geom_Surface)& S)
560 //=======================================================================
561 //function : BRepLib_MakeEdge
563 //=======================================================================
565 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L,
566 const Handle(Geom_Surface)& S,
567 const Standard_Real p1,
568 const Standard_Real p2)
574 //=======================================================================
575 //function : BRepLib_MakeEdge
577 //=======================================================================
579 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L,
580 const Handle(Geom_Surface)& S,
587 //=======================================================================
588 //function : BRepLib_MakeEdge
590 //=======================================================================
592 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L,
593 const Handle(Geom_Surface)& S,
594 const TopoDS_Vertex& V1,
595 const TopoDS_Vertex& V2)
601 //=======================================================================
602 //function : BRepLib_MakeEdge
604 //=======================================================================
606 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L,
607 const Handle(Geom_Surface)& S,
610 const Standard_Real p1,
611 const Standard_Real p2)
613 Init(L,S,P1,P2,p1,p2);
617 //=======================================================================
618 //function : BRepLib_MakeEdge
620 //=======================================================================
622 BRepLib_MakeEdge::BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L,
623 const Handle(Geom_Surface)& S,
624 const TopoDS_Vertex& V1,
625 const TopoDS_Vertex& V2,
626 const Standard_Real p1,
627 const Standard_Real p2)
629 Init(L,S,V1,V2,p1,p2);
633 //=======================================================================
636 //=======================================================================
638 void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& C)
640 Init(C,C->FirstParameter(),C->LastParameter());
644 //=======================================================================
647 //=======================================================================
649 void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& C,
650 const Standard_Real p1,
651 const Standard_Real p2)
660 //=======================================================================
663 //=======================================================================
665 void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& C,
669 Standard_Real Tol = BRepLib::Precision();
673 B.MakeVertex(V1,P1,Tol);
674 if (P1.Distance(P2) < Tol)
677 B.MakeVertex(V2,P2,Tol);
683 //=======================================================================
686 //=======================================================================
688 void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& C,
689 const TopoDS_Vertex& V1,
690 const TopoDS_Vertex& V2)
692 // try projecting the vertices on the curve
697 p1 = C->FirstParameter();
699 if (!Project(C,V1,p1)) {
700 myError = BRepLib_PointProjectionFailed;
704 p2 = C->LastParameter();
706 if (!Project(C,V2,p2)) {
707 myError = BRepLib_PointProjectionFailed;
715 //=======================================================================
718 //=======================================================================
720 void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& C,
723 const Standard_Real p1,
724 const Standard_Real p2)
726 Standard_Real Tol = BRepLib::Precision();
730 B.MakeVertex(V1,P1,Tol);
731 if (P1.Distance(P2) < Tol)
734 B.MakeVertex(V2,P2,Tol);
740 //=======================================================================
742 //purpose : this one really makes the job ...
743 //=======================================================================
745 void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& CC,
746 const TopoDS_Vertex& VV1,
747 const TopoDS_Vertex& VV2,
748 const Standard_Real pp1,
749 const Standard_Real pp2)
751 // kill trimmed curves
752 Handle(Geom_Curve) C = CC;
753 Handle(Geom_TrimmedCurve) CT = Handle(Geom_TrimmedCurve)::DownCast(C);
754 while (!CT.IsNull()) {
755 C = CT->BasisCurve();
756 CT = Handle(Geom_TrimmedCurve)::DownCast(C);
760 Standard_Real p1 = pp1;
761 Standard_Real p2 = pp2;
762 Standard_Real cf = C->FirstParameter();
763 Standard_Real cl = C->LastParameter();
764 Standard_Real epsilon = Precision::PConfusion();
765 Standard_Boolean periodic = C->IsPeriodic();
771 ElCLib::AdjustPeriodic(cf,cl,epsilon,p1,p2);
784 Standard_Real x = p1;
790 if ((cf - p1 > epsilon) || (p2 - cl > epsilon)) {
791 myError = BRepLib_ParameterOutOfRange;
795 // check ponctuallity
796 if ((p2-p1) <= gp::Resolution()) {
797 myError = BRepLib_LineThroughIdenticPoints;
802 // compute points on the curve
803 Standard_Boolean p1inf = Precision::IsNegativeInfinite(p1);
804 Standard_Boolean p2inf = Precision::IsPositiveInfinite(p2);
806 if (!p1inf) P1 = C->Value(p1);
807 if (!p2inf) P2 = C->Value(p2);
809 Standard_Real preci = BRepLib::Precision();
812 // check for closed curve
813 Standard_Boolean closed = Standard_False;
814 if (!p1inf && !p2inf)
815 closed = (P1.Distance(P2) <= preci);
817 // check if the vertices are on the curve
819 if (V1.IsNull() && V2.IsNull()) {
820 B.MakeVertex(V1,P1,preci);
823 else if (V1.IsNull())
825 else if (V2.IsNull())
828 if (!V1.IsSame(V2)) {
829 myError = BRepLib_DifferentPointsOnClosedCurve;
832 else if (P1.Distance(BRep_Tool::Pnt(V1)) >
833 Max(preci,BRep_Tool::Tolerance(V1))) {
834 myError = BRepLib_DifferentPointsOnClosedCurve;
844 myError = BRepLib_PointWithInfiniteParameter;
850 B.MakeVertex(V1,P1,preci);
852 else if (P1.Distance(BRep_Tool::Pnt(V1)) >
853 Max(preci,BRep_Tool::Tolerance(V1))) {
854 myError = BRepLib_DifferentsPointAndParameter;
861 myError = BRepLib_PointWithInfiniteParameter;
867 B.MakeVertex(V2,P2,preci);
869 else if (P2.Distance(BRep_Tool::Pnt(V2)) >
870 Max(preci,BRep_Tool::Tolerance(V2))){
871 myError = BRepLib_DifferentsPointAndParameter;
877 V1.Orientation(TopAbs_FORWARD);
878 V2.Orientation(TopAbs_REVERSED);
882 TopoDS_Edge& E = TopoDS::Edge(myShape);
883 B.MakeEdge(E,C,preci);
892 myError = BRepLib_EdgeDone;
896 //=======================================================================
899 //=======================================================================
901 void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& C,
902 const Handle(Geom_Surface)& S)
904 Init(C,S,C->FirstParameter(),C->LastParameter());
908 //=======================================================================
911 //=======================================================================
913 void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& C,
914 const Handle(Geom_Surface)& S,
915 const Standard_Real p1,
916 const Standard_Real p2)
921 Init(C,S,V1,V2,p1,p2);
925 //=======================================================================
928 //=======================================================================
930 void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& C,
931 const Handle(Geom_Surface)& S,
935 Standard_Real Tol = BRepLib::Precision();
939 B.MakeVertex(V1,P1,Tol);
940 if (P1.Distance(P2) < Tol)
943 B.MakeVertex(V2,P2,Tol);
949 //=======================================================================
952 //=======================================================================
954 void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& C,
955 const Handle(Geom_Surface)& S,
956 const TopoDS_Vertex& V1,
957 const TopoDS_Vertex& V2)
959 // try projecting the vertices on the curve
964 p1 = C->FirstParameter();
966 if (!Project(C,S,V1,p1)) {
967 myError = BRepLib_PointProjectionFailed;
971 p2 = C->LastParameter();
973 if (!Project(C,S,V2,p2)) {
974 myError = BRepLib_PointProjectionFailed;
978 Init(C,S,V1,V2,p1,p2);
982 //=======================================================================
985 //=======================================================================
987 void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& C,
988 const Handle(Geom_Surface)& S,
991 const Standard_Real p1,
992 const Standard_Real p2)
994 Standard_Real Tol = BRepLib::Precision();
998 B.MakeVertex(V1,P1,Tol);
999 if (P1.Distance(P2) < Tol)
1002 B.MakeVertex( V2, P2, Tol);
1004 Init(C,S,V1,V2,p1,p2);
1008 //=======================================================================
1010 //purpose : this one really makes the job ...
1011 //=======================================================================
1013 void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& CC,
1014 const Handle(Geom_Surface)& S,
1015 const TopoDS_Vertex& VV1,
1016 const TopoDS_Vertex& VV2,
1017 const Standard_Real pp1,
1018 const Standard_Real pp2)
1020 // kill trimmed curves
1021 Handle(Geom2d_Curve) C = CC;
1022 Handle(Geom2d_TrimmedCurve) CT = Handle(Geom2d_TrimmedCurve)::DownCast(C);
1023 while (!CT.IsNull()) {
1024 C = CT->BasisCurve();
1025 CT = Handle(Geom2d_TrimmedCurve)::DownCast(C);
1029 Standard_Real p1 = pp1;
1030 Standard_Real p2 = pp2;
1031 Standard_Real cf = C->FirstParameter();
1032 Standard_Real cl = C->LastParameter();
1033 Standard_Real epsilon = Precision::PConfusion();
1034 Standard_Boolean periodic = C->IsPeriodic();
1037 TopoDS_Vertex V1,V2;
1038 Standard_Boolean reverse = Standard_False;
1042 ElCLib::AdjustPeriodic(cf,cl,epsilon,p1,p2);
1055 Standard_Real x = p1;
1058 reverse = Standard_True;
1062 if ((cf - p1 > epsilon) || (p2 - cl > epsilon)) {
1063 myError = BRepLib_ParameterOutOfRange;
1068 // compute points on the curve
1069 Standard_Boolean p1inf = Precision::IsNegativeInfinite(p1);
1070 Standard_Boolean p2inf = Precision::IsPositiveInfinite(p2);
1074 P2d1 = C->Value(p1);
1075 P1 = S->Value(P2d1.X(),P2d1.Y());
1078 P2d2 = C->Value(p2);
1079 P2 = S->Value(P2d2.X(),P2d2.Y());
1082 Standard_Real preci = BRepLib::Precision();
1085 // check for closed curve
1086 Standard_Boolean closed = Standard_False;
1087 if (!p1inf && !p2inf)
1088 closed = (P1.Distance(P2) <= preci);
1090 // check if the vertices are on the curve
1092 if (V1.IsNull() && V2.IsNull()) {
1093 B.MakeVertex(V1,P1,preci);
1096 else if (V1.IsNull())
1098 else if (V2.IsNull())
1101 if (!V1.IsSame(V2)) {
1102 myError = BRepLib_DifferentPointsOnClosedCurve;
1105 else if (P1.Distance(BRep_Tool::Pnt(V1)) >
1106 Max(preci,BRep_Tool::Tolerance(V1))) {
1107 myError = BRepLib_DifferentPointsOnClosedCurve;
1113 else { // not closed
1117 myError = BRepLib_PointWithInfiniteParameter;
1123 B.MakeVertex(V1,P1,preci);
1125 else if (P1.Distance(BRep_Tool::Pnt(V1)) >
1126 Max(preci,BRep_Tool::Tolerance(V1))) {
1127 myError = BRepLib_DifferentsPointAndParameter;
1134 myError = BRepLib_PointWithInfiniteParameter;
1140 B.MakeVertex(V2,P2,preci);
1142 else if (P2.Distance(BRep_Tool::Pnt(V2)) >
1143 Max(preci,BRep_Tool::Tolerance(V2))){
1144 myError = BRepLib_DifferentsPointAndParameter;
1150 V1.Orientation(TopAbs_FORWARD);
1151 V2.Orientation(TopAbs_REVERSED);
1155 TopoDS_Edge& E = TopoDS::Edge(myShape);
1157 B.UpdateEdge(E,C,S,TopLoc_Location(),preci);
1168 E.Orientation(TopAbs_REVERSED);
1170 myError = BRepLib_EdgeDone;
1174 //=======================================================================
1177 //=======================================================================
1179 BRepLib_EdgeError BRepLib_MakeEdge::Error() const
1184 //=======================================================================
1187 //=======================================================================
1189 const TopoDS_Edge& BRepLib_MakeEdge::Edge()const
1191 return TopoDS::Edge(Shape());
1195 //=======================================================================
1196 //function : Vertex1
1198 //=======================================================================
1200 const TopoDS_Vertex& BRepLib_MakeEdge::Vertex1()const
1207 //=======================================================================
1208 //function : Vertex2
1210 //=======================================================================
1212 const TopoDS_Vertex& BRepLib_MakeEdge::Vertex2()const
1220 //=======================================================================
1221 //function : operator
1223 //=======================================================================
1225 BRepLib_MakeEdge::operator TopoDS_Edge() const