@gov.nasa.jpl.honeycomb/cahvore-utilities
v0.0.6
Published
Set of cahvore transformation functions ported from RSVP C++ implementations.
Readme
CAHVORE Transformation Utilities
Set of functions for converting a 2D camera coordinate to a camera ray ported from the original C implementation (JPL internal only).
Original implementation by Todd Litwin.
See also https://github.com/NASA-AMMOS/CameraModelUtilsJS/tree/main/src/cahvore-utilities
API
Functions
cmod_cahvore_2d_to_3d_general
cmod_cahvore_2d_to_3d_general(
pos2 : Vector2,
linearity : Number,
c : Vector3,
a : Vector3,
h : Vector3,
v : Vector3,
o : Vector3,
r : Vector3,
e : Vector3,
pos3 : Vector3 = null,
uvec3 : Vector3 = null
) : { pos3, uvec3 }Algorithm by Todd Litwin Partially ported from cmod_cahvore.
This function projects a 2D image point out into 3D using the camera model parameters provided. Note this port does not calculate partial derivatives of pos3 to pos2 or uvec3 to uvec2
cmod_cahv_2d_to_3d
cmod_cahv_2d_to_3d(
pos2 : Vector2,
c : Vector3,
a : Vector3,
h : Vector3,
v : Vector3,
pos3 : Vector3 = null,
uvec3 : Vector3 = null
) : { pos3, uvec3 }Algorithm by Todd Litwin Partially ported from cmod_cahv.
Uses the Yakimovsky & Cunningham camera model known locally as CAHV This function projects a 2D image point out into 3D using the camera model parameters provided. Note it does not output the partial derivative of uvec3 to pos2
cmod_cahvor_2d_to_3d
cmod_cahvor_2d_to_3d(
pos2 : Vector2,
c : Vector3,
a : Vector3,
h : Vector3,
v : Vector3,
o : Vector3,
r : Vector3,
pos3 : Vector3 = null,
uvec3 : Vector3 = null
) : { pos3, uvec3 }Algorithm by Todd Litwin Partially ported from cmod_cahvor.
Uses the Yakimovsky & Cunningham camera model known locally as CAHVOR This function projects a 2D image point out into 3D using the camera model parameters provided. Note it does not output the partial derivative of uvec3 to pos2
getRay
getRay( model : Object, sample : Vector2, outRay : Ray ) : voidReturns the outgoing ray from the camera model given an image sample coordinate. Internally calls the appropriate camera model to ray function.
getLinearFrustumInfo
getLinearFrustumInfo( model : Object ) : LinearFrustumInfoFunction takes a camera model and returns an object describing the resulting local camera frame and minimum and maximum frustums.
frameBoundsToProjectionMatrix
frameBoundsToProjectionMatrix(
frameBounds : FrameBounds,
near : Number,
far : Number,
target : Matrix4
) : targetFunction that takes a frame bounds description of a bounding box 1m out in the camera frame and sets the "target" matrix to an off axis projection matrix with the apex at the current origin.
FrameBounds
left
left : Numberright
right : Numbertop
top : Numberbottom
bottom : NumberLinearFrustumInfo
frame
frame : Matrix4The transformation frame of the linear camera model frustums. Equivalent to "Camera.matrix".
minFrameBounds
minFrameBounds : FrameBoundsThe bounds that are completely encompassed the cahvore model at the minimal extents 1m out in the given frame.
maxFrameBounds
maxFrameBounds : FrameBoundsThe bounds that completely encompass the cahvore model at the maximum extents 1m out in the given frame.
