Reformat parameter listings in docs.

This commit is contained in:
Bruce Mitchener 2018-10-08 09:42:02 +07:00 committed by Sébastien Crozet
parent e7610196b6
commit 0dbe69ddb7
3 changed files with 91 additions and 73 deletions

View File

@ -4,10 +4,11 @@ use aliases::{TVec2, TVec3, TVec4, TMat4};
/// Define a picking region.
///
/// # Parameters
/// * `center` - Specify the center of a picking region in window coordinates.
/// * `delta` - Specify the width and height, respectively, of the picking region in window coordinates.
/// * `viewport` - Rendering viewport
/// # Parameters:
///
/// * `center` - Specify the center of a picking region in window coordinates.
/// * `delta` - Specify the width and height, respectively, of the picking region in window coordinates.
/// * `viewport` - Rendering viewport.
pub fn pick_matrix<N: Real>(center: &TVec2<N>, delta: &TVec2<N>, viewport: &TVec4<N>) -> TMat4<N> {
let shift = TVec3::new(
(viewport.z - (center.x - viewport.x) * na::convert(2.0)) / delta.x,
@ -21,11 +22,12 @@ pub fn pick_matrix<N: Real>(center: &TVec2<N>, delta: &TVec2<N>, viewport: &TVec
/// Map the specified object coordinates `(obj.x, obj.y, obj.z)` into window coordinates using OpenGL near and far clip planes definition.
///
/// # Parameters
/// * `obj` - Specify the object coordinates.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// # Parameters:
///
/// * `obj` - Specify the object coordinates.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
///
/// # See also:
///
@ -42,11 +44,12 @@ pub fn project<N: Real>(obj: &TVec3<N>, model: &TMat4<N>, proj: &TMat4<N>, viewp
///
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// # Parameters
/// * `obj` - Specify the object coordinates.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// # Parameters:
///
/// * `obj` - Specify the object coordinates.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
///
/// # See also:
///
@ -64,11 +67,12 @@ pub fn project_no<N: Real>(obj: &TVec3<N>, model: &TMat4<N>, proj: &TMat4<N>, vi
///
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// # Parameters
/// * `obj` - Specify the object coordinates.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// # Parameters:
///
/// * `obj` - Specify the object coordinates.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
///
/// # See also:
///
@ -90,11 +94,12 @@ pub fn project_zo<N: Real>(obj: &TVec3<N>, model: &TMat4<N>, proj: &TMat4<N>, vi
/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using OpenGL near and far clip planes definition.
///
/// # Parameters
/// * `obj` - Specify the window coordinates to be mapped.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// # Parameters:
///
/// * `obj` - Specify the window coordinates to be mapped.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
///
/// # See also:
///
@ -111,11 +116,12 @@ pub fn unproject<N: Real>(win: &TVec3<N>, model: &TMat4<N>, proj: &TMat4<N>, vie
///
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// # Parameters
/// * `obj` - Specify the window coordinates to be mapped.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// # Parameters:
///
/// * `obj` - Specify the window coordinates to be mapped.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
///
/// # See also:
///
@ -142,11 +148,12 @@ pub fn unproject_no<N: Real>(win: &TVec3<N>, model: &TMat4<N>, proj: &TMat4<N>,
///
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// # Parameters
/// * `obj` - Specify the window coordinates to be mapped.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// # Parameters:
///
/// * `obj` - Specify the window coordinates to be mapped.
/// * `model` - Specifies the current modelview matrix.
/// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
///
/// # See also:
///

View File

@ -11,10 +11,11 @@ pub fn identity<N: Number, D: Dimension>() -> TMat<N, D, D>
/// Build a look at view matrix based on the right handedness.
///
/// # Parameters
/// * `eye` Position of the camera
/// * `center` Position where the camera is looking at
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`
/// # Parameters:
///
/// * `eye` Position of the camera.
/// * `center` Position where the camera is looking at.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`.
///
/// # See also:
///
@ -26,10 +27,11 @@ pub fn look_at<N: Real>(eye: &TVec3<N>, center: &TVec3<N>, up: &TVec3<N>) -> TMa
/// Build a left handed look at view matrix.
///
/// # Parameters
/// * `eye` Position of the camera
/// * `center` Position where the camera is looking at
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`
/// # Parameters:
///
/// * `eye` Position of the camera.
/// * `center` Position where the camera is looking at.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`.
///
/// # See also:
///
@ -41,10 +43,11 @@ pub fn look_at_lh<N: Real>(eye: &TVec3<N>, center: &TVec3<N>, up: &TVec3<N>) ->
/// Build a right handed look at view matrix.
///
/// # Parameters
/// * `eye` Position of the camera
/// * `center` Position where the camera is looking at
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`
/// # Parameters:
///
/// * `eye` Position of the camera.
/// * `center` Position where the camera is looking at.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`.
///
/// # See also:
///
@ -56,10 +59,11 @@ pub fn look_at_rh<N: Real>(eye: &TVec3<N>, center: &TVec3<N>, up: &TVec3<N>) ->
/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle and right-multiply it to `m`.
///
/// # Parameters
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// * `axis` Rotation axis, recommended to be normalized.
/// # Parameters:
///
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// * `axis` Rotation axis, recommended to be normalized.
///
/// # See also:
///
@ -74,9 +78,10 @@ pub fn rotate<N: Real>(m: &TMat4<N>, angle: N, axis: &TVec3<N>) -> TMat4<N> {
/// Builds a rotation 4 * 4 matrix around the X axis and right-multiply it to `m`.
///
/// # Parameters
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// # Parameters:
///
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
///
/// # See also:
///
@ -91,9 +96,10 @@ pub fn rotate_x<N: Real>(m: &TMat4<N>, angle: N) -> TMat4<N> {
/// Builds a rotation 4 * 4 matrix around the Y axis and right-multiply it to `m`.
///
/// # Parameters
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// # Parameters:
///
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
///
/// # See also:
///
@ -108,9 +114,10 @@ pub fn rotate_y<N: Real>(m: &TMat4<N>, angle: N) -> TMat4<N> {
/// Builds a rotation 4 * 4 matrix around the Z axis and right-multiply it to `m`.
///
/// # Parameters
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// # Parameters:
///
/// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
///
/// # See also:
///
@ -125,9 +132,10 @@ pub fn rotate_z<N: Real>(m: &TMat4<N>, angle: N) -> TMat4<N> {
/// Builds a scale 4 * 4 matrix created from 3 scalars and right-multiply it to `m`.
///
/// # Parameters
/// * `m` Input matrix multiplied by this scale matrix.
/// * `v` Ratio of scaling for each axis.
/// # Parameters:
///
/// * `m` Input matrix multiplied by this scale matrix.
/// * `v` Ratio of scaling for each axis.
///
/// # See also:
///
@ -142,9 +150,10 @@ pub fn scale<N: Number>(m: &TMat4<N>, v: &TVec3<N>) -> TMat4<N> {
/// Builds a translation 4 * 4 matrix created from a vector of 3 components and right-multiply it to `m`.
///
/// # Parameters
/// * `m` Input matrix multiplied by this translation matrix.
/// * `v` Coordinates of a translation vector.
/// # Parameters:
///
/// * `m` Input matrix multiplied by this translation matrix.
/// * `v` Coordinates of a translation vector.
///
/// # See also:
///

View File

@ -4,20 +4,22 @@ use aliases::{Qua, TMat4, TVec3};
/// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle.
///
/// # Parameters
/// * `m` - Input matrix multiplied by this rotation matrix.
/// * `angle` - Rotation angle expressed in radians.
/// * `axis` - Rotation axis, must be normalized.
/// # Parameters:
///
/// * `m` - Input matrix multiplied by this rotation matrix.
/// * `angle` - Rotation angle expressed in radians.
/// * `axis` - Rotation axis, must be normalized.
pub fn rotate_normalized_axis<N: Real>(m: &TMat4<N>, angle: N, axis: &TVec3<N>) -> TMat4<N> {
m * Rotation3::from_axis_angle(&Unit::new_unchecked(*axis), angle).to_homogeneous()
}
/// Rotates a quaternion from a vector of 3 components normalized axis and an angle.
///
/// # Parameters
/// * `q` - Source orientation
/// * `angle` - Angle expressed in radians.
/// * `axis` - Normalized axis of the rotation, must be normalized.
/// # Parameters:
///
/// * `q` - Source orientation.
/// * `angle` - Angle expressed in radians.
/// * `axis` - Normalized axis of the rotation, must be normalized.
pub fn quat_rotate_normalized_axis<N: Real>(q: &Qua<N>, angle: N, axis: &TVec3<N>) -> Qua<N> {
q * UnitQuaternion::from_axis_angle(&Unit::new_unchecked(*axis), angle).unwrap()
}