All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.cesium.Cartesian4.kt Maven / Gradle / Ivy

There is a newer version: 1.90.0-10
Show newest version
// Automatically generated - do not modify!

@file:Suppress(
    "EXTERNAL_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER",
)

package cesium

/**
 * A 4D Cartesian point.
 * @see Online Documentation
 *
 * @constructor
 * @property [x] The X component.
 *   Default value - `0.0`
 * @property [y] The Y component.
 *   Default value - `0.0`
 * @property [z] The Z component.
 *   Default value - `0.0`
 * @property [w] The W component.
 *   Default value - `0.0`
 * @see Online Documentation
 */
@JsName("\$cesium__Cartesian4")
external class Cartesian4(
    var x: Double = definedExternally,
    var y: Double = definedExternally,
    var z: Double = definedExternally,
    var w: Double = definedExternally,
) {
    /**
     * Duplicates this Cartesian4 instance.
     * @param [result] The object onto which to store the result.
     * @return The modified result parameter or a new Cartesian4 instance if one was not provided.
     * @see Online Documentation
     */
    fun clone(result: Cartesian4? = definedExternally): Cartesian4

    /**
     * Compares this Cartesian against the provided Cartesian componentwise and returns
     * `true` if they pass an absolute or relative tolerance test,
     * `false` otherwise.
     * @param [right] The right hand side Cartesian.
     * @param [relativeEpsilon] The relative epsilon tolerance to use for equality testing.
     *   Default value - `0`
     * @param [absoluteEpsilon] The absolute epsilon tolerance to use for equality testing.
     *   Default value - [relativeEpsilon]
     * @return `true` if they are within the provided epsilon, `false` otherwise.
     * @see Online Documentation
     */
    fun equalsEpsilon(
        right: Cartesian4? = definedExternally,
        relativeEpsilon: Double? = definedExternally,
        absoluteEpsilon: Double? = definedExternally,
    ): Boolean

    companion object : Packable {
        /**
         * Creates a Cartesian4 instance from x, y, z and w coordinates.
         * @param [x] The x coordinate.
         * @param [y] The y coordinate.
         * @param [z] The z coordinate.
         * @param [w] The w coordinate.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter or a new Cartesian4 instance if one was not provided.
         * @see Online Documentation
         */
        fun fromElements(
            x: Double,
            y: Double,
            z: Double,
            w: Double,
            result: Cartesian4? = definedExternally,
        ): Cartesian4

        /**
         * Creates a Cartesian4 instance from a [Color]. `red`, `green`, `blue`,
         * and `alpha` map to `x`, `y`, `z`, and `w`, respectively.
         * @param [color] The source color.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter or a new Cartesian4 instance if one was not provided.
         * @see Online Documentation
         */
        fun fromColor(
            color: Color,
            result: Cartesian4? = definedExternally,
        ): Cartesian4

        /**
         * Duplicates a Cartesian4 instance.
         * @param [cartesian] The Cartesian to duplicate.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
         * @see Online Documentation
         */
        fun clone(
            cartesian: Cartesian4,
            result: Cartesian4? = definedExternally,
        ): Cartesian4

        /**
         * The number of elements used to pack the object into an array.
         * @see Online Documentation
         */
        override val packedLength: Int

        /**
         * Stores the provided instance into the provided array.
         * @param [value] The value to pack.
         * @param [array] The array to pack into.
         * @param [startingIndex] The index into the array at which to start packing the elements.
         *   Default value - `0`
         * @return The array that was packed into
         * @see Online Documentation
         */
        override fun pack(
            value: Cartesian4,
            array: Array,
            startingIndex: Int?,
        ): Array

        /**
         * Retrieves an instance from a packed array.
         * @param [array] The packed array.
         * @param [startingIndex] The starting index of the element to be unpacked.
         *   Default value - `0`
         * @param [result] The object into which to store the result.
         * @return The modified result parameter or a new Cartesian4 instance if one was not provided.
         * @see Online Documentation
         */
        override fun unpack(
            array: Array,
            startingIndex: Int?,
            result: Cartesian4?,
        ): Cartesian4

        /**
         * Flattens an array of Cartesian4s into and array of components.
         * @param [array] The array of cartesians to pack.
         * @param [result] The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a [DeveloperError] will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
         * @return The packed array.
         * @see Online Documentation
         */
        fun packArray(
            array: Array,
            result: Array? = definedExternally,
        ): Array

        /**
         * Unpacks an array of cartesian components into and array of Cartesian4s.
         * @param [array] The array of components to unpack.
         * @param [result] The array onto which to store the result.
         * @return The unpacked array.
         * @see Online Documentation
         */
        fun unpackArray(
            array: Array,
            result: Array? = definedExternally,
        ): Array

        /**
         * Creates a Cartesian4 from four consecutive elements in an array.
         * ```
         * // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0)
         * var v = [1.0, 2.0, 3.0, 4.0];
         * var p = Cartesian4.fromArray(v);
         *
         * // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array
         * var v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0];
         * var p2 = Cartesian4.fromArray(v2, 2);
         * ```
         * @param [array] The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
         * @param [startingIndex] The offset into the array of the first element, which corresponds to the x component.
         *   Default value - `0`
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter or a new Cartesian4 instance if one was not provided.
         * @see Online Documentation
         */
        fun fromArray(
            array: Array,
            startingIndex: Int? = definedExternally,
            result: Cartesian4? = definedExternally,
        ): Cartesian4

        /**
         * Computes the value of the maximum component for the supplied Cartesian.
         * @param [cartesian] The cartesian to use.
         * @return The value of the maximum component.
         * @see Online Documentation
         */
        fun maximumComponent(cartesian: Cartesian4): Double

        /**
         * Computes the value of the minimum component for the supplied Cartesian.
         * @param [cartesian] The cartesian to use.
         * @return The value of the minimum component.
         * @see Online Documentation
         */
        fun minimumComponent(cartesian: Cartesian4): Double

        /**
         * Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
         * @param [first] A cartesian to compare.
         * @param [second] A cartesian to compare.
         * @param [result] The object into which to store the result.
         * @return A cartesian with the minimum components.
         * @see Online Documentation
         */
        fun minimumByComponent(
            first: Cartesian4,
            second: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
         * @param [first] A cartesian to compare.
         * @param [second] A cartesian to compare.
         * @param [result] The object into which to store the result.
         * @return A cartesian with the maximum components.
         * @see Online Documentation
         */
        fun maximumByComponent(
            first: Cartesian4,
            second: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the provided Cartesian's squared magnitude.
         * @param [cartesian] The Cartesian instance whose squared magnitude is to be computed.
         * @return The squared magnitude.
         * @see Online Documentation
         */
        fun magnitudeSquared(cartesian: Cartesian4): Double

        /**
         * Computes the Cartesian's magnitude (length).
         * @param [cartesian] The Cartesian instance whose magnitude is to be computed.
         * @return The magnitude.
         * @see Online Documentation
         */
        fun magnitude(cartesian: Cartesian4): Double

        /**
         * Computes the 4-space distance between two points.
         * ```
         * // Returns 1.0
         * var d = Cartesian4.distance(
         *   new Cartesian4(1.0, 0.0, 0.0, 0.0),
         *   new Cartesian4(2.0, 0.0, 0.0, 0.0));
         * ```
         * @param [left] The first point to compute the distance from.
         * @param [right] The second point to compute the distance to.
         * @return The distance between two points.
         * @see Online Documentation
         */
        fun distance(
            left: Cartesian4,
            right: Cartesian4,
        ): Double

        /**
         * Computes the squared distance between two points.  Comparing squared distances
         * using this function is more efficient than comparing distances using [Cartesian4.distance].
         * ```
         * // Returns 4.0, not 2.0
         * var d = Cartesian4.distance(
         *   new Cartesian4(1.0, 0.0, 0.0, 0.0),
         *   new Cartesian4(3.0, 0.0, 0.0, 0.0));
         * ```
         * @param [left] The first point to compute the distance from.
         * @param [right] The second point to compute the distance to.
         * @return The distance between two points.
         * @see Online Documentation
         */
        fun distanceSquared(
            left: Cartesian4,
            right: Cartesian4,
        ): Double

        /**
         * Computes the normalized form of the supplied Cartesian.
         * @param [cartesian] The Cartesian to be normalized.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun normalize(
            cartesian: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the dot (scalar) product of two Cartesians.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @return The dot product.
         * @see Online Documentation
         */
        fun dot(
            left: Cartesian4,
            right: Cartesian4,
        ): Double

        /**
         * Computes the componentwise product of two Cartesians.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun multiplyComponents(
            left: Cartesian4,
            right: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the componentwise quotient of two Cartesians.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun divideComponents(
            left: Cartesian4,
            right: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the componentwise sum of two Cartesians.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun add(
            left: Cartesian4,
            right: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the componentwise difference of two Cartesians.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun subtract(
            left: Cartesian4,
            right: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Multiplies the provided Cartesian componentwise by the provided scalar.
         * @param [cartesian] The Cartesian to be scaled.
         * @param [scalar] The scalar to multiply with.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun multiplyByScalar(
            cartesian: Cartesian4,
            scalar: Double,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Divides the provided Cartesian componentwise by the provided scalar.
         * @param [cartesian] The Cartesian to be divided.
         * @param [scalar] The scalar to divide by.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun divideByScalar(
            cartesian: Cartesian4,
            scalar: Double,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Negates the provided Cartesian.
         * @param [cartesian] The Cartesian to be negated.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun negate(
            cartesian: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the absolute value of the provided Cartesian.
         * @param [cartesian] The Cartesian whose absolute value is to be computed.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun abs(
            cartesian: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Computes the linear interpolation or extrapolation at t using the provided cartesians.
         * @param [start] The value corresponding to t at 0.0.
         * @param [end] The value corresponding to t at 1.0.
         * @param [t] The point along t at which to interpolate.
         * @param [result] The object onto which to store the result.
         * @return The modified result parameter.
         * @see Online Documentation
         */
        fun lerp(
            start: Cartesian4,
            end: Cartesian4,
            t: Double,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Returns the axis that is most orthogonal to the provided Cartesian.
         * @param [cartesian] The Cartesian on which to find the most orthogonal axis.
         * @param [result] The object onto which to store the result.
         * @return The most orthogonal axis.
         * @see Online Documentation
         */
        fun mostOrthogonalAxis(
            cartesian: Cartesian4,
            result: Cartesian4,
        ): Cartesian4

        /**
         * Compares the provided Cartesians componentwise and returns
         * `true` if they are equal, `false` otherwise.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @return `true` if left and right are equal, `false` otherwise.
         * @see Online Documentation
         */
        fun equals(
            left: Cartesian4? = definedExternally,
            right: Cartesian4? = definedExternally,
        ): Boolean

        /**
         * Compares the provided Cartesians componentwise and returns
         * `true` if they pass an absolute or relative tolerance test,
         * `false` otherwise.
         * @param [left] The first Cartesian.
         * @param [right] The second Cartesian.
         * @param [relativeEpsilon] The relative epsilon tolerance to use for equality testing.
         *   Default value - `0`
         * @param [absoluteEpsilon] The absolute epsilon tolerance to use for equality testing.
         *   Default value - [relativeEpsilon]
         * @return `true` if left and right are within the provided epsilon, `false` otherwise.
         * @see Online Documentation
         */
        fun equalsEpsilon(
            left: Cartesian4? = definedExternally,
            right: Cartesian4? = definedExternally,
            relativeEpsilon: Double? = definedExternally,
            absoluteEpsilon: Double? = definedExternally,
        ): Boolean

        /**
         * An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
         * @see Online Documentation
         */
        val ZERO: Cartesian4

        /**
         * An immutable Cartesian4 instance initialized to (1.0, 1.0, 1.0, 1.0).
         * @see Online Documentation
         */
        val ONE: Cartesian4

        /**
         * An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
         * @see Online Documentation
         */
        val UNIT_X: Cartesian4

        /**
         * An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
         * @see Online Documentation
         */
        val UNIT_Y: Cartesian4

        /**
         * An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
         * @see Online Documentation
         */
        val UNIT_Z: Cartesian4

        /**
         * An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
         * @see Online Documentation
         */
        val UNIT_W: Cartesian4

        /**
         * Packs an arbitrary floating point value to 4 values representable using uint8.
         * @param [value] A floating point number.
         * @param [result] The Cartesian4 that will contain the packed float.
         * @return A Cartesian4 representing the float packed to values in x, y, z, and w.
         * @see Online Documentation
         */
        fun packFloat(
            value: Double,
            result: Cartesian4? = definedExternally,
        ): Cartesian4
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy