Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Cartesian2
    • Vector2

Index

Constructors

constructor

  • new Vector2(x?: number, y?: number): Vector2
  • Parameters

    • Optional x: number
    • Optional y: number

    Returns Vector2

Properties

x

x: number

The X component.

y

y: number

The Y component.

Static Readonly IDENTIFY

IDENTIFY: Cartesian2

An immutable Cartesian2 instance initialized to (1.0, 1.0).

Static Readonly UNIT_X

UNIT_X: Cartesian2

An immutable Cartesian2 instance initialized to (1.0, 0.0).

Static Readonly UNIT_Y

UNIT_Y: Cartesian2

An immutable Cartesian2 instance initialized to (0.0, 1.0).

Static Readonly ZERO

ZERO: Cartesian2

An immutable Cartesian2 instance initialized to (0.0, 0.0).

Static packedLength

packedLength: number

The number of elements used to pack the object into an array.

Methods

clone

  • clone(result?: Cartesian2): Cartesian2
  • Duplicates this Cartesian2 instance.

    Parameters

    • Optional result: Cartesian2

    Returns Cartesian2

    The modified result parameter or a new Cartesian2 instance if one was not provided.

equals

  • equals(right?: Cartesian2): boolean
  • Compares this Cartesian against the provided Cartesian componentwise and returns true if they are equal, false otherwise.

    Parameters

    • Optional right: Cartesian2

    Returns boolean

    true if they are equal, false otherwise.

equalsEpsilon

  • equalsEpsilon(right?: Cartesian2, relativeEpsilon?: number, absoluteEpsilon?: number): boolean
  • Compares this Cartesian against the provided Cartesian componentwise and returns true if they pass an absolute or relative tolerance test, false otherwise.

    Parameters

    • Optional right: Cartesian2
    • Optional relativeEpsilon: number
    • Optional absoluteEpsilon: number

    Returns boolean

    true if they are within the provided epsilon, false otherwise.

toString

  • toString(): string
  • Creates a string representing this Cartesian in the format '(x, y)'.

    Returns string

    A string representing the provided Cartesian in the format '(x, y)'.

Static abs

  • abs(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • Computes the absolute value of the provided Cartesian.

    Parameters

    • cartesian: Cartesian2

      The Cartesian whose absolute value is to be computed.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static add

  • add(left: Cartesian2, right: Cartesian2, result: Cartesian2): Cartesian2
  • Computes the componentwise sum of two Cartesians.

    Parameters

    • left: Cartesian2

      The first Cartesian.

    • right: Cartesian2

      The second Cartesian.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static angleBetween

  • angleBetween(left: Cartesian2, right: Cartesian2): number
  • Returns the angle, in radians, between the provided Cartesians.

    Parameters

    • left: Cartesian2

      The first Cartesian.

    • right: Cartesian2

      The second Cartesian.

    Returns number

    The angle between the Cartesians.

Static ceil

  • ceil(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • 向上取整

    Parameters

    • cartesian: Cartesian2
    • result: Cartesian2

    Returns Cartesian2

Static clone

  • clone(cartesian: Cartesian2, result?: Cartesian2): Cartesian2
  • Duplicates a Cartesian2 instance.

    Parameters

    • cartesian: Cartesian2

      The Cartesian to duplicate.

    • Optional result: Cartesian2

    Returns Cartesian2

    The modified result parameter or a new Cartesian2 instance if one was not provided. (Returns undefined if cartesian is undefined)

Static distance

  • distance(left: Cartesian2, right: Cartesian2): number
  • Computes the distance between two points.

    example

    // Returns 1.0 var d = Cesium.Cartesian2.distance(new Cesium.Cartesian2(1.0, 0.0), new Cesium.Cartesian2(2.0, 0.0));

    Parameters

    • left: Cartesian2

      The first point to compute the distance from.

    • right: Cartesian2

      The second point to compute the distance to.

    Returns number

    The distance between two points.

Static distanceSquared

  • distanceSquared(left: Cartesian2, right: Cartesian2): number
  • Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances using {@link Cartesian2#distance}.

    example

    // Returns 4.0, not 2.0 var d = Cesium.Cartesian2.distance(new Cesium.Cartesian2(1.0, 0.0), new Cesium.Cartesian2(3.0, 0.0));

    Parameters

    • left: Cartesian2

      The first point to compute the distance from.

    • right: Cartesian2

      The second point to compute the distance to.

    Returns number

    The distance between two points.

Static divideByScalar

  • divideByScalar(cartesian: Cartesian2, scalar: number, result: Cartesian2): Cartesian2
  • Divides the provided Cartesian componentwise by the provided scalar.

    Parameters

    • cartesian: Cartesian2

      The Cartesian to be divided.

    • scalar: number

      The scalar to divide by.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static divideComponents

  • divideComponents(left: Cartesian2, right: Cartesian2, result: Cartesian2): Cartesian2
  • Computes the componentwise quotient of two Cartesians.

    Parameters

    • left: Cartesian2

      The first Cartesian.

    • right: Cartesian2

      The second Cartesian.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static dot

  • dot(left: Cartesian2, right: Cartesian2): number
  • Computes the dot (scalar) product of two Cartesians.

    Parameters

    • left: Cartesian2

      The first Cartesian.

    • right: Cartesian2

      The second Cartesian.

    Returns number

    The dot product.

Static equals

  • equals(left?: Cartesian2, right?: Cartesian2): boolean
  • Compares the provided Cartesians componentwise and returns true if they are equal, false otherwise.

    Parameters

    • Optional left: Cartesian2
    • Optional right: Cartesian2

    Returns boolean

    true if left and right are equal, false otherwise.

Static equalsEpsilon

  • equalsEpsilon(left?: Cartesian2, right?: Cartesian2, relativeEpsilon?: number, absoluteEpsilon?: number): boolean
  • Compares the provided Cartesians componentwise and returns true if they pass an absolute or relative tolerance test, false otherwise.

    Parameters

    • Optional left: Cartesian2
    • Optional right: Cartesian2
    • Optional relativeEpsilon: number
    • Optional absoluteEpsilon: number

    Returns boolean

    true if left and right are within the provided epsilon, false otherwise.

Static floor

  • floor(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • 向下取整

    Parameters

    • cartesian: Cartesian2
    • result: Cartesian2

    Returns Cartesian2

Static fromArray

Static fromCartesian3

  • fromCartesian3(cartesian: Cartesian3, result?: Cartesian2): Cartesian2
  • Creates a Cartesian2 instance from an existing Cartesian3. This simply takes the x and y properties of the Cartesian3 and drops z.

    Parameters

    • cartesian: Cartesian3

      The Cartesian3 instance to create a Cartesian2 instance from.

    • Optional result: Cartesian2

    Returns Cartesian2

    The modified result parameter or a new Cartesian2 instance if one was not provided.

Static fromCartesian4

  • fromCartesian4(cartesian: Cartesian4, result?: Cartesian2): Cartesian2
  • Creates a Cartesian2 instance from an existing Cartesian4. This simply takes the x and y properties of the Cartesian4 and drops z and w.

    Parameters

    • cartesian: Cartesian4

      The Cartesian4 instance to create a Cartesian2 instance from.

    • Optional result: Cartesian2

    Returns Cartesian2

    The modified result parameter or a new Cartesian2 instance if one was not provided.

Static fromElements

  • fromElements(x: number, y: number, result?: Cartesian2): Cartesian2
  • Creates a Cartesian2 instance from x and y coordinates.

    Parameters

    • x: number

      The x coordinate.

    • y: number

      The y coordinate.

    • Optional result: Cartesian2

    Returns Cartesian2

    The modified result parameter or a new Cartesian2 instance if one was not provided.

Static getProjectPtOnLine

  • getProjectPtOnLine(pt: Cartesian2, linePt0: Cartesian2, linePt1: Cartesian2, result: Cartesian2): Cartesian2
  • Computes project pt on line.

    Parameters

    • pt: Cartesian2
    • linePt0: Cartesian2
    • linePt1: Cartesian2
    • result: Cartesian2

    Returns Cartesian2

    The project pt on line.

Static lerp

  • lerp(start: Cartesian2, end: Cartesian2, t: number, result: Cartesian2): Cartesian2
  • Computes the linear interpolation or extrapolation at t using the provided cartesians.

    Parameters

    • start: Cartesian2

      The value corresponding to t at 0.0.

    • end: Cartesian2

      The value corresponding to t at 1.0.

    • t: number

      The point along t at which to interpolate.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static magnitude

  • magnitude(cartesian: Cartesian2): number
  • Computes the Cartesian's magnitude (length).

    Parameters

    • cartesian: Cartesian2

      The Cartesian instance whose magnitude is to be computed.

    Returns number

    The magnitude.

Static magnitudeSquared

  • magnitudeSquared(cartesian: Cartesian2): number
  • Computes the provided Cartesian's squared magnitude.

    Parameters

    • cartesian: Cartesian2

      The Cartesian instance whose squared magnitude is to be computed.

    Returns number

    The squared magnitude.

Static maximumByComponent

  • maximumByComponent(first: Cartesian2, second: Cartesian2, result: Cartesian2): Cartesian2
  • Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.

    Parameters

    • first: Cartesian2

      A cartesian to compare.

    • second: Cartesian2

      A cartesian to compare.

    • result: Cartesian2

      The object into which to store the result.

    Returns Cartesian2

    A cartesian with the maximum components.

Static maximumComponent

  • maximumComponent(cartesian: Cartesian2): number
  • Computes the value of the maximum component for the supplied Cartesian.

    Parameters

    • cartesian: Cartesian2

      The cartesian to use.

    Returns number

    The value of the maximum component.

Static minimumByComponent

  • minimumByComponent(first: Cartesian2, second: Cartesian2, result: Cartesian2): Cartesian2
  • Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.

    Parameters

    • first: Cartesian2

      A cartesian to compare.

    • second: Cartesian2

      A cartesian to compare.

    • result: Cartesian2

      The object into which to store the result.

    Returns Cartesian2

    A cartesian with the minimum components.

Static minimumComponent

  • minimumComponent(cartesian: Cartesian2): number
  • Computes the value of the minimum component for the supplied Cartesian.

    Parameters

    • cartesian: Cartesian2

      The cartesian to use.

    Returns number

    The value of the minimum component.

Static mostOrthogonalAxis

  • mostOrthogonalAxis(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • Returns the axis that is most orthogonal to the provided Cartesian.

    Parameters

    • cartesian: Cartesian2

      The Cartesian on which to find the most orthogonal axis.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The most orthogonal axis.

Static multiplyByScalar

  • multiplyByScalar(cartesian: Cartesian2, scalar: number, result: Cartesian2): Cartesian2
  • Multiplies the provided Cartesian componentwise by the provided scalar.

    Parameters

    • cartesian: Cartesian2

      The Cartesian to be scaled.

    • scalar: number

      The scalar to multiply with.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static multiplyComponents

  • multiplyComponents(left: Cartesian2, right: Cartesian2, result: Cartesian2): Cartesian2
  • Computes the componentwise product of two Cartesians.

    Parameters

    • left: Cartesian2

      The first Cartesian.

    • right: Cartesian2

      The second Cartesian.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static negate

  • negate(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • Negates the provided Cartesian.

    Parameters

    • cartesian: Cartesian2

      The Cartesian to be negated.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static normalize

  • normalize(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • Computes the normalized form of the supplied Cartesian.

    Parameters

    • cartesian: Cartesian2

      The Cartesian to be normalized.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static pack

  • pack(value: Cartesian2, array: number[], startingIndex?: number): number[]
  • Stores the provided instance into the provided array.

    Parameters

    • value: Cartesian2

      The value to pack.

    • array: number[]

      The array to pack into.

    • Optional startingIndex: number

    Returns number[]

    The array that was packed into

Static packArray

  • packArray(array: Cartesian2[], result?: number[]): number[]
  • Flattens an array of Cartesian2s into and array of components.

    Parameters

    • array: Cartesian2[]

      The array of cartesians to pack.

    • Optional result: number[]

    Returns number[]

    The packed array.

Static round

  • round(cartesian: Cartesian2, result: Cartesian2): Cartesian2
  • 四舍五入

    Parameters

    • cartesian: Cartesian2
    • result: Cartesian2

    Returns Cartesian2

Static subtract

  • subtract(left: Cartesian2, right: Cartesian2, result: Cartesian2): Cartesian2
  • Computes the componentwise difference of two Cartesians.

    Parameters

    • left: Cartesian2

      The first Cartesian.

    • right: Cartesian2

      The second Cartesian.

    • result: Cartesian2

      The object onto which to store the result.

    Returns Cartesian2

    The modified result parameter.

Static toArray

Static unpack

  • unpack(array: number[], startingIndex?: number, result?: Cartesian2): Cartesian2
  • Retrieves an instance from a packed array.

    Parameters

    • array: number[]

      The packed array.

    • Optional startingIndex: number
    • Optional result: Cartesian2

    Returns Cartesian2

    The modified result parameter or a new Cartesian2 instance if one was not provided.

Static unpackArray

  • unpackArray(array: number[], result?: Cartesian2[]): Cartesian2[]
  • Unpacks an array of cartesian components into and array of Cartesian2s.

    Parameters

    • array: number[]

      The array of components to unpack.

    • Optional result: Cartesian2[]

    Returns Cartesian2[]

    The unpacked array.