0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / AdvApp2Var / AdvApp2Var_Node.cxx
CommitLineData
b311480e 1// Created on: 1996-07-02
2// Created by: Joelle CHAUVET
3// Copyright (c) 1996-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23#include <AdvApp2Var_Node.ixx>
24#include <TColgp_HArray2OfPnt.hxx>
25#include <TColStd_HArray2OfReal.hxx>
26
27
28//=======================================================================
29//function : AdvApp2Var_Node
30//purpose :
31//=======================================================================
32
33AdvApp2Var_Node::AdvApp2Var_Node() :
34myOrdInU(2),
35myOrdInV(2)
36{
37 myTruePoints = new TColgp_HArray2OfPnt ( 0, 2, 0, 2);
38 gp_Pnt P0(0.,0.,0.);
39 myTruePoints->Init(P0);
40 myErrors = new TColStd_HArray2OfReal( 0, 2, 0, 2);
41 myErrors->Init(0.);
42}
43
44//=======================================================================
45//function : AdvApp2Var_Node
46//purpose :
47//=======================================================================
48
49AdvApp2Var_Node::AdvApp2Var_Node(const Standard_Integer iu,
50 const Standard_Integer iv) :
51myOrdInU(iu),
52myOrdInV(iv)
53{
54 myTruePoints = new TColgp_HArray2OfPnt ( 0, Max(0,iu), 0, Max(0,iv));
55 gp_Pnt P0(0.,0.,0.);
56 myTruePoints->Init(P0);
57 myErrors = new TColStd_HArray2OfReal( 0, Max(0,iu), 0, Max(0,iv));
58 myErrors->Init(0.);
59}
60
61//=======================================================================
62//function : AdvApp2Var_Node
63//purpose :
64//=======================================================================
65
66AdvApp2Var_Node::AdvApp2Var_Node(const gp_XY& UV,
67 const Standard_Integer iu,
68 const Standard_Integer iv) :
69myCoord(UV),
70myOrdInU(iu),
71myOrdInV(iv)
72{
73 myTruePoints = new TColgp_HArray2OfPnt ( 0, iu, 0, iv);
74 gp_Pnt P0(0.,0.,0.);
75 myTruePoints->Init(P0);
76 myErrors = new TColStd_HArray2OfReal( 0, iu, 0, iv);
77 myErrors->Init(0.);
78}
79
80
81//=======================================================================
82//function : Coord
83//purpose : returns the coordinates (U,V) of the node
84//=======================================================================
85
86gp_XY AdvApp2Var_Node::Coord() const
87{
88 return myCoord;
89}
90
91//=======================================================================
92//function : SetCoord
93//purpose : changes the coordinates (U,V) to (x1,x2)
94//=======================================================================
95
96void AdvApp2Var_Node::SetCoord(const Standard_Real x1,
97 const Standard_Real x2)
98{
99 myCoord.SetX(x1);
100 myCoord.SetY(x2);
101}
102
103//=======================================================================
104//function : UOrder
105//purpose : returns the continuity order in U of the node
106//=======================================================================
107
108Standard_Integer AdvApp2Var_Node::UOrder() const
109{
110 return myOrdInU;
111}
112
113//=======================================================================
114//function : VOrder
115//purpose : returns the continuity order in V of the node
116//=======================================================================
117
118Standard_Integer AdvApp2Var_Node::VOrder() const
119{
120 return myOrdInV;
121}
122
123
124//=======================================================================
125//function : SetPoint
126//purpose : affects the value F(U,V) or its derivates on the node (U,V)
127//=======================================================================
128
129void AdvApp2Var_Node::SetPoint(const Standard_Integer iu,
130 const Standard_Integer iv,
131 const gp_Pnt& Pt)
132{
133 myTruePoints->SetValue(iu, iv, Pt);
134}
135
136
137//=======================================================================
138//function : Point
139//purpose : returns the value F(U,V) or its derivates on the node (U,V)
140//=======================================================================
141
142gp_Pnt AdvApp2Var_Node::Point(const Standard_Integer iu,
143 const Standard_Integer iv) const
144{
145 return myTruePoints->Value(iu, iv);
146}
147
148
149//=======================================================================
150//function : SetError
151//purpose : affects the error between F(U,V) and its approximation
152//=======================================================================
153
154void AdvApp2Var_Node::SetError(const Standard_Integer iu,
155 const Standard_Integer iv,
156 const Standard_Real error)
157{
158 myErrors->SetValue(iu, iv, error);
159}
160
161
162//=======================================================================
163//function : Error
164//purpose : returns the error between F(U,V) and its approximation
165//=======================================================================
166
167Standard_Real AdvApp2Var_Node::Error(const Standard_Integer iu,
168 const Standard_Integer iv) const
169{
170 return myErrors->Value(iu, iv);
171}
172
173
174
175
176
177
178
179
180
181
182