Class CameraLibrary
- Namespace
- NominalSystems.Classes
- Assembly
- NominalSystems.Classes.dll
[Nominal] A library for handling the mathematical functions for the cameras and lenses used in the simulation. These can calculate other properties such as the field of view, aperture f-stops, and depth of field.
public static class CameraLibrary
- Inheritance
-
CameraLibrary
Methods
GetApertureFStops(double, double)
Calculates the aperture F-stop parameter value based on the aperture size and the focal length.
public static double GetApertureFStops(double focalLength, double aperture)
Parameters
Returns
- double
[-] The F-stop value for the aperture
GetDepthOfField(double, double, double, double)
Calculates the depth of field based on the focal length, circle of confusion, focal distance, and hyper-focal distance. This is the range of distances that will be accurately focused on.
public static double GetDepthOfField(double focalLength, double circleOfConfusion, double focalDistance, double hyperFocalDistance)
Parameters
focalLength
double[mm] The focal length
circleOfConfusion
double[mm] The circle of confusion parameter
focalDistance
double[mm] The focal distance
hyperFocalDistance
double[mm] The hyper-focal distance
Returns
- double
[m] The depth of field value that can be focused on
GetFarDepthOfField(double, double, double, double)
Calculates the far depth of field based on the focal length, circle of confusion, focal distance, and hyper-focal distance. This is the furthest distance that will be focused on.
public static double GetFarDepthOfField(double focalLength, double circleOfConfusion, double focalDistance, double hyperFocalDistance)
Parameters
focalLength
double[mm] The focal length
circleOfConfusion
double[mm] The circle of confusion parameter
focalDistance
double[mm] The focal distance
hyperFocalDistance
double[mm] The hyper-focal distance
Returns
- double
[m] The far DOF distance
GetFieldOfView(double, double, Vector2)
Calculates the Field of View of a camera given the pixel pitch, focal length, and resolution.
public static double GetFieldOfView(double pixelPitch, double focalLength, Vector2 resolution)
Parameters
pixelPitch
double[mm] The pixel pitch
focalLength
double[mm] The focal length
resolution
Vector2[px] The resolution of the camera
Returns
- double
[deg] The field of view of the camera
GetFieldOfViewXY(double, double, Vector2)
Calculates the size of the field of view in the X and Y directions.
public static Vector2 GetFieldOfViewXY(double pixelPitch, double focalLength, Vector2 resolution)
Parameters
pixelPitch
double[mm] The pixel pitch
focalLength
double[mm] The focal length
resolution
Vector2[px] The resolution of the camera
Returns
- Vector2
[deg] The field of view in each direction
GetGroundSampleDistance(double, double, double)
Calculates the Ground Sample Distance (GSD) based on the altitude, pixel size, and focal length of a Camera.
public static double GetGroundSampleDistance(double altitude, double pixelSize, double focalLength)
Parameters
altitude
double[m] The Altitude of the Camera
pixelSize
double[mm] The size of a pixel in the Camera (typically equal to Pixel Pitch)
focalLength
double[mm] The Focal Length of the Camera
Returns
- double
[m] The GSD of the Camera in meters
GetHyperFocalDistance(double, double, double)
Calculates the hyper-focal distance based on the focal length, aperture f-stops, and circle of confusion.
public static double GetHyperFocalDistance(double focalLength, double apertureFStops, double circleOfConfusion)
Parameters
focalLength
double[mm] The focal length
apertureFStops
double[-] The F-stops of the aperture
circleOfConfusion
double[mm] The circle of confusion point
Returns
- double
[m] The hyper-focal distance
GetNearDepthOfField(double, double, double, double)
Calculates the near depth of field based on the focal length, circle of confusion, focal distance, and hyper-focal distance. This is the closest distance that will be focused on.
public static double GetNearDepthOfField(double focalLength, double circleOfConfusion, double focalDistance, double hyperFocalDistance)
Parameters
focalLength
double[mm] The focal length
circleOfConfusion
double[mm] The circle of confusion parameter
focalDistance
double[mm] The focal distance
hyperFocalDistance
double[mm] The hyper-focal distance
Returns
- double
[m] The near DOF distance
GetSunPhaseAngle(Vector3, Vector3, Vector3)
Calculates the Sun Phase Angle based on the world position of three objects
public static double GetSunPhaseAngle(Vector3 sourcePosition, Vector3 observerPosition, Vector3 targetPosition)
Parameters
sourcePosition
Vector3The world space position of the light source
observerPosition
Vector3The world space position of the object observing the Target
targetPosition
Vector3The world space position of the observed target
Returns
- double
[Deg] The Sun Phase Angle in Degrees