0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / IGESGeom / IGESGeom_SplineCurve.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
42cf5bc1 19#include <IGESGeom_SplineCurve.hxx>
20#include <Standard_DimensionMismatch.hxx>
21#include <Standard_OutOfRange.hxx>
22#include <Standard_Type.hxx>
7fd59977 23
92efcf78 24IMPLEMENT_STANDARD_RTTIEXT(IGESGeom_SplineCurve,IGESData_IGESEntity)
25
b311480e 26IGESGeom_SplineCurve::IGESGeom_SplineCurve () { }
7fd59977 27
28
29 void IGESGeom_SplineCurve::Init
30 (const Standard_Integer aType,
31 const Standard_Integer aDegree,
32 const Standard_Integer nbDimensions,
33 const Handle(TColStd_HArray1OfReal)& allBreakPoints,
34 const Handle(TColStd_HArray2OfReal)& allXPolynomials,
35 const Handle(TColStd_HArray2OfReal)& allYPolynomials,
36 const Handle(TColStd_HArray2OfReal)& allZPolynomials,
37 const Handle(TColStd_HArray1OfReal)& allXvalues,
38 const Handle(TColStd_HArray1OfReal)& allYvalues,
39 const Handle(TColStd_HArray1OfReal)& allZvalues)
40{
41 Standard_Integer len = allXPolynomials->ColLength();
42 if ((len != allYPolynomials->ColLength()) ||
43 (len != allZPolynomials->ColLength()) )
9775fa61 44 throw Standard_DimensionMismatch("IGESGeom_SplineCurve : Column Length of HArray2s in Init");
7fd59977 45 if (allBreakPoints->Lower() != 1 || allXvalues->Lower() != 1 ||
46 allYvalues->Lower() != 1 || allZvalues->Lower() != 1 ||
47 allXPolynomials->LowerCol() != 1 || allXPolynomials->LowerRow() != 1 ||
e04db199 48 allYPolynomials->LowerCol() != 1 || allYPolynomials->LowerRow() != 1 ||
7fd59977 49 allZPolynomials->LowerCol() != 1 || allZPolynomials->LowerRow() != 1)
9775fa61 50 throw Standard_DimensionMismatch("IGESGeom_SplineCurve : Lower Indices of HArrays in Init");
7fd59977 51 len = allXPolynomials->RowLength();
52 if ((len != allYPolynomials->RowLength()) ||
53 (len != allZPolynomials->RowLength()) )
9775fa61 54 throw Standard_DimensionMismatch("IGESGeom_SplineCurve : Row Length of HArray2s in Init");
7fd59977 55
56 len = allXvalues->Length();
57 if ((len != allYvalues->Length()) || (len != allZvalues->Length()) )
9775fa61 58 throw Standard_DimensionMismatch("IGESGeom_SplineCurve : Length of HArray1s in Init");
7fd59977 59
60 theType = aType;
61 theDegree = aDegree;
62 theNbDimensions = nbDimensions;
63 theBreakPoints = allBreakPoints;
64 theXCoordsPolynomial = allXPolynomials;
65 theYCoordsPolynomial = allYPolynomials;
66 theZCoordsPolynomial = allZPolynomials;
67 theXvalues = allXvalues;
68 theYvalues = allYvalues;
69 theZvalues = allZvalues;
70 InitTypeAndForm(112,0);
71}
72
73 Standard_Integer IGESGeom_SplineCurve::SplineType () const
74{
75 return theType;
76}
77
78 Standard_Integer IGESGeom_SplineCurve::Degree () const
79{
80 return theDegree;
81}
82
83 Standard_Integer IGESGeom_SplineCurve::NbDimensions () const
84{
85 return theNbDimensions;
86}
87
88 Standard_Integer IGESGeom_SplineCurve::NbSegments () const
89{
90 if(theBreakPoints.IsNull())
91 return 0;
92 else
93 return ((theBreakPoints->Length()) - 1);
94}
95
96 Standard_Real IGESGeom_SplineCurve::BreakPoint
97 (const Standard_Integer Index) const
98{
99 return theBreakPoints->Value(Index);
100}
101
102 void IGESGeom_SplineCurve::XCoordPolynomial
103 (const Standard_Integer Index, Standard_Real& AX,
104 Standard_Real& BX, Standard_Real& CX, Standard_Real& DX) const
105{
106 AX = theXCoordsPolynomial->Value(Index, 1);
107 BX = theXCoordsPolynomial->Value(Index, 2);
108 CX = theXCoordsPolynomial->Value(Index, 3);
109 DX = theXCoordsPolynomial->Value(Index, 4);
110}
111
112 void IGESGeom_SplineCurve::YCoordPolynomial
113 (const Standard_Integer Index, Standard_Real& AY,
114 Standard_Real& BY, Standard_Real& CY, Standard_Real& DY) const
115{
116 AY = theYCoordsPolynomial->Value(Index, 1);
117 BY = theYCoordsPolynomial->Value(Index, 2);
118 CY = theYCoordsPolynomial->Value(Index, 3);
119 DY = theYCoordsPolynomial->Value(Index, 4);
120}
121
122 void IGESGeom_SplineCurve::ZCoordPolynomial
123 (const Standard_Integer Index, Standard_Real& AZ,
124 Standard_Real& BZ, Standard_Real& CZ, Standard_Real& DZ) const
125{
126 AZ = theZCoordsPolynomial->Value(Index, 1);
127 BZ = theZCoordsPolynomial->Value(Index, 2);
128 CZ = theZCoordsPolynomial->Value(Index, 3);
129 DZ = theZCoordsPolynomial->Value(Index, 4);
130}
131
132 void IGESGeom_SplineCurve::XValues
133 (Standard_Real& TPX0, Standard_Real& TPX1,
134 Standard_Real& TPX2, Standard_Real& TPX3) const
135{
136 TPX0 = theXvalues->Value(1);
137 TPX1 = theXvalues->Value(2);
138 TPX2 = theXvalues->Value(3);
139 TPX3 = theXvalues->Value(4);
140}
141
142 void IGESGeom_SplineCurve::YValues
143 (Standard_Real& TPY0, Standard_Real& TPY1,
144 Standard_Real& TPY2, Standard_Real& TPY3) const
145{
146 TPY0 = theYvalues->Value(1);
147 TPY1 = theYvalues->Value(2);
148 TPY2 = theYvalues->Value(3);
149 TPY3 = theYvalues->Value(4);
150}
151
152 void IGESGeom_SplineCurve::ZValues
153 (Standard_Real& TPZ0, Standard_Real& TPZ1,
154 Standard_Real& TPZ2, Standard_Real& TPZ3) const
155{
156 TPZ0 = theZvalues->Value(1);
157 TPZ1 = theZvalues->Value(2);
158 TPZ2 = theZvalues->Value(3);
159 TPZ3 = theZvalues->Value(4);
160}