Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "geocortex/essentials/GeometryUtilities"

Index

Functions

angle

  • angle(a: Point, b: Point): number
  • Calculates the angle (in Radians) between two vectors.

    Parameters

    • a: Point

      The first vector.

    • b: Point

      The second vector.

    Returns number

clipEnvelope

  • clipEnvelope(envelopeToClip: Extent, clipAgainst: Extent): Extent
  • Returns an envelope representing the result of clipping a given envelope against another given envelope.

    Parameters

    • envelopeToClip: Extent

      The envelope to clip.

    • clipAgainst: Extent

      The envelope to clip against.

    Returns Extent

computeDistance

  • computeDistance(point1: Point, point2: Point): number
  • Computes the Cartesian distance between two points.

    Parameters

    • point1: Point

      The first point.

    • point2: Point

      The second point.

    Returns number

crossProduct

  • crossProduct(a: Point, b: Point, origin?: Point): number
  • Calculates the 2D cross product of two vectors.

    Parameters

    • a: Point

      The first vector.

    • b: Point

      The second vector.

    • Optional origin: Point

      The origin by which these vectors relate.

    Returns number

crossProductArray

  • crossProductArray(a: number[], b: number[], origin?: number[]): number
  • Calculates the 2D cross product of two vectors.

    Parameters

    • a: number[]

      The first vector.

    • b: number[]

      The second vector.

    • Optional origin: number[]

      The origin by which these vectors relate.

    Returns number

dotProduct

  • dotProduct(a: Point, b: Point): number
  • Calculates the dot product of two vectors.

    Parameters

    • a: Point

      The first vector.

    • b: Point

      The second vector.

    Returns number

envelopeToPolygon

  • envelopeToPolygon(envelope: Extent): Polygon
  • Creates a polygon representing the given extent.

    Parameters

    • envelope: Extent

      The envelope to turn into a polygon.

    Returns Polygon

envelopesAreEqual

  • envelopesAreEqual(envelope1: Extent, envelope2: Extent): boolean
  • Compares two envelopes for spatial equality.

    Parameters

    • envelope1: Extent
    • envelope2: Extent

    Returns boolean

getExtent

  • getExtent(geometries: Geometry[]): Extent
  • Builds a bounding extent, given an array of geometries.

    Parameters

    • geometries: Geometry[]

      The collection of geometries for which to build the bounding extent.

    Returns Extent

isConvex

  • isConvex(poly: Polygon): boolean
  • Checks whether or not a polygon is convex.

    Parameters

    • poly: Polygon

    Returns boolean

isSelfIntersectingPolygon

  • isSelfIntersectingPolygon(poly: Polygon): boolean
  • Checks if a polygon is self intersecting

    Parameters

    • poly: Polygon

    Returns boolean

isValidGeometry

  • isValidGeometry(geometry: Geometry): boolean
  • Checks a given geometry for validity.

    Parameters

    • geometry: Geometry

      The geometry to check.

    Returns boolean

length

  • length(vector: Point): number
  • Calculates the length of a vector.

    Parameters

    • vector: Point

      The vector to calculate length for.

    Returns number

normalize

  • normalize(vector: Point): Point
  • Returns a normalized vector.

    Parameters

    • vector: Point

      The vector to normalize.

    Returns Point

pointInEnvelope

  • pointInEnvelope(point: Point, envelope: Extent): boolean
  • Checks whether or not a point lies in an Envelope.

    Parameters

    • point: Point

      The point to check.

    • envelope: Extent

      The envelope to check.

    Returns boolean

polygonMidpoint

  • polygonMidpoint(points: Point[]): Point
  • Calculates the approximate midpoint of a collection of points.

    Parameters

    • points: Point[]

      The array of points.

    Returns Point

scaleEnvelope

  • scaleEnvelope(envelope: Extent, scaleX: number, scaleY: number): Extent
  • Returns an extent that represents the provided envelope scaled by the given amounts on each axis.

    Parameters

    • envelope: Extent

      The envelope to scale.

    • scaleX: number

      The amount to scale on the X axis.

    • scaleY: number

      The amount to scale on the Y axis.

    Returns Extent

scaleEnvelopeWithoutTranslation

  • scaleEnvelopeWithoutTranslation(envelope: Extent, scaleFactor: number): Extent
  • Returns an extent that represents the provided envelope, whose width and height have been scaled by the given amount, and whose center has position is unchanged.

    Parameters

    • envelope: Extent

      The envelope to scale.

    • scaleFactor: number

      The amount to scale by.

    Returns Extent

spatialRefsAreEqual

  • spatialRefsAreEqual(ref1: SpatialReference, ref2: SpatialReference, ignoreNulls?: boolean): boolean
  • Compares two spatial references for equality.

    Parameters

    • ref1: SpatialReference

      The first SpatialReference.

    • ref2: SpatialReference

      The second SpatialReference.

    • Optional ignoreNulls: boolean

      Whether or not a null spatial reference passed in should equate to equal to the other.

    Returns boolean

translateEnvelope

  • translateEnvelope(envelope: Extent, translateX: number, translateY: number): Extent
  • Returns an extent that represents the provided envelope scaled by the given amounts on each axis.

    Parameters

    • envelope: Extent

      The envelope to translate.

    • translateX: number

      The amount to translate on the X axis.

    • translateY: number

      The amount to translate on the Y axis.

    Returns Extent