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
9 // under the terms of the GNU Lesser General Public 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.
17 #include <BRepLProp.ixx>
18 #include <Precision.hxx>
19 #include <BRepLProp_CLProps.hxx>
22 #include <TopoDS_Edge.hxx>
23 #include <TopAbs_Orientation.hxx>
25 //=======================================================================
26 //function : Continuity
28 //=======================================================================
30 GeomAbs_Shape BRepLProp::Continuity(const BRepAdaptor_Curve& C1,
31 const BRepAdaptor_Curve& C2,
32 const Standard_Real u1,
33 const Standard_Real u2,
34 const Standard_Real tl,
35 const Standard_Real ta)
37 GeomAbs_Shape cont = GeomAbs_C0;
38 Standard_Boolean fini = Standard_False;
41 GeomAbs_Shape cont1 = C1.Continuity(), cont2 = C2.Continuity();
42 Standard_Integer n1 = 0, n2 = 0;
43 if (cont1 >= 5) n1 = 3;
44 else if(cont1 == 4) n1 = 2;
45 else if(cont1 == 2) n1 = 1;
46 if (cont2 >= 5) n2 = 3;
47 else if(cont2 == 4) n2 = 2;
48 else if(cont2 == 2) n2 = 1;
49 BRepLProp_CLProps clp1(C1,u1,n1,tl);
50 BRepLProp_CLProps clp2(C2,u2,n2,tl);
51 if(!(clp1.Value().IsEqual(clp2.Value(),tl))) {
52 Standard_Failure::Raise("Courbes non jointives");
54 Standard_Integer min = Min(n1,n2);
58 if(C1.Edge().Orientation() == TopAbs_REVERSED) d1.Reverse();
59 if(C2.Edge().Orientation() == TopAbs_REVERSED) d2.Reverse();
60 if(d1.IsEqual(d2,tl,ta)) {
63 else if(clp1.IsTangentDefined() && clp2.IsTangentDefined()){
66 if(C1.Edge().Orientation() == TopAbs_REVERSED) dir1.Reverse();
67 if(C2.Edge().Orientation() == TopAbs_REVERSED) dir2.Reverse();
68 if(dir1.IsEqual(dir2,ta)){
73 else {fini = Standard_True; }
75 if ( min >= 2 && !fini ) {
78 if(d1.IsEqual(d2,tl,ta)){
82 const TopoDS_Edge& E1 = C1.Edge();
83 const TopoDS_Edge& E2 = C2.Edge();
84 if (E1.IsSame(E2) && C1.IsPeriodic() && cont >= GeomAbs_G1)
90 //=======================================================================
91 //function : Continuity
93 //=======================================================================
95 GeomAbs_Shape BRepLProp::Continuity(const BRepAdaptor_Curve& C1,
96 const BRepAdaptor_Curve& C2,
97 const Standard_Real u1,
98 const Standard_Real u2)
100 return Continuity(C1,C2,u1,u2,Precision::Confusion(),Precision::Angular());