FS#2708 - getVectorTo() strictRange: Ambiguous or not used at all
strictRange by default typically RMAXDOUBLE
Expected is a vector with a magnitude strictly not larger than the given range.
But the behavior is very different in regards with the shape:
- RArc: Unused, compare strictRange with distance to center minus radius
- RLine: Only applied for non-perpendicular vectors towards the nearest endpoint if limited
- RCircle: Unused, see RArc
There is always a perpendicular vector towards an RCircle
- REllipse: Unused, there are 0-4 normals for a full or limited ellipse shape
Compare strictRange with distance to (nearest) point on ellipse ...
... At least, if that would be a point exactly on the ellipse or not a false positive
- RPoint: Unused, compare strictRange with distance to point
- RPolyline: Only applied for non-perpendicular vectors towards limited line segments
- RXLine: Unused, handled as unlimited RLine
There is always a perpendicular vector towards an RXLine
- RRay: Unused for unlimited, not passed on for limited ⇒ RMAXDOUBLE
- RSpline: Undocumented for proxy, otherwise handled as RPolyline
- ...
Turns out that for a returned valid vector one still has to verify that it is within range or not.
getDistanceTo is itself based on getVectorTo ... Doing things twice.
Or that the projected point is on the limited shape ... Also doing things twice.
Then I don’t understand the purpose as it is only implemented for an RLine (segment) when limited. And then only when the projected position is not on the limited shape.
What requires an extra diversification on perpendicular or not.
I only see a purpose for RLine.getVectorTo(pos, false, 1e-6)
What is equally tolerant for the start and end of a limited line (segment).
Except that the magnitude from the start is always exactly zero, even when near.
Regards,
CVH