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. /// Define a picking region.
/// ///
/// # Parameters /// # 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. /// * `center` - Specify the center of a picking region in window coordinates.
/// * `viewport` - Rendering viewport /// * `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> { pub fn pick_matrix<N: Real>(center: &TVec2<N>, delta: &TVec2<N>, viewport: &TVec4<N>) -> TMat4<N> {
let shift = TVec3::new( let shift = TVec3::new(
(viewport.z - (center.x - viewport.x) * na::convert(2.0)) / delta.x, (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. /// Map the specified object coordinates `(obj.x, obj.y, obj.z)` into window coordinates using OpenGL near and far clip planes definition.
/// ///
/// # Parameters /// # Parameters:
/// * `obj` - Specify the object coordinates. ///
/// * `model` - Specifies the current modelview matrix. /// * `obj` - Specify the object coordinates.
/// * `proj` - Specifies the current projection matrix. /// * `model` - Specifies the current modelview matrix.
/// * `viewport` - Specifies the current viewport. /// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// ///
/// # See also: /// # 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) /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
/// ///
/// # Parameters /// # Parameters:
/// * `obj` - Specify the object coordinates. ///
/// * `model` - Specifies the current modelview matrix. /// * `obj` - Specify the object coordinates.
/// * `proj` - Specifies the current projection matrix. /// * `model` - Specifies the current modelview matrix.
/// * `viewport` - Specifies the current viewport. /// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// ///
/// # See also: /// # 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) /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// ///
/// # Parameters /// # Parameters:
/// * `obj` - Specify the object coordinates. ///
/// * `model` - Specifies the current modelview matrix. /// * `obj` - Specify the object coordinates.
/// * `proj` - Specifies the current projection matrix. /// * `model` - Specifies the current modelview matrix.
/// * `viewport` - Specifies the current viewport. /// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// ///
/// # See also: /// # 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. /// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using OpenGL near and far clip planes definition.
/// ///
/// # Parameters /// # Parameters:
/// * `obj` - Specify the window coordinates to be mapped. ///
/// * `model` - Specifies the current modelview matrix. /// * `obj` - Specify the window coordinates to be mapped.
/// * `proj` - Specifies the current projection matrix. /// * `model` - Specifies the current modelview matrix.
/// * `viewport` - Specifies the current viewport. /// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// ///
/// # See also: /// # 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) /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
/// ///
/// # Parameters /// # Parameters:
/// * `obj` - Specify the window coordinates to be mapped. ///
/// * `model` - Specifies the current modelview matrix. /// * `obj` - Specify the window coordinates to be mapped.
/// * `proj` - Specifies the current projection matrix. /// * `model` - Specifies the current modelview matrix.
/// * `viewport` - Specifies the current viewport. /// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// ///
/// # See also: /// # 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) /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// ///
/// # Parameters /// # Parameters:
/// * `obj` - Specify the window coordinates to be mapped. ///
/// * `model` - Specifies the current modelview matrix. /// * `obj` - Specify the window coordinates to be mapped.
/// * `proj` - Specifies the current projection matrix. /// * `model` - Specifies the current modelview matrix.
/// * `viewport` - Specifies the current viewport. /// * `proj` - Specifies the current projection matrix.
/// * `viewport` - Specifies the current viewport.
/// ///
/// # See also: /// # 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. /// Build a look at view matrix based on the right handedness.
/// ///
/// # Parameters /// # Parameters:
/// * `eye` Position of the camera ///
/// * `center` Position where the camera is looking at /// * `eye` Position of the camera.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)` /// * `center` Position where the camera is looking at.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`.
/// ///
/// # See also: /// # 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. /// Build a left handed look at view matrix.
/// ///
/// # Parameters /// # Parameters:
/// * `eye` Position of the camera ///
/// * `center` Position where the camera is looking at /// * `eye` Position of the camera.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)` /// * `center` Position where the camera is looking at.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`.
/// ///
/// # See also: /// # 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. /// Build a right handed look at view matrix.
/// ///
/// # Parameters /// # Parameters:
/// * `eye` Position of the camera ///
/// * `center` Position where the camera is looking at /// * `eye` Position of the camera.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)` /// * `center` Position where the camera is looking at.
/// * `u` Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)`.
/// ///
/// # See also: /// # 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`. /// Builds a rotation 4 * 4 matrix created from an axis vector and an angle and right-multiply it to `m`.
/// ///
/// # Parameters /// # Parameters:
/// * `m` Input matrix multiplied by this rotation matrix. ///
/// * `angle` Rotation angle expressed in radians. /// * `m` Input matrix multiplied by this rotation matrix.
/// * `axis` Rotation axis, recommended to be normalized. /// * `angle` Rotation angle expressed in radians.
/// * `axis` Rotation axis, recommended to be normalized.
/// ///
/// # See also: /// # 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`. /// Builds a rotation 4 * 4 matrix around the X axis and right-multiply it to `m`.
/// ///
/// # Parameters /// # Parameters:
/// * `m` Input matrix multiplied by this rotation matrix. ///
/// * `angle` Rotation angle expressed in radians. /// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// ///
/// # See also: /// # 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`. /// Builds a rotation 4 * 4 matrix around the Y axis and right-multiply it to `m`.
/// ///
/// # Parameters /// # Parameters:
/// * `m` Input matrix multiplied by this rotation matrix. ///
/// * `angle` Rotation angle expressed in radians. /// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// ///
/// # See also: /// # 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`. /// Builds a rotation 4 * 4 matrix around the Z axis and right-multiply it to `m`.
/// ///
/// # Parameters /// # Parameters:
/// * `m` Input matrix multiplied by this rotation matrix. ///
/// * `angle` Rotation angle expressed in radians. /// * `m` Input matrix multiplied by this rotation matrix.
/// * `angle` Rotation angle expressed in radians.
/// ///
/// # See also: /// # 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`. /// Builds a scale 4 * 4 matrix created from 3 scalars and right-multiply it to `m`.
/// ///
/// # Parameters /// # Parameters:
/// * `m` Input matrix multiplied by this scale matrix. ///
/// * `v` Ratio of scaling for each axis. /// * `m` Input matrix multiplied by this scale matrix.
/// * `v` Ratio of scaling for each axis.
/// ///
/// # See also: /// # 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`. /// Builds a translation 4 * 4 matrix created from a vector of 3 components and right-multiply it to `m`.
/// ///
/// # Parameters /// # Parameters:
/// * `m` Input matrix multiplied by this translation matrix. ///
/// * `v` Coordinates of a translation vector. /// * `m` Input matrix multiplied by this translation matrix.
/// * `v` Coordinates of a translation vector.
/// ///
/// # See also: /// # 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. /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle.
/// ///
/// # Parameters /// # Parameters:
/// * `m` - Input matrix multiplied by this rotation matrix. ///
/// * `angle` - Rotation angle expressed in radians. /// * `m` - Input matrix multiplied by this rotation matrix.
/// * `axis` - Rotation axis, must be normalized. /// * `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> { 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() 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. /// Rotates a quaternion from a vector of 3 components normalized axis and an angle.
/// ///
/// # Parameters /// # Parameters:
/// * `q` - Source orientation ///
/// * `angle` - Angle expressed in radians. /// * `q` - Source orientation.
/// * `axis` - Normalized axis of the rotation, must be normalized. /// * `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> { 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() q * UnitQuaternion::from_axis_angle(&Unit::new_unchecked(*axis), angle).unwrap()
} }