diff --git a/functions/apply.html b/functions/apply.html index 961c045..f75e0bf 100644 --- a/functions/apply.html +++ b/functions/apply.html @@ -9,4 +9,4 @@

Example: Scale a vector by a scalar

apply((a, b) => a + (b - a) / 2, [1, 2, 3], [4, 5, 6]); // [2.5, 3.5, 4.5]
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/cross.html b/functions/cross.html index 9d86a84..4bb0f44 100644 --- a/functions/cross.html +++ b/functions/cross.html @@ -2,4 +2,4 @@

Parameters

Returns Vector

The resulting vector.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/degrees.html b/functions/degrees.html index 504349e..dc44a63 100644 --- a/functions/degrees.html +++ b/functions/degrees.html @@ -2,4 +2,4 @@

Parameters

Returns number

Angle in degrees.

See

https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/deg.m

-
\ No newline at end of file +
\ No newline at end of file diff --git a/functions/delta.html b/functions/delta.html index ff95437..4d4a4d8 100644 --- a/functions/delta.html +++ b/functions/delta.html @@ -8,4 +8,4 @@
  • frame: Matrix = Z_AXIS_NORTH

    Coordinate frame in which the vectors are decomposed.

  • Returns Vector

    Position vector in meters from A to B, decomposed in E.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/n_EA_E_and_n_EB_E2p_AB_E.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/destination.html b/functions/destination.html index 5ace38f..c2200ab 100644 --- a/functions/destination.html +++ b/functions/destination.html @@ -7,4 +7,4 @@

    Returns [to: Vector, toDepth: number]

    An n-vector of position B, and depth of position B in meters, relative to the ellipsoid.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/n_EA_E_and_p_AB_E2n_EB_E.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/dot.html b/functions/dot.html index dd7646d..672f6d8 100644 --- a/functions/dot.html +++ b/functions/dot.html @@ -2,4 +2,4 @@

    Parameters

    Returns number

    The resulting scalar.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/eulerXYZToRotationMatrix.html b/functions/eulerXYZToRotationMatrix.html index c176c47..a42b71f 100644 --- a/functions/eulerXYZToRotationMatrix.html +++ b/functions/eulerXYZToRotationMatrix.html @@ -4,4 +4,4 @@
  • z: number

    Rotation around the z-axis in radians.

  • Returns Matrix

    A rotation matrix.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/xyz2R.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/eulerZYXToRotationMatrix.html b/functions/eulerZYXToRotationMatrix.html index 2ec3530..876e623 100644 --- a/functions/eulerZYXToRotationMatrix.html +++ b/functions/eulerZYXToRotationMatrix.html @@ -4,4 +4,4 @@
  • x: number

    Rotation around the x-axis in radians.

  • Returns Matrix

    A rotation matrix.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/zyx2R.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/fromECEF.html b/functions/fromECEF.html index d2c3636..9408c7c 100644 --- a/functions/fromECEF.html +++ b/functions/fromECEF.html @@ -5,4 +5,4 @@

    Returns [vector: Vector, depth: number]

    Representation of position B, decomposed in E, and depth in meters of system B relative to the ellipsoid.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/p_EB_E2n_EB_E.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/fromGeodeticCoordinates.html b/functions/fromGeodeticCoordinates.html index dab3be1..df4d792 100644 --- a/functions/fromGeodeticCoordinates.html +++ b/functions/fromGeodeticCoordinates.html @@ -4,4 +4,4 @@
  • frame: Matrix = Z_AXIS_NORTH

    Coordinate frame in which the n-vector is decomposed.

  • Returns Vector

    An n-vector.

    See

    https://github.com/FFI-no/n-vector/blob/82d749a67cc9f332f48c51aa969cdc277b4199f2/nvector/lat_long2n_E.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/fromRotationMatrix.html b/functions/fromRotationMatrix.html index 8693200..305c52e 100644 --- a/functions/fromRotationMatrix.html +++ b/functions/fromRotationMatrix.html @@ -5,4 +5,4 @@
  • https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/R_EL2n_E.m
  • https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/R_EN2n_E.m
  • -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/multiply.html b/functions/multiply.html index e25fa92..8d3c9fb 100644 --- a/functions/multiply.html +++ b/functions/multiply.html @@ -2,4 +2,4 @@

    Parameters

    Returns Matrix

    The resulting matrix.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/norm.html b/functions/norm.html index 696ed22..ac4ede2 100644 --- a/functions/norm.html +++ b/functions/norm.html @@ -1,4 +1,4 @@ norm | nvector-geodesy

    Function norm

    • Finds the Euclidean norm of a vector.

      Parameters

      Returns number

      The Euclidean norm.

      -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/normalize.html b/functions/normalize.html index 9ce7550..ebfb38f 100644 --- a/functions/normalize.html +++ b/functions/normalize.html @@ -2,4 +2,4 @@

    Parameters

    Returns Vector

    A normalized vector.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/unit.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/radians.html b/functions/radians.html index 8aaf6c6..6f6aa3b 100644 --- a/functions/radians.html +++ b/functions/radians.html @@ -2,4 +2,4 @@

    Parameters

    Returns number

    Angle in radians.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/rad.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/rotationMatrixToEulerXYZ.html b/functions/rotationMatrixToEulerXYZ.html index 7074144..884e164 100644 --- a/functions/rotationMatrixToEulerXYZ.html +++ b/functions/rotationMatrixToEulerXYZ.html @@ -2,4 +2,4 @@

    Parameters

    Returns Vector

    The Euler angles in XYZ order.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/R2xyz.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/rotationMatrixToEulerZYX.html b/functions/rotationMatrixToEulerZYX.html index 0bd24f9..1e64769 100644 --- a/functions/rotationMatrixToEulerZYX.html +++ b/functions/rotationMatrixToEulerZYX.html @@ -2,4 +2,4 @@

    Parameters

    Returns Vector

    The Euler angles in ZYX order.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/R2zyx.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/sphere.html b/functions/sphere.html index c7d37c3..6ac935d 100644 --- a/functions/sphere.html +++ b/functions/sphere.html @@ -1,4 +1,4 @@ sphere | nvector-geodesy

    Function sphere

    • Create a spherical ellipsoid with the given radius.

      Parameters

      • radius: number

        A radius in meters.

      Returns Ellipsoid

      A spherical ellipsoid.

      -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/toECEF.html b/functions/toECEF.html index c430311..0cae602 100644 --- a/functions/toECEF.html +++ b/functions/toECEF.html @@ -5,4 +5,4 @@
  • frame: Matrix = Z_AXIS_NORTH

    Coordinate frame in which the n-vector is decomposed.

  • Returns Vector

    An ECEF position vector.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/n_EB_E2p_EB_E.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/toGeodeticCoordinates.html b/functions/toGeodeticCoordinates.html index 52823dc..46f1173 100644 --- a/functions/toGeodeticCoordinates.html +++ b/functions/toGeodeticCoordinates.html @@ -3,4 +3,4 @@
  • frame: Matrix = Z_AXIS_NORTH

    Coordinate frame in which the n-vector is decomposed.

  • Returns [latitude: number, longitude: number]

    Geodetic latitude and longitude in radians.

    See

    https://github.com/FFI-no/n-vector/blob/82d749a67cc9f332f48c51aa969cdc277b4199f2/nvector/n_E2lat_long.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/toRotationMatrix.html b/functions/toRotationMatrix.html index a99d3a8..f7253a1 100644 --- a/functions/toRotationMatrix.html +++ b/functions/toRotationMatrix.html @@ -3,4 +3,4 @@
  • frame: Matrix = Z_AXIS_NORTH

    Coordinate frame in which the n-vector is decomposed.

  • Returns Matrix

    A rotation matrix.

    See

    https://github.com/FFI-no/n-vector/blob/82d749a67cc9f332f48c51aa969cdc277b4199f2/nvector/n_E2R_EN.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/toRotationMatrixUsingWanderAzimuth.html b/functions/toRotationMatrixUsingWanderAzimuth.html index 1127213..c0ab7b1 100644 --- a/functions/toRotationMatrixUsingWanderAzimuth.html +++ b/functions/toRotationMatrixUsingWanderAzimuth.html @@ -4,4 +4,4 @@
  • frame: Matrix = Z_AXIS_NORTH

    Coordinate frame in which the n-vector is decomposed.

  • Returns Matrix

    A rotation matrix.

    See

    https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/n_E_and_wa2R_EL.m

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/transform.html b/functions/transform.html index b6b9e5c..f315d86 100644 --- a/functions/transform.html +++ b/functions/transform.html @@ -2,4 +2,4 @@

    Parameters

    Returns Vector

    The transformed vector.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/functions/transpose.html b/functions/transpose.html index 1c10ac6..79de938 100644 --- a/functions/transpose.html +++ b/functions/transpose.html @@ -1,4 +1,4 @@ transpose | nvector-geodesy

    Function transpose

    \ No newline at end of file +
    \ No newline at end of file diff --git a/index.html b/index.html index 127be9c..ba8b2c7 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ interpolated position at time ti.

    https://www.ffi.no/en/research/n-vector/#example_6

    -
    import {
    apply,
    degrees,
    fromGeodeticCoordinates,
    normalize,
    radians,
    toGeodeticCoordinates,
    } from "nvector-geodesy";
    import { expect, test } from "vitest";

    /**
    * Example 6: Interpolated position
    *
    * Given the position of B at time t(0) and t(1). Find an interpolated position
    * at time t(i).
    *
    * @see https://www.ffi.no/en/research/n-vector/#example_6
    */
    test("Example 6", () => {
    // PROBLEM:

    // Given the position of B at time t0 and t1, pt0 and pt1:
    const t0 = 10;
    const t1 = 20;
    const ti = 16;
    const pt0 = fromGeodeticCoordinates(radians(89.9), radians(-150));
    const pt1 = fromGeodeticCoordinates(radians(89.9), radians(150));

    // Find an interpolated position at time ti, pti. All positions are given as
    // n-vectors.

    // SOLUTION:

    // Standard interpolation can be used directly with n-vector:
    const pti = normalize(
    apply((pt0, pt1) => pt0 + ((ti - t0) * (pt1 - pt0)) / (t1 - t0), pt0, pt1),
    );

    // Use human-friendly outputs:
    const [lat, lon] = toGeodeticCoordinates(pti);

    expect(degrees(lat)).toBeCloseTo(89.91282199988446, 12);
    expect(degrees(lon)).toBeCloseTo(173.4132244463705, 12);
    }); +
    import {
    apply,
    degrees,
    fromGeodeticCoordinates,
    normalize,
    radians,
    toGeodeticCoordinates,
    } from "nvector-geodesy";
    import { expect, test } from "vitest";

    /**
    * Example 6: Interpolated position
    *
    * Given the position of B at time t(0) and t(1). Find an interpolated position
    * at time t(i).
    *
    * @see https://www.ffi.no/en/research/n-vector/#example_6
    */
    test("Example 6", () => {
    // PROBLEM:

    // Given the position of B at time t0 and t1, pt0 and pt1:
    const t0 = 10,
    t1 = 20,
    ti = 16;
    const pt0 = fromGeodeticCoordinates(radians(89.9), radians(-150));
    const pt1 = fromGeodeticCoordinates(radians(89.9), radians(150));

    // Find an interpolated position at time ti, pti. All positions are given as
    // n-vectors.

    // SOLUTION:

    // Standard interpolation can be used directly with n-vectors:
    const pti = normalize(
    apply((pt0, pt1) => pt0 + ((ti - t0) * (pt1 - pt0)) / (t1 - t0), pt0, pt1),
    );

    // Use human-friendly outputs:
    const [lat, lon] = toGeodeticCoordinates(pti);

    expect(degrees(lat)).toBeCloseTo(89.91282199988446, 12);
    expect(degrees(lon)).toBeCloseTo(173.4132244463705, 12);
    });

    Example 7: Mean position/center

    Illustration of example 7

    diff --git a/types/Ellipsoid.html b/types/Ellipsoid.html index b9f282c..bbf0b67 100644 --- a/types/Ellipsoid.html +++ b/types/Ellipsoid.html @@ -2,4 +2,4 @@

    Type declaration

    • a: number

      The semi-major axis of the ellipsoid in meters.

    • b: number

      The semi-minor axis of the ellipsoid in meters.

    • f: number

      The flattening of the ellipsoid.

      -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/types/Matrix.html b/types/Matrix.html index cf84e64..513cef1 100644 --- a/types/Matrix.html +++ b/types/Matrix.html @@ -1,2 +1,2 @@ Matrix | nvector-geodesy

    Type alias Matrix

    Matrix: [[n11: number, n12: number, n13: number], [n21: number, n22: number, n23: number], [n31: number, n32: number, n33: number]]

    A 3x3 matrix.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/types/Vector.html b/types/Vector.html index 9ba0175..b460912 100644 --- a/types/Vector.html +++ b/types/Vector.html @@ -1,2 +1,2 @@ Vector | nvector-geodesy

    Type alias Vector

    Vector: [x: number, y: number, z: number]

    A 3D vector.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/variables/GRS_80.html b/variables/GRS_80.html index 763a5e5..0aac67f 100644 --- a/variables/GRS_80.html +++ b/variables/GRS_80.html @@ -1,3 +1,3 @@ GRS_80 | nvector-geodesy
    \ No newline at end of file +
    \ No newline at end of file diff --git a/variables/WGS_72.html b/variables/WGS_72.html index f2d6c99..e65945e 100644 --- a/variables/WGS_72.html +++ b/variables/WGS_72.html @@ -1,3 +1,3 @@ WGS_72 | nvector-geodesy
    \ No newline at end of file +
    \ No newline at end of file diff --git a/variables/WGS_84.html b/variables/WGS_84.html index 3805e52..c2f94e3 100644 --- a/variables/WGS_84.html +++ b/variables/WGS_84.html @@ -1,3 +1,3 @@ WGS_84 | nvector-geodesy
    \ No newline at end of file +
    \ No newline at end of file diff --git a/variables/X_AXIS_NORTH.html b/variables/X_AXIS_NORTH.html index 146c571..98f1a3a 100644 --- a/variables/X_AXIS_NORTH.html +++ b/variables/X_AXIS_NORTH.html @@ -7,4 +7,4 @@ orientation. In this manner, the axes of E is chosen to correspond with the axes of N and B.

    \ No newline at end of file +
    \ No newline at end of file diff --git a/variables/Z_AXIS_NORTH.html b/variables/Z_AXIS_NORTH.html index bda4549..0f8540a 100644 --- a/variables/Z_AXIS_NORTH.html +++ b/variables/Z_AXIS_NORTH.html @@ -3,4 +3,4 @@

    The z-axis points to the North Pole and x-axis points to the point where latitude = longitude = 0. This choice is very common in many fields.

    \ No newline at end of file +
    \ No newline at end of file