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
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.
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.
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.
21 // Modified: Mon Dec 9 11:39:13 1996
23 // G1135 : empty constructor
26 #include <AdvApp2Var_Network.ixx>
27 #include <AdvApp2Var_Patch.hxx>
28 #include <AdvApp2Var_SequenceOfPatch.hxx>
29 #include <TColStd_SequenceOfReal.hxx>
31 //==========================================================================================
32 //function : AdvApp2Var_Network
34 //==========================================================================================
36 AdvApp2Var_Network::AdvApp2Var_Network()
41 //==========================================================================================
42 //function : AdvApp2Var_Network
44 //==========================================================================================
46 AdvApp2Var_Network::AdvApp2Var_Network(const AdvApp2Var_SequenceOfPatch& Net,
47 const TColStd_SequenceOfReal& TheU,
48 const TColStd_SequenceOfReal& TheV)
55 //==========================================================================================
56 //function : FirstNotApprox
57 //purpose : return the first Patch not approximated
58 //==========================================================================================
60 Standard_Boolean AdvApp2Var_Network::FirstNotApprox(Standard_Integer& Index) const
62 Standard_Boolean good = Standard_True;
64 for (i = 1; i <= myNet.Length() && good; i++) {
65 good = myNet.Value(i).IsApproximated();
66 if (!good) {Index = i;}
71 //==========================================================================================
72 //function : UpdateInU
73 //purpose : modification and insertion of patches and parameters
74 //==========================================================================================
76 void AdvApp2Var_Network::UpdateInU(const Standard_Real CuttingValue)
79 // insertion du nouveau parametre de decoupe
80 Standard_Integer i=1,j;
81 while (myUParameters.Value(i)<CuttingValue) {
84 myUParameters.InsertBefore(i,CuttingValue);
86 Standard_Integer indice;
87 for (j=1; j< myVParameters.Length() ; j++){
89 // modification des patches concernes par la decoupe
91 indice = (myUParameters.Length()-1) * (j-1) + i - 1;
92 Pat = myNet.Value(indice);
93 Pat.ChangeDomain(Pat.U0(), CuttingValue, Pat.V0(), Pat.V1());
95 myNet.SetValue(indice, Pat);
97 // insertion des nouveaux patches
98 AdvApp2Var_Patch NewPat(CuttingValue,myUParameters.Value(i+1),
99 myVParameters.Value(j),myVParameters.Value(j+1),
100 Pat.UOrder(),Pat.VOrder());
101 NewPat.ResetApprox();
102 myNet.InsertAfter(indice, NewPat);
107 //==========================================================================================
108 //function : UpdateInV
109 //purpose : modification and insertion of patches and parameters
110 //==========================================================================================
112 void AdvApp2Var_Network::UpdateInV(const Standard_Real CuttingValue)
115 // insertion du nouveau parametre de decoupe
116 Standard_Integer i,j=1;
117 AdvApp2Var_Patch Pat;
118 while (myVParameters.Value(j)<CuttingValue) {
121 myVParameters.InsertBefore(j,CuttingValue);
123 // modification des patches concernes par la decoupe
124 Standard_Integer indice;
125 for (i=1; i< myUParameters.Length() ; i++){
126 indice = (myUParameters.Length()-1) * (j-2) + i;
127 Pat = myNet.Value(indice);
128 Pat.ChangeDomain(Pat.U0(), Pat.U1(), Pat.V0(), CuttingValue);
130 myNet.SetValue(indice,Pat);
133 // insertion des nouveaux patches
134 for (i=1; i< myUParameters.Length() ; i++){
135 indice = (myUParameters.Length()-1) * (j-1) + i-1;
136 AdvApp2Var_Patch NewPat(myUParameters.Value(i), myUParameters.Value(i+1),
137 CuttingValue,myVParameters.Value(j+1),
138 Pat.UOrder(),Pat.VOrder());
139 NewPat.ResetApprox();
140 myNet.InsertAfter(indice,NewPat);
144 //=======================================================================
145 //function : SameDegree
146 //purpose : same numbers of coefficients for all patches
147 //=======================================================================
149 void AdvApp2Var_Network::SameDegree(const Standard_Integer iu,
150 const Standard_Integer iv,
151 Standard_Integer& ncfu,
152 Standard_Integer& ncfv)
155 // calcul des coeff. max avec init selon l'ordre de continuite
156 Standard_Integer IndPat;
159 for (IndPat=1;IndPat<=myNet.Length();IndPat++) {
160 ncfu = Max(ncfu,myNet.Value(IndPat).NbCoeffInU());
161 ncfv = Max(ncfv,myNet.Value(IndPat).NbCoeffInV());
164 // augmentation des nombres de coeff.
165 AdvApp2Var_Patch Pat;
166 for (IndPat=1;IndPat<=myNet.Length();IndPat++) {
167 Pat = myNet.Value(IndPat);
168 Pat.ChangeNbCoeff(ncfu,ncfv);
169 myNet.SetValue(IndPat,Pat);
174 //=======================================================================
177 //=======================================================================
179 Standard_Integer AdvApp2Var_Network::NbPatch() const
181 return myNet.Length();
184 //=======================================================================
185 //function : NbPatchInU
187 //=======================================================================
189 Standard_Integer AdvApp2Var_Network::NbPatchInU() const
191 return myUParameters.Length()-1;
194 //=======================================================================
195 //function : NbPatchInV
197 //=======================================================================
199 Standard_Integer AdvApp2Var_Network::NbPatchInV() const
201 return myVParameters.Length()-1;
204 //=======================================================================
205 //function : UParameter
207 //=======================================================================
209 Standard_Real AdvApp2Var_Network::UParameter(const Standard_Integer Index) const
211 return myUParameters.Value(Index);
214 //=======================================================================
215 //function : VParameter
217 //=======================================================================
219 Standard_Real AdvApp2Var_Network::VParameter(const Standard_Integer Index) const
221 return myVParameters.Value(Index);