summaryrefslogtreecommitdiffstats
path: root/Line.h
diff options
context:
space:
mode:
Diffstat (limited to 'Line.h')
-rw-r--r--Line.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/Line.h b/Line.h
index 18f714c..caeb6f7 100644
--- a/Line.h
+++ b/Line.h
@@ -19,13 +19,10 @@ class Line {
Vertex v1, v2;
public:
Line() {}
- Line(const Vertex& v1, const Vertex& v2) {
- this->v1 = v1; this->v2 = v2;
- }
- Line(double x1, double y1, double x2, double y2) {
- v1.setLocation(x1, y1);
- v2.setLocation(x2, y2);
- }
+ Line(const Vertex& vertex1, const Vertex& vertex2) :
+ v1(vertex1), v2(vertex2) {}
+ Line(float x1, float y1, float x2, float y2) :
+ v1(x1, y1), v2(x2, y2) {}
Vertex &getVertex1() {return v1;}
const Vertex &getVertex1() const {return v1;}
@@ -35,8 +32,8 @@ class Line {
const Vertex &getVertex2() const {return v2;}
void setVertex2(const Vertex &v) {v2 = v;}
- double lengthSq() const {return v1.distanceSq(v2);}
- double length() const {return sqrt(lengthSq());}
+ float lengthSq() const {return v1.distanceSq(v2);}
+ float length() const {return sqrtf(lengthSq());}
bool contains(const Vertex &v) const;