-
Notifications
You must be signed in to change notification settings - Fork 1
/
disks.cpp
63 lines (48 loc) · 1.37 KB
/
disks.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
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include "CtcLMI.h"
#include "vibes/vibes.h"
#include "CtcEllipsoid.h"
#include "CtcEllipsoids.h"
using namespace ibex;
using namespace std;
void ctcAndDraw1();
void ctcAndDraw2();
int main()
{
vibes::beginDrawing();
ctcAndDraw1();
// ctcAndDraw2();
vibes::endDrawing();
return EXIT_SUCCESS;
}
// Differentes boites par rapport a un disque
void ctcAndDraw1()
{
vibes::newFigure("Boxes vs 1 disk");
Vector C(2);
double R = 2;
Variable x(2);
NumConstraint c(x, sqr(x[0] - C[0]) + sqr(x[1] - C[1]) <= sqr(R));
CtcFwdBwd ctcFwdBwd(c);
vibes::drawEllipse(C[0], C[1], R, R, 0, vibesParams("figure", "Boxes vs 1 disk", "lightGray[lightGray]"));
double _box[2][2] = {
{-4, 4},
{-8, 3}
};
IntervalVector box(2, _box);
double _smallBox[2][2] = {
{1, 1.8},
{-1.8, -1}};
IntervalVector smallBox(2, _smallBox);
vibes::drawBox(box, vibesParams("figure", "Boxes vs 1 disk"));
vibes::drawBox(smallBox, vibesParams("figure", "Boxes vs 1 disk"));
IntervalVector box1 = box;
ctcFwdBwd.contract(box1);
vibes::drawBox(box1, vibesParams("figure", "Boxes vs 1 disk"));
box1=smallBox;
ctcFwdBwd.contract(box1);
vibes::drawBox(box1, vibesParams("figure", "Boxes vs 1 disk"));
vibes::axisAuto("Boxes vs 1 disk");
}