Click or drag to resize
Ab4d.SharpEngine logo

SceneViewBoundingBox3DTo2D Method

Converts a 3D BoundingBox to the two Vector2 that define the 2D bounding box on the screen.

Namespace: Ab4d.SharpEngine
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public (Vector2 minimumScreen, Vector2 maximumScreen) BoundingBox3DTo2D(
	BoundingBox boundingBox,
	bool adjustByDpiScale = false
)

Parameters

boundingBox  BoundingBox
Original 3D BoundingBox
adjustByDpiScale  Boolean  (Optional)
when true (false by default), then the 2D positions will be adjusted by DPI scale (to get positions on the final UI element)

Return Value

ValueTupleVector2, Vector2
Rect in the screen coordinates
Remarks

Converts a 3D BoundingBox to the two Vector2 that define the 2D bounding box on the screen.

The matrix to convert 3D points to 2D points is calculated from the used Ab4d.Camera. The matrix value is cached and is only recalculated when the camera is changed.

If the matrix to convert 3D points to 2D points cannot be calculated (for example if the size of this SceneView is not set), the returned points will be Vector2(float.NaN, float.NaN).

See Also