Click or drag to resize
Ab4d.SharpEngine logo

LineSelectorData Methods

The LineSelectorData type exposes the following members.

Methods
 NameDescription
Public methodCalculateViewPositions CalculateViewPositions method converts the 3D line positions into 2D positions on the screen that can be used for calculating distance to specified 2D position. This method must be called before GetClosestDistance(Vector2, Single) or GetClosestPositionOnLine(Vector3, Vector3) methods can be called. The SceneView property must be set before calling this method. When calling CalculateViewPositions on multiple instances of LineSelectorData, it is recommended to use CalculateViewPositions that takes worldToViewMatrix and dpi scale. This is faster because SceneView.GetWorldToViewportMatrix is called only once.
Public methodCalculateViewPositions(Matrix4x4, Single, Single) CalculateViewPositions method converts the 3D line positions into 2D positions on the screen that can be used for calculating distance to specified 2D position. This method must be called before GetClosestDistance(Vector2, Single) or GetClosestPositionOnLine(Vector3, Vector3) methods can be called.
Public methodGetClosestDistance 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.
Public methodGetClosestPositionOnLine(Vector3, Vector3) Gets the Vector3 that represents the closest position of the line segment with index LastLinePositionIndex to the specified ray. The ray is usually calculated by SceneView.GetRayFromCamera method.
Public methodGetClosestPositionOnLine(Int32, Vector3, Vector3) Gets the Vector3 that represents the closest position of the line segment with index LastLinePositionIndex to the specified ray. The ray is usually calculated by SceneView.GetRayFromCamera method.
Public methodUpdateLinePositions UpdateLinePositions method updates the 3D line positions that are used to calculate the distances. This method needs to be called when the 3D line positions are changed.
Top
See Also