summaryrefslogtreecommitdiff
path: root/src/IGESGeom/IGESGeom_SplineCurve.cxx
blob: 2057b9e2165cc0a73f3463cf2c5c50c1ae08ac06 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//--------------------------------------------------------------------
//
//  File Name : IGESGeom_SplineCurve.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESGeom_SplineCurve.ixx>


    IGESGeom_SplineCurve::IGESGeom_SplineCurve ()    {  }


    void IGESGeom_SplineCurve::Init
  (const Standard_Integer               aType,
   const Standard_Integer               aDegree,
   const Standard_Integer               nbDimensions,
   const Handle(TColStd_HArray1OfReal)& allBreakPoints,
   const Handle(TColStd_HArray2OfReal)& allXPolynomials,
   const Handle(TColStd_HArray2OfReal)& allYPolynomials,
   const Handle(TColStd_HArray2OfReal)& allZPolynomials,
   const Handle(TColStd_HArray1OfReal)& allXvalues,
   const Handle(TColStd_HArray1OfReal)& allYvalues,
   const Handle(TColStd_HArray1OfReal)& allZvalues)
{
  Standard_Integer len = allXPolynomials->ColLength();
  if ((len != allYPolynomials->ColLength()) ||
      (len != allZPolynomials->ColLength()) )
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineCurve : Column Length of HArray2s in Init");
  if (allBreakPoints->Lower() != 1 || allXvalues->Lower() != 1 ||
      allYvalues->Lower()     != 1 || allZvalues->Lower() != 1 ||
      allXPolynomials->LowerCol() != 1 || allXPolynomials->LowerRow() != 1 ||
      allYPolynomials->LowerCol() != 1 || allXPolynomials->LowerRow() != 1 ||
      allZPolynomials->LowerCol() != 1 || allZPolynomials->LowerRow() != 1)
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineCurve : Lower Indices of HArrays in Init");
  len = allXPolynomials->RowLength();
  if ((len != allYPolynomials->RowLength()) ||
      (len != allZPolynomials->RowLength()) )
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineCurve : Row Length of HArray2s in Init");

  len = allXvalues->Length();
  if ((len != allYvalues->Length()) || (len != allZvalues->Length()) )
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineCurve : Length of HArray1s in Init");

  theType   = aType;
  theDegree = aDegree;
  theNbDimensions = nbDimensions;
  theBreakPoints  = allBreakPoints;
  theXCoordsPolynomial = allXPolynomials;
  theYCoordsPolynomial = allYPolynomials;
  theZCoordsPolynomial = allZPolynomials;
  theXvalues = allXvalues;
  theYvalues = allYvalues;
  theZvalues = allZvalues;
  InitTypeAndForm(112,0);
}

    Standard_Integer IGESGeom_SplineCurve::SplineType () const
{
  return theType;
}

    Standard_Integer IGESGeom_SplineCurve::Degree () const
{
  return theDegree;
}

    Standard_Integer IGESGeom_SplineCurve::NbDimensions () const
{
  return theNbDimensions;
}

    Standard_Integer IGESGeom_SplineCurve::NbSegments () const
{
  if(theBreakPoints.IsNull())
    return 0;
  else
    return ((theBreakPoints->Length()) - 1);
}

    Standard_Real IGESGeom_SplineCurve::BreakPoint
  (const Standard_Integer Index) const
{
  return theBreakPoints->Value(Index);
}

    void IGESGeom_SplineCurve::XCoordPolynomial
  (const Standard_Integer Index, Standard_Real& AX,
 Standard_Real& BX, Standard_Real& CX, Standard_Real& DX) const
{
  AX = theXCoordsPolynomial->Value(Index, 1);
  BX = theXCoordsPolynomial->Value(Index, 2);
  CX = theXCoordsPolynomial->Value(Index, 3);
  DX = theXCoordsPolynomial->Value(Index, 4);
}

    void IGESGeom_SplineCurve::YCoordPolynomial
  (const Standard_Integer Index, Standard_Real& AY,
 Standard_Real& BY, Standard_Real& CY, Standard_Real& DY) const
{
  AY = theYCoordsPolynomial->Value(Index, 1);
  BY = theYCoordsPolynomial->Value(Index, 2);
  CY = theYCoordsPolynomial->Value(Index, 3);
  DY = theYCoordsPolynomial->Value(Index, 4);
}

    void IGESGeom_SplineCurve::ZCoordPolynomial
  (const Standard_Integer Index, Standard_Real& AZ,
 Standard_Real& BZ, Standard_Real& CZ, Standard_Real& DZ) const
{
  AZ = theZCoordsPolynomial->Value(Index, 1);
  BZ = theZCoordsPolynomial->Value(Index, 2);
  CZ = theZCoordsPolynomial->Value(Index, 3);
  DZ = theZCoordsPolynomial->Value(Index, 4);
}

    void IGESGeom_SplineCurve::XValues
  (Standard_Real& TPX0, Standard_Real& TPX1,
 Standard_Real& TPX2, Standard_Real& TPX3) const
{
  TPX0 = theXvalues->Value(1);
  TPX1 = theXvalues->Value(2);
  TPX2 = theXvalues->Value(3);
  TPX3 = theXvalues->Value(4);
}

    void IGESGeom_SplineCurve::YValues
  (Standard_Real& TPY0, Standard_Real& TPY1,
 Standard_Real& TPY2, Standard_Real& TPY3) const
{
  TPY0 = theYvalues->Value(1);
  TPY1 = theYvalues->Value(2);
  TPY2 = theYvalues->Value(3);
  TPY3 = theYvalues->Value(4);
}

    void IGESGeom_SplineCurve::ZValues
  (Standard_Real& TPZ0, Standard_Real& TPZ1,
 Standard_Real& TPZ2, Standard_Real& TPZ3) const
{
  TPZ0 = theZvalues->Value(1);
  TPZ1 = theZvalues->Value(2);
  TPZ2 = theZvalues->Value(3);
  TPZ3 = theZvalues->Value(4);
}