0023024: Update headers of OCCT files
[occt.git] / src / BRepGProp / BRepGProp_EdgeTool.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19
20#include <BRepGProp_EdgeTool.ixx>
21#include <GeomAdaptor_Curve.hxx>
22#include <Geom_Curve.hxx>
23#include <Geom_BezierCurve.hxx>
24#include <Geom_BSplineCurve.hxx>
25
26Standard_Real BRepGProp_EdgeTool::FirstParameter(const BRepAdaptor_Curve& C)
27{
28 return C.FirstParameter();
29}
30
31Standard_Real BRepGProp_EdgeTool::LastParameter(const BRepAdaptor_Curve& C)
32{
33 return C.LastParameter();
34}
35
36Standard_Integer BRepGProp_EdgeTool::IntegrationOrder(const BRepAdaptor_Curve& BAC)
37{
38 switch (BAC.GetType()) {
39
40 case GeomAbs_Line :
41 return 2;
42
43 case GeomAbs_Parabola :
44 return 5;
45
46 case GeomAbs_BezierCurve :
47 {
48 const GeomAdaptor_Curve& GAC = BAC.Curve();
49 const Handle(Geom_Curve)& GC = GAC.Curve();
50 const Handle(Geom_BezierCurve)& GBZC = (*((Handle(Geom_BezierCurve)*)&GC));
51 Standard_Integer n = 2*(GBZC->NbPoles()) - 1;
52 return n;
53 }
54 break;
55 case GeomAbs_BSplineCurve :
56 {
57 const GeomAdaptor_Curve& GAC = BAC.Curve();
58 const Handle(Geom_Curve)& GC = GAC.Curve();
59 const Handle(Geom_BSplineCurve)& GBSC = (*((Handle(Geom_BSplineCurve)*)&GC));
60 Standard_Integer n = 2*(GBSC->NbPoles()) - 1;
61 return n;
62 }
63 break;
64
65 default :
66 return 10;
67 }
68 //POP WE should return something : -> Default
69 return 10;
70}
71
72gp_Pnt BRepGProp_EdgeTool::Value(const BRepAdaptor_Curve& C, const Standard_Real U)
73{
74 return C.Value(U);
75}
76
77void BRepGProp_EdgeTool::D1(const BRepAdaptor_Curve& C,
78 const Standard_Real U, gp_Pnt& P, gp_Vec& V1)
79{
80 C.D1(U,P,V1);
81}
82
83// modified by NIZHNY-MKK Thu Jun 9 12:15:15 2005.BEGIN
84Standard_Integer BRepGProp_EdgeTool::NbIntervals(const BRepAdaptor_Curve& C,const GeomAbs_Shape S)
85{
86 BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually NbIntervals() does not modify the
87 // object "C". So it is safe to do such a cast.
88 return pC->NbIntervals(S);
89}
90
91void BRepGProp_EdgeTool::Intervals(const BRepAdaptor_Curve& C,TColStd_Array1OfReal& T,const GeomAbs_Shape S)
92{
93 BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually Intervals() does not modify the
94 // object "C". So it is safe to do such a cast.
95 pC->Intervals(T, S);
96}
97// modified by NIZHNY-MKK Thu Jun 9 12:15:18 2005.END