1 // Created on: 1998-02-26
2 // Created by: Roman BORISOV
3 // Copyright (c) 1998-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 <Adaptor3d_Curve.hxx>
19 #include <GeomFill_SnglrFunc.hxx>
22 #include <Precision.hxx>
23 #include <Standard_DomainError.hxx>
24 #include <Standard_NotImplemented.hxx>
25 #include <Standard_OutOfRange.hxx>
27 GeomFill_SnglrFunc::GeomFill_SnglrFunc(const Handle(Adaptor3d_Curve)& HC) :
28 myHCurve(HC), ratio(1)
32 void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio)
37 Standard_Real GeomFill_SnglrFunc::FirstParameter() const
39 return myHCurve->FirstParameter();
42 Standard_Real GeomFill_SnglrFunc::LastParameter() const
44 return myHCurve->LastParameter();
47 Standard_Integer GeomFill_SnglrFunc::NbIntervals(const GeomAbs_Shape S) const
49 GeomAbs_Shape HCS=GeomAbs_C0;
54 else if (S == GeomAbs_C1)
58 else if (S >= GeomAbs_C2)
62 return myHCurve->NbIntervals(HCS);
65 void GeomFill_SnglrFunc::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) const
67 GeomAbs_Shape HCS=GeomAbs_C0;
72 else if (S == GeomAbs_C1)
76 else if (S >= GeomAbs_C2)
80 myHCurve->Intervals(T, HCS);
83 Standard_Boolean GeomFill_SnglrFunc::IsPeriodic() const
85 return myHCurve->IsPeriodic();
88 Standard_Real GeomFill_SnglrFunc::Period() const
90 return myHCurve->Period();
94 gp_Pnt GeomFill_SnglrFunc::Value(const Standard_Real U) const
98 myHCurve->D2(U, C, DC, D2C);
100 return gp_Pnt(DC.Crossed(D2C).XYZ());
103 void GeomFill_SnglrFunc::D0(const Standard_Real U,gp_Pnt& P) const
107 myHCurve->D2(U, C, DC, D2C);
109 P = gp_Pnt(DC.Crossed(D2C).XYZ());
112 void GeomFill_SnglrFunc::D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V) const
116 myHCurve->D3(U, C, DC, D2C, D3C);
118 P = gp_Pnt(DC.Crossed(D2C).XYZ());
122 void GeomFill_SnglrFunc::D2(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
125 gp_Vec DC, D2C, D3C, D4C;
126 myHCurve->D3(U, C, DC, D2C, D3C);
127 P = gp_Pnt(DC.Crossed(D2C).XYZ());
128 V1 = DC.Crossed(D3C);
129 D4C = myHCurve->DN(U, 4);
130 V2 = D2C.Crossed(D3C) + DC.Crossed(D4C);
132 P.ChangeCoord() *= ratio;
137 void GeomFill_SnglrFunc::D3(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2,gp_Vec& V3) const
139 gp_Vec DC, D2C, D3C, D4C, D5C;
140 myHCurve->D3(U, P, DC, D2C, D3C);
141 D4C = myHCurve->DN(U, 4);
142 D5C = myHCurve->DN(U, 5);
143 P = gp_Pnt(DC.Crossed(D2C).XYZ()).ChangeCoord()*ratio;
144 V1 = DC.Crossed(D3C)*ratio;
145 V2 = (D2C.Crossed(D3C) + DC.Crossed(D4C))*ratio;
146 V3 = (DC.Crossed(D5C) + D2C.Crossed(D4C)*2)*ratio;
149 gp_Vec GeomFill_SnglrFunc::DN(const Standard_Real U,const Standard_Integer N) const
151 Standard_RangeError_Raise_if (N < 1, "Exception: Geom2d_OffsetCurve::DN(). N<1.");
153 gp_Vec D1C, D2C, D3C;
168 throw Standard_NotImplemented("Exception: Derivative order is greater than 3. "
169 "Cannot compute of derivative.");
173 Standard_Real GeomFill_SnglrFunc::Resolution(const Standard_Real R3D) const
175 return Precision::Parametric(R3D);
178 GeomAbs_CurveType GeomFill_SnglrFunc::GetType() const
180 return GeomAbs_OtherCurve;