3 using namespace grapic;
9 winInit(
"Pavage Drawing", 800, 610);
10 backgroundColor( 185, 210, 225, 255 );
18 Point<2> pt((
double)(300.), (
double)(300.));
22 stop = winManageEvent();
31 bool insidePavage =
false;
32 bool empty = pavage.
empty();
34 if(grapic::isMousePressed(SDL_BUTTON_LEFT)) {
38 if(grapic::isMousePressed(SDL_BUTTON_RIGHT)) {
43 std::set<std::vector<Point<2>*>> figures = pavage.
getFigures();
45 std::vector<Point<2>*> highlight;
48 for (std::vector<
Point<2>*> figure : figures){
59 for (
unsigned int i=0; i<figure.size(); i++){
61 for (
unsigned int j=i+1; j<figure.size(); j++){
72 if (addpt && (insidePavage || empty)){
74 std::cout <<
"Entrez une valeur : ";
77 std::cout<<pt<<std::endl;
80 else if (addpt && !insidePavage){
82 std::stringstream avert;
83 avert <<
"Impossible d'ajouter le point " << pt <<
" qui n'est pas dans le pavage!";
84 grapic::print(1, 1, avert.str().c_str());
89 else if (clicked && insidePavage) {
91 for (
unsigned int i=0; i<highlight.size(); i++){
92 Point<2>* pointCur = highlight.at(i);
93 for (
unsigned int j=i+1; j<highlight.size(); j++){
94 Point<2>* pointCur2 = highlight.at(j);
100 std::stringstream coord;
102 for (
int i=0; i<3 ;i++){
103 coord << *highlight.at(i) <<
" ";
107 grapic::print(1, 25, coord.str().c_str());
112 std::stringstream interpo;
113 interpo <<
"Valeur d'interpolation : " << pavage.
interpolation(pt);
115 grapic::print(1, 1, interpo.str().c_str());
121 else if (!insidePavage){
123 std::stringstream avert;
124 avert <<
"Vous etes en dehors du pavage!";
125 grapic::print(1, 1, avert.str().c_str());
128 else if (insidePavage){
130 std::stringstream coord;
132 grapic::print(1, 1, coord.str().c_str());
bool isPointInFigure(const std::vector< Point< N > * > &figure, const Point< N > &pt) const
Test d'appartenance d'un point à une figure.
classe representant un pavage consitué de trisimplexe dans un espace de dimension N ...
double getCoord(unsigned int index) const
Getter d'une coordonnée.
bool empty() const
Teste si le pavage est vide.
void drawPavage(Pavage< 2 > &pavage)
Dessin d'un pavage.
void addPoint(Point< N > &pt, double val)
Ajout d'un point au pavage.
void setCoord(unsigned int index, double val)
setter d'une coordonnée du point e la coordonnée d'index index du point
double interpolation(const Point< N > &point) const
Calcul de la valeur d'interpolation d'un point.
classe representant un point dans un espace de dimension N
std::set< std::vector< Point< N > * > > & getFigures()
Getter des figures du pavage.
std::list< Point< N > * > getSinglePoints() const
Getter des points du pavage.