-
Notifications
You must be signed in to change notification settings - Fork 0
/
geometry.h
78 lines (57 loc) · 1.44 KB
/
geometry.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
#ifndef __GEOMETRY_H__
#define __GEOMETRY_H__
#include <GL/glut.h>
#include "Gconst.h"
#include "flags.h"
class Point
{
public:
double x,y,h;
Point();
Point(double , double );
Point(double , double , double );
Point operator =(const Point &p){ x = p.x; y = p.y; h = p.h; return *this;}
Point operator +(const Point &p){ x+=p.x; y+=p.y; h+=p.h; return *this;}
Point operator *(const double &d) {x*=d; y*=d; return *this;}
~Point(){}
void Draw(GColor GColor);
};
class Segment
{
Point P1, P2;
public:
Segment(Point, Point);
~Segment(){}
Segment operator=(const Segment &s){ P1=s.P1; P2=s.P2; return *this;};
Point GetP1();
Point GetP2();
float GetRo();
float GetTheta();
Point middle();
bool Has_on_it(Point);
void Draw(GColor =Gblack);
};
class Line
{
float m;
float q;
public:
Line(float =0.0, float =0.0);
Line(Point, Point);
Line(Segment S);
Line(Segment *S);
Line(Point P, GVector *V);
~Line(){}
Line ortho(Point);
Line parallel(Point);
float Get_m();
float Get_q();
void Draw(GColor =Gblack);
};
Point interception (Line, Line);
Point interception (Line*, Line*);
/*************** funzione appartenenza di un punto a un segmento ****************/
bool point_on_segment(Point, Segment);
/*************** funzione distanza punto-segmento *****************/
float Dist(Point, Segment);
#endif