]> Shamusworld >> Repos - architektonas/blobdiff - src/vector.cpp
Added new triangulation tool, ability to snap to endpoints/intersections.
[architektonas] / src / vector.cpp
index 11ddb6494962b724e8166b05502baa27612c0295..6147c6d71d4021c0e10744b482e2b7796bb93c72 100644 (file)
@@ -31,6 +31,15 @@ Vector::Vector(Vector tail, Vector head): x(head.x - tail.x), y(head.y - tail.y)
 }
 
 
+// Create vector from angle + length (2D; z is set to zero)
+void Vector::SetAngleAndLength(double angle, double length)
+{
+       x = cos(angle) * length;
+       y = sin(angle) * length;
+       z = 0;
+}
+
+
 Vector Vector::operator=(Vector const v)
 {
        x = v.x, y = v.y, z = v.z;
@@ -257,10 +266,8 @@ double Vector::Parameter(Vector tail, Vector head, Vector p)
 // (Not sure which is head or tail, or which hand the normal lies)
 // [v1 should be the tail, v2 should be the head, in which case the normal should
 //  rotate anti-clockwise.]
-///*static*/ Vector Vector::Normal(Vector v1, Vector v2)
 /*static*/ Vector Vector::Normal(Vector tail, Vector head)
 {
-//     Vector v = (v1 - v2).Unit();
        Vector v = (head - tail).Unit();
        return Vector(-v.y, v.x);
 }