0024761: Convertation of the generic classes to the non-generic. Part 5
[occt.git] / src / GccGeo / GccGeo_ParGenCurve.gxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15//#include <GccGeo_ParGenCurve_Gen.hxx>
16
17#include <gp_Pnt.hxx>
18#include <gp_Vec.hxx>
19#include <Standard_NotImplemented.hxx>
20
21GccGeo_ParGenCurve::
22 GccGeo_ParGenCurve () {
23 Dep = 0.;
24}
25
26GccGeo_ParGenCurve::
27 GccGeo_ParGenCurve (const TheCurve& C ,
28 const Standard_Real D ) {
29 Cu = C;
30 Dep = D;
31 }
32
33
34Standard_Real GccGeo_ParGenCurve::GetResolution() {
35 return Cu.GetResolution();
36}
37
38Standard_Integer GccGeo_ParGenCurve::GetIntervals() {
39 return Cu.GetIntervals();
40}
41
42gp_Pnt2d
43GccGeo_ParGenCurve::Value (const Standard_Real U) {
44
45 gp_Pnt2d P;
46 gp_Vec2d V;
47 Standard_Real NorTan;
48 if (deport!=0.) {
49 Cu.D1(U,P,V);
50 NorTan= V.Magnitude();
51 V.SetCoord(V.Y(),-V.X());
52 if (NorTan >= gp::Resolution()) {
53 return gp_Pnt2d(P.XY()+deport*V.XY()/NorTan);
54 }
55 else {
56 gp_VectorWithNullMagnitude::Raise();
57 }
58 }
59 else {
60 return Cu.Value(U);
61 }
62}
63
64void GccGeo_ParGenCurve::D1(const Standard_Real U,
65 gp_Pnt2d& P,
66 gp_Vec2d& T) {
67 gp_Vec2d V1,V2,V3;
68 gp_Pnt2d PP;
69 Standard_Real Nor1,Alfa;
70 Standard_Integer Index,firstKnot,lastKnot;
71 if (deport != 0.) {
72 Cu.D2(U,PP,V1,V2);
73 Nor1= V1.Magnitude();
74 V3.SetCoord(V1.Y(),-V1.X());
75 V2.SetCoord(V2.Y(),-V2.X());
76 if (Nor1 >= gp::Resolution()) {
77 P = gp_Pnt2d(PP.XY()+deport*V3.XY()/Nor1);
78 Alfa = V1.XY()/Nor1*V2.XY()/Nor1;
79 T = gp_Vec2d( V1.XY() + (deport/Nor1)*(V2.XY()-Alfa*V3.XY()));
80 }
81 else {
82 gp_VectorWithNullMagnitude::Raise();
83 }
84 }
85 else {
86 Cu.D1(U,P,T);
87 }
88}
89
90void GccGeo_ParGenCurve::D2(const Standard_Real U,
91 gp_Pnt2d& P,
92 gp_Vec2d& T,
93 gp_Vec2d& N) {
94 gp_Pnt2d PP;
95 gp_Vec2d V11,V22,V1t,V2t,V33;
96 Standard_Real Nor1,Alfa,Dalfa;
97 Standard_Integer Index,firstKnot,lastKnot;
98 if (deport!=0.) {
99 Cu.D3(U,PP,V11,V22,V33);
100 Nor1= V1.Magnitude();
101 V1t.SetCoord(V11.Y(),-V11.X());
102 V2t.SetCoord(V22.Y(),-V22.X());
103 V33.SetCoord(V33.Y(),-V33.X());
104 if (Nor1 >= gp::Resolution()) {
105 P = gp_Pnt2d(PP.XY()+deport*V1t.XY()/Nor1);
106 Alfa = V1t.XY()/Nor1*V2t.XY()/Nor1;
107 Dalfa= (V2t.XY()/Nor1*V2t.XY()/Nor1)+
108 (V1t.XY()/Nor1*V33.XY()/Nor1)-
109 2.*Alfa*Alfa;
110 T = gp_Vec2d( V11.XY() + (deport/Nor1)*(V2t.XY()-Alfa*V1t.XY()));
111 N = gp_Vec2d( V22.XY() + (deport/Nor1)*(V33.XY()-2.*Alfa*V2t.XY()-
112 (Dalfa-Alfa*Alfa)*V1t.XY()));
113 }
114 else {
115 gp_VectorWithNullMagnitude::Raise();
116 }
117 }
118 else {
119 Cu.D2(U,P,T,N);
120 }
121}
122