0024624: Lost word in license statement in source files
[occt.git] / src / BRepGProp / BRepGProp_EdgeTool.cxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <BRepGProp_EdgeTool.ixx>
16 #include <GeomAdaptor_Curve.hxx>
17 #include <Geom_Curve.hxx>
18 #include <Geom_BezierCurve.hxx>
19 #include <Geom_BSplineCurve.hxx>
20
21 Standard_Real  BRepGProp_EdgeTool::FirstParameter(const BRepAdaptor_Curve& C)
22 {
23   return C.FirstParameter();
24 }
25
26 Standard_Real  BRepGProp_EdgeTool::LastParameter(const BRepAdaptor_Curve& C)
27 {
28   return C.LastParameter();
29 }
30
31 Standard_Integer  BRepGProp_EdgeTool::IntegrationOrder(const BRepAdaptor_Curve& BAC)
32 {
33   switch (BAC.GetType()) {
34
35   case GeomAbs_Line :
36     return 2;
37
38   case GeomAbs_Parabola :
39     return 5;
40
41   case GeomAbs_BezierCurve :
42     {
43     const GeomAdaptor_Curve& GAC = BAC.Curve();
44     const Handle(Geom_Curve)& GC = GAC.Curve();
45     const Handle(Geom_BezierCurve)& GBZC = (*((Handle(Geom_BezierCurve)*)&GC));
46     Standard_Integer n = 2*(GBZC->NbPoles()) - 1;
47     return n; 
48     }
49     break;
50   case GeomAbs_BSplineCurve :
51     {
52     const GeomAdaptor_Curve& GAC = BAC.Curve();
53     const Handle(Geom_Curve)& GC = GAC.Curve();
54     const Handle(Geom_BSplineCurve)& GBSC = (*((Handle(Geom_BSplineCurve)*)&GC));
55     Standard_Integer n = 2*(GBSC->NbPoles()) - 1;
56     return n; 
57     }
58     break;
59     
60     default :
61       return 10;
62   }
63 }
64
65 gp_Pnt  BRepGProp_EdgeTool::Value(const BRepAdaptor_Curve& C, const Standard_Real U)
66 {
67   return C.Value(U);
68 }
69
70 void  BRepGProp_EdgeTool::D1(const BRepAdaptor_Curve& C, 
71          const Standard_Real U, gp_Pnt& P, gp_Vec& V1)
72 {
73   C.D1(U,P,V1);
74 }
75
76 // modified by NIZHNY-MKK  Thu Jun  9 12:15:15 2005.BEGIN
77 Standard_Integer BRepGProp_EdgeTool::NbIntervals(const BRepAdaptor_Curve& C,const GeomAbs_Shape S) 
78 {
79   BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually NbIntervals() does not modify the 
80                                                    // object "C". So it is safe to do such a cast.
81   return pC->NbIntervals(S);
82 }
83
84 void BRepGProp_EdgeTool::Intervals(const BRepAdaptor_Curve& C,TColStd_Array1OfReal& T,const GeomAbs_Shape S) 
85 {
86   BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually Intervals() does not modify the
87                                                    // object "C". So it is safe to do such a cast.
88   pC->Intervals(T, S);
89 }
90 // modified by NIZHNY-MKK  Thu Jun  9 12:15:18 2005.END