1 |
|
5 |
//------------------------------------------------------------
|
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 |
|
|
// visuctt.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H26
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
|
27 |
|
|
#include <vcl.h>
|
28 |
|
|
#include <io.h>
|
29 |
|
|
#pragma hdrstop
|
30 |
|
|
|
31 |
|
|
#include <fstream.h>
|
32 |
|
|
//#include "fct_generateur_3d.h"
|
33 |
|
|
#include "tpl_grille.h"
|
34 |
|
|
#include "visuctt.h"
|
35 |
|
|
#include "config.h"
|
36 |
|
|
#include "applifonc.h"
|
37 |
|
|
#include "compocarte.h"
|
38 |
|
|
#include "main.h"
|
39 |
|
|
#include "visugraph.h"
|
40 |
|
|
//---------------------------------------------------------------------------
|
41 |
|
|
#pragma package(smart_init)
|
42 |
|
|
#pragma resource "*.dfm"
|
43 |
|
|
Tvisucttform *visucttform;
|
44 |
|
|
//---------------------------------------------------------------------------
|
45 |
|
|
__fastcall Tvisucttform::Tvisucttform(TComponent* Owner)
|
46 |
|
|
: TForm(Owner),zoom(0),dx(0.0),dy(0.0),debut_trans(false),shrink(0),facteur_shrink(0.8),render(0),axe(0),debut_rot(0),grille(NULL)
|
47 |
|
|
{
|
48 |
|
|
}
|
49 |
|
|
//---------------------------------------------------------------------------
|
50 |
|
|
void __fastcall Tvisucttform::Fermer1Click(TObject *Sender)
|
51 |
|
|
{
|
52 |
|
|
Close();
|
53 |
|
|
if (grille!=NULL) delete grille;
|
54 |
|
|
}
|
55 |
|
|
//---------------------------------------------------------------------------
|
56 |
|
|
|
57 |
|
|
void __fastcall Tvisucttform::FileExitItemClick(TObject *Sender)
|
58 |
|
|
{
|
59 |
|
|
TerminateProcess(GetCurrentProcess(),0);
|
60 |
|
|
}
|
61 |
|
|
//---------------------------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
void __fastcall Tvisucttform::FormClose(TObject *Sender,
|
64 |
|
|
TCloseAction &Action)
|
65 |
|
|
{
|
66 |
|
|
MainForm->ToolBar4->Visible=false;
|
67 |
|
|
MainForm->activecttform=NULL;
|
68 |
|
|
int nb=lst_cellule.size();
|
69 |
|
|
for (int i=0;i<nb;i++)
|
70 |
|
|
delete lst_cellule[i];
|
71 |
|
|
MainForm->StatusBar->Panels->Items[3]->Text="";
|
72 |
|
|
MainForm->StatusBar->Panels->Items[4]->Text="";
|
73 |
|
|
Action=caFree;
|
74 |
|
|
}
|
75 |
|
|
//---------------------------------------------------------------------------
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
void __fastcall Tvisucttform::Timer1Timer(TObject *Sender)
|
79 |
|
|
{
|
80 |
|
|
Timer1->Enabled=false;
|
81 |
|
|
FILE *in;
|
82 |
|
|
in=fopen(Caption.c_str(),"rt");
|
83 |
|
|
char mess[400];
|
84 |
|
|
fgets(mess,400,in);
|
85 |
bournival |
34 |
|
86 |
francois |
56 |
|
87 |
|
5 |
sscanf(mess,"%d %lf %lf %lf %lf %lf %lf %d %d %d",&nb_renseignement,&xmin,&ymin,&zmin,&xmax,&ymax,&zmax,&pasx,&pasy,&pasz);
|
88 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
89 |
|
|
{
|
90 |
|
|
fgets(mess,400,in);
|
91 |
|
|
mess[strlen(mess)-1]=0;
|
92 |
|
|
ListBox1->Items->Add(mess);
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
ListBox1->ItemIndex=0;
|
96 |
|
|
if (in!=NULL)
|
97 |
|
|
{
|
98 |
|
|
while (feof(in)==0)
|
99 |
|
|
{
|
100 |
|
|
char mess[400];
|
101 |
|
|
celluleaff* cell=new celluleaff(nb_renseignement);
|
102 |
|
|
fgets(mess,400,in);
|
103 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt1[0]),&(cell->coordpt1[1]),&(cell->coordpt1[2]));
|
104 |
|
|
char *p=strchr(mess,' ')+1;
|
105 |
|
|
p=strchr(p,' ')+1;
|
106 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
107 |
|
|
{
|
108 |
|
|
double val;
|
109 |
|
|
p=strchr(p,' ')+1;
|
110 |
|
|
sscanf(p,"%lf",&val);
|
111 |
|
|
cell->change_valeur(l,0,val);
|
112 |
|
|
}
|
113 |
|
|
fgets(mess,400,in);
|
114 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt2[0]),&(cell->coordpt2[1]),&(cell->coordpt2[2]));
|
115 |
|
|
p=strchr(mess,' ')+1;
|
116 |
|
|
p=strchr(p,' ')+1;
|
117 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
118 |
|
|
{
|
119 |
|
|
double val;
|
120 |
|
|
p=strchr(p,' ')+1;
|
121 |
|
|
sscanf(p,"%lf",&val);
|
122 |
|
|
cell->change_valeur(l,1,val);
|
123 |
|
|
}
|
124 |
|
|
fgets(mess,400,in);
|
125 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt3[0]),&(cell->coordpt3[1]),&(cell->coordpt3[2]));
|
126 |
|
|
p=strchr(mess,' ')+1;
|
127 |
|
|
p=strchr(p,' ')+1;
|
128 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
129 |
|
|
{
|
130 |
|
|
double val;
|
131 |
|
|
p=strchr(p,' ')+1;
|
132 |
|
|
sscanf(p,"%lf",&val);
|
133 |
|
|
cell->change_valeur(l,2,val);
|
134 |
|
|
}
|
135 |
|
|
fgets(mess,400,in);
|
136 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt4[0]),&(cell->coordpt4[1]),&(cell->coordpt4[2]));
|
137 |
|
|
p=strchr(mess,' ')+1;
|
138 |
|
|
p=strchr(p,' ')+1;
|
139 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
140 |
|
|
{
|
141 |
|
|
double val;
|
142 |
|
|
p=strchr(p,' ')+1;
|
143 |
|
|
sscanf(p,"%lf",&val);
|
144 |
|
|
cell->change_valeur(l,3,val);
|
145 |
|
|
}
|
146 |
|
|
fgets(mess,400,in);
|
147 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt5[0]),&(cell->coordpt5[1]),&(cell->coordpt5[2]));
|
148 |
|
|
p=strchr(mess,' ')+1;
|
149 |
|
|
p=strchr(p,' ')+1;
|
150 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
151 |
|
|
{
|
152 |
|
|
double val;
|
153 |
|
|
p=strchr(p,' ')+1;
|
154 |
|
|
sscanf(p,"%lf",&val);
|
155 |
|
|
cell->change_valeur(l,4,val);
|
156 |
|
|
}
|
157 |
|
|
fgets(mess,400,in);
|
158 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt6[0]),&(cell->coordpt6[1]),&(cell->coordpt6[2]));
|
159 |
|
|
p=strchr(mess,' ')+1;
|
160 |
|
|
p=strchr(p,' ')+1;
|
161 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
162 |
|
|
{
|
163 |
|
|
double val;
|
164 |
|
|
p=strchr(p,' ')+1;
|
165 |
|
|
sscanf(p,"%lf",&val);
|
166 |
|
|
cell->change_valeur(l,5,val);
|
167 |
|
|
}
|
168 |
|
|
fgets(mess,400,in);
|
169 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt7[0]),&(cell->coordpt7[1]),&(cell->coordpt7[2]));
|
170 |
|
|
p=strchr(mess,' ')+1;
|
171 |
|
|
p=strchr(p,' ')+1;
|
172 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
173 |
|
|
{
|
174 |
|
|
double val;
|
175 |
|
|
p=strchr(p,' ')+1;
|
176 |
|
|
sscanf(p,"%lf",&val);
|
177 |
|
|
cell->change_valeur(l,6,val);
|
178 |
|
|
}
|
179 |
|
|
fgets(mess,400,in);
|
180 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt8[0]),&(cell->coordpt8[1]),&(cell->coordpt8[2]));
|
181 |
|
|
p=strchr(mess,' ')+1;
|
182 |
|
|
p=strchr(p,' ')+1;
|
183 |
|
|
for (int l=0;l<nb_renseignement;l++)
|
184 |
|
|
{
|
185 |
|
|
double val;
|
186 |
|
|
p=strchr(p,' ')+1;
|
187 |
|
|
sscanf(p,"%lf",&val);
|
188 |
|
|
cell->change_valeur(l,7,val);
|
189 |
|
|
}
|
190 |
|
|
lst_cellule.insert(lst_cellule.end(),cell);
|
191 |
|
|
}
|
192 |
|
|
int nb=lst_cellule.size();
|
193 |
|
|
if (nb>0)
|
194 |
|
|
{
|
195 |
|
|
double xmin=lst_cellule[0]->coordpt1[0];
|
196 |
|
|
double xmax=lst_cellule[0]->coordpt1[0];
|
197 |
|
|
double ymin=lst_cellule[0]->coordpt1[1];
|
198 |
|
|
double ymax=lst_cellule[0]->coordpt1[1];
|
199 |
|
|
double zmin=lst_cellule[0]->coordpt1[2];
|
200 |
|
|
double zmax=lst_cellule[0]->coordpt1[2];
|
201 |
|
|
for (int k=0;k<nb_renseignement;k++)
|
202 |
|
|
{
|
203 |
|
|
valmax[k]=lst_cellule[0]->get_valeur(k,0);
|
204 |
|
|
valmin[k]=lst_cellule[0]->get_valeur(k,0);
|
205 |
|
|
}
|
206 |
|
|
for (int i=0;i<nb;i++)
|
207 |
|
|
{
|
208 |
|
|
celluleaff* cell=lst_cellule[i];
|
209 |
|
|
if (cell->coordpt1[0]>xmax) xmax=cell->coordpt1[0];
|
210 |
|
|
if (cell->coordpt1[0]<xmin) xmin=cell->coordpt1[0];
|
211 |
|
|
if (cell->coordpt1[1]>ymax) ymax=cell->coordpt1[1];
|
212 |
|
|
if (cell->coordpt1[1]<ymin) ymin=cell->coordpt1[1];
|
213 |
|
|
if (cell->coordpt1[2]>zmax) zmax=cell->coordpt1[2];
|
214 |
|
|
if (cell->coordpt1[2]<zmin) zmin=cell->coordpt1[2];
|
215 |
|
|
if (cell->coordpt2[0]>xmax) xmax=cell->coordpt2[0];
|
216 |
|
|
if (cell->coordpt2[0]<xmin) xmin=cell->coordpt2[0];
|
217 |
|
|
if (cell->coordpt2[1]>ymax) ymax=cell->coordpt2[1];
|
218 |
|
|
if (cell->coordpt2[1]<ymin) ymin=cell->coordpt2[1];
|
219 |
|
|
if (cell->coordpt2[2]>zmax) zmax=cell->coordpt2[2];
|
220 |
|
|
if (cell->coordpt2[2]<zmin) zmin=cell->coordpt2[2];
|
221 |
|
|
if (cell->coordpt3[0]>xmax) xmax=cell->coordpt3[0];
|
222 |
|
|
if (cell->coordpt3[0]<xmin) xmin=cell->coordpt3[0];
|
223 |
|
|
if (cell->coordpt3[1]>ymax) ymax=cell->coordpt3[1];
|
224 |
|
|
if (cell->coordpt3[1]<ymin) ymin=cell->coordpt3[1];
|
225 |
|
|
if (cell->coordpt3[2]>zmax) zmax=cell->coordpt3[2];
|
226 |
|
|
if (cell->coordpt3[2]<zmin) zmin=cell->coordpt3[2];
|
227 |
|
|
if (cell->coordpt4[0]>xmax) xmax=cell->coordpt4[0];
|
228 |
|
|
if (cell->coordpt4[0]<xmin) xmin=cell->coordpt4[0];
|
229 |
|
|
if (cell->coordpt4[1]>ymax) ymax=cell->coordpt4[1];
|
230 |
|
|
if (cell->coordpt4[1]<ymin) ymin=cell->coordpt4[1];
|
231 |
|
|
if (cell->coordpt4[2]>zmax) zmax=cell->coordpt4[2];
|
232 |
|
|
if (cell->coordpt4[2]<zmin) zmin=cell->coordpt4[2];
|
233 |
|
|
if (cell->coordpt5[0]>xmax) xmax=cell->coordpt5[0];
|
234 |
|
|
if (cell->coordpt5[0]<xmin) xmin=cell->coordpt5[0];
|
235 |
|
|
if (cell->coordpt5[1]>ymax) ymax=cell->coordpt5[1];
|
236 |
|
|
if (cell->coordpt5[1]<ymin) ymin=cell->coordpt5[1];
|
237 |
|
|
if (cell->coordpt5[2]>zmax) zmax=cell->coordpt5[2];
|
238 |
|
|
if (cell->coordpt5[2]<zmin) zmin=cell->coordpt5[2];
|
239 |
|
|
if (cell->coordpt6[0]>xmax) xmax=cell->coordpt6[0];
|
240 |
|
|
if (cell->coordpt6[0]<xmin) xmin=cell->coordpt6[0];
|
241 |
|
|
if (cell->coordpt6[1]>ymax) ymax=cell->coordpt6[1];
|
242 |
|
|
if (cell->coordpt6[1]<ymin) ymin=cell->coordpt6[1];
|
243 |
|
|
if (cell->coordpt6[2]>zmax) zmax=cell->coordpt6[2];
|
244 |
|
|
if (cell->coordpt6[2]<zmin) zmin=cell->coordpt6[2];
|
245 |
|
|
if (cell->coordpt7[0]>xmax) xmax=cell->coordpt7[0];
|
246 |
|
|
if (cell->coordpt7[0]<xmin) xmin=cell->coordpt7[0];
|
247 |
|
|
if (cell->coordpt7[1]>ymax) ymax=cell->coordpt7[1];
|
248 |
|
|
if (cell->coordpt7[1]<ymin) ymin=cell->coordpt7[1];
|
249 |
|
|
if (cell->coordpt7[2]>zmax) zmax=cell->coordpt7[2];
|
250 |
|
|
if (cell->coordpt7[2]<zmin) zmin=cell->coordpt7[2];
|
251 |
|
|
if (cell->coordpt8[0]>xmax) xmax=cell->coordpt8[0];
|
252 |
|
|
if (cell->coordpt8[0]<xmin) xmin=cell->coordpt8[0];
|
253 |
|
|
if (cell->coordpt8[1]>ymax) ymax=cell->coordpt8[1];
|
254 |
|
|
if (cell->coordpt8[1]<ymin) ymin=cell->coordpt8[1];
|
255 |
|
|
if (cell->coordpt8[2]>zmax) zmax=cell->coordpt8[2];
|
256 |
|
|
if (cell->coordpt8[2]<zmin) zmin=cell->coordpt8[2];
|
257 |
|
|
for (int k=0;k<nb_renseignement;k++)
|
258 |
|
|
{
|
259 |
|
|
if (cell->get_valeur(k,0)>valmax[k]) valmax[k]=cell->get_valeur(k,0);
|
260 |
|
|
if (cell->get_valeur(k,0)<valmin[k]) valmin[k]=cell->get_valeur(k,0);
|
261 |
|
|
if (cell->get_valeur(k,1)>valmax[k]) valmax[k]=cell->get_valeur(k,1);
|
262 |
|
|
if (cell->get_valeur(k,1)<valmin[k]) valmin[k]=cell->get_valeur(k,1);
|
263 |
|
|
if (cell->get_valeur(k,2)>valmax[k]) valmax[k]=cell->get_valeur(k,2);
|
264 |
|
|
if (cell->get_valeur(k,2)<valmin[k]) valmin[k]=cell->get_valeur(k,2);
|
265 |
|
|
if (cell->get_valeur(k,3)>valmax[k]) valmax[k]=cell->get_valeur(k,3);
|
266 |
|
|
if (cell->get_valeur(k,3)<valmin[k]) valmin[k]=cell->get_valeur(k,3);
|
267 |
|
|
if (cell->get_valeur(k,4)>valmax[k]) valmax[k]=cell->get_valeur(k,4);
|
268 |
|
|
if (cell->get_valeur(k,4)<valmin[k]) valmin[k]=cell->get_valeur(k,4);
|
269 |
|
|
if (cell->get_valeur(k,5)>valmax[k]) valmax[k]=cell->get_valeur(k,5);
|
270 |
|
|
if (cell->get_valeur(k,5)<valmin[k]) valmin[k]=cell->get_valeur(k,5);
|
271 |
|
|
if (cell->get_valeur(k,6)>valmax[k]) valmax[k]=cell->get_valeur(k,6);
|
272 |
|
|
if (cell->get_valeur(k,6)<valmin[k]) valmin[k]=cell->get_valeur(k,6);
|
273 |
|
|
if (cell->get_valeur(k,7)>valmax[k]) valmax[k]=cell->get_valeur(k,7);
|
274 |
|
|
if (cell->get_valeur(k,7)<valmin[k]) valmin[k]=cell->get_valeur(k,7);
|
275 |
|
|
}
|
276 |
|
|
}
|
277 |
|
|
boite.reinit(xmin,ymin,zmin,xmax,ymax,zmax);
|
278 |
|
|
grille=new TPL_GRILLE<celluleaff*>;
|
279 |
|
|
grille->initialiser(xmin,ymin,zmin,xmax,ymax,zmax,20,20,20);
|
280 |
|
|
for (int i=0;i<nb;i++)
|
281 |
|
|
{
|
282 |
|
|
celluleaff* cell=lst_cellule[i];
|
283 |
|
|
grille->inserer(cell);
|
284 |
|
|
}
|
285 |
|
|
recadre(dx,dy,0);
|
286 |
|
|
initvue();
|
287 |
|
|
redess();
|
288 |
|
|
TrackBar1->Min=0;
|
289 |
|
|
TrackBar1->Max=100;
|
290 |
|
|
TrackBar1->Position=0;
|
291 |
|
|
TrackBar2->Min=0;
|
292 |
|
|
TrackBar2->Max=100;
|
293 |
|
|
TrackBar2->Position=100;
|
294 |
|
|
TrackBar3->Min=0;
|
295 |
|
|
TrackBar3->Max=100;
|
296 |
|
|
TrackBar3->Position=0;
|
297 |
|
|
TrackBar4->Min=0;
|
298 |
|
|
TrackBar4->Max=100;
|
299 |
|
|
TrackBar4->Position=100;
|
300 |
|
|
TrackBar5->Min=0;
|
301 |
|
|
TrackBar5->Max=100;
|
302 |
|
|
TrackBar5->Position=0;
|
303 |
|
|
TrackBar6->Min=0;
|
304 |
|
|
TrackBar6->Max=100;
|
305 |
|
|
TrackBar6->Position=100;
|
306 |
|
|
return;
|
307 |
|
|
}
|
308 |
|
|
}
|
309 |
|
|
MessageBox(Handle,"Fichier non valide","Erreur",MB_OK);
|
310 |
|
|
Close();
|
311 |
|
|
}
|
312 |
|
|
//---------------------------------------------------------------------------
|
313 |
|
|
|
314 |
|
|
void __fastcall Tvisucttform::FormActivate(TObject *Sender)
|
315 |
|
|
{
|
316 |
|
|
MainForm->ToolBar4->Visible=true;
|
317 |
|
|
MainForm->activecttform=this;
|
318 |
|
|
FILE* in=fopen(Caption.c_str(),"rt");
|
319 |
|
|
if (in!=NULL)
|
320 |
|
|
{
|
321 |
|
|
std::ftime ft;
|
322 |
|
|
getftime(fileno(in), &ft);
|
323 |
|
|
char mess[1000];
|
324 |
|
|
sprintf(mess,"Heure fichier: %02u:%02u:%02u\n",ft.ft_hour, ft.ft_min,ft.ft_tsec * 2);
|
325 |
|
|
MainForm->StatusBar->Panels->Items[3]->Text=mess;
|
326 |
|
|
sprintf(mess,"Jour fichier: %02u/%02u/%02u\n",ft.ft_day, ft.ft_month,ft.ft_year+1980);
|
327 |
|
|
MainForm->StatusBar->Panels->Items[4]->Text=mess;
|
328 |
|
|
fclose(in);
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
}
|
332 |
|
|
//---------------------------------------------------------------------------
|
333 |
|
|
|
334 |
|
|
void __fastcall Tvisucttform::FormDeactivate(TObject *Sender)
|
335 |
|
|
{
|
336 |
|
|
MainForm->ToolBar4->Visible=false;
|
337 |
|
|
MainForm->activecttform=NULL;
|
338 |
|
|
MainForm->StatusBar->Panels->Items[3]->Text="";
|
339 |
|
|
MainForm->StatusBar->Panels->Items[4]->Text="";
|
340 |
|
|
}
|
341 |
|
|
//---------------------------------------------------------------------------
|
342 |
|
|
|
343 |
|
|
void __fastcall Tvisucttform::configExecute(TObject *Sender)
|
344 |
|
|
{
|
345 |
|
|
configwin->ShowModal();
|
346 |
|
|
}
|
347 |
|
|
//---------------------------------------------------------------------------
|
348 |
|
|
|
349 |
|
|
void __fastcall Tvisucttform::FormCreate(TObject *Sender)
|
350 |
|
|
{
|
351 |
|
|
RGB_r[0]=0;RGB_g[0]=0;RGB_b[0]=255;
|
352 |
|
|
RGB_r[1]=0;RGB_g[1]=100;RGB_b[1]=255;
|
353 |
|
|
RGB_r[2]=0;RGB_g[2]=200;RGB_b[2]=255;
|
354 |
|
|
RGB_r[3]=0;RGB_g[3]=255;RGB_b[3]=255;
|
355 |
|
|
RGB_r[4]=0;RGB_g[4]=255;RGB_b[4]=200;
|
356 |
|
|
RGB_r[5]=0;RGB_g[5]=255;RGB_b[5]=100;
|
357 |
|
|
RGB_r[6]=0;RGB_g[6]=255;RGB_b[6]=0;
|
358 |
|
|
RGB_r[7]=100;RGB_g[7]=255;RGB_b[7]=0;
|
359 |
|
|
RGB_r[8]=200;RGB_g[8]=255;RGB_b[8]=0;
|
360 |
|
|
RGB_r[9]=255;RGB_g[9]=255;RGB_b[9]=0;
|
361 |
|
|
RGB_r[10]=255;RGB_g[10]=150;RGB_b[10]=0;
|
362 |
|
|
RGB_r[11]=255;RGB_g[11]=120;RGB_b[11]=56;
|
363 |
|
|
RGB_r[12]=255;RGB_g[12]=0;RGB_b[12]=0;
|
364 |
|
|
RGB_r[13]=152;RGB_g[13]=120;RGB_b[13]=56;
|
365 |
|
|
hdc = GetDC(Handle);
|
366 |
|
|
SetPixelFormatDescriptor();
|
367 |
|
|
hrc = wglCreateContext(hdc);
|
368 |
|
|
if (hrc == NULL)
|
369 |
|
|
ShowMessage(":-)~ hrc == NULL");
|
370 |
|
|
if(wglMakeCurrent(hdc, hrc) == false)
|
371 |
|
|
ShowMessage("Could not MakeCurrent");
|
372 |
|
|
glClearColor(MainForm->valeurconfig[57],MainForm->valeurconfig[58],MainForm->valeurconfig[59], 0.0f);
|
373 |
|
|
}
|
374 |
|
|
//---------------------------------------------------------------------------
|
375 |
|
|
void __fastcall Tvisucttform::SetPixelFormatDescriptor(void)
|
376 |
|
|
{
|
377 |
|
|
PIXELFORMATDESCRIPTOR pfd = {
|
378 |
|
|
sizeof(PIXELFORMATDESCRIPTOR),
|
379 |
|
|
1,
|
380 |
|
|
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
|
381 |
|
|
PFD_TYPE_RGBA,
|
382 |
|
|
24,
|
383 |
|
|
0,0,0,0,0,0,
|
384 |
|
|
0,0,
|
385 |
|
|
0,0,0,0,0,
|
386 |
|
|
32,
|
387 |
|
|
0,
|
388 |
|
|
0,
|
389 |
|
|
PFD_MAIN_PLANE,
|
390 |
|
|
0,
|
391 |
|
|
0,0,
|
392 |
|
|
};
|
393 |
|
|
int PixelFormat = ChoosePixelFormat(hdc, &pfd);
|
394 |
|
|
SetPixelFormat(hdc, PixelFormat, &pfd);
|
395 |
|
|
}
|
396 |
|
|
//---------------------------------------------------------------------------
|
397 |
|
|
void __fastcall Tvisucttform::recadre(double dx,double dy,int etat)
|
398 |
|
|
{
|
399 |
|
|
wglMakeCurrent(hdc,hrc);
|
400 |
|
|
GLfloat w = ClientWidth-Panel1->Width;
|
401 |
|
|
GLfloat h = ClientHeight;
|
402 |
|
|
char mess[255];
|
403 |
|
|
if (etat==0) glViewport(0, 0, w, h);
|
404 |
|
|
glMatrixMode(GL_PROJECTION);
|
405 |
|
|
glLoadIdentity();
|
406 |
|
|
double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
|
407 |
|
|
d=max(d,boite.get_zmax()-boite.get_zmin());
|
408 |
|
|
d=d*1.75/2.;
|
409 |
|
|
double aspect=w/h;
|
410 |
|
|
double xmin,ymin,xmax,ymax;
|
411 |
|
|
if (w<h) xmin=boite.get_xcentre()-d+dx; else xmin=boite.get_xcentre()-d*aspect+dx;
|
412 |
|
|
if (w<h) ymin=boite.get_ycentre()-d/aspect+dy; else ymin=boite.get_ycentre()-d+dy;
|
413 |
|
|
double zmin=boite.get_zcentre()-100*d;
|
414 |
|
|
if (w<h) xmax=xmin+2.*d; else xmax=xmin+2.*d*aspect;
|
415 |
|
|
if (w<h) ymax=ymin+2.*d/aspect; else ymax=ymin+2.*d;
|
416 |
|
|
double zmax=zmin+200.*d;
|
417 |
|
|
glOrtho(xmin,xmax,ymin,ymax,zmin,zmax);
|
418 |
|
|
}
|
419 |
|
|
//---------------------------------------------------------------------------
|
420 |
|
|
void __fastcall Tvisucttform::dessineaxe(void)
|
421 |
|
|
{
|
422 |
|
|
double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
|
423 |
|
|
d=max(d,boite.get_zmax()-boite.get_zmin());
|
424 |
|
|
d=d*MainForm->valeurconfig[10];
|
425 |
|
|
glLineWidth(MainForm->valeurconfig[9]);
|
426 |
|
|
glBegin(GL_LINES);
|
427 |
|
|
glColor3f(MainForm->valeurconfig[0],MainForm->valeurconfig[1],MainForm->valeurconfig[2]);
|
428 |
|
|
glVertex3f(0.0,0.0,0.0);
|
429 |
|
|
glVertex3f(d,0.0,0.0);
|
430 |
|
|
glColor3f(MainForm->valeurconfig[3],MainForm->valeurconfig[4],MainForm->valeurconfig[5]);
|
431 |
|
|
glVertex3f(0.0,0.0,0.0);
|
432 |
|
|
glVertex3f(0.0,d,0.0);
|
433 |
|
|
glColor3f(MainForm->valeurconfig[6],MainForm->valeurconfig[7],MainForm->valeurconfig[8]);
|
434 |
|
|
glVertex3f(0.0,0.0,0.0);
|
435 |
|
|
glVertex3f(0.0,0.0,d);
|
436 |
|
|
glEnd();
|
437 |
|
|
}
|
438 |
|
|
//---------------------------------------------------------------------------
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
void __fastcall Tvisucttform::FormPaint(TObject *Sender)
|
442 |
|
|
{
|
443 |
|
|
wglMakeCurrent(hdc,hrc);
|
444 |
|
|
glClearColor(MainForm->valeurconfig[57],MainForm->valeurconfig[58],MainForm->valeurconfig[59], 0.0f);
|
445 |
|
|
redess();
|
446 |
|
|
}
|
447 |
|
|
//---------------------------------------------------------------------------
|
448 |
|
|
void __fastcall Tvisucttform::redess(void)
|
449 |
|
|
{
|
450 |
|
|
wglMakeCurrent(hdc,hrc);
|
451 |
|
|
glClearColor(MainForm->valeurconfig[57],MainForm->valeurconfig[58],MainForm->valeurconfig[59], 0.0f);
|
452 |
|
|
Label1->Color=getcolor(RGB_r[12]/255.,RGB_g[12]/255.,RGB_b[12]/255.);
|
453 |
|
|
Label2->Color=getcolor(RGB_r[0]/255.,RGB_g[0]/255.,RGB_b[0]/255.);
|
454 |
|
|
char mess[100];
|
455 |
|
|
int numvaleur=ListBox1->ItemIndex;
|
456 |
|
|
sprintf(mess,"%f",valmax[numvaleur]);
|
457 |
|
|
Label3->Caption=mess;
|
458 |
|
|
sprintf(mess,"%f",valmin[numvaleur]);
|
459 |
|
|
Label4->Caption=mess;
|
460 |
|
|
wglMakeCurrent(hdc,hrc);
|
461 |
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
462 |
|
|
int nb=lst_cellule.size();
|
463 |
|
|
double ecart=valmax[numvaleur]-valmin[numvaleur];
|
464 |
|
|
double pr=MainForm->valeurconfig[60]-MainForm->valeurconfig[63];
|
465 |
|
|
double pg=MainForm->valeurconfig[61]-MainForm->valeurconfig[64];
|
466 |
|
|
double pb=MainForm->valeurconfig[62]-MainForm->valeurconfig[65];
|
467 |
|
|
if (render==1)
|
468 |
|
|
{
|
469 |
|
|
glEnable(GL_DEPTH_TEST);
|
470 |
|
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
471 |
|
|
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
472 |
|
|
}
|
473 |
|
|
else
|
474 |
|
|
{
|
475 |
|
|
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
|
476 |
|
|
}
|
477 |
|
|
glBegin(GL_QUADS);
|
478 |
|
|
for (int i=0;i<nb;i++)
|
479 |
|
|
{
|
480 |
|
|
celluleaff* cell=lst_cellule[i];
|
481 |
|
|
double *xyz1=cell->coordpt1;
|
482 |
|
|
double *xyz2=cell->coordpt2;
|
483 |
|
|
double *xyz3=cell->coordpt3;
|
484 |
|
|
double *xyz4=cell->coordpt4;
|
485 |
|
|
double *xyz5=cell->coordpt5;
|
486 |
|
|
double *xyz6=cell->coordpt6;
|
487 |
|
|
double *xyz7=cell->coordpt7;
|
488 |
|
|
double *xyz8=cell->coordpt8;
|
489 |
|
|
BOITE_3D boite1(xyz1[0],xyz1[1],xyz1[2],xyz7[0],xyz7[1],xyz7[2]);
|
490 |
|
|
double x1=boite.get_xmin()+TrackBar1->Position*(boite.get_xmax()-boite.get_xmin())/100.;
|
491 |
|
|
double y1=boite.get_ymin()+TrackBar3->Position*(boite.get_ymax()-boite.get_ymin())/100.;
|
492 |
|
|
double z1=boite.get_zmin()+TrackBar5->Position*(boite.get_zmax()-boite.get_zmin())/100.;
|
493 |
|
|
double x2=boite.get_xmin()+TrackBar2->Position*(boite.get_xmax()-boite.get_xmin())/100.;
|
494 |
|
|
double y2=boite.get_ymin()+TrackBar4->Position*(boite.get_ymax()-boite.get_ymin())/100.;
|
495 |
|
|
double z2=boite.get_zmin()+TrackBar6->Position*(boite.get_zmax()-boite.get_zmin())/100.;
|
496 |
|
|
BOITE_3D boite2(x1,y1,z1,x2,y2,z2);
|
497 |
|
|
if (boite1*boite2)
|
498 |
|
|
{
|
499 |
|
|
double xyzs1[3],xyzs2[3],xyzs3[3],xyzs4[3],xyzs5[3],xyzs6[3],xyzs7[3],xyzs8[3];
|
500 |
|
|
if (shrink)
|
501 |
|
|
{
|
502 |
|
|
double xg=0.125*(xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0]+xyz5[0]+xyz6[0]+xyz7[0]+xyz8[0]);
|
503 |
|
|
double yg=0.125*(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1]+xyz5[1]+xyz6[1]+xyz7[1]+xyz8[1]);
|
504 |
|
|
double zg=0.125*(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2]+xyz5[2]+xyz6[2]+xyz7[2]+xyz8[2]);
|
505 |
|
|
xyzs1[0]=xg+facteur_shrink*(xyz1[0]-xg);
|
506 |
|
|
xyzs1[1]=yg+facteur_shrink*(xyz1[1]-yg);
|
507 |
|
|
xyzs1[2]=zg+facteur_shrink*(xyz1[2]-zg);
|
508 |
|
|
xyz1=xyzs1;
|
509 |
|
|
xyzs2[0]=xg+facteur_shrink*(xyz2[0]-xg);
|
510 |
|
|
xyzs2[1]=yg+facteur_shrink*(xyz2[1]-yg);
|
511 |
|
|
xyzs2[2]=zg+facteur_shrink*(xyz2[2]-zg);
|
512 |
|
|
xyz2=xyzs2;
|
513 |
|
|
xyzs3[0]=xg+facteur_shrink*(xyz3[0]-xg);
|
514 |
|
|
xyzs3[1]=yg+facteur_shrink*(xyz3[1]-yg);
|
515 |
|
|
xyzs3[2]=zg+facteur_shrink*(xyz3[2]-zg);
|
516 |
|
|
xyz3=xyzs3;
|
517 |
|
|
xyzs4[0]=xg+facteur_shrink*(xyz4[0]-xg);
|
518 |
|
|
xyzs4[1]=yg+facteur_shrink*(xyz4[1]-yg);
|
519 |
|
|
xyzs4[2]=zg+facteur_shrink*(xyz4[2]-zg);
|
520 |
|
|
xyz4=xyzs4;
|
521 |
|
|
xyzs5[0]=xg+facteur_shrink*(xyz5[0]-xg);
|
522 |
|
|
xyzs5[1]=yg+facteur_shrink*(xyz5[1]-yg);
|
523 |
|
|
xyzs5[2]=zg+facteur_shrink*(xyz5[2]-zg);
|
524 |
|
|
xyz5=xyzs5;
|
525 |
|
|
xyzs6[0]=xg+facteur_shrink*(xyz6[0]-xg);
|
526 |
|
|
xyzs6[1]=yg+facteur_shrink*(xyz6[1]-yg);
|
527 |
|
|
xyzs6[2]=zg+facteur_shrink*(xyz6[2]-zg);
|
528 |
|
|
xyz6=xyzs6;
|
529 |
|
|
xyzs7[0]=xg+facteur_shrink*(xyz7[0]-xg);
|
530 |
|
|
xyzs7[1]=yg+facteur_shrink*(xyz7[1]-yg);
|
531 |
|
|
xyzs7[2]=zg+facteur_shrink*(xyz7[2]-zg);
|
532 |
|
|
xyz7=xyzs7;
|
533 |
|
|
xyzs8[0]=xg+facteur_shrink*(xyz8[0]-xg);
|
534 |
|
|
xyzs8[1]=yg+facteur_shrink*(xyz8[1]-yg);
|
535 |
|
|
xyzs8[2]=zg+facteur_shrink*(xyz8[2]-zg);
|
536 |
|
|
xyz8=xyzs8;
|
537 |
|
|
}
|
538 |
|
|
if (ecart<0.0001) ecart=1;
|
539 |
|
|
//face1
|
540 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart);
|
541 |
|
|
int pos=(int) ((cell->get_valeur(numvaleur,0)-valmin[numvaleur])*12./ecart);
|
542 |
|
|
if (pos<0) pos=0;
|
543 |
|
|
if (pos>12) pos=12;
|
544 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
545 |
|
|
glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
|
546 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart);
|
547 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,1)-valmin[numvaleur])*12./ecart);
|
548 |
|
|
if (pos<0) pos=0;
|
549 |
|
|
if (pos>12) pos=12;
|
550 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
551 |
|
|
glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
|
552 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart);
|
553 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,2)-valmin[numvaleur])*12./ecart);
|
554 |
|
|
if (pos<0) pos=0;
|
555 |
|
|
if (pos>12) pos=12;
|
556 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
557 |
|
|
glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
|
558 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart);
|
559 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,3)-valmin[numvaleur])*12./ecart);
|
560 |
|
|
if (pos<0) pos=0;
|
561 |
|
|
if (pos>12) pos=12;
|
562 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
563 |
|
|
glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
|
564 |
|
|
//face2
|
565 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart);
|
566 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,4)-valmin[numvaleur])*12./ecart);
|
567 |
|
|
if (pos<0) pos=0;
|
568 |
|
|
if (pos>12) pos=12;
|
569 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
570 |
|
|
glVertex3f(xyz5[0],xyz5[1],xyz5[2]);
|
571 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart);
|
572 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,5)-valmin[numvaleur])*12./ecart);
|
573 |
|
|
if (pos<0) pos=0;
|
574 |
|
|
if (pos>12) pos=12;
|
575 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
576 |
|
|
glVertex3f(xyz6[0],xyz6[1],xyz6[2]);
|
577 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart);
|
578 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,6)-valmin[numvaleur])*12./ecart);
|
579 |
|
|
if (pos<0) pos=0;
|
580 |
|
|
if (pos>12) pos=12;
|
581 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
582 |
|
|
glVertex3f(xyz7[0],xyz7[1],xyz7[2]);
|
583 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart);
|
584 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,7)-valmin[numvaleur])*12./ecart);
|
585 |
|
|
if (pos<0) pos=0;
|
586 |
|
|
if (pos>12) pos=12;
|
587 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
588 |
|
|
glVertex3f(xyz8[0],xyz8[1],xyz8[2]);
|
589 |
|
|
//face3
|
590 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart);
|
591 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,0)-valmin[numvaleur])*12./ecart);
|
592 |
|
|
if (pos<0) pos=0;
|
593 |
|
|
if (pos>12) pos=12;
|
594 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
595 |
|
|
glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
|
596 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart);
|
597 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,1)-valmin[numvaleur])*12./ecart);
|
598 |
|
|
if (pos<0) pos=0;
|
599 |
|
|
if (pos>12) pos=12;
|
600 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
601 |
|
|
glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
|
602 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart);
|
603 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,5)-valmin[numvaleur])*12./ecart);
|
604 |
|
|
if (pos<0) pos=0;
|
605 |
|
|
if (pos>12) pos=12;
|
606 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
607 |
|
|
glVertex3f(xyz6[0],xyz6[1],xyz6[2]);
|
608 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart);
|
609 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,4)-valmin[numvaleur])*12./ecart);
|
610 |
|
|
if (pos<0) pos=0;
|
611 |
|
|
if (pos>12) pos=12;
|
612 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
613 |
|
|
glVertex3f(xyz5[0],xyz5[1],xyz5[2]);
|
614 |
|
|
//face4
|
615 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,1)-valmin[numvaleur])/ecart);
|
616 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,1)-valmin[numvaleur])*12./ecart);
|
617 |
|
|
if (pos<0) pos=0;
|
618 |
|
|
if (pos>12) pos=12;
|
619 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
620 |
|
|
glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
|
621 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart);
|
622 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,2)-valmin[numvaleur])*12./ecart);
|
623 |
|
|
if (pos<0) pos=0;
|
624 |
|
|
if (pos>12) pos=12;
|
625 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
626 |
|
|
glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
|
627 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart);
|
628 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,6)-valmin[numvaleur])*12./ecart);
|
629 |
|
|
if (pos<0) pos=0;
|
630 |
|
|
if (pos>12) pos=12;
|
631 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
632 |
|
|
glVertex3f(xyz7[0],xyz7[1],xyz7[2]);
|
633 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,5)-valmin[numvaleur])/ecart);
|
634 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,5)-valmin[numvaleur])*12./ecart);
|
635 |
|
|
if (pos<0) pos=0;
|
636 |
|
|
if (pos>12) pos=12;
|
637 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
638 |
|
|
glVertex3f(xyz6[0],xyz6[1],xyz6[2]);
|
639 |
|
|
//face5
|
640 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,2)-valmin[numvaleur])/ecart);
|
641 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,2)-valmin[numvaleur])*12./ecart);
|
642 |
|
|
if (pos<0) pos=0;
|
643 |
|
|
if (pos>12) pos=12;
|
644 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
645 |
|
|
glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
|
646 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart);
|
647 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,3)-valmin[numvaleur])*12./ecart);
|
648 |
|
|
if (pos<0) pos=0;
|
649 |
|
|
if (pos>12) pos=12;
|
650 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
651 |
|
|
glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
|
652 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart);
|
653 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,7)-valmin[numvaleur])*12./ecart);
|
654 |
|
|
if (pos<0) pos=0;
|
655 |
|
|
if (pos>12) pos=12;
|
656 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
657 |
|
|
glVertex3f(xyz8[0],xyz8[1],xyz8[2]);
|
658 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,6)-valmin[numvaleur])/ecart);
|
659 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,6)-valmin[numvaleur])*12./ecart);
|
660 |
|
|
if (pos<0) pos=0;
|
661 |
|
|
if (pos>12) pos=12;
|
662 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
663 |
|
|
glVertex3f(xyz7[0],xyz7[1],xyz7[2]);
|
664 |
|
|
//face6
|
665 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,3)-valmin[numvaleur])/ecart);
|
666 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,3)-valmin[numvaleur])*12./ecart);
|
667 |
|
|
if (pos<0) pos=0;
|
668 |
|
|
if (pos>12) pos=12;
|
669 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
670 |
|
|
glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
|
671 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,0)-valmin[numvaleur])/ecart);
|
672 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,0)-valmin[numvaleur])*12./ecart);
|
673 |
|
|
if (pos<0) pos=0;
|
674 |
|
|
if (pos>12) pos=12;
|
675 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
676 |
|
|
glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
|
677 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,4)-valmin[numvaleur])/ecart);
|
678 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,4)-valmin[numvaleur])*12./ecart);
|
679 |
|
|
if (pos<0) pos=0;
|
680 |
|
|
if (pos>12) pos=12;
|
681 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
682 |
|
|
glVertex3f(xyz5[0],xyz5[1],xyz5[2]);
|
683 |
|
|
glColor3f(MainForm->valeurconfig[63]+pr*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart,MainForm->valeurconfig[64]+pg*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart,MainForm->valeurconfig[65]+pb*(cell->get_valeur(numvaleur,7)-valmin[numvaleur])/ecart);
|
684 |
|
|
pos=(int) ((cell->get_valeur(numvaleur,7)-valmin[numvaleur])*12./ecart);
|
685 |
|
|
if (pos<0) pos=0;
|
686 |
|
|
if (pos>12) pos=12;
|
687 |
|
|
glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
|
688 |
|
|
glVertex3f(xyz8[0],xyz8[1],xyz8[2]);
|
689 |
|
|
}
|
690 |
|
|
}
|
691 |
|
|
glEnd();
|
692 |
|
|
if (axe==1) dessineaxe();
|
693 |
|
|
glFlush();
|
694 |
|
|
SwapBuffers(hdc);
|
695 |
|
|
}
|
696 |
|
|
|
697 |
|
|
void __fastcall Tvisucttform::transformation(TObject *Sender, WORD &Key,TShiftState Shift)
|
698 |
|
|
{
|
699 |
|
|
wglMakeCurrent(hdc,hrc);
|
700 |
|
|
GLfloat w = ClientWidth-Panel1->Width;
|
701 |
|
|
GLfloat h = ClientHeight;
|
702 |
|
|
glMatrixMode(GL_MODELVIEW);
|
703 |
|
|
double un=0.005*min(w,h);
|
704 |
|
|
if (Key==VK_LEFT)
|
705 |
|
|
{
|
706 |
|
|
dx=dx+un;
|
707 |
|
|
recadre(dx,dy,1);
|
708 |
|
|
}
|
709 |
|
|
if (Key==VK_RIGHT)
|
710 |
|
|
{
|
711 |
|
|
dx=dx-un;
|
712 |
|
|
recadre(dx,dy,1);
|
713 |
|
|
}
|
714 |
|
|
if (Key==VK_UP)
|
715 |
|
|
{
|
716 |
|
|
dy=dy-un;
|
717 |
|
|
recadre(dx,dy,1);
|
718 |
|
|
}
|
719 |
|
|
if (Key==VK_DOWN)
|
720 |
|
|
{
|
721 |
|
|
dy=dy+un;
|
722 |
|
|
recadre(dx,dy,1);
|
723 |
|
|
}
|
724 |
|
|
if(Key == VK_F1)
|
725 |
|
|
{
|
726 |
|
|
zoom++;
|
727 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
728 |
|
|
glScalef(1.1,1.1,1.1);
|
729 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
730 |
|
|
}
|
731 |
|
|
if(Key == VK_F2)
|
732 |
|
|
{
|
733 |
|
|
zoom--;
|
734 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
735 |
|
|
glScalef(1./1.1,1./1.1,1./1.1);
|
736 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
737 |
|
|
}
|
738 |
|
|
if(Key == VK_F3)
|
739 |
|
|
{
|
740 |
|
|
dx=0.;
|
741 |
|
|
dy=0.;
|
742 |
|
|
zoom=0;
|
743 |
|
|
recadre(dx,dy,1);
|
744 |
|
|
initvue();
|
745 |
|
|
}
|
746 |
|
|
if(Key == VK_F4)
|
747 |
|
|
{
|
748 |
|
|
if (zoom>0)
|
749 |
|
|
glScalef(1./pow(1.1,zoom),1./pow(1.1,zoom),1./pow(1.1,zoom));
|
750 |
|
|
if (zoom<0)
|
751 |
|
|
glScalef(pow(1.1,-zoom),pow(1.1,-zoom),pow(1.1,-zoom));
|
752 |
|
|
zoom=0;
|
753 |
|
|
dx=0;
|
754 |
|
|
dy=0;
|
755 |
|
|
recadre(dx,dy,1);
|
756 |
|
|
}
|
757 |
|
|
if(Key == VK_HOME)
|
758 |
|
|
{
|
759 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
760 |
|
|
glRotatef(-5, 0.0, 1.0, 0.0);
|
761 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
762 |
|
|
}
|
763 |
|
|
if(Key == VK_END)
|
764 |
|
|
{
|
765 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
766 |
|
|
glRotatef(5, 0.0, 1.0, 0.0);
|
767 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
768 |
|
|
}
|
769 |
|
|
if(Key == VK_INSERT)
|
770 |
|
|
{
|
771 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
772 |
|
|
glRotatef(-5, 1.0, 0.0, 0.0);
|
773 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
774 |
|
|
}
|
775 |
|
|
if(Key == VK_DELETE)
|
776 |
|
|
{
|
777 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
778 |
|
|
glRotatef(5, 1.0, 0.0, 0.0);
|
779 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
780 |
|
|
}
|
781 |
|
|
if(Key == VK_PRIOR)
|
782 |
|
|
{
|
783 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
784 |
|
|
glRotatef(-5, 0.0, 0.0, 1.0);
|
785 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
786 |
|
|
}
|
787 |
|
|
if(Key == VK_NEXT)
|
788 |
|
|
{
|
789 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
790 |
|
|
glRotatef(5, 0.0, 0.0, 1.0);
|
791 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
792 |
|
|
}
|
793 |
|
|
if (Key==VK_ADD)
|
794 |
|
|
{
|
795 |
|
|
facteur_shrink=facteur_shrink+0.05;
|
796 |
|
|
if (facteur_shrink>1.) facteur_shrink=1;
|
797 |
|
|
}
|
798 |
|
|
if (Key==VK_SUBTRACT)
|
799 |
|
|
{
|
800 |
|
|
facteur_shrink=facteur_shrink-0.05;
|
801 |
|
|
if (facteur_shrink<0.) facteur_shrink=0.;
|
802 |
|
|
}
|
803 |
|
|
|
804 |
|
|
redess();
|
805 |
|
|
}
|
806 |
|
|
//---------------------------------------------------------------------------
|
807 |
|
|
void __fastcall Tvisucttform::FormResize(TObject *Sender)
|
808 |
|
|
{
|
809 |
|
|
int w=ClientWidth-Panel1->Width;
|
810 |
|
|
int h=ClientHeight;
|
811 |
|
|
while(w==0)
|
812 |
|
|
{
|
813 |
|
|
Width++;
|
814 |
|
|
w=ClientWidth-Panel1->Width;
|
815 |
|
|
}
|
816 |
|
|
while(h==0)
|
817 |
|
|
{
|
818 |
|
|
Height++;
|
819 |
|
|
h=ClientHeight;
|
820 |
|
|
}
|
821 |
|
|
|
822 |
|
|
recadre(dx,dy,0);
|
823 |
|
|
redess();
|
824 |
|
|
}
|
825 |
|
|
//---------------------------------------------------------------------------
|
826 |
|
|
|
827 |
|
|
void __fastcall Tvisucttform::initvue(void)
|
828 |
|
|
{
|
829 |
|
|
wglMakeCurrent(hdc,hrc);
|
830 |
|
|
glMatrixMode(GL_MODELVIEW);
|
831 |
|
|
glLoadIdentity();
|
832 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
833 |
|
|
glRotatef(-90., 0.0, 1.0, 0.0);
|
834 |
|
|
glRotatef(-90., 1.0, 0.0, 0.0);
|
835 |
|
|
glRotatef(45., 0.0, 1.0, 0.0);
|
836 |
|
|
glRotatef(-45., 0.0, 0.0, 1.0);
|
837 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
838 |
|
|
}
|
839 |
|
|
//---------------------------------------------------------------------------
|
840 |
|
|
|
841 |
|
|
void __fastcall Tvisucttform::FormKeyDown(TObject *Sender, WORD &Key,
|
842 |
|
|
TShiftState Shift)
|
843 |
|
|
{
|
844 |
|
|
transformation(Sender,Key,Shift);
|
845 |
|
|
}
|
846 |
|
|
//---------------------------------------------------------------------------
|
847 |
|
|
|
848 |
|
|
void __fastcall Tvisucttform::FormMouseDown(TObject *Sender,
|
849 |
|
|
TMouseButton Button, TShiftState Shift, int X, int Y)
|
850 |
|
|
{
|
851 |
|
|
if (Button==mbRight)
|
852 |
|
|
if (debut_trans==false)
|
853 |
|
|
{
|
854 |
|
|
debut_trans=true;
|
855 |
|
|
xdepart=X;
|
856 |
|
|
ydepart=Y;
|
857 |
|
|
}
|
858 |
|
|
if (Button==mbMiddle)
|
859 |
|
|
if (debut_rot==false)
|
860 |
|
|
{
|
861 |
|
|
debut_rot=true;
|
862 |
|
|
xrot=X;
|
863 |
|
|
yrot=Y;
|
864 |
|
|
}
|
865 |
|
|
|
866 |
|
|
}
|
867 |
|
|
//---------------------------------------------------------------------------
|
868 |
|
|
|
869 |
|
|
void __fastcall Tvisucttform::FormMouseMove(TObject *Sender,
|
870 |
|
|
TShiftState Shift, int X, int Y)
|
871 |
|
|
{
|
872 |
|
|
if (debut_trans==true)
|
873 |
|
|
{
|
874 |
|
|
GLfloat w = ClientWidth-Panel1->Width;
|
875 |
|
|
GLfloat h = ClientHeight;
|
876 |
|
|
double aspect=w/h;
|
877 |
|
|
double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
|
878 |
|
|
d=max(d,boite.get_zmax()-boite.get_zmin());
|
879 |
|
|
d=d*1.5;
|
880 |
|
|
double xmin,ymin,xmax,ymax;
|
881 |
|
|
if (w<h) xmin=boite.get_xcentre()-d+dx; else xmin=boite.get_xcentre()-d*aspect+dx;
|
882 |
|
|
if (w<h) ymin=boite.get_ycentre()-d/aspect+dy; else ymin=boite.get_ycentre()-d+dy;
|
883 |
|
|
if (w<h) xmax=xmin+2.*d; else xmax=xmin+2.*d*aspect;
|
884 |
|
|
if (w<h) ymax=ymin+2.*d/aspect; else ymax=ymin+2.*d;
|
885 |
|
|
dx=dx+(xdepart-X)/2./w*(xmax-xmin);
|
886 |
|
|
dy=dy-(ydepart-Y)/2./h*(ymax-ymin);
|
887 |
|
|
recadre(dx,dy,1);
|
888 |
|
|
redess();
|
889 |
|
|
xdepart=X;
|
890 |
|
|
ydepart=Y;
|
891 |
|
|
}
|
892 |
|
|
if (debut_rot==true)
|
893 |
|
|
{
|
894 |
|
|
GLfloat w = ClientWidth-Panel1->Width;
|
895 |
|
|
GLfloat h = ClientHeight;
|
896 |
|
|
double deltax=X-xrot;
|
897 |
|
|
double deltay=Y-yrot;
|
898 |
|
|
double norme=deltax*deltax+deltay*deltay;
|
899 |
|
|
norme=sqrt(norme);
|
900 |
|
|
if (norme>=1.)
|
901 |
|
|
{
|
902 |
|
|
glMatrixMode(GL_MODELVIEW);
|
903 |
|
|
deltax=deltax*1.0/norme;
|
904 |
|
|
deltay=deltay*1.0/norme;
|
905 |
|
|
GLdouble matriceproj[16],matricevue[16];
|
906 |
|
|
GLint matriceport[4];
|
907 |
|
|
glGetIntegerv(GL_VIEWPORT,matriceport);
|
908 |
|
|
glGetDoublev(GL_MODELVIEW_MATRIX,matricevue);
|
909 |
|
|
glGetDoublev(GL_PROJECTION_MATRIX,matriceproj);
|
910 |
|
|
double orx,ory,orz;
|
911 |
|
|
double rx,ry,rz;
|
912 |
|
|
gluUnProject((GLdouble)xrot,(GLdouble)yrot,0.,matricevue,matriceproj,matriceport,&orx,&ory,&orz);
|
913 |
|
|
gluUnProject(xrot+deltay,yrot+deltax,0.,matricevue,matriceproj,matriceport,&rx,&ry,&rz);
|
914 |
|
|
rx=rx-orx;
|
915 |
|
|
ry=ry-ory;
|
916 |
|
|
rz=rz-orz;
|
917 |
|
|
double norme2=sqrt(rx*rx+ry*ry+rz*rz);
|
918 |
|
|
rx=rx/norme2;
|
919 |
|
|
ry=ry/norme2;
|
920 |
|
|
rz=rz/norme2;
|
921 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
922 |
|
|
glRotatef(norme/sqrt(w*h)*360, rx, ry, rz);
|
923 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
924 |
|
|
redess();
|
925 |
|
|
}
|
926 |
|
|
xrot=X;
|
927 |
|
|
yrot=Y;
|
928 |
|
|
}
|
929 |
|
|
|
930 |
|
|
|
931 |
|
|
|
932 |
|
|
}
|
933 |
|
|
//---------------------------------------------------------------------------
|
934 |
|
|
|
935 |
|
|
void __fastcall Tvisucttform::FormMouseUp(TObject *Sender,
|
936 |
|
|
TMouseButton Button, TShiftState Shift, int X, int Y)
|
937 |
|
|
{
|
938 |
|
|
if (Button==mbRight)
|
939 |
|
|
if (debut_trans==true)
|
940 |
|
|
{
|
941 |
|
|
GLfloat w = ClientWidth-Panel1->Width;
|
942 |
|
|
GLfloat h = ClientHeight;
|
943 |
|
|
double aspect=w/h;
|
944 |
|
|
debut_trans=false;
|
945 |
|
|
double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
|
946 |
|
|
d=max(d,boite.get_zmax()-boite.get_zmin());
|
947 |
|
|
d=d*1.5;
|
948 |
|
|
double xmin,ymin,xmax,ymax;
|
949 |
|
|
if (w<h) xmin=boite.get_xcentre()-d+dx; else xmin=boite.get_xcentre()-d*aspect+dx;
|
950 |
|
|
if (w<h) ymin=boite.get_ycentre()-d/aspect+dy; else ymin=boite.get_ycentre()-d+dy;
|
951 |
|
|
if (w<h) xmax=xmin+2.*d; else xmax=xmin+2.*d*aspect;
|
952 |
|
|
if (w<h) ymax=ymin+2.*d/aspect; else ymax=ymin+2.*d;
|
953 |
|
|
dx=dx+(xdepart-X)/2./w*(xmax-xmin);
|
954 |
|
|
dy=dy-(ydepart-Y)/2./h*(ymax-ymin);
|
955 |
|
|
recadre(dx,dy,1);
|
956 |
|
|
redess();
|
957 |
|
|
xdepart=X;
|
958 |
|
|
ydepart=Y;
|
959 |
|
|
}
|
960 |
|
|
if (Button==mbMiddle) debut_rot=false;
|
961 |
|
|
}
|
962 |
|
|
//---------------------------------------------------------------------------
|
963 |
|
|
|
964 |
|
|
void __fastcall Tvisucttform::FormMouseWheelDown(TObject *Sender,
|
965 |
|
|
TShiftState Shift, TPoint &MousePos, bool &Handled)
|
966 |
|
|
{
|
967 |
|
|
wglMakeCurrent(hdc,hrc);
|
968 |
|
|
glMatrixMode(GL_MODELVIEW);
|
969 |
|
|
zoom++;
|
970 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
971 |
|
|
glScalef(1.1,1.1,1.1);
|
972 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
973 |
|
|
redess();
|
974 |
|
|
|
975 |
|
|
}
|
976 |
|
|
//---------------------------------------------------------------------------
|
977 |
|
|
|
978 |
|
|
void __fastcall Tvisucttform::FormMouseWheelUp(TObject *Sender,
|
979 |
|
|
TShiftState Shift, TPoint &MousePos, bool &Handled)
|
980 |
|
|
{
|
981 |
|
|
wglMakeCurrent(hdc,hrc);
|
982 |
|
|
glMatrixMode(GL_MODELVIEW);
|
983 |
|
|
zoom--;
|
984 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
985 |
|
|
glScalef(1./1.1,1./1.1,1./1.1);
|
986 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
987 |
|
|
redess();
|
988 |
|
|
|
989 |
|
|
}
|
990 |
|
|
//---------------------------------------------------------------------------
|
991 |
|
|
|
992 |
|
|
void __fastcall Tvisucttform::axeonExecute(TObject *Sender)
|
993 |
|
|
{
|
994 |
|
|
axe=1;
|
995 |
|
|
redess();
|
996 |
|
|
}
|
997 |
|
|
//---------------------------------------------------------------------------
|
998 |
|
|
|
999 |
|
|
void __fastcall Tvisucttform::axeoffExecute(TObject *Sender)
|
1000 |
|
|
{
|
1001 |
|
|
axe=0;
|
1002 |
|
|
redess();
|
1003 |
|
|
}
|
1004 |
|
|
//---------------------------------------------------------------------------
|
1005 |
|
|
|
1006 |
|
|
void __fastcall Tvisucttform::shrinkonExecute(TObject *Sender)
|
1007 |
|
|
{
|
1008 |
|
|
shrink=1;
|
1009 |
|
|
redess();
|
1010 |
|
|
}
|
1011 |
|
|
//---------------------------------------------------------------------------
|
1012 |
|
|
|
1013 |
|
|
void __fastcall Tvisucttform::shrinkoffExecute(TObject *Sender)
|
1014 |
|
|
{
|
1015 |
|
|
shrink=0;
|
1016 |
|
|
redess();
|
1017 |
|
|
}
|
1018 |
|
|
//---------------------------------------------------------------------------
|
1019 |
|
|
|
1020 |
|
|
void __fastcall Tvisucttform::renderonExecute(TObject *Sender)
|
1021 |
|
|
{
|
1022 |
|
|
render=1;
|
1023 |
|
|
redess();
|
1024 |
|
|
}
|
1025 |
|
|
//---------------------------------------------------------------------------
|
1026 |
|
|
|
1027 |
|
|
void __fastcall Tvisucttform::renderoffExecute(TObject *Sender)
|
1028 |
|
|
{
|
1029 |
|
|
render=0;
|
1030 |
|
|
redess();
|
1031 |
|
|
}
|
1032 |
|
|
//---------------------------------------------------------------------------
|
1033 |
|
|
|
1034 |
|
|
void __fastcall Tvisucttform::xmExecute(TObject *Sender)
|
1035 |
|
|
{
|
1036 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1037 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
1038 |
|
|
glRotatef(-5, 1.0, 0.0, 0.0);
|
1039 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
1040 |
|
|
redess();
|
1041 |
|
|
}
|
1042 |
|
|
//---------------------------------------------------------------------------
|
1043 |
|
|
|
1044 |
|
|
void __fastcall Tvisucttform::xpExecute(TObject *Sender)
|
1045 |
|
|
{
|
1046 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1047 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
1048 |
|
|
glRotatef(5, 1.0, 0.0, 0.0);
|
1049 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
1050 |
|
|
redess();
|
1051 |
|
|
}
|
1052 |
|
|
//---------------------------------------------------------------------------
|
1053 |
|
|
|
1054 |
|
|
void __fastcall Tvisucttform::ymExecute(TObject *Sender)
|
1055 |
|
|
{
|
1056 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1057 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
1058 |
|
|
glRotatef(-5, 0.0, 1.0, 0.0);
|
1059 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
1060 |
|
|
redess();
|
1061 |
|
|
}
|
1062 |
|
|
//---------------------------------------------------------------------------
|
1063 |
|
|
|
1064 |
|
|
void __fastcall Tvisucttform::ypExecute(TObject *Sender)
|
1065 |
|
|
{
|
1066 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1067 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
1068 |
|
|
glRotatef(5, 0.0, 1.0, 0.0);
|
1069 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
1070 |
|
|
redess();
|
1071 |
|
|
}
|
1072 |
|
|
//---------------------------------------------------------------------------
|
1073 |
|
|
|
1074 |
|
|
void __fastcall Tvisucttform::zmExecute(TObject *Sender)
|
1075 |
|
|
{
|
1076 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1077 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
1078 |
|
|
glRotatef(-5, 0.0, 0.0, 1.0);
|
1079 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
1080 |
|
|
redess();
|
1081 |
|
|
}
|
1082 |
|
|
//---------------------------------------------------------------------------
|
1083 |
|
|
|
1084 |
|
|
void __fastcall Tvisucttform::zpExecute(TObject *Sender)
|
1085 |
|
|
{
|
1086 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1087 |
|
|
glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
|
1088 |
|
|
glRotatef(5, 0.0, 0.0, 1.0);
|
1089 |
|
|
glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
|
1090 |
|
|
redess();
|
1091 |
|
|
}
|
1092 |
|
|
//---------------------------------------------------------------------------
|
1093 |
|
|
TColor __fastcall Tvisucttform::getcolor(double r,double g,double b)
|
1094 |
|
|
{
|
1095 |
|
|
int rr=int(r*255.);
|
1096 |
|
|
int gg=int(g*255.);
|
1097 |
|
|
int bb=int(b*255.);
|
1098 |
|
|
int color=rr+(gg<<8)+(bb<<16);
|
1099 |
|
|
return (TColor)color;
|
1100 |
|
|
}
|
1101 |
|
|
//---------------------------------------------------------------------------
|
1102 |
|
|
|
1103 |
|
|
void __fastcall Tvisucttform::f3Execute(TObject *Sender)
|
1104 |
|
|
{
|
1105 |
|
|
dx=0.;
|
1106 |
|
|
dy=0.;
|
1107 |
|
|
zoom=0;
|
1108 |
|
|
recadre(dx,dy,1);
|
1109 |
|
|
initvue();
|
1110 |
|
|
redess();
|
1111 |
|
|
|
1112 |
|
|
}
|
1113 |
|
|
//---------------------------------------------------------------------------
|
1114 |
|
|
|
1115 |
|
|
void __fastcall Tvisucttform::f4Execute(TObject *Sender)
|
1116 |
|
|
{
|
1117 |
|
|
glMatrixMode(GL_MODELVIEW);
|
1118 |
|
|
if (zoom>0)
|
1119 |
|
|
glScalef(1./pow(1.1,zoom),1./pow(1.1,zoom),1./pow(1.1,zoom));
|
1120 |
|
|
if (zoom<0)
|
1121 |
|
|
glScalef(pow(1.1,-zoom),pow(1.1,-zoom),pow(1.1,-zoom));
|
1122 |
|
|
zoom=0;
|
1123 |
|
|
dx=0;
|
1124 |
|
|
dy=0;
|
1125 |
|
|
recadre(dx,dy,1);
|
1126 |
|
|
redess();
|
1127 |
|
|
|
1128 |
|
|
}
|
1129 |
|
|
//---------------------------------------------------------------------------
|
1130 |
|
|
|
1131 |
|
|
void __fastcall Tvisucttform::TrackBar1Change(TObject *Sender)
|
1132 |
|
|
{
|
1133 |
|
|
if (TrackBar2->Position<TrackBar1->Position) TrackBar2->Position=TrackBar1->Position;
|
1134 |
|
|
ActiveControl=NULL;
|
1135 |
|
|
redess();
|
1136 |
|
|
}
|
1137 |
|
|
//---------------------------------------------------------------------------
|
1138 |
|
|
|
1139 |
|
|
void __fastcall Tvisucttform::TrackBar2Change(TObject *Sender)
|
1140 |
|
|
{
|
1141 |
|
|
if (TrackBar2->Position<TrackBar1->Position) TrackBar1->Position=TrackBar2->Position;
|
1142 |
|
|
ActiveControl=NULL;
|
1143 |
|
|
redess();
|
1144 |
|
|
}
|
1145 |
|
|
//---------------------------------------------------------------------------
|
1146 |
|
|
|
1147 |
|
|
|
1148 |
|
|
void __fastcall Tvisucttform::TrackBar3Change(TObject *Sender)
|
1149 |
|
|
{
|
1150 |
|
|
if (TrackBar4->Position<TrackBar3->Position) TrackBar4->Position=TrackBar3->Position;
|
1151 |
|
|
ActiveControl=NULL;
|
1152 |
|
|
redess();
|
1153 |
|
|
|
1154 |
|
|
}
|
1155 |
|
|
//---------------------------------------------------------------------------
|
1156 |
|
|
|
1157 |
|
|
void __fastcall Tvisucttform::TrackBar4Change(TObject *Sender)
|
1158 |
|
|
{
|
1159 |
|
|
if (TrackBar4->Position<TrackBar3->Position) TrackBar3->Position=TrackBar4->Position;
|
1160 |
|
|
ActiveControl=NULL;
|
1161 |
|
|
redess();
|
1162 |
|
|
}
|
1163 |
|
|
//---------------------------------------------------------------------------
|
1164 |
|
|
|
1165 |
|
|
void __fastcall Tvisucttform::TrackBar5Change(TObject *Sender)
|
1166 |
|
|
{
|
1167 |
|
|
if (TrackBar6->Position<TrackBar5->Position) TrackBar6->Position=TrackBar5->Position;
|
1168 |
|
|
ActiveControl=NULL;
|
1169 |
|
|
redess();
|
1170 |
|
|
}
|
1171 |
|
|
//---------------------------------------------------------------------------
|
1172 |
|
|
|
1173 |
|
|
void __fastcall Tvisucttform::TrackBar6Change(TObject *Sender)
|
1174 |
|
|
{
|
1175 |
|
|
if (TrackBar6->Position<TrackBar5->Position) TrackBar5->Position=TrackBar6->Position;
|
1176 |
|
|
ActiveControl=NULL;
|
1177 |
|
|
redess();
|
1178 |
|
|
}
|
1179 |
|
|
//---------------------------------------------------------------------------
|
1180 |
|
|
|
1181 |
|
|
void __fastcall Tvisucttform::ListBox1Click(TObject *Sender)
|
1182 |
|
|
{
|
1183 |
|
|
wglMakeCurrent(hdc,hrc);
|
1184 |
|
|
glClearColor(MainForm->valeurconfig[57],MainForm->valeurconfig[58],MainForm->valeurconfig[59], 0.0f);
|
1185 |
|
|
ActiveControl=NULL;
|
1186 |
|
|
redess();
|
1187 |
|
|
}
|
1188 |
|
|
//---------------------------------------------------------------------------
|
1189 |
|
|
|
1190 |
|
|
void __fastcall Tvisucttform::Appliquerunefonctionunchamps1Click(
|
1191 |
|
|
TObject *Sender)
|
1192 |
|
|
{
|
1193 |
|
|
afm->ComboBox1->Clear();
|
1194 |
|
|
afm->ComboBox2->ItemIndex=-1;
|
1195 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1196 |
|
|
afm->ComboBox1->Items->Add(ListBox1->Items->Strings[i]);
|
1197 |
|
|
afm->ShowModal();
|
1198 |
|
|
if (afm->etat==1)
|
1199 |
|
|
{
|
1200 |
|
|
int k=afm->ComboBox1->ItemIndex;
|
1201 |
|
|
int operation=afm->ComboBox2->ItemIndex;
|
1202 |
|
|
int nb=lst_cellule.size();
|
1203 |
|
|
valmax[k]=-1e308;
|
1204 |
|
|
valmin[k]=1e308;
|
1205 |
|
|
for (int i=0;i<nb;i++)
|
1206 |
|
|
{
|
1207 |
|
|
celluleaff* cell=lst_cellule[i];
|
1208 |
|
|
for (int l=0;l<8;l++)
|
1209 |
|
|
{
|
1210 |
|
|
double val=cell->get_valeur(k,l);
|
1211 |
|
|
switch (operation)
|
1212 |
|
|
{
|
1213 |
|
|
case 0 : val=fabs(val);break;
|
1214 |
|
|
case 1 : val=cos(val);break;
|
1215 |
|
|
case 2 : val=sin(val);break;
|
1216 |
|
|
case 3 : val=tan(val);break;
|
1217 |
|
|
case 4 : if ( (val<=1.) && (val>=-1.)) val=acos(val); else val=0.; break;
|
1218 |
|
|
case 5 : if ( (val<=1.) && (val>=-1.)) val=asin(val); else val=0.; break;
|
1219 |
|
|
case 6 : val=atan(val);break;
|
1220 |
|
|
case 7 : if (val>0.) val=log(val); else val=0.; break;
|
1221 |
|
|
case 8 : val=exp(val);break;
|
1222 |
|
|
case 9 : if (val>0.) val=log10(val); else val=0; break;
|
1223 |
|
|
case 10 : val=pow(10,val);break;
|
1224 |
|
|
case 11 : val=-val;break;
|
1225 |
|
|
|
1226 |
|
|
}
|
1227 |
|
|
cell->change_valeur(k,l,val);
|
1228 |
|
|
if (val>valmax[k]) valmax[k]=val;
|
1229 |
|
|
if (val<valmin[k]) valmin[k]=val;
|
1230 |
|
|
}
|
1231 |
|
|
}
|
1232 |
|
|
switch (operation)
|
1233 |
|
|
{
|
1234 |
|
|
case 0 : ListBox1->Items->Strings[k]="| " + ListBox1->Items->Strings[k] + " |";break;
|
1235 |
|
|
case 1 : ListBox1->Items->Strings[k]="cos(" + ListBox1->Items->Strings[k] + ")";break;
|
1236 |
|
|
case 2 : ListBox1->Items->Strings[k]="sin(" + ListBox1->Items->Strings[k] + ")";break;
|
1237 |
|
|
case 3 : ListBox1->Items->Strings[k]="tg(" + ListBox1->Items->Strings[k] + ")";break;
|
1238 |
|
|
case 4 : ListBox1->Items->Strings[k]="acos(" + ListBox1->Items->Strings[k] + ")";break;
|
1239 |
|
|
case 5 : ListBox1->Items->Strings[k]="asin(" + ListBox1->Items->Strings[k] + ")";break;
|
1240 |
|
|
case 6 : ListBox1->Items->Strings[k]="atg(" + ListBox1->Items->Strings[k] + ")";break;
|
1241 |
|
|
case 7 : ListBox1->Items->Strings[k]="ln(" + ListBox1->Items->Strings[k] + ")";break;
|
1242 |
|
|
case 8 : ListBox1->Items->Strings[k]="e(" + ListBox1->Items->Strings[k] + ")";break;
|
1243 |
|
|
case 9 : ListBox1->Items->Strings[k]="log(" + ListBox1->Items->Strings[k] + ")";break;
|
1244 |
|
|
case 10 : ListBox1->Items->Strings[k]="10(" + ListBox1->Items->Strings[k] + ")";break;
|
1245 |
|
|
case 11 : ListBox1->Items->Strings[k]="-"+ListBox1->Items->Strings[k];break;
|
1246 |
|
|
}
|
1247 |
|
|
|
1248 |
|
|
}
|
1249 |
|
|
|
1250 |
|
|
}
|
1251 |
|
|
//---------------------------------------------------------------------------
|
1252 |
|
|
|
1253 |
|
|
|
1254 |
|
|
|
1255 |
|
|
void __fastcall Tvisucttform::Enregistrercettecarte1Click(TObject *Sender)
|
1256 |
|
|
{
|
1257 |
|
|
if (SaveDialog1->Execute())
|
1258 |
|
|
{
|
1259 |
|
|
ofstream o(SaveDialog1->FileName.c_str(),ios::out|ios::trunc);
|
1260 |
|
|
o.precision(16);
|
1261 |
|
|
o.setf(ios::showpoint);
|
1262 |
|
|
int nb=lst_cellule.size();
|
1263 |
|
|
o << nb_renseignement << " " << xmin << " " << ymin << " " << zmin << " " << xmax << " " << ymax << " " << zmax << " " << pasx << " " << pasy << " " << pasz << endl;
|
1264 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1265 |
|
|
o << ListBox1->Items->Strings[i].c_str() << endl;
|
1266 |
|
|
for (int i=0;i<nb;i++)
|
1267 |
|
|
{
|
1268 |
|
|
celluleaff* cell=lst_cellule[i];
|
1269 |
|
|
double x1=cell->coordpt1[0];
|
1270 |
|
|
double y1=cell->coordpt1[1];
|
1271 |
|
|
double z1=cell->coordpt1[2];
|
1272 |
|
|
double x2=cell->coordpt7[0];
|
1273 |
|
|
double y2=cell->coordpt7[1];
|
1274 |
|
|
double z2=cell->coordpt7[2];
|
1275 |
|
|
o << x1 << " " << y1 << " " << z1;
|
1276 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1277 |
|
|
o << " " << cell->get_valeur(i,0);
|
1278 |
|
|
o << endl;
|
1279 |
|
|
o << x2 << " " << y1 << " " << z1 ;
|
1280 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1281 |
|
|
o << " " << cell->get_valeur(i,1);
|
1282 |
|
|
o << endl;
|
1283 |
|
|
o << x2 << " " << y2 << " " << z1 ;
|
1284 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1285 |
|
|
o << " " << cell->get_valeur(i,2);
|
1286 |
|
|
o << endl;
|
1287 |
|
|
o << x1 << " " << y2 << " " << z1 ;
|
1288 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1289 |
|
|
o << " " << cell->get_valeur(i,3);
|
1290 |
|
|
o << endl;
|
1291 |
|
|
o << x1 << " " << y1 << " " << z2 ;
|
1292 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1293 |
|
|
o << " " << cell->get_valeur(i,4);
|
1294 |
|
|
o << endl;
|
1295 |
|
|
o << x2 << " " << y1 << " " << z2 ;
|
1296 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1297 |
|
|
o << " " << cell->get_valeur(i,5);
|
1298 |
|
|
o << endl;
|
1299 |
|
|
o << x2 << " " << y2 << " " << z2 ;
|
1300 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1301 |
|
|
o << " " << cell->get_valeur(i,6);
|
1302 |
|
|
o << endl;
|
1303 |
|
|
o << x1 << " " << y2 << " " << z2 ;
|
1304 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1305 |
|
|
o << " " << cell->get_valeur(i,7);
|
1306 |
|
|
o << endl;
|
1307 |
|
|
}
|
1308 |
|
|
|
1309 |
|
|
}
|
1310 |
|
|
|
1311 |
|
|
}
|
1312 |
|
|
//---------------------------------------------------------------------------
|
1313 |
|
|
|
1314 |
|
|
|
1315 |
|
|
void __fastcall Tvisucttform::Composer1Click(TObject *Sender)
|
1316 |
|
|
{
|
1317 |
|
|
comc->ShowModal();
|
1318 |
|
|
if (comc->etat==1)
|
1319 |
|
|
{
|
1320 |
|
|
FILE *in;
|
1321 |
|
|
in=fopen(comc->Label2->Caption.c_str(),"rt");
|
1322 |
|
|
char mess[400];
|
1323 |
|
|
fgets(mess,400,in);
|
1324 |
|
|
int nb_renseignement2;
|
1325 |
|
|
double xmin2,ymin2,zmin2;
|
1326 |
|
|
double xmax2,ymax2,zmax2;
|
1327 |
|
|
int pasx2,pasy2,pasz2;
|
1328 |
|
|
sscanf(mess,"%d %lf %lf %lf %lf %lf %lf %d %d %d",&nb_renseignement2,&xmin2,&ymin2,&zmin2,&xmax2,&ymax2,&zmax2,&pasx2,&pasy2,&pasz2);
|
1329 |
|
|
if (nb_renseignement!=nb_renseignement2)
|
1330 |
|
|
{
|
1331 |
|
|
MessageBox(Handle,"Carte de taille imcompatible","Erreur",0);
|
1332 |
|
|
fclose(in);
|
1333 |
|
|
return;
|
1334 |
|
|
}
|
1335 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1336 |
|
|
fgets(mess,400,in);
|
1337 |
|
|
vector<celluleaff*> lst_cellule2;
|
1338 |
|
|
while (feof(in)==0)
|
1339 |
|
|
{
|
1340 |
|
|
char mess[400];
|
1341 |
|
|
celluleaff* cell=new celluleaff(nb_renseignement2);
|
1342 |
|
|
fgets(mess,400,in);
|
1343 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt1[0]),&(cell->coordpt1[1]),&(cell->coordpt1[2]));
|
1344 |
|
|
char *p=strchr(mess,' ')+1;
|
1345 |
|
|
p=strchr(p,' ')+1;
|
1346 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1347 |
|
|
{
|
1348 |
|
|
double val;
|
1349 |
|
|
p=strchr(p,' ')+1;
|
1350 |
|
|
sscanf(p,"%lf",&val);
|
1351 |
|
|
cell->change_valeur(l,0,val);
|
1352 |
|
|
}
|
1353 |
|
|
fgets(mess,400,in);
|
1354 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt2[0]),&(cell->coordpt2[1]),&(cell->coordpt2[2]));
|
1355 |
|
|
p=strchr(mess,' ')+1;
|
1356 |
|
|
p=strchr(p,' ')+1;
|
1357 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1358 |
|
|
{
|
1359 |
|
|
double val;
|
1360 |
|
|
p=strchr(p,' ')+1;
|
1361 |
|
|
sscanf(p,"%lf",&val);
|
1362 |
|
|
cell->change_valeur(l,1,val);
|
1363 |
|
|
}
|
1364 |
|
|
fgets(mess,400,in);
|
1365 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt3[0]),&(cell->coordpt3[1]),&(cell->coordpt3[2]));
|
1366 |
|
|
p=strchr(mess,' ')+1;
|
1367 |
|
|
p=strchr(p,' ')+1;
|
1368 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1369 |
|
|
{
|
1370 |
|
|
double val;
|
1371 |
|
|
p=strchr(p,' ')+1;
|
1372 |
|
|
sscanf(p,"%lf",&val);
|
1373 |
|
|
cell->change_valeur(l,2,val);
|
1374 |
|
|
}
|
1375 |
|
|
fgets(mess,400,in);
|
1376 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt4[0]),&(cell->coordpt4[1]),&(cell->coordpt4[2]));
|
1377 |
|
|
p=strchr(mess,' ')+1;
|
1378 |
|
|
p=strchr(p,' ')+1;
|
1379 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1380 |
|
|
{
|
1381 |
|
|
double val;
|
1382 |
|
|
p=strchr(p,' ')+1;
|
1383 |
|
|
sscanf(p,"%lf",&val);
|
1384 |
|
|
cell->change_valeur(l,3,val);
|
1385 |
|
|
}
|
1386 |
|
|
fgets(mess,400,in);
|
1387 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt5[0]),&(cell->coordpt5[1]),&(cell->coordpt5[2]));
|
1388 |
|
|
p=strchr(mess,' ')+1;
|
1389 |
|
|
p=strchr(p,' ')+1;
|
1390 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1391 |
|
|
{
|
1392 |
|
|
double val;
|
1393 |
|
|
p=strchr(p,' ')+1;
|
1394 |
|
|
sscanf(p,"%lf",&val);
|
1395 |
|
|
cell->change_valeur(l,4,val);
|
1396 |
|
|
}
|
1397 |
|
|
fgets(mess,400,in);
|
1398 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt6[0]),&(cell->coordpt6[1]),&(cell->coordpt6[2]));
|
1399 |
|
|
p=strchr(mess,' ')+1;
|
1400 |
|
|
p=strchr(p,' ')+1;
|
1401 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1402 |
|
|
{
|
1403 |
|
|
double val;
|
1404 |
|
|
p=strchr(p,' ')+1;
|
1405 |
|
|
sscanf(p,"%lf",&val);
|
1406 |
|
|
cell->change_valeur(l,5,val);
|
1407 |
|
|
}
|
1408 |
|
|
fgets(mess,400,in);
|
1409 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt7[0]),&(cell->coordpt7[1]),&(cell->coordpt7[2]));
|
1410 |
|
|
p=strchr(mess,' ')+1;
|
1411 |
|
|
p=strchr(p,' ')+1;
|
1412 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1413 |
|
|
{
|
1414 |
|
|
double val;
|
1415 |
|
|
p=strchr(p,' ')+1;
|
1416 |
|
|
sscanf(p,"%lf",&val);
|
1417 |
|
|
cell->change_valeur(l,6,val);
|
1418 |
|
|
}
|
1419 |
|
|
fgets(mess,400,in);
|
1420 |
|
|
sscanf(mess,"%lf %lf %lf",&(cell->coordpt8[0]),&(cell->coordpt8[1]),&(cell->coordpt8[2]));
|
1421 |
|
|
p=strchr(mess,' ')+1;
|
1422 |
|
|
p=strchr(p,' ')+1;
|
1423 |
|
|
for (int l=0;l<nb_renseignement2;l++)
|
1424 |
|
|
{
|
1425 |
|
|
double val;
|
1426 |
|
|
p=strchr(p,' ')+1;
|
1427 |
|
|
sscanf(p,"%lf",&val);
|
1428 |
|
|
cell->change_valeur(l,7,val);
|
1429 |
|
|
}
|
1430 |
|
|
lst_cellule2.insert(lst_cellule2.end(),cell);
|
1431 |
|
|
}
|
1432 |
|
|
fclose(in);
|
1433 |
|
|
|
1434 |
|
|
TPL_GRILLE<celluleaff*> grille;
|
1435 |
|
|
grille.initialiser(xmin-1.,ymin-1.,zmin-1.,xmax+1.,ymax+1.,zmax+1.,pasx,pasy,pasz);
|
1436 |
|
|
int nb2=lst_cellule2.size();
|
1437 |
|
|
for (int i=0;i<nb2;i++)
|
1438 |
|
|
grille.inserer(lst_cellule2[i]);
|
1439 |
|
|
int nb=lst_cellule.size();
|
1440 |
|
|
for (int k=0;k<nb_renseignement;k++)
|
1441 |
|
|
{
|
1442 |
|
|
valmin[k]=1e308;
|
1443 |
|
|
valmax[k]=-1e308;
|
1444 |
|
|
}
|
1445 |
|
|
for (int i=0;i<nb;i++)
|
1446 |
|
|
{
|
1447 |
|
|
celluleaff *cell=lst_cellule[i];
|
1448 |
|
|
for (int k=0;k<nb_renseignement;k++)
|
1449 |
|
|
{
|
1450 |
|
|
for (int l=0;l<8;l++)
|
1451 |
|
|
{
|
1452 |
|
|
double val=cell->get_valeur(k,l);
|
1453 |
|
|
double *xyz;
|
1454 |
|
|
if (l==0) xyz=cell->coordpt1;
|
1455 |
|
|
if (l==1) xyz=cell->coordpt2;
|
1456 |
|
|
if (l==2) xyz=cell->coordpt3;
|
1457 |
|
|
if (l==3) xyz=cell->coordpt4;
|
1458 |
|
|
if (l==4) xyz=cell->coordpt5;
|
1459 |
|
|
if (l==5) xyz=cell->coordpt6;
|
1460 |
|
|
if (l==6) xyz=cell->coordpt7;
|
1461 |
|
|
if (l==7) xyz=cell->coordpt8;
|
1462 |
|
|
TPL_MAP_ENTITE<celluleaff*> list_trouve;
|
1463 |
|
|
grille.rechercher(xyz[0],xyz[1],xyz[2],0.,list_trouve);
|
1464 |
|
|
int nbtrouve=list_trouve.get_nb();
|
1465 |
|
|
for (int itrou=0;itrou<nbtrouve;itrou++)
|
1466 |
|
|
{
|
1467 |
|
|
celluleaff* cell2=list_trouve.get(itrou);
|
1468 |
|
|
BOITE_3D boite1=cell2->get_boite_3D();
|
1469 |
|
|
double xsi=-1+2*(xyz[0]-boite1.get_xmin())/(boite1.get_xmax()-boite1.get_xmin());
|
1470 |
|
|
double eta=-1+2*(xyz[1]-boite1.get_ymin())/(boite1.get_ymax()-boite1.get_ymin());
|
1471 |
|
|
double psi=-1+2*(xyz[2]-boite1.get_zmin())/(boite1.get_zmax()-boite1.get_zmin());
|
1472 |
|
|
if ((xsi<1.0000000001) && (xsi>-1.0000000001) )
|
1473 |
|
|
if ((eta<1.0000000001) && (eta>-1.0000000001) )
|
1474 |
|
|
if ((psi<1.0000000001) && (psi>-1.0000000001) )
|
1475 |
|
|
{
|
1476 |
|
|
double a1=1+xsi;
|
1477 |
|
|
double b1=1+eta;
|
1478 |
|
|
double c1=1+psi;
|
1479 |
|
|
double a2=1-xsi;
|
1480 |
|
|
double b2=1-eta;
|
1481 |
|
|
double c2=1-psi;
|
1482 |
|
|
double N1=a2*b2*c2;
|
1483 |
|
|
double N3=a1*b1*c2;
|
1484 |
|
|
double N2=a1*b2*c2;
|
1485 |
|
|
double N4=a2*b1*c2;
|
1486 |
|
|
double N5=a2*b2*c1;
|
1487 |
|
|
double N6=a1*b2*c1;
|
1488 |
|
|
double N7=a1*b1*c1;
|
1489 |
|
|
double N8=a2*b1*c1;
|
1490 |
|
|
double valeur1=cell2->get_valeur(k,0);
|
1491 |
|
|
double valeur2=cell2->get_valeur(k,1);
|
1492 |
|
|
double valeur3=cell2->get_valeur(k,2);
|
1493 |
|
|
double valeur4=cell2->get_valeur(k,3);
|
1494 |
|
|
double valeur5=cell2->get_valeur(k,4);
|
1495 |
|
|
double valeur6=cell2->get_valeur(k,5);
|
1496 |
|
|
double valeur7=cell2->get_valeur(k,6);
|
1497 |
|
|
double valeur8=cell2->get_valeur(k,7);
|
1498 |
|
|
double res=N1*valeur1+N2*valeur2+N3*valeur3+N4*valeur4+N5*valeur5+N6*valeur6+N7*valeur7+N8*valeur8;
|
1499 |
|
|
res=res/8.;
|
1500 |
|
|
if (comc->ComboBox1->Text=="+") val=val+res;
|
1501 |
|
|
if (comc->ComboBox1->Text=="-") val=val-res;
|
1502 |
|
|
if (comc->ComboBox1->Text=="*") val=val*res;
|
1503 |
|
|
if (comc->ComboBox1->Text=="-%")
|
1504 |
|
|
if (fabs(val)<1e-10) val=0.; else val=(val-res)/val;
|
1505 |
|
|
cell->change_valeur(k,l,val);
|
1506 |
|
|
if (val>valmax[k]) valmax[k]=val;
|
1507 |
|
|
if (val<valmin[k]) valmin[k]=val;
|
1508 |
|
|
itrou=nbtrouve+1;
|
1509 |
|
|
}
|
1510 |
|
|
}
|
1511 |
|
|
}
|
1512 |
|
|
}
|
1513 |
|
|
}
|
1514 |
|
|
|
1515 |
|
|
|
1516 |
|
|
for (int i=0;i<nb2;i++)
|
1517 |
|
|
delete lst_cellule2[i];
|
1518 |
|
|
}
|
1519 |
|
|
}
|
1520 |
|
|
//---------------------------------------------------------------------------
|
1521 |
|
|
|
1522 |
|
|
void __fastcall Tvisucttform::UpDown1Click(TObject *Sender,
|
1523 |
|
|
TUDBtnType Button)
|
1524 |
|
|
{
|
1525 |
|
|
int numvaleur=ListBox1->ItemIndex;
|
1526 |
|
|
double ecart=valmax[numvaleur]-valmin[numvaleur];
|
1527 |
|
|
if (Button==0) valmax[numvaleur]=ecart/2.*1.1+0.5*(valmin[numvaleur]+valmax[numvaleur]);
|
1528 |
|
|
if (Button==1) valmax[numvaleur]=ecart/2./1.1+0.5*(valmin[numvaleur]+valmax[numvaleur]);
|
1529 |
|
|
ecart=valmax[numvaleur]-valmin[numvaleur];
|
1530 |
|
|
if (ecart<1e-10) valmax[numvaleur]=valmin[numvaleur]+1e-10;
|
1531 |
|
|
redess();
|
1532 |
|
|
|
1533 |
|
|
}
|
1534 |
|
|
//---------------------------------------------------------------------------
|
1535 |
|
|
|
1536 |
|
|
void __fastcall Tvisucttform::UpDown2Click(TObject *Sender,
|
1537 |
|
|
TUDBtnType Button)
|
1538 |
|
|
{
|
1539 |
|
|
int numvaleur=ListBox1->ItemIndex;
|
1540 |
|
|
double ecart=valmax[numvaleur]-valmin[numvaleur];
|
1541 |
|
|
if (Button==0) valmin[numvaleur]=0.5*(valmin[numvaleur]+valmax[numvaleur])-ecart/2./1.1;
|
1542 |
|
|
if (Button==1) valmin[numvaleur]=0.5*(valmin[numvaleur]+valmax[numvaleur])-ecart/2.*1.1;
|
1543 |
|
|
ecart=valmax[numvaleur]-valmin[numvaleur];
|
1544 |
|
|
if (ecart<1e-10) valmin[numvaleur]=valmax[numvaleur]-1e-10;
|
1545 |
|
|
redess();
|
1546 |
|
|
}
|
1547 |
|
|
//---------------------------------------------------------------------------
|
1548 |
|
|
|
1549 |
|
|
void __fastcall Tvisucttform::CheckBox1Click(TObject *Sender)
|
1550 |
|
|
{
|
1551 |
|
|
static double valmaxenreg[100];
|
1552 |
|
|
static double valminenreg[100];
|
1553 |
|
|
if (CheckBox1->Checked)
|
1554 |
|
|
{
|
1555 |
|
|
UpDown1->Visible=false;
|
1556 |
|
|
UpDown2->Visible=false;
|
1557 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1558 |
|
|
{
|
1559 |
|
|
valmax[i]=valmaxenreg[i];
|
1560 |
|
|
valmin[i]=valminenreg[i];
|
1561 |
|
|
}
|
1562 |
|
|
}
|
1563 |
|
|
else
|
1564 |
|
|
{
|
1565 |
|
|
UpDown1->Visible=true;
|
1566 |
|
|
UpDown2->Visible=true;
|
1567 |
|
|
for (int i=0;i<nb_renseignement;i++)
|
1568 |
|
|
{
|
1569 |
|
|
valmaxenreg[i]=valmax[i];
|
1570 |
|
|
valminenreg[i]=valmin[i];
|
1571 |
|
|
}
|
1572 |
|
|
}
|
1573 |
|
|
redess();
|
1574 |
|
|
}
|
1575 |
|
|
//---------------------------------------------------------------------------
|
1576 |
|
|
|
1577 |
|
|
void __fastcall Tvisucttform::CheckBox2Click(TObject *Sender)
|
1578 |
|
|
{
|
1579 |
|
|
if (Panel2->Visible==true) Panel2->Visible=false; else Panel2->Visible=true;
|
1580 |
|
|
}
|
1581 |
|
|
//---------------------------------------------------------------------------
|
1582 |
|
|
|
1583 |
|
|
void __fastcall Tvisucttform::Button1Click(TObject *Sender)
|
1584 |
|
|
{
|
1585 |
|
|
double x=atof(Edit1->Text.c_str());
|
1586 |
|
|
double y=atof(Edit2->Text.c_str());
|
1587 |
|
|
double z=atof(Edit3->Text.c_str());
|
1588 |
|
|
Edit4->Text="";
|
1589 |
|
|
double res=evaluer(x,y,z);
|
1590 |
|
|
Edit4->Text=res;
|
1591 |
|
|
}
|
1592 |
|
|
//---------------------------------------------------------------------------
|
1593 |
|
|
double __fastcall Tvisucttform::evaluer(double x,double y,double z)
|
1594 |
|
|
{
|
1595 |
|
|
TPL_MAP_ENTITE<celluleaff*> liste;
|
1596 |
|
|
grille->rechercher(x,y,z,1e-10,liste);
|
1597 |
|
|
int nb=liste.get_nb();
|
1598 |
|
|
for (int i=0;i<nb;i++)
|
1599 |
|
|
{
|
1600 |
|
|
celluleaff* cell=liste.get(i);
|
1601 |
|
|
BOITE_3D boite=cell->get_boite_3D();
|
1602 |
|
|
if (boite.contient(x,y,z))
|
1603 |
|
|
{
|
1604 |
|
|
double xsi=-1+2*(x-boite.get_xmin())/(boite.get_xmax()-boite.get_xmin());
|
1605 |
|
|
double eta=-1+2*(y-boite.get_ymin())/(boite.get_ymax()-boite.get_ymin());
|
1606 |
|
|
double psi=-1+2*(z-boite.get_zmin())/(boite.get_zmax()-boite.get_zmin());
|
1607 |
|
|
double a1=1+xsi;
|
1608 |
|
|
double b1=1+eta;
|
1609 |
|
|
double c1=1+psi;
|
1610 |
|
|
double a2=1-xsi;
|
1611 |
|
|
double b2=1-eta;
|
1612 |
|
|
double c2=1-psi;
|
1613 |
|
|
double N1=a2*b2*c2;
|
1614 |
|
|
double N3=a1*b1*c2;
|
1615 |
|
|
double N2=a1*b2*c2;
|
1616 |
|
|
double N4=a2*b1*c2;
|
1617 |
|
|
double N5=a2*b2*c1;
|
1618 |
|
|
double N6=a1*b2*c1;
|
1619 |
|
|
double N7=a1*b1*c1;
|
1620 |
|
|
double N8=a2*b1*c1;
|
1621 |
|
|
int k=ListBox1->ItemIndex;
|
1622 |
|
|
double valeur1=cell->get_valeur(k,0);
|
1623 |
|
|
double valeur2=cell->get_valeur(k,1);
|
1624 |
|
|
double valeur3=cell->get_valeur(k,2);
|
1625 |
|
|
double valeur4=cell->get_valeur(k,3);
|
1626 |
|
|
double valeur5=cell->get_valeur(k,4);
|
1627 |
|
|
double valeur6=cell->get_valeur(k,5);
|
1628 |
|
|
double valeur7=cell->get_valeur(k,6);
|
1629 |
|
|
double valeur8=cell->get_valeur(k,7);
|
1630 |
|
|
double res=N1*valeur1+N2*valeur2+N3*valeur3+N4*valeur4+N5*valeur5+N6*valeur6+N7*valeur7+N8*valeur8;
|
1631 |
|
|
res=res/8.;
|
1632 |
|
|
return(res);
|
1633 |
|
|
}
|
1634 |
|
|
}
|
1635 |
|
|
return(0);
|
1636 |
|
|
}
|
1637 |
|
|
//---------------------------------------------------------------------------
|
1638 |
|
|
|
1639 |
|
|
void __fastcall Tvisucttform::Button2Click(TObject *Sender)
|
1640 |
|
|
{
|
1641 |
|
|
double x=atof(Edit5->Text.c_str());
|
1642 |
|
|
double y=atof(Edit6->Text.c_str());
|
1643 |
|
|
double z=atof(Edit7->Text.c_str());
|
1644 |
|
|
double dx=atof(Edit8->Text.c_str());
|
1645 |
|
|
double dy=atof(Edit9->Text.c_str());
|
1646 |
|
|
double dz=atof(Edit10->Text.c_str());
|
1647 |
|
|
double tmin=atof(Edit11->Text.c_str());
|
1648 |
|
|
double tmax=atof(Edit12->Text.c_str());
|
1649 |
|
|
int nbpoint=atoi(Edit13->Text.c_str());
|
1650 |
|
|
|
1651 |
|
|
Tgraph *form2=new Tgraph(Application);
|
1652 |
|
|
form2->Width=MainForm->ClientWidth/2.;
|
1653 |
|
|
form2->Height=MainForm->ClientHeight/2.;
|
1654 |
|
|
form2->Left=MainForm->ClientWidth/2.+1;
|
1655 |
|
|
form2->Top=0;
|
1656 |
|
|
form2->Caption=Caption;
|
1657 |
|
|
form2->Series1->Clear();
|
1658 |
|
|
form2->Chart1->Title->Text->Clear();
|
1659 |
|
|
char chaine[500];
|
1660 |
|
|
sprintf(chaine,"Courbe de valeur de la carte de taille pour le critère %s",ListBox1->Items->Strings[ListBox1->ItemIndex].c_str());
|
1661 |
|
|
form2->Chart1->Title->Text->Add(chaine);
|
1662 |
|
|
form2->Chart1->LeftAxis->Title->Caption="Valeur";
|
1663 |
|
|
form2->Chart1->BottomAxis->Title->Caption="t";
|
1664 |
|
|
|
1665 |
|
|
for (int i=0;i<=nbpoint;i++)
|
1666 |
|
|
{
|
1667 |
|
|
double t=tmin+i*1.0/nbpoint*(tmax-tmin);
|
1668 |
|
|
double xx=x+t*dx;
|
1669 |
|
|
double yy=y+t*dy;
|
1670 |
|
|
double zz=z+t*dz;
|
1671 |
|
|
double res=evaluer(xx,yy,zz);
|
1672 |
|
|
form2->Series1->AddXY(t,res,"",clRed);
|
1673 |
|
|
}
|
1674 |
|
|
}
|
1675 |
|
|
//---------------------------------------------------------------------------
|
1676 |
|
|
|
1677 |
|
|
void __fastcall Tvisucttform::Button3Click(TObject *Sender)
|
1678 |
|
|
{
|
1679 |
|
|
if (SaveDialog1->Execute())
|
1680 |
|
|
{
|
1681 |
|
|
double x=atof(Edit5->Text.c_str());
|
1682 |
|
|
double y=atof(Edit6->Text.c_str());
|
1683 |
|
|
double z=atof(Edit7->Text.c_str());
|
1684 |
|
|
double dx=atof(Edit8->Text.c_str());
|
1685 |
|
|
double dy=atof(Edit9->Text.c_str());
|
1686 |
|
|
double dz=atof(Edit10->Text.c_str());
|
1687 |
|
|
double tmin=atof(Edit11->Text.c_str());
|
1688 |
|
|
double tmax=atof(Edit12->Text.c_str());
|
1689 |
|
|
int nbpoint=atoi(Edit13->Text.c_str());
|
1690 |
|
|
FILE *in=fopen(SaveDialog1->FileName.c_str(),"wt");
|
1691 |
|
|
for (int i=0;i<=nbpoint;i++)
|
1692 |
|
|
{
|
1693 |
|
|
double t=tmin+i*1.0/nbpoint*(tmax-tmin);
|
1694 |
|
|
double xx=x+t*dx;
|
1695 |
|
|
double yy=y+t*dy;
|
1696 |
|
|
double zz=z+t*dz;
|
1697 |
|
|
double res=evaluer(xx,yy,zz);
|
1698 |
|
|
fprintf(in,"%lf;%lf;%lf;%lf;%lf;\n",t,xx,yy,zz,res);
|
1699 |
|
|
}
|
1700 |
|
|
fclose(in);
|
1701 |
|
|
}
|
1702 |
|
|
}
|
1703 |
|
|
//---------------------------------------------------------------------------
|
1704 |
|
|
|