-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLineSegment.cpp
More file actions
37 lines (31 loc) · 824 Bytes
/
LineSegment.cpp
File metadata and controls
37 lines (31 loc) · 824 Bytes
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
#include "LineSegment.h"
LineSegment::LineSegment(const Vector2d& pointA, const Vector2d& pointB)
: startPoint(pointA), endPoint(pointB)
{
line = Hyperplane2d::Through(startPoint, endPoint);
maxX = std::max(startPoint(0),endPoint(0));
maxY = std::max(startPoint(1),endPoint(1));
minX = std::min(startPoint(0),endPoint(0));
minY = std::min(startPoint(1),endPoint(1));
}
LineSegment::Vector2d& LineSegment::getStartPoint() {
return startPoint;
}
LineSegment::Vector2d& LineSegment::getEndPoint() {
return endPoint;
}
LineSegment::Hyperplane2d& LineSegment::getLine() {
return line;
}
double LineSegment::getMaxX(){
return maxX;
}
double LineSegment::getMinX(){
return minX;
}
double LineSegment::getMaxY(){
return maxY;
}
double LineSegment::getMinY(){
return minY;
}