-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurfImp.h
107 lines (89 loc) · 2.51 KB
/
surfImp.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <GL/glut.h>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
#define WIDTH_GRILLE 200 //grid width
#define HEIGHT_GRILLE 150 //grid height
const int NMAX = 100;
float T = 0.7, Ri = 100;
struct Point
{
float x, y, d;
bool isIn()
{
return d < T;
}
void set(float xx, float yy, float dd)
{
x = xx;
y = yy;
d = dd;
}
};
Point P[NMAX];
Point Grid[WIDTH_GRILLE][HEIGHT_GRILLE];
struct Square
{
Point A, B, C, D;
void set(int i, int j)
{
A = Grid[i][j];
B = Grid[i + 1][j];
C = Grid[i + 1][j + 1];
D = Grid[i][j + 1];
}
};
Square carres[WIDTH_GRILLE - 1][HEIGHT_GRILLE - 1];
enum MenuEntry
{
MENU_Default = 0,
MENU_AddPoint = 1,
MENU_INCREASE_Ri = 2,
MENU_DECREASE_Ri = 3,
MENU_INCREASE_T = 4,
MENU_DECREASE_T = 5,
MENU_EXIT = 6
};
enum SubMenuPotentielEntry
{
SUB_MENU_Murakami = 1,
SUB_MENU_Nishimura = 2,
SUB_MENU_Wyvil = 3
};
enum SubMenuDensiteEntry
{
SUB_MENU_Melange = 1,
SUB_MENU_Union = 2,
SUB_MENU_Sub = 3
};
/**************************** disatance ****************************/
//calcule la distance euclidienne entre deux points
float distance(Point P1, Point P2);
/**************************** afficher les points ****************************/
void drawPoint();
/**************************** fonctions de potentiel ****************************/
float Murakami(float r);
float Nishimura(float r);
float Wyvill(float r);
float valueOfPotentielFunc(Point p1, Point p2);
/**************************** fonctions de densité ****************************/
float Melange(Point point);
float Union(Point point);
float Sub(Point point);
float ValueOfDensiteFunc(Point point);
/**************************** Polygonalisation ****************************/
void SetUpEdges(Square c);
void MarchingSquares(float Ux, float Uy);
/**************************** fonction de display & reshape ****************************/
void display();
void reshape(int width, int height);
/**************************** fonctions souris ****************************/
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
/**************************** fonctions menu ****************************/
void menuFoncDensite(int item); //sous menu fonction de densite
void menuFoncPotentiel(int item); //sous menu fonction de potentiel
void mainMenu(int item); //menu principale
void createMenu(); // crée tout le menu