-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlowlevelgeometry.h
More file actions
91 lines (70 loc) · 2.07 KB
/
lowlevelgeometry.h
File metadata and controls
91 lines (70 loc) · 2.07 KB
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
#ifndef LOWLEVELGEOMETRY_H
#define LOWLEVELGEOMETRY_H
#include <QtOpenGL>
#include <utility>
#include <vector>
#include <error.h>
#define schar signed char
#define COMPARING_ERROR 0.0001
using namespace std;
struct Point
{
double point_[3];
Point();
Point(const double& firstComponent, const double& secondComponent, const double& thirdComponent);
bool operator == (Point a);
bool operator == (double a);
Point operator + (Point a);
Point operator - (Point a);
double operator / (Point a);
Point& operator += (Point a);
double& operator [](unsigned int index);
const double& getComponent(unsigned int index) const;
};
struct StraightLine
{
Point points_[2];
StraightLine();
StraightLine(const Point& point1, const Point& point2);
Point& operator [](uint index);
const Point& getPoint(uint index) const;
};
/*
struct StraightLine
{
Point point_;
Point vector_;
StraightLine(const Point& point, const Point& vector);
Point& operator [](unsigned int index);
Point& getPoint();
Point& getVector();
};
*/
struct Piece
{
Point points_[2];
Piece(const Point& point1, const Point& point2);
Point& operator [](unsigned int index);
Point& getFirstPoint();
Point& getSecondPoint();
};
struct Plane
{
double coefficients_[4];
Plane(double firstCoefficient, double secondCoefficient, double thirdCoefficient, double fourthCoefficient);
double& operator [](uint index);
const double& getCoefficient(uint index) const;
};
struct PlanesGroup_xyzPlanesSymmetry
{
list<Plane> planes_;
PlanesGroup_xyzPlanesSymmetry(const Plane& plane);
Plane& operator [](uint index);
const Plane& getPlane(uint index) const;
};
bool sortPointsOnStraightLine(list<Point>* points, Point directingVector);
schar pointProvisionRelativeToPlane(const Point& point, const Plane& plane);
bool planeCrossingByStraightLine(Plane plane, StraightLine line, Point* crossingPoint);
bool planeCrossingByPiece(Plane plane, Piece piece, Point* crossingPoint);
bool planeCrossingByPlane(Plane plane1, Plane plane2, StraightLine* crossingStraightLine);
#endif // LOWLEVELGEOMETRY_H