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
cameraProjectionCameraThe camera to animate.
newPositionPoint3DThe position to animate to.
newDirectionVector3DThe direction to animate to.
newUpDirectionVector3DThe up direction to animate to.
animationTimedoubleAnimation time in milliseconds.
Exceptions
AnimateWidth(OrthographicCamera?, double, double)
Animates the orthographic width.
public static void AnimateWidth(this OrthographicCamera? camera, double newWidth, double animationTime)
Parameters
cameraOrthographicCameraAn orthographic camera.
newWidthdoubleThe width to animate to.
animationTimedoubleAnimation time in milliseconds.
Exceptions
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
cameraProjectionCameraThe camera.
newLookDirectionVector3DThe new look direction.
newUpDirectionVector3DThe new up direction.
animationTimedoubleThe animation time.
Exceptions
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
sourceProjectionCameraThe source camera.
destProjectionCameraThe destination camera.
distancedoubleNew length of the LookDirection vector.
Exceptions
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
sourceProjectionCameraThe source camera.
destProjectionCameraThe destination camera.
copyNearFarPlaneDistancesboolCopy near and far plane distances if set to
true.
Exceptions
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
cameraProjectionCameraThe actual camera.
viewportViewport3DThe viewport.
animationTimedoubleThe 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
cameraProjectionCameraThe camera to change.
viewportViewport3DThe viewport.
centerPoint3DThe center of the sphere.
radiusdoubleThe radius of the sphere.
lookDirectionVector3DThe look direction.
upDirectionVector3DThe up direction.
animationTimedoubleThe animation time.
Exceptions
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
cameraProjectionCameraThe camera to change.
viewportViewport3DThe viewport.
boundsRect3DThe bounding rectangle.
lookDirectionVector3DThe look direction.
upDirectionVector3DThe up direction.
animationTimedoubleThe 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
cameraProjectionCameraThe actual camera.
viewportViewport3DThe viewport.
lookDirectionVector3DThe look direction.
upDirectionVector3DThe up direction.
animationTimedoubleThe animation time.
Exceptions
GetInfo(Camera)
Gets an information string about the specified camera.
public static string GetInfo(this Camera camera)
Parameters
cameraCameraThe camera.
Returns
- string
The get info.
GetInverseTransform(Camera?, double)
Gets the inverse camera transform.
public static Matrix3D GetInverseTransform(this Camera? camera, double aspectRatio)
Parameters
Returns
- Matrix3D
The inverse transform.
Exceptions
GetProjectionMatrix(Camera?, double)
Gets the projection matrix for the specified camera.
public static Matrix3D GetProjectionMatrix(this Camera? camera, double aspectRatio)
Parameters
Returns
- Matrix3D
The projection matrix.
Exceptions
GetTotalTransform(Camera?, double)
Gets the combined view and projection transform.
public static Matrix3D GetTotalTransform(this Camera? camera, double aspectRatio)
Parameters
Returns
- Matrix3D
The total view and projection transform.
Exceptions
GetViewMatrix(Camera?)
Obtains the view transform matrix for a camera. (see page 327)
public static Matrix3D GetViewMatrix(this Camera? camera)
Parameters
cameraCameraCamera 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
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
cameraProjectionCameraThe camera.
targetPoint3DThe target.
animationTimedoubleThe 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
cameraProjectionCameraThe camera.
targetPoint3DThe target point.
distancedoubleThe distance to the camera.
animationTimedoubleThe animation time.
Exceptions
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
cameraProjectionCameraThe camera.
targetPoint3DThe target.
newLookDirectionVector3DThe new look direction.
animationTimedoubleThe 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
cameraProjectionCameraThe camera.
targetPoint3DThe target.
newLookDirectionVector3DThe new look direction.
newUpDirectionVector3DThe new up direction.
animationTimedoubleThe animation time.
Exceptions
Reset(Camera?)
Resets the specified camera.
public static void Reset(this Camera? camera)
Parameters
cameraCameraThe 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
cameraProjectionCameraThe actual camera.
viewportViewport3DThe viewport.
animationTimedoubleThe animation time.
Exceptions
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
cameraProjectionCameraThe camera to change.
viewportViewport3DThe viewport.
centerPoint3DThe center of the sphere.
radiusdoubleThe radius of the sphere.
animationTimedoubleThe 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
cameraProjectionCameraThe camera to change.
viewportViewport3DThe viewport.
boundsRect3DThe bounding rectangle.
animationTimedoubleThe 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
cameraProjectionCameraThe camera.
viewportViewport3DThe viewport.
zoomRectangleRectThe zoom rectangle.