-
Notifications
You must be signed in to change notification settings - Fork 0
/
poisson.cpp
executable file
·64 lines (52 loc) · 1.04 KB
/
poisson.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "poisson.h"
poisson::poisson()
{
ai=0;;
}
poisson::poisson(vect _p, vect _v, float s, float ve)
{
p=_p;
v=_v;
sz=s;
vs=ve;
ai=0;
}
poisson::~poisson(void)
{
}
void poisson::aff()
{
vect nez = v.normal();
vect nag = nez^vect(nez.z,nez.y,-nez.x);
vect nag2=nez^nag;
glBegin (GL_TRIANGLES);
glColor3f (0,0,1);(p+nag*0.1).vert();
glColor3f (0,0,1);(p-nag*0.1).vert();
glColor3f (1,0,0);(p+nez).vert();
glEnd ();
glBegin (GL_TRIANGLES);
glColor3f (0,0,1);(p+nag2*0.1).vert();
glColor3f (0,0,1);(p-nag2*0.1).vert();
glColor3f (1,0,0);(p+nez).vert();
glEnd ();
/*glColor3f (1,1,1);
glBegin (GL_LINE_STRIP);
int i=ai;
for (int j=0; j<L; j++)
{
glVertex3f (apos[i].x,apos[i].y,apos[i].z);
i++;
if (i>L-1) i=0;
}
glEnd ();*/
}
void poisson::anime (float tp)
{
//apos[ai++]=p;
p=p+v*tp;
//if (ai==L)ai=0;
}
bool poisson::voisin (vect w)
{
return (w-p).norme()<vs;
}