ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/sat/src/sat_plane.cpp
Revision: 433
Committed: Thu Oct 17 14:04:40 2013 UTC (11 years, 6 months ago) by francois
File size: 6494 byte(s)
Log Message:
Magic V4. Nouvelle approche pour les exe (suite)

File Contents

# User Rev Content
1 francois 283 //------------------------------------------------------------
2     //------------------------------------------------------------
3     // MAGiC
4     // Jean Christophe Cuilli�re et Vincent FRANCOIS
5     // D�partement de G�nie M�canique - UQTR
6     //------------------------------------------------------------
7     // Le projet MAGIC est un projet de recherche du d�partement
8     // de g�nie m�canique de l'Universit� du Qu�bec �
9     // Trois Rivi�res
10     // Les librairies ne peuvent �tre utilis�es sans l'accord
11     // des auteurs (contact : francois@uqtr.ca)
12     //------------------------------------------------------------
13     //------------------------------------------------------------
14     //
15     // sat_plane.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H24
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26     #include "sat_plane.h"
27     #include "constantegeo.h"
28     #include "ot_mathematique.h"
29    
30    
31     SAT_PLANE::SAT_PLANE(unsigned long num):SAT_SURFACE(num)
32     {
33     }
34    
35     SAT_PLANE::SAT_PLANE():SAT_SURFACE()
36     {
37     }
38    
39     SAT_PLANE::~SAT_PLANE()
40     {
41     }
42    
43    
44    
45     void SAT_PLANE::calcule_parametre(void)
46     {
47     OT_VECTEUR_3D vec_normal(normal);
48     vec_normal.norme();
49     if (!(OPERATEUR::egal(vec_normal.get_x(),0.,0.0001)))
50     {
51     dir1[0]=vec_normal.get_y();
52     dir1[1]=(-vec_normal.get_x());
53     dir1[2]=0.;
54     }
55     else if (!(OPERATEUR::egal(vec_normal.get_y(),0.,0.0001)))
56     {
57     dir1[0]=0.;
58     dir1[1]=(-vec_normal.get_z());
59     dir1[2]=vec_normal.get_y();
60     }
61     else
62     {
63     dir1[0]=vec_normal.get_z();
64     dir1[1]=0.;
65     dir1[2]=0.;
66     }
67     OT_VECTEUR_3D vec_dir1(dir1);
68     vec_dir1.norme();
69     OT_VECTEUR_3D vec_dir2=vec_normal&vec_dir1;
70     dir2[0]=vec_dir2.get_x();
71     dir2[1]=vec_dir2.get_y();
72     dir2[2]=vec_dir2.get_z();
73     }
74    
75    
76     void SAT_PLANE::evaluer(double *uv,double *xyz)
77     {
78     xyz[0]=root[0]+uv[0]*dir1[0]+uv[1]*dir2[0];
79     xyz[1]=root[1]+uv[0]*dir1[1]+uv[1]*dir2[1];
80     xyz[2]=root[2]+uv[0]*dir1[2]+uv[1]*dir2[2];
81     }
82    
83     void SAT_PLANE::deriver(double *uv,double *xyzdu, double *xyzdv)
84     {
85     xyzdu[0]=dir1[0];
86     xyzdu[1]=dir1[1];
87     xyzdu[2]=dir1[2];
88     xyzdv[0]=dir2[0];
89     xyzdv[1]=dir2[1];
90     xyzdv[2]=dir2[2];
91     }
92    
93     void SAT_PLANE::deriver_seconde(double *uv,double* xyzduu,double* xyzduv,double* xyzdvv,double *xyz, double *xyzdu , double *xyzdv )
94     {
95     xyzduu[0]=0.;
96     xyzduu[1]=0.;
97     xyzduu[2]=0.;
98     xyzduv[0]=0.;
99     xyzduv[1]=0.;
100     xyzduv[2]=0.;
101     xyzdvv[0]=0.;
102     xyzdvv[1]=0.;
103     xyzdvv[2]=0.;
104     evaluer(uv,xyz);
105     deriver(uv,xyzdu,xyzdv);
106     }
107    
108     void SAT_PLANE::inverser(double *uv,double *xyz,double precision)
109     {
110     double coord[3];
111     int n1,n2;
112     coord[0]=xyz[0]-root[0];
113     coord[1]=xyz[1]-root[1];
114     coord[2]=xyz[2]-root[2];;
115     double det=dir1[0]*dir2[1]-dir1[1]*dir2[0];
116     if (!(OPERATEUR::egal(det,0.0,0.0001)))
117     {
118     n1=0;
119     n2=1;
120     }
121     else
122     {
123     det=dir1[0]*dir2[2]-dir1[2]*dir2[0];
124     if (!(OPERATEUR::egal(det,0.0,0.0001)))
125     {
126     n1=0;
127     n2=2;
128     }
129     else
130     {
131     n1=1;
132     n2=2;
133     det=dir1[1]*dir2[2]-dir1[2]*dir2[1];
134     }
135     }
136     uv[0]=(coord[n1]*dir2[n2]-coord[n2]*dir2[n1])/det;
137     uv[1]=(dir1[n1]*coord[n2]-dir1[n2]*coord[n1])/det;
138    
139     }
140    
141     int SAT_PLANE::est_periodique_u(void)
142     {
143     return 0;
144     }
145    
146     int SAT_PLANE::est_periodique_v(void)
147     {
148     return 0;
149     }
150    
151     double SAT_PLANE::get_periode_u(void)
152     {
153     return 0.;
154     }
155    
156     double SAT_PLANE::get_periode_v(void)
157     {
158     return 0.;
159     }
160    
161     double SAT_PLANE::get_umin(void)
162     {
163     return -1e300;
164     }
165    
166     double SAT_PLANE::get_umax(void)
167     {
168     return 1e300;
169     }
170    
171     double SAT_PLANE::get_vmin(void)
172     {
173     return -1e300;
174     }
175    
176     double SAT_PLANE::get_vmax(void)
177     {
178     return 1e300;
179     }
180    
181    
182     int SAT_PLANE::get_type_geometrique(TPL_LISTE_ENTITE<double> &param)
183     {
184     param.ajouter(root[0]);
185     param.ajouter(root[1]);
186     param.ajouter(root[2]);
187     param.ajouter(normal[0]);
188     param.ajouter(normal[1]);
189     param.ajouter(normal[2]);
190     return MGCo_PLAN;
191     }
192    
193    
194    
195     void SAT_PLANE::get_param_NURBS(int& indx_premier_ptctr,TPL_LISTE_ENTITE<double> &param)
196     {
197    
198     // For a plan the net controls point is
199     double uv[2];
200     double xyz[3];
201    
202     // The first parameter indicate the code access
203     param.ajouter(2);
204     // The follewing two parameters of the list indicate the orders of the net points
205    
206     param.ajouter(2);
207     param.ajouter(2);
208    
209     // The follewing two parameters indicate the number of rows and colons of the control points
210     // respectively to the two parameters directions
211    
212     param.ajouter(2);
213     param.ajouter(2);
214    
215     // this present the knot vector in the u-direction
216    
217     param.ajouter(0);
218     param.ajouter(0);
219     param.ajouter(1);
220     param.ajouter(1);
221    
222     // this present the knot vector in the v-direction
223    
224     param.ajouter(0);
225     param.ajouter(0);
226     param.ajouter(1);
227     param.ajouter(1);
228    
229     // note that the cordinate of the control points are given in the homogeneous cordinates
230    
231    
232     double inf_val=10e6;
233    
234     // this is the firt control point with cordinate (+inf,+inf)
235    
236     xyz[0]=root[0]+inf_val*dir1[0]+inf_val*dir2[0];
237     xyz[1]=root[1]+inf_val*dir1[1]+inf_val*dir2[1];
238     xyz[2]=root[2]+inf_val*dir1[2]+inf_val*dir2[2];
239    
240     param.ajouter(xyz[0]);
241     param.ajouter(xyz[1]);
242     param.ajouter(xyz[2]);
243 francois 433 param.ajouter(1.);
244 francois 283
245    
246     // this is the second control point with cordinate (-inf,+inf)
247    
248     xyz[0]=root[0]-inf_val*dir1[0]+inf_val*dir2[0];
249     xyz[1]=root[1]-inf_val*dir1[1]+inf_val*dir2[1];
250     xyz[2]=root[2]-inf_val*dir1[2]+inf_val*dir2[2];
251    
252     param.ajouter(xyz[0]);
253     param.ajouter(xyz[1]);
254     param.ajouter(xyz[2]);
255 francois 433 param.ajouter(1.);
256 francois 283
257    
258     // this is the third control point with cordinate (-inf,-inf)
259    
260     xyz[0]=root[0]+inf_val*dir1[0]-inf_val*dir2[0];
261     xyz[1]=root[1]+inf_val*dir1[1]-inf_val*dir2[1];
262     xyz[2]=root[2]+inf_val*dir1[2]-inf_val*dir2[2];
263    
264     param.ajouter(xyz[0]);
265     param.ajouter(xyz[1]);
266     param.ajouter(xyz[2]);
267 francois 433 param.ajouter(1.);
268 francois 283
269     // this is the second control point with cordinate (inf,-inf)
270    
271     xyz[0]=root[0]-inf_val*dir1[0]-inf_val*dir2[0];
272     xyz[1]=root[1]-inf_val*dir1[1]-inf_val*dir2[1];
273     xyz[2]=root[2]-inf_val*dir1[2]-inf_val*dir2[2];
274    
275     param.ajouter(xyz[0]);
276     param.ajouter(xyz[1]);
277     param.ajouter(xyz[2]);
278 francois 433 param.ajouter(1.);
279 francois 283
280     indx_premier_ptctr=13;
281    
282     }