summaryrefslogtreecommitdiff
path: root/src/GeomFill/GeomFill_SnglrFunc.cxx
blob: 60cfadcefba55e3c216dac690a021b3318557919 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// File:	GeomFill_SnglrFunc.cxx
// Created:	Thu Feb 26 11:21:25 1998
// Author:	Roman BORISOV
//		<rbv@ecolox.nnov.matra-dtv.fr>


#include <GeomFill_SnglrFunc.ixx>
#include <Precision.hxx>

GeomFill_SnglrFunc::GeomFill_SnglrFunc(const Handle(Adaptor3d_HCurve)& HC) : 
       myHCurve(HC), ratio(1)
{
}

void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio)
{
  ratio = Ratio;
}

 Standard_Real GeomFill_SnglrFunc::FirstParameter() const
{
  return myHCurve->FirstParameter();
}

 Standard_Real GeomFill_SnglrFunc::LastParameter() const
{
  return myHCurve->LastParameter();
}

 Standard_Integer GeomFill_SnglrFunc::NbIntervals(const GeomAbs_Shape S) 
{
#ifndef DEB
  GeomAbs_Shape HCS=GeomAbs_C0;
#else
  GeomAbs_Shape HCS;
#endif
  switch(S) {
  case GeomAbs_C0: HCS = GeomAbs_C2; break;
  case GeomAbs_C1: HCS = GeomAbs_C3; break;
  case GeomAbs_C2: HCS = GeomAbs_CN; break;
  default: Standard_DomainError::Raise();
  }
  return myHCurve->NbIntervals(HCS);
}

 void GeomFill_SnglrFunc::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) 
{
#ifndef DEB
  GeomAbs_Shape HCS=GeomAbs_C0;
#else
  GeomAbs_Shape HCS ;
#endif
  switch(S) {
  case GeomAbs_C0: HCS = GeomAbs_C2; break;
  case GeomAbs_C1: HCS = GeomAbs_C3; break;
  case GeomAbs_C2: HCS = GeomAbs_CN; break;
  default: Standard_DomainError::Raise();
  }
  myHCurve->Intervals(T, HCS);
}

 Standard_Boolean GeomFill_SnglrFunc::IsPeriodic() const
{
  return myHCurve->IsPeriodic();
}

 Standard_Real GeomFill_SnglrFunc::Period() const
{
  return myHCurve->Period();
}


 gp_Pnt GeomFill_SnglrFunc::Value(const Standard_Real U) const
{
  gp_Pnt C;
  gp_Vec DC, D2C;
  myHCurve->D2(U, C, DC, D2C);
  DC *= ratio;
  return gp_Pnt(DC.Crossed(D2C).XYZ());
}

 void GeomFill_SnglrFunc::D0(const Standard_Real U,gp_Pnt& P) const
{
  gp_Pnt C;
  gp_Vec DC, D2C;
  myHCurve->D2(U, C, DC, D2C);
  DC *= ratio;
  P = gp_Pnt(DC.Crossed(D2C).XYZ());
}

 void GeomFill_SnglrFunc::D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V) const
{
  gp_Pnt C;
  gp_Vec DC, D2C, D3C;
  myHCurve->D3(U, C, DC, D2C, D3C);
  DC *= ratio;
  P = gp_Pnt(DC.Crossed(D2C).XYZ());
  V = DC.Crossed(D3C);
}

 void GeomFill_SnglrFunc::D2(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
{
  gp_Pnt C;
  gp_Vec DC, D2C, D3C, D4C;
  myHCurve->D3(U, C, DC, D2C, D3C);
  P = gp_Pnt(DC.Crossed(D2C).XYZ());
  V1 = DC.Crossed(D3C);
  D4C = myHCurve->DN(U, 4);
  V2 = D2C.Crossed(D3C) + DC.Crossed(D4C);

  P.ChangeCoord() *= ratio;
  V1 *= ratio;
  V2 *= ratio;
}

 Standard_Real GeomFill_SnglrFunc::Resolution(const Standard_Real R3D) const
{
  return Precision::Parametric(R3D);
}

 GeomAbs_CurveType GeomFill_SnglrFunc::GetType() const
{
  return GeomAbs_OtherCurve;
}