summaryrefslogtreecommitdiff
path: root/src/IGESGeom/IGESGeom_SplineSurface.cxx
blob: 27a4f01d468d669465589600f327967ddabc7eb1 (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
//--------------------------------------------------------------------
//
//  File Name : IGESGeom_SplineSurface.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESGeom_SplineSurface.ixx>


    IGESGeom_SplineSurface::IGESGeom_SplineSurface ()    {  }


    void IGESGeom_SplineSurface::Init
  (const Standard_Integer aBoundaryType, 
   const Standard_Integer aPatchType,
   const Handle(TColStd_HArray1OfReal)& allUBreakPoints,
   const Handle(TColStd_HArray1OfReal)& allVBreakPoints,
   const Handle(IGESBasic_HArray2OfHArray1OfReal)& allXCoeffs,
   const Handle(IGESBasic_HArray2OfHArray1OfReal)& allYCoeffs,
   const Handle(IGESBasic_HArray2OfHArray1OfReal)& allZCoeffs)
{
  Standard_Integer i,j;
  if (allUBreakPoints->Lower() != 1 || allVBreakPoints->Lower() != 1)
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineSurface: Lower Indices of BreakPoints in Init");

  Standard_Integer nbUSegs = allUBreakPoints->Length() - 1;
  Standard_Integer nbVSegs = allVBreakPoints->Length() - 1;

  Standard_Integer len = allXCoeffs->RowLength();
  if ((len != allYCoeffs->RowLength()) || (len != allZCoeffs->RowLength()))
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineSurface: Row Length of HArray2s in Init");
  if (allXCoeffs->LowerCol() != 1 || allXCoeffs->LowerRow() != 1 ||
      allYCoeffs->LowerCol() != 1 || allYCoeffs->LowerRow() != 1 ||
      allZCoeffs->LowerCol() != 1 || allZCoeffs->LowerRow() != 1 )
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineSurface: Lower Col-Row Indices of HArray2s in Init");

  len = allXCoeffs->ColLength();
  if ((len != allYCoeffs->ColLength()) || (len != allZCoeffs->ColLength()))
    Standard_DimensionMismatch::Raise
  ("IGESGeom_SplineSurface: Column Length of HArray2s in Init");

  Handle(TColStd_HArray1OfReal) temp1;
  Handle(TColStd_HArray1OfReal) temp2;
  Handle(TColStd_HArray1OfReal) temp3;
  for (i = 1; i <= nbUSegs; i++)
    for (j = 1; j <= nbVSegs; j++)
      {
        temp1 = allXCoeffs->Value(i,j);
        temp2 = allYCoeffs->Value(i,j);
        temp3 = allZCoeffs->Value(i,j);
        if ((temp1.IsNull() || temp1->Length() != 16) || 
            (temp2.IsNull() || temp2->Length() != 16) || 
            (temp3.IsNull() || temp3->Length() != 16))
	  Standard_DimensionMismatch::Raise
	    ("IGESGeom_SplineSurface: Lengths of elements of HArray2s in Init");
      }


  theBoundaryType = aBoundaryType;
  thePatchType = aPatchType;
  theUBreakPoints = allUBreakPoints;
  theVBreakPoints = allVBreakPoints;
  theXCoeffs = allXCoeffs;
  theYCoeffs = allYCoeffs;
  theZCoeffs = allZCoeffs;
  InitTypeAndForm(114,0);
}

    Standard_Integer IGESGeom_SplineSurface::NbUSegments () const
{
  return (theUBreakPoints->Length() - 1);
}

    Standard_Integer IGESGeom_SplineSurface::NbVSegments () const
{
  return (theVBreakPoints->Length() - 1);
}

    Standard_Integer IGESGeom_SplineSurface::BoundaryType () const
{
  return theBoundaryType;
}

    Standard_Integer IGESGeom_SplineSurface::PatchType () const
{
  return thePatchType;
}

    Standard_Real IGESGeom_SplineSurface::UBreakPoint
  (const Standard_Integer Index) const
{
  return theUBreakPoints->Value(Index);
}

    Standard_Real IGESGeom_SplineSurface::VBreakPoint
  (const Standard_Integer Index) const
{
  return theVBreakPoints->Value(Index);
}

    Handle(TColStd_HArray1OfReal) IGESGeom_SplineSurface::XPolynomial
  (const Standard_Integer Index1, const Standard_Integer Index2) const
{
  return(theXCoeffs->Value(Index1,Index2));
}

    Handle(TColStd_HArray1OfReal) IGESGeom_SplineSurface::YPolynomial
  (const Standard_Integer Index1, const Standard_Integer Index2) const
{
  return(theYCoeffs->Value(Index1,Index2));
}

    Handle(TColStd_HArray1OfReal) IGESGeom_SplineSurface::ZPolynomial
  (const Standard_Integer Index1, const Standard_Integer Index2) const
{
  return(theZCoeffs->Value(Index1,Index2));
}

    void  IGESGeom_SplineSurface::Polynomials
  (Handle(IGESBasic_HArray2OfHArray1OfReal)& allXCoeffs,
   Handle(IGESBasic_HArray2OfHArray1OfReal)& allYCoeffs,
   Handle(IGESBasic_HArray2OfHArray1OfReal)& allZCoeffs) const
{
  allXCoeffs = theXCoeffs;
  allYCoeffs = theYCoeffs;
  allZCoeffs = theZCoeffs;
}