|
LineSelectorData Class |
LineSelectorData class can be used to get the closest distance of a specified screen position to the 3D line that is used to create an instance of LineSelectorData.
When line or positions are transformed, then set the
PositionsTransform3D property to apply the transformation.
When
CheckBoundingBox is set to true, then an optimized distance detection algorithm is used that first checks the bounding box before checking individual line segments.
See remarks in the
CheckBoundingBox for more info.
Inheritance Hierarchy Namespace: Ab3d.UtilitiesAssembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax public class LineSelectorData
The LineSelectorData type exposes the following members.
Constructors | Name | Description |
---|
| LineSelectorData(BaseLineVisual3D, Boolean) |
Constructor that use the positions defined in the baseLineVisual3D.
|
| LineSelectorData(ListPoint3D, Boolean) |
Constructor that use the positions from the specified List of Point3Ds.
|
| LineSelectorData(Point3DCollection, Boolean) |
Constructor that use the positions from the specified Point3DCollection.
|
| LineSelectorData(BaseLineVisual3D, BaseCamera, Boolean) |
Constructor that use the positions defined in the baseLineVisual3D.
|
| LineSelectorData(ListPoint3D, Boolean, BaseCamera) |
Constructor that use the positions from the specified List of Point3Ds.
|
| LineSelectorData(Point3DCollection, Boolean, BaseCamera) |
Constructor that use the positions from the specified Point3DCollection.
|
| LineSelectorData(ListPoint3D, Rect3D, Boolean, BaseCamera) |
Constructor that use the positions from the specified List of Point3Ds and also provides positionsBoundingBox.
This also sets CheckBoundingBox to true.
|
TopProperties | Name | Description |
---|
| AdjustLineDistanceWithLineThickness |
Gets or sets a Boolean that specifies if LastDistance value is adjusted by line thickness.
If true then distance is measured from line edge, if false then distance is measured from center of the line.
This value is used only if LineSelectorData is created from BaseLineVisual3D.
|
| Camera |
Camera that is used to show the 3D scene with 3D lines.
This property is also set when calling CalculateScreenSpacePositions(BaseCamera).
|
| CheckBoundingBox |
Gets or sets Boolean that specifies if performance is optimized by first checking the bounding box before
calculating screen positions. See remarks for more info. Default value is false (for backwards compatibility).
|
| LastClosestPositionOnLine |
Gets as Point3D that represents the position on the line that is closest to the mouse position.
This value is calculated in GetClosestDistance method.
|
| LastDistance |
Gets a double value that specifies the closest distance of this line to the specified position.
This value is calculated in GetClosestDistance method.
When CheckBoundingBox is true and when the screenPosition was outside the bounding box, then this value is set to double.MaxValue.
|
| LastDistanceFromCamera |
Gets a double value that represents a distance from the LastClosestPositionOnLine to the Camera.
|
| LastLinePositionIndex |
Gets an index of the first position of the line segment that is closest to the specified position.
This value is calculated in GetClosestDistance method.
|
| LineVisual3D |
Gets LineVisual3D that was used to create this LineSelectorData.
|
| PositionsTransform3D |
Gets or sets a Transform3D that is used to transform all positions.
PositionsTransform3D is automatically set from LineVisual3D.Transform when LineSelectorData is created with LineVisual3D (its value stay null if there is no transformation set on the LineVisual3D or if it is Identity).
|
| ScreenPositionsBoundingBox |
Gets a 2D bounding box (RectangleF) of the positions on the screen.
This property has a valid value only after calling CalculateScreenSpacePositions(BaseCamera) or
CalculateScreenSpacePositions(Matrix3D, Transform3D)method.
|
| UsedLineThickness |
Gets or sets LineThickness that is used to adjust the actual distance from the line.
This value can be automatically set from the LineSelectorData when it is created with BaseLineVisual3D and adjustLineDistanceWithLineThickness set to true.
|
TopMethods | Name | Description |
---|
| CalculateScreenSpacePositions(BaseCamera) |
CalculateScreenSpacePositions method converts the 3D line positions into 2D positions that can be used for calculating distance to specified 2D position.
This method must be called before GetClosestDistance(Point) or GetClosestDistance(Point, Int32) can be called.
This method can be called only on the UI thread. To call this method in multiple threads, use the method override that takes Matrix3D and Transform3D as parameters.
|
| CalculateScreenSpacePositions(Matrix3D, Transform3D) |
CalculateScreenSpacePositions method converts the 3D line positions into 2D positions that can be used for calculating distance to specified 2D position.
This method must be called before GetClosestDistance(Point) or GetClosestDistance(Point, Int32) can be called.
This method takes a reference to a worldToViewport Matrix and an optional Transform3D and can be called on any thread.
|
| GetClosestDistance(Point) |
GetClosestDistance method calculates the closest distance of the line used to create this LineSelectorData to the specified position.
This method also sets LastDistance, LastLinePositionIndex, LastClosestPositionOnLine and LastDistanceFromCamera properties.
Before calling this method the CalculateScreenSpacePositions method must be called.
This method must not be called when CheckBoundingBox is true. In this case use the method that also takes maxSelectionDistance as parameter.
|
| GetClosestDistance(Point, Double) |
GetClosestDistance method calculates the closest distance of the line used to create this LineSelectorData to the specified position.
In case CheckBoundingBox is true the method returns float.MaxValue when the screenPosition is outside the bounding box.
This method also sets LastDistance, LastLinePositionIndex, LastClosestPositionOnLine and LastDistanceFromCamera properties.
Before calling this method the CalculateScreenSpacePositions method must be called.
|
| GetClosestDistance(Point, Int32) |
GetClosestDistance method calculates the closest distance of the line used to create this LineSelectorData to the specified position.
This method also sets LastDistance, LastLinePositionIndex and LastClosestPositionOnLine properties.
Before calling this method the CalculateScreenSpacePositions method must be called.
This method must not be called when CheckBoundingBox is true. In this case use the method that also takes maxSelectionDistance as parameter.
|
| GetClosestDistance(Point, Double, Int32) |
GetClosestDistance method calculates the closest distance of the line used to create this LineSelectorData to the specified position.
In case CheckBoundingBox is true (by default) the method returns float.MaxValue when the screenPosition is outside the bounding box.
This method also sets LastDistance, LastLinePositionIndex and LastClosestPositionOnLine properties.
Before calling this method the CalculateScreenSpacePositions method must be called.
|
| UpdateLinePositions |
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.
|
TopSee Also