Line |
Gets or sets Boolean that specifies if performance is optimized by first checking the bounding box before calculating screen positions.
When true and when number of positions is more than 30, then the CalculateViewPositions method calculates screen positions only for the 8 corners of the positions bounding box. This is much faster than calculating screen positions for all positions.
Then the GetClosestDistance(Vector2, Single) method first checks if the mouse position is outside of the screen bounding box. In this case the methods immediately returns with float.MaxValue (and not an actual distance of the line). If the mouse position is inside the bounding box, then screen positions are calculated for all the positions and then a new bounding box is calculated from actual screen positions. If mouse is stil inside the new bounding box, then the actual distance to the line is calculated by checking all line segments.
When CheckBoundingBox is false, then CalculateViewPositions always calculates screen positions for all positions and the GetClosestDistance(Vector2, Single) method always returns an actual distance to the line (and not float.MaxValue in case the mouse is outside the bounding box).
Default value is true when the original positions count is more or equal to 30.