Class ViewportExtensions
- Namespace
- HelixToolkit.WinUI.SharpDX
- Assembly
- HelixToolkit.WinUI.SharpDX.dll
public static class ViewportExtensions
- Inheritance
-
ViewportExtensions
- Inherited Members
Fields
EmptyHits
public static readonly HitTestResult[] EmptyHits
Field Value
Methods
FindHits(Viewport3DX, Point)
Finds the hits for a given 2D viewport position.
public static IList<HitTestResult> FindHits(this Viewport3DX viewport, Point position)
Parameters
viewportViewport3DXThe viewport.
positionPointThe position.
Returns
- IList<HitTestResult>
List of hits, sorted with the nearest hit first.
FindNearest(Viewport3DX, Point, out Vector3, out Vector3, out Element3D?, out SceneNode?)
Finds the nearest point and its normal.
public static bool FindNearest(this Viewport3DX viewport, Point position, out Vector3 point, out Vector3 normal, out Element3D? model, out SceneNode? node)
Parameters
viewportViewport3DXThe viewport.
positionPointThe position.
pointVector3The point.
normalVector3The normal.
modelElement3DThe model.
nodeSceneNode
Returns
- bool
The find nearest.
Traverse<T>(Element3D, Action<T>)
Traverses the Visual3D/Element3D tree and invokes the specified action on each Element3D of the specified type.
public static void Traverse<T>(this Element3D element, Action<T> action) where T : Element3D
Parameters
Type Parameters
TThe type filter.
Traverse<T>(Element3D, Func<T, bool>)
Traverses the Visual3D/Element3D tree and invokes the specified action on each Element3D of the specified type.
public static void Traverse<T>(this Element3D element, Func<T, bool> function) where T : Element3D
Parameters
Type Parameters
TThe type filter.
Traverse<T>(Viewport3DX, Action<T>)
Traverses the Visual3D/Element3D tree and invokes the specified action on each Element3D of the specified type.
public static void Traverse<T>(this Viewport3DX viewport, Action<T> action) where T : Element3D
Parameters
viewportViewport3DXThe viewport.
actionAction<T>The action.
Type Parameters
TThe type filter.
Traverse<T>(Viewport3DX, Func<T, bool>)
Traverses the specified action.
public static void Traverse<T>(this Viewport3DX viewport, Func<T, bool> function) where T : Element3D
Parameters
viewportViewport3DXThe viewport.
functionFunc<T, bool>The function. Return true to continue traverse, otherwise stop at current node
Type Parameters
T
UnProject(Viewport3DX, Vector2)
Un-projects a 2D screen point.
public static Ray UnProject(this Viewport3DX viewport, Vector2 point2d)
Parameters
viewportViewport3DXThe viewport.
point2dVector2The input point.
Returns
- Ray
The ray.
UnProject(Viewport3DX, Point)
public static Ray UnProject(this Viewport3DX viewport, Point point2d)
Parameters
viewportViewport3DXpoint2dPoint
Returns
UnProjectOnPlane(Viewport3DX, Point, Vector3, Vector3)
Un-project a point from the screen (2D) to a point on plane (3D)
public static Vector3? UnProjectOnPlane(this Viewport3DX viewport, Point p, Vector3 position, Vector3 normal)
Parameters
viewportViewport3DXThe viewport.
pPointThe 2D point.
positionVector3plane position
normalVector3plane normal
Returns
- Vector3?
A 3D point.
ZoomByChangingFieldOfView(Viewport3DX, double)
Changes the field of view and tries to keep the scale fixed.
public static void ZoomByChangingFieldOfView(this Viewport3DX viewport, double delta)
Parameters
viewportViewport3DXThe viewport.
deltadoubleThe relative change in fov.
ZoomToRectangle(Viewport3DX, Rect)
Zooms the viewport to the specified rectangle.
public static void ZoomToRectangle(this Viewport3DX viewport, Rect rectangle)
Parameters
viewportViewport3DXThe viewport.
rectangleRectThe rectangle.