Table of Contents

Class CameraHelper

Namespace
HelixToolkit.Wpf
Assembly
HelixToolkit.Wpf.dll

Provides extension methods for Camera derived classes.

public static class CameraHelper
Inheritance
CameraHelper
Inherited Members

Methods

AnimateTo(ProjectionCamera?, Point3D, Vector3D, Vector3D, double)

Animates the camera position and directions.

public static void AnimateTo(this ProjectionCamera? camera, Point3D newPosition, Vector3D newDirection, Vector3D newUpDirection, double animationTime)

Parameters

camera ProjectionCamera

The camera to animate.

newPosition Point3D

The position to animate to.

newDirection Vector3D

The direction to animate to.

newUpDirection Vector3D

The up direction to animate to.

animationTime double

Animation time in milliseconds.

Exceptions

ArgumentNullException
ArgumentException

AnimateWidth(OrthographicCamera?, double, double)

Animates the orthographic width.

public static void AnimateWidth(this OrthographicCamera? camera, double newWidth, double animationTime)

Parameters

camera OrthographicCamera

An orthographic camera.

newWidth double

The width to animate to.

animationTime double

Animation time in milliseconds.

Exceptions

ArgumentNullException
ArgumentException

ChangeDirection(ProjectionCamera?, Vector3D, Vector3D, double)

Changes the direction of a camera.

public static void ChangeDirection(this ProjectionCamera? camera, Vector3D newLookDirection, Vector3D newUpDirection, double animationTime)

Parameters

camera ProjectionCamera

The camera.

newLookDirection Vector3D

The new look direction.

newUpDirection Vector3D

The new up direction.

animationTime double

The animation time.

Exceptions

ArgumentNullException

CopyDirectionOnly(ProjectionCamera?, ProjectionCamera?, double)

Copy the direction of the source Camera. Used for the CoordinateSystem view.

public static void CopyDirectionOnly(this ProjectionCamera? source, ProjectionCamera? dest, double distance)

Parameters

source ProjectionCamera

The source camera.

dest ProjectionCamera

The destination camera.

distance double

New length of the LookDirection vector.

Exceptions

ArgumentNullException

CopyTo(ProjectionCamera?, ProjectionCamera?, bool)

Copies the specified camera, converts field of view/width if necessary.

public static void CopyTo(this ProjectionCamera? source, ProjectionCamera? dest, bool copyNearFarPlaneDistances = true)

Parameters

source ProjectionCamera

The source camera.

dest ProjectionCamera

The destination camera.

copyNearFarPlaneDistances bool

Copy near and far plane distances if set to true.

Exceptions

ArgumentNullException

CreateDefaultCamera()

Creates a default perspective camera.

public static PerspectiveCamera CreateDefaultCamera()

Returns

PerspectiveCamera

A perspective camera.

FitView(ProjectionCamera?, Viewport3D, double)

Fits the current scene in the current view.

public static void FitView(this ProjectionCamera? camera, Viewport3D viewport, double animationTime = 0)

Parameters

camera ProjectionCamera

The actual camera.

viewport Viewport3D

The viewport.

animationTime double

The animation time.

FitView(ProjectionCamera?, Viewport3D?, Point3D, double, Vector3D, Vector3D, double)

Fits the specified bounding sphere to the view.

public static void FitView(ProjectionCamera? camera, Viewport3D? viewport, Point3D center, double radius, Vector3D lookDirection, Vector3D upDirection, double animationTime = 0)

Parameters

camera ProjectionCamera

The camera to change.

viewport Viewport3D

The viewport.

center Point3D

The center of the sphere.

radius double

The radius of the sphere.

lookDirection Vector3D

The look direction.

upDirection Vector3D

The up direction.

animationTime double

The animation time.

Exceptions

ArgumentNullException

FitView(ProjectionCamera?, Viewport3D?, Rect3D, Vector3D, Vector3D, double)

Fits the specified bounding rectangle in the current view.

public static void FitView(this ProjectionCamera? camera, Viewport3D? viewport, Rect3D bounds, Vector3D lookDirection, Vector3D upDirection, double animationTime = 0)

Parameters

camera ProjectionCamera

The camera to change.

viewport Viewport3D

The viewport.

bounds Rect3D

The bounding rectangle.

lookDirection Vector3D

The look direction.

upDirection Vector3D

The up direction.

animationTime double

The animation time.

FitView(ProjectionCamera?, Viewport3D?, Vector3D, Vector3D, double)

Fits the current scene in the current view.

public static void FitView(this ProjectionCamera? camera, Viewport3D? viewport, Vector3D lookDirection, Vector3D upDirection, double animationTime = 0)

Parameters

camera ProjectionCamera

The actual camera.

viewport Viewport3D

The viewport.

lookDirection Vector3D

The look direction.

upDirection Vector3D

The up direction.

animationTime double

The animation time.

Exceptions

ArgumentNullException

GetInfo(Camera)

Gets an information string about the specified camera.

public static string GetInfo(this Camera camera)

Parameters

camera Camera

The camera.

Returns

string

The get info.

GetInverseTransform(Camera?, double)

Gets the inverse camera transform.

public static Matrix3D GetInverseTransform(this Camera? camera, double aspectRatio)

Parameters

camera Camera

The camera.

aspectRatio double

The aspect ratio.

Returns

Matrix3D

The inverse transform.

Exceptions

ArgumentNullException
HelixToolkitException

GetProjectionMatrix(Camera?, double)

Gets the projection matrix for the specified camera.

public static Matrix3D GetProjectionMatrix(this Camera? camera, double aspectRatio)

Parameters

camera Camera

The camera.

aspectRatio double

The aspect ratio.

Returns

Matrix3D

The projection matrix.

Exceptions

ArgumentNullException
HelixToolkitException

GetTotalTransform(Camera?, double)

Gets the combined view and projection transform.

public static Matrix3D GetTotalTransform(this Camera? camera, double aspectRatio)

Parameters

camera Camera

The camera.

aspectRatio double

The aspect ratio.

Returns

Matrix3D

The total view and projection transform.

Exceptions

ArgumentNullException
HelixToolkitException

GetViewMatrix(Camera?)

Obtains the view transform matrix for a camera. (see page 327)

public static Matrix3D GetViewMatrix(this Camera? camera)

Parameters

camera Camera

Camera to obtain the ViewMatrix for

Returns

Matrix3D

A Matrix3D object with the camera view transform matrix, or a Matrix3D with all zeros if the "camera" is null.

Exceptions

ArgumentNullException
HelixToolkitException

LookAt(ProjectionCamera, Point3D, double)

Set the camera target point without changing the look direction.

public static void LookAt(this ProjectionCamera camera, Point3D target, double animationTime)

Parameters

camera ProjectionCamera

The camera.

target Point3D

The target.

animationTime double

The animation time.

LookAt(ProjectionCamera?, Point3D, double, double)

Set the camera target point and camera distance.

public static void LookAt(this ProjectionCamera? camera, Point3D target, double distance, double animationTime)

Parameters

camera ProjectionCamera

The camera.

target Point3D

The target point.

distance double

The distance to the camera.

animationTime double

The animation time.

Exceptions

ArgumentNullException

LookAt(ProjectionCamera, Point3D, Vector3D, double)

Set the camera target point and look direction

public static void LookAt(this ProjectionCamera camera, Point3D target, Vector3D newLookDirection, double animationTime)

Parameters

camera ProjectionCamera

The camera.

target Point3D

The target.

newLookDirection Vector3D

The new look direction.

animationTime double

The animation time.

LookAt(ProjectionCamera?, Point3D, Vector3D, Vector3D, double)

Set the camera target point and directions

public static void LookAt(this ProjectionCamera? camera, Point3D target, Vector3D newLookDirection, Vector3D newUpDirection, double animationTime)

Parameters

camera ProjectionCamera

The camera.

target Point3D

The target.

newLookDirection Vector3D

The new look direction.

newUpDirection Vector3D

The new up direction.

animationTime double

The animation time.

Exceptions

ArgumentNullException

Reset(Camera?)

Resets the specified camera.

public static void Reset(this Camera? camera)

Parameters

camera Camera

The camera.

ZoomExtents(ProjectionCamera?, Viewport3D?, double)

Zooms to fit the extents of the specified viewport.

public static void ZoomExtents(this ProjectionCamera? camera, Viewport3D? viewport, double animationTime = 0)

Parameters

camera ProjectionCamera

The actual camera.

viewport Viewport3D

The viewport.

animationTime double

The animation time.

Exceptions

ArgumentNullException

ZoomExtents(ProjectionCamera?, Viewport3D?, Point3D, double, double)

Zooms to fit the specified sphere.

public static void ZoomExtents(ProjectionCamera? camera, Viewport3D? viewport, Point3D center, double radius, double animationTime = 0)

Parameters

camera ProjectionCamera

The camera to change.

viewport Viewport3D

The viewport.

center Point3D

The center of the sphere.

radius double

The radius of the sphere.

animationTime double

The animation time.

ZoomExtents(ProjectionCamera?, Viewport3D?, Rect3D, double)

Zooms to fit the specified bounding rectangle.

public static void ZoomExtents(this ProjectionCamera? camera, Viewport3D? viewport, Rect3D bounds, double animationTime = 0)

Parameters

camera ProjectionCamera

The camera to change.

viewport Viewport3D

The viewport.

bounds Rect3D

The bounding rectangle.

animationTime double

The animation time.

ZoomToRectangle(ProjectionCamera?, Viewport3D?, Rect)

Zooms the camera to the specified rectangle.

public static void ZoomToRectangle(this ProjectionCamera? camera, Viewport3D? viewport, Rect zoomRectangle)

Parameters

camera ProjectionCamera

The camera.

viewport Viewport3D

The viewport.

zoomRectangle Rect

The zoom rectangle.

Exceptions

ArgumentNullException