Table of Contents

Class Camera3D

Namespace
LightningChartLib.WinForms.Charting.Views.View3D
Assembly
LightningChart.WinForms.Charting.NET4.dll

Camera in 3D view.

Defines how and from what direction the world is seen from.

[TypeConverter(typeof(ExpandableObjectConverter))]
public class Camera3D : ChartNode, IChartNode, IDisposable
Inheritance
Camera3D
Implements
Inherited Members

Remarks

Projection.

Camera supports three different projection types, as defined by Projection property.
<p>
Projection defines how the elements on 3D world are shown on the screen, 
i.e. how are they projected onto the 2D surface. 
</p><p>
The <xref href="LightningChartLib.WinForms.Charting.ProjectionType.Perspective" data-throw-if-not-resolved="false"></xref> projection is the default, 
and resembles "real world" as closely as possible. 
</p><p>
Other options are two versions of orthographic 
(<a href="https://en.wikipedia.org/wiki/Orthographic_projection">Wikipedia link</a>)
projections, with slight difference on zooming behavior. 
</p><p>
New orthographic projection and <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.Projection" data-throw-if-not-resolved="false"></xref> property 
was introduced in v8.4. and used as default 
orthographic projection hence. Before that the projection selection was 
done by now obsolete OrthographicCamera property. 
</p><p>
For more information on possible values and their documentation, 
see <xref href="LightningChartLib.WinForms.Charting.ProjectionType" data-throw-if-not-resolved="false"></xref> enumeration. 
</p><h3>Location and orientation.</h3><p>The camera look on to the <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.Target" data-throw-if-not-resolved="false"></xref> form <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.ViewDistance" data-throw-if-not-resolved="false"></xref> away.
Camera location and orientation in is defined in relation to the 
<xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.Target" data-throw-if-not-resolved="false"></xref> by <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.RotationX" data-throw-if-not-resolved="false"></xref>, <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.RotationY" data-throw-if-not-resolved="false"></xref> and 
<xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.RotationZ" data-throw-if-not-resolved="false"></xref> properties. Meaning of these properties 
is defined by <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.OrientationMode" data-throw-if-not-resolved="false"></xref> property. 
The possible values can be limited by the use of 
<xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.RotationXMinimum" data-throw-if-not-resolved="false"></xref> and <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.RotationXMaximum" data-throw-if-not-resolved="false"></xref> for X-axis rotation, 
and the respective properties for Y- and Z-axis. 
</p><p>
Orientation system has been changed in v8.4. when the new orientation mode 
<xref href="LightningChartLib.WinForms.Charting.OrientationModes.ZXY_Extrinsic" data-throw-if-not-resolved="false"></xref> was introduced and set as 
default. To use the old way, set the orientation mode to 
<xref href="LightningChartLib.WinForms.Charting.OrientationModes.XYZ_Mixed" data-throw-if-not-resolved="false"></xref>.

<p>
Note that the selected orientation mode affects mouse rotation behavior as well. 
</p></p><p>
For more information on the effects and differences of the 
different modes, see <xref href="LightningChartLib.WinForms.Charting.OrientationModes" data-throw-if-not-resolved="false"></xref> documentation. 
</p><h3>Field of view.</h3>
Camera controls the field of view as well. The feature is controlled 
through <xref href="LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.FieldOfViewAngle" data-throw-if-not-resolved="false"></xref> property.

Constructors

Camera3D()

Constructor.

public Camera3D()

Camera3D(View3DBase)

Constructor.

public Camera3D(View3DBase owner)

Parameters

owner View3DBase

Camera owner view.

Properties

FieldOfViewAngle

Field of view, that is, perspective angle.

public double FieldOfViewAngle { get; set; }

Property Value

double

MinimumViewDistance

Minimum View distance. Limits the adjust range of ViewDistance. In some cases, you don't want to let the user set the camera too near.

public double MinimumViewDistance { get; set; }

Property Value

double

OrientationMode

Type of orientation angle definition used in camera orientation.

This affects how on the orientation angles (RotationX, RotationY and RotationZ) are interpreted and how do they affect the camera orientation / position.

See OrientationModes for more detailed description of options.

public OrientationModes OrientationMode { get; set; }

Property Value

OrientationModes

Projection

Gets or sets camera projection type.

public ProjectionType Projection { get; set; }

Property Value

ProjectionType

RotationX

Part of defining camera orientation and position, by setting its looking direction rotation around X-axis (pitch, elevation) in degrees.

Selected Orientation mode (OrientationMode) defines how the value affects camera orientation and position. See OrientationModes enumeration for more information.

RotationY and RotationZ needs to be set as well for defining camera orientation. The rotation values are taken into account on a specific order, NOT on the order they are set.

In some orientation modes setting this value causes user device horizontal rotation axis to be set.

public double RotationX { get; set; }

Property Value

double

RotationXMaximum

Maximum allowed value of RotationX property.

This can be used to limit camera orientation / location to some specific area.

public double RotationXMaximum { get; set; }

Property Value

double

Remarks

It should be note that leaving small angle of disallowed area does not work well with user device camera rotations (mouse etc.), as the check is done on frame renderings, and rotation can thus pass over the limit if done quickly enough.

RotationXMinimum

Minimum allowed value of RotationX property.

This can be used to limit camera orientation / location to some specific area.

public double RotationXMinimum { get; set; }

Property Value

double

Remarks

It should be note that leaving small angle of disallowed area does not work well with user device camera rotations (mouse etc.), as the check is done on frame renderings, and rotation can thus pass over the limit if done quickly enough.

RotationY

Part of defining camera orientation and position, by setting its looking direction rotation around Y-axis (Yaw, Heading, Bearing) in degrees.

Selected Orientation mode (OrientationMode) defines how the value affects camera orientation and position. See OrientationModes enumeration for more information.

RotationX and RotationZ needs to be set as well for defining camera orientation. The rotation values are taken into account on a specific order, NOT on the order they are set.

In some orientation modes setting this value causes user device horizontal rotation axis to be set.

public double RotationY { get; set; }

Property Value

double

RotationYMaximum

Maximum allowed value of RotationY property.

This can be used to limit camera orientation / location to some specific area.

public double RotationYMaximum { get; set; }

Property Value

double

Remarks

It should be note that leaving small angle of disallowed range does not work well with user device camera rotations (mouse etc.), as the check is done on frame renderings, and rotation can thus pass over the limit if done quickly enough.

RotationYMinimum

Minimum allowed value of RotationY property.

This can be used to limit camera orientation / location to some specific area.

public double RotationYMinimum { get; set; }

Property Value

double

Remarks

It should be note that leaving small angle of disallowed range does not work well with user device camera rotations (mouse etc.), as the check is done on frame renderings, and rotation can thus pass over the limit if done quickly enough.

RotationZ

Part of defining camera orientation and position, by setting its looking direction rotation around Z-axis (pitch, elevation) in degrees. This property has highly different effects on different orientation modes.

Selected Orientation mode (OrientationMode) defines how the value affects camera orientation and position. See OrientationModes enumeration for more information.

RotationY and RotationX needs to be set as well for defining camera orientation. The rotation values are taken into account on a specific order, NOT on the order they are set.

In some orientation modes setting this value causes user device horizontal rotation axis to be set.

public double RotationZ { get; set; }

Property Value

double

RotationZMaximum

Maximum allowed value of RotationZ property.

This can be used to limit camera orientation / location to some specific area.

public double RotationZMaximum { get; set; }

Property Value

double

Remarks

It should be note that leaving small angle of disallowed area does not work well with user device camera rotations (mouse etc.), as the check is done on frame renderings, and rotation can thus pass over the limit if done quickly enough.

RotationZMinimum

Minimum allowed value of RotationZ property.

This can be used to limit camera orientation / location to some specific area.

public double RotationZMinimum { get; set; }

Property Value

double

Remarks

It should be note that leaving small angle of disallowed area does not work well with user device camera rotations (mouse etc.), as the check is done on frame renderings, and rotation can thus pass over the limit if done quickly enough.

Target

Target 3D world coordinate. Camera is targeted towards this coordinate. Use (0,0,0) to center in the 3D view. View distance is calculated from this target.

public PointDoubleXYZ Target { get; set; }

Property Value

PointDoubleXYZ

ViewDistance

View distance. You should use values in range 10...1000. Distance is calculated from Target. MinimumViewDistanceMaximumViewDistance

public double ViewDistance { get; set; }

Property Value

double

Methods

Dispose(bool)

Clean up any resources being used.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if managed resources should be disposed, otherwise false.

DistanceToOrthographicViewArea(double)

Converts view distance value into a orthographic view area. Used for building projection matrix.

public SizeFloat DistanceToOrthographicViewArea(double distance)

Parameters

distance double
param distance M:LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.DistanceToOrthographicViewArea(System.Double)

Returns

SizeFloat

Orthographic view area.

GetFarClipDistance()

Getter of the far clipping distance for the 3D projection. This is an advanced setting that is not supported in normal use and should not be modified.

public float GetFarClipDistance()

Returns

float

Current far clipping distance.

GetLocationAs3DWorldCoord()

Gets camera location in 3D world space.

public PointDouble3D GetLocationAs3DWorldCoord()

Returns

PointDouble3D

Camera location.

GetNearClipDistance()

Getter of the near clipping distance for the 3D projection. This is an advanced setting that is not supported in normal use and should not be modified.

public float GetNearClipDistance()

Returns

float

Current near clipping distance.

LockPointerDeviceHorizRotationAxis()

Locks user pointer device (mouse etc) based rotation to use current camera orientation settings for rotation axis. This affects the way horizontal rotation behaves on certain OrientationModes values.

This has no effect when OrientationMode is XYZ_Mixed.

This method is intended mostly as internal operation of LC. It's run when RotationX, RotationY or RotationZ properties are changed, causing horizontal rotation axis to be locked based on the current rotation settings. The method has been left as public for special cases, where users need to make the same operation without modifying the rotation parameters.

public void LockPointerDeviceHorizRotationAxis()

Remarks

Horizontal rotation axis defines the axis around which the camera is rotated on horizontal user input, e.g. mouse based rotation. Calculation and the effects are described separately for different Orientation modes at OrientationModes enumeration values documentation.

OrthographicViewAreaToDistance(SizeFloat)

Converts orthographic view's area into a view distance value.

public float OrthographicViewAreaToDistance(SizeFloat ViewArea)

Parameters

ViewArea SizeFloat
param ViewArea M:LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.OrthographicViewAreaToDistance(LightningChartLib.WinForms.Charting.SizeFloat)

Returns

float

Orthographic view's area as view distance.

OrthographicViewAreaToDistance(SizeFloat, double, double)

Converts orthographic view's area into a view distance value.

public static float OrthographicViewAreaToDistance(SizeFloat viewArea, double aspectRatio, double fov)

Parameters

viewArea SizeFloat

Orthographic view area.

aspectRatio double

Aspect ratio.

fov double

Field of view, in radians.

Returns

float

Orthographic view's area as view distance.

SetEulerAngles(double, double, double)

Same as setting RotationX, RotationY and RotationZ properties separately. Allows easier setting of the properties and is faster than separate setting of the properties.

public void SetEulerAngles(double X, double Y, double Z)

Parameters

X double
param X M:LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.SetEulerAngles(System.Double,System.Double,System.Double)
Y double
param Y M:LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.SetEulerAngles(System.Double,System.Double,System.Double)
Z double
param Z M:LightningChartLib.WinForms.Charting.Views.View3D.Camera3D.SetEulerAngles(System.Double,System.Double,System.Double)

Remarks

Note that using this the property change events come before actual view changes.

SetFarClipDistance(float)

Setter of the far clipping distance for the 3D projection. This is an advanced setting that is not supported in normal use and should not be modified.

public void SetFarClipDistance(float farClipDist)

Parameters

farClipDist float

New far clipping distance.

SetNearClipDistance(float)

Setter of the near clipping distance for the 3D projection. This is an advanced setting that is not supported in normal use and should not be modified.

public void SetNearClipDistance(float nearClipDist)

Parameters

nearClipDist float

New near clipping distance.

SetPredefinedCamera(PredefinedCamera)

Sets camera orientation angles to values based given predefined orientation setting.

public void SetPredefinedCamera(PredefinedCamera predefinedCamera)

Parameters

predefinedCamera PredefinedCamera

Predefined camera orientation setting to be used.

ToString()

Convert class description to string

public override string ToString()

Returns

string

String