summaryrefslogtreecommitdiff
path: root/inc/GccGeo_ParGenCurve.gxx
blob: 485938ed50ed9321847f6c0b802377f19982bc3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//#include <GccGeo_ParGenCurve_Gen.hxx>

#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Standard_NotImplemented.hxx>

GccGeo_ParGenCurve::
  GccGeo_ParGenCurve () {
  Dep = 0.;
}

GccGeo_ParGenCurve::
  GccGeo_ParGenCurve (const TheCurve&     C ,
		      const Standard_Real D ) {
    Cu = C;
    Dep = D;
  }


Standard_Real GccGeo_ParGenCurve::GetResolution() {
  return Cu.GetResolution();
}

Standard_Integer GccGeo_ParGenCurve::GetIntervals() {
  return Cu.GetIntervals();
}

gp_Pnt2d 
GccGeo_ParGenCurve::Value (const Standard_Real   U) {
    
  gp_Pnt2d P;
  gp_Vec2d V;
  Standard_Real NorTan;
  if (deport!=0.) {
    Cu.D1(U,P,V);
    NorTan= V.Magnitude();
    V.SetCoord(V.Y(),-V.X());
    if (NorTan >= gp::Resolution()) { 
      return gp_Pnt2d(P.XY()+deport*V.XY()/NorTan);
    }
    else { 
      gp_VectorWithNullMagnitude::Raise();
      }   
  }
  else {
    return Cu.Value(U);
  }
}

void GccGeo_ParGenCurve::D1(const Standard_Real   U,
                                  gp_Pnt2d&       P,
			          gp_Vec2d&       T) {
  gp_Vec2d V1,V2,V3;
  gp_Pnt2d PP;
  Standard_Real Nor1,Alfa;
  Standard_Integer Index,firstKnot,lastKnot;
  if (deport != 0.) {
    Cu.D2(U,PP,V1,V2);
    Nor1= V1.Magnitude();
    V3.SetCoord(V1.Y(),-V1.X());
    V2.SetCoord(V2.Y(),-V2.X());
    if (Nor1 >= gp::Resolution()) {
      P = gp_Pnt2d(PP.XY()+deport*V3.XY()/Nor1); 
      Alfa = V1.XY()/Nor1*V2.XY()/Nor1;
      T = gp_Vec2d( V1.XY() + (deport/Nor1)*(V2.XY()-Alfa*V3.XY()));  
    }
    else { 
      gp_VectorWithNullMagnitude::Raise();
      }   
  }
  else {
    Cu.D1(U,P,T);
  }
}

void GccGeo_ParGenCurve::D2(const Standard_Real U,
			          gp_Pnt2d&     P,
			          gp_Vec2d&     T,
			          gp_Vec2d&     N) {
  gp_Pnt2d PP;
  gp_Vec2d V11,V22,V1t,V2t,V33;
  Standard_Real Nor1,Alfa,Dalfa;
  Standard_Integer Index,firstKnot,lastKnot;
  if (deport!=0.) {
    Cu.D3(U,PP,V11,V22,V33);
    Nor1= V1.Magnitude();
    V1t.SetCoord(V11.Y(),-V11.X());
    V2t.SetCoord(V22.Y(),-V22.X());
    V33.SetCoord(V33.Y(),-V33.X());
    if (Nor1 >= gp::Resolution()) {
      P = gp_Pnt2d(PP.XY()+deport*V1t.XY()/Nor1); 
      Alfa = V1t.XY()/Nor1*V2t.XY()/Nor1;
      Dalfa= (V2t.XY()/Nor1*V2t.XY()/Nor1)+
             (V1t.XY()/Nor1*V33.XY()/Nor1)-
              2.*Alfa*Alfa;
      T = gp_Vec2d( V11.XY() + (deport/Nor1)*(V2t.XY()-Alfa*V1t.XY()));  
      N = gp_Vec2d( V22.XY() + (deport/Nor1)*(V33.XY()-2.*Alfa*V2t.XY()-
  					       (Dalfa-Alfa*Alfa)*V1t.XY()));
    }
    else { 
      gp_VectorWithNullMagnitude::Raise();
    }
  }
  else {
	Cu.D2(U,P,T,N);
  }
}