|
LineSelectorDataGetClosestDistance Method |
GetClosestDistance method calculates the closest distance of the line to the specified screenPosition.
In case
CheckBoundingBox is true (by default) the method returns float.MaxValue when the screenPosition is outside the bounding box.
See remarks in the
CheckBoundingBox for more info.
Before calling this method the CalculateViewPositions method must be called.
This method also sets the
LastDistance property.
To get the line segment index that is closest to the screenPosition read the
LastLinePositionIndex property.
Namespace: Ab4d.SharpEngine.UtilitiesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax public float GetClosestDistance(
Vector2 screenPosition,
float maxSelectionDistance
)
Parameters
- screenPosition Vector2
- 2D position that will be used to calculate the distance to this line
- maxSelectionDistance Single
- the distance at which the line will be selected (zero if user needs to be on the line)
Return Value
Singledistance of this line to the specified position; in case CheckBoundingBox is true (by default) the method returns float.MaxValue when the screenPosition is outside the bounding box
See Also