- // Our parameter lies between zero and one, so calculate it!
- Vector v(endpoint, position);
- double length = v.Magnitude();
- // We scale the magnitude of v so that it lies between 0 and 1...
- // By multiplying the parameter by the magnitude, we obtain the point we
- // want. No scaling necessary as it's inherent in the approach!
- double spotOnLength = length * parameter;
-
- // To get our point, we use the initial point of the line and add in our
- // scaled point.
- Vector result = position + (v * spotOnLength);
- return result;
+ // The parameter is a percentage of the length of the vector, so all we
+ // have to do is scale the vector by it to find the point.
+ return position + (Vector(position, endpoint) * parameter);
+}
+
+
+/*virtual*/ void Line::MovePointAtParameter(double parameter, Vector v)
+{
+ if (parameter == 0)
+ position += v;
+ else if (parameter == 1.0)
+ endpoint += v;
+ else
+ {} // Not sure how to handle this case :-P