Table of Contents

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

HitTestResult[]

Methods

FindHits(Viewport3DX, Point)

Finds the hits for a given 2D viewport position.

public static IList<HitTestResult> FindHits(this Viewport3DX viewport, Point position)

Parameters

viewport Viewport3DX

The viewport.

position Point

The 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

viewport Viewport3DX

The viewport.

position Point

The position.

point Vector3

The point.

normal Vector3

The normal.

model Element3D

The model.

node SceneNode

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

element Element3D

The element.

action Action<T>

The action.

Type Parameters

T

The 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

element Element3D

The element.

function Func<T, bool>

The action.

Type Parameters

T

The 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

viewport Viewport3DX

The viewport.

action Action<T>

The action.

Type Parameters

T

The 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

viewport Viewport3DX

The viewport.

function Func<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

viewport Viewport3DX

The viewport.

point2d Vector2

The input point.

Returns

Ray

The ray.

UnProject(Viewport3DX, Point)

public static Ray UnProject(this Viewport3DX viewport, Point point2d)

Parameters

viewport Viewport3DX
point2d Point

Returns

Ray

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

viewport Viewport3DX

The viewport.

p Point

The 2D point.

position Vector3

plane position

normal Vector3

plane 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

viewport Viewport3DX

The viewport.

delta double

The relative change in fov.

ZoomToRectangle(Viewport3DX, Rect)

Zooms the viewport to the specified rectangle.

public static void ZoomToRectangle(this Viewport3DX viewport, Rect rectangle)

Parameters

viewport Viewport3DX

The viewport.

rectangle Rect

The rectangle.