1 // Created on: 1994-02-24
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRepAdaptor_Curve.hxx>
19 #include <BRepLProp.hxx>
20 #include <BRepLProp_CLProps.hxx>
23 #include <Precision.hxx>
24 #include <TopAbs_Orientation.hxx>
25 #include <TopoDS_Edge.hxx>
27 //=======================================================================
28 //function : Continuity
30 //=======================================================================
31 GeomAbs_Shape BRepLProp::Continuity(const BRepAdaptor_Curve& C1,
32 const BRepAdaptor_Curve& C2,
33 const Standard_Real u1,
34 const Standard_Real u2,
35 const Standard_Real tl,
36 const Standard_Real ta)
38 GeomAbs_Shape cont = GeomAbs_C0;
39 Standard_Boolean fini = Standard_False;
42 GeomAbs_Shape cont1 = C1.Continuity(), cont2 = C2.Continuity();
43 Standard_Integer n1 = 0, n2 = 0;
44 if (cont1 >= 5) n1 = 3;
45 else if(cont1 == 4) n1 = 2;
46 else if(cont1 == 2) n1 = 1;
47 if (cont2 >= 5) n2 = 3;
48 else if(cont2 == 4) n2 = 2;
49 else if(cont2 == 2) n2 = 1;
50 BRepLProp_CLProps clp1(C1,u1,n1,tl);
51 BRepLProp_CLProps clp2(C2,u2,n2,tl);
52 if(!(clp1.Value().IsEqual(clp2.Value(),tl))) {
53 Standard_Failure::Raise("Courbes non jointives");
55 Standard_Integer min = Min(n1,n2);
59 if(C1.Edge().Orientation() == TopAbs_REVERSED) d1.Reverse();
60 if(C2.Edge().Orientation() == TopAbs_REVERSED) d2.Reverse();
61 if(d1.IsEqual(d2,tl,ta)) {
64 else if(clp1.IsTangentDefined() && clp2.IsTangentDefined()){
67 if(C1.Edge().Orientation() == TopAbs_REVERSED) dir1.Reverse();
68 if(C2.Edge().Orientation() == TopAbs_REVERSED) dir2.Reverse();
69 if(dir1.IsEqual(dir2,ta)){
74 else {fini = Standard_True; }
76 if ( min >= 2 && !fini ) {
79 if(d1.IsEqual(d2,tl,ta)){
83 const TopoDS_Edge& E1 = C1.Edge();
84 const TopoDS_Edge& E2 = C2.Edge();
85 if (E1.IsSame(E2) && C1.IsPeriodic() && cont >= GeomAbs_G1)
91 //=======================================================================
92 //function : Continuity
94 //=======================================================================
96 GeomAbs_Shape BRepLProp::Continuity(const BRepAdaptor_Curve& C1,
97 const BRepAdaptor_Curve& C2,
98 const Standard_Real u1,
99 const Standard_Real u2)
101 return Continuity(C1,C2,u1,u2,Precision::Confusion(),Precision::Angular());