API (v2.0.0) - Giro3D
    Preparing search index...

    A rectangular extent in a specific coordinate system.

    Index

    Constructors

    • Creates an extent from a coordinate system and a pair of coordinates.

      Parameters

      Returns Extent

      Both coordinates must be in the same coordinate system as this extent.

    • Creates an extent from an object containing the min/max XY values.

      Parameters

      • crs: CoordinateSystem

        The coordinate system to use.

      • values: { maxX: number; maxY: number; minX: number; minY: number }

        The extent limits.

      Returns Extent

    • Creates an extent from the min/max XY values.

      Parameters

      • crs: CoordinateSystem

        The coordinate system to use.

      • values: { east: number; north: number; south: number; west: number }

        The extent limits.

      Returns Extent

      Due to ambiguity (not all coordinate systems are north-up), this constructor should not be used.

    • Creates an extent from the min/max XY values

      Parameters

      • crs: CoordinateSystem

        The coordinate system to use.

      • minX: number

        The X coordinate of the left side of this extent.

      • maxX: number

        The X coordinate of the righ side of this extent.

      • minY: number

        The Y coordinate of the bottom side of this extent.

      • maxY: number

        The Y coordinate of the top side of this extent.

      Returns Extent

    Accessors

    • get maxX(): number

      The maximum X value of this extent (the X coordinate of the right side).

      Returns number

    • get minY(): number

      The minimum Y value of this extent (the Y coordinate of the bottom side).

      Returns number

    • get values(): Float64Array

      Returns the internal value array in this order: [minX, maxX, minY, maxY]

      Returns Float64Array

    Methods

    • Converts this extent into another CRS. If crs is the same as the current CRS, the original object is returned.

      Parameters

      Returns Extent

      the converted extent.

      const original = new Extent(CoordinateSystem.epsg4326, -5, 5, -5, 5);
      const transformed = original.as(CoordinateSystem.epsg3857);
      // [-556597.4539663679, 556597.4539663679, -557305.2572745769, 557305.2572745753]
    • Sets target with the center of this extent.

      Parameters

      • Optionaltarget: Vector2

        the vector to set with the center's coordinates. If none provided, a new one is created.

      Returns Vector2

      the modified object passed in argument.

    • Sets target with the center of this extent. Note: The z coordinate of the resulting vector will be set to zero.

      Parameters

      • Optionaltarget: Vector3

        the vector to set with the center's coordinates. If none provided, a new one is created.

      Returns Vector3

      the modified object passed in argument.

    • Tests whether this extent contains entirely another extent.

      Parameters

      • other: Extent

        the other extent to test

      • epsilon: number | null = null

        the precision delta (+/- epsilon). If this value is not provided, a reasonable epsilon will be computed.

      Returns boolean

      true if this extent contains the other extent.

    • Sets the target with the width and height of this extent. The x property will be set with the width, and the y property will be set with the height.

      Parameters

      • target: Vector2 = ...

        the optional target to set with the result.

      Returns Vector2

      the modified object passed in argument, or a new object if none was provided.

    • Returns true if the two extents are equal.

      Parameters

      • other: Extent

        The extent to compare.

      • epsilon: number = 0.00001

        The optional comparison epsilon.

      Returns boolean

      true if the extents are equal, otherwise false.

    • Returns an extent that is adjusted so that its edges land exactly at the border of the grid pixels. Optionally, you can specify the minimum pixel size of the resulting extent.

      Parameters

      • gridExtent: Extent

        The grid extent.

      • gridWidth: number

        The grid width, in pixels.

      • gridHeight: number

        The grid height, in pixels.

      • OptionalminPixWidth: number

        The minimum width, in pixels, of the resulting extent.

      • OptionalminPixHeight: number

        The minimum height, in pixels, of the resulting extent.

      Returns GridExtent

      The adjusted extent and pixel size of the adjusted extent.

    • Set this extent to the intersection of itself and other

      Parameters

      • other: Extent

        the bounding box to intersect

      Returns this

      the modified extent

    • Returns true if this extent intersects with the specified extent.

      Parameters

      • bbox: Extent

        the extent to test

      Returns boolean

      true if this extent intersects with the provided extent, false otherwise.

    • Tests whether this extent is contained in another extent.

      Parameters

      • other: Extent

        the other extent to test

      • epsilon: number | null = null

        the precision delta (+/- epsilon). If this value is not provided, a reasonable epsilon will be computed.

      Returns boolean

      true if this extent is contained in the other extent.

    • Checks whether the specified coordinate is inside this extent.

      Parameters

      • coord: Coordinates

        the coordinate to test

      • epsilon: number = 0

        the precision delta (+/- epsilon)

      Returns boolean

      true if the coordinate is inside the bounding box

    • Checks the validity of the extent. Valid extents must not have infinite or NaN values.

      Returns boolean

      true if the extent is valid, false otherwise.

    • Parameters

      • x: number
      • y: number
      • epsilon: number = 0

      Returns boolean

    • Returns the normalized offset from bottom-left in extent of this Coordinates

      Parameters

      • coordinate: Coordinates

        the coordinate

      • target: Vector2 = ...

        optional Vector2 target. If not present a new one will be created.

      Returns Vector2

      normalized offset in extent

      extent.offsetInExtent(extent.center())
      // returns `(0.5, 0.5)`.
    • Returns the coordinate of the location on the extent that matches U and V, where U and V are normalized (in the range [0, 1]), and U = 0 and V = 0 are the bottom/left corner of the extent, and U = 1 and V = 1 are to top right corner.

      Parameters

      • u: number

        The normalized coordinate over the X-axis.

      • v: number

        The normalized coordinate over the Y-axis.

      • Optionaltarget: Coordinates

        The target to store the result. If unspecified, one will be created.

      Returns Coordinates

      The sampled coordinate.

      const extent = new Extent(CoordinateSystem.epsg4326, 0, 10, 0, 5);
      // Get the bottom left corner
      extent.sampleUV(0, 0)
      // [0, 0]

      // Get the center
      extent.sampleUV(0.5, 0.5)
      // [5, 2.5]

      // Get the top right corner
      extent.sampleUV(1, 1)
      // [10, 5]
    • Sets the values of this extent from a coordinate system and a pair of coordinates.

      Parameters

      Returns this

      Both coordinates must be in the same coordinate system as this extent.

    • Sets the values of this extent from an object containing the min/max XY values.

      Parameters

      • crs: CoordinateSystem

        The coordinate system to use.

      • values: { maxX: number; maxY: number; minX: number; minY: number }

        The extent limits.

      Returns this

    • Sets the values of this extent from the min/max XY values.

      Parameters

      • crs: CoordinateSystem

        The coordinate system to use.

      • values: { east: number; north: number; south: number; west: number }

        The extent limits.

      Returns this

      Due to ambiguity (not all coordinate systems are north-up), this constructor should not be used.

    • Sets the values of this extent from the min/max XY values

      Parameters

      • crs: CoordinateSystem

        The coordinate system to use.

      • minX: number

        The X coordinate of the left side of this extent.

      • maxX: number

        The X coordinate of the righ side of this extent.

      • minY: number

        The Y coordinate of the bottom side of this extent.

      • maxY: number

        The Y coordinate of the top side of this extent.

      Returns this

    • Moves the extent by the provided x and y values.

      Parameters

      • x: number

        the horizontal shift

      • y: number

        the vertical shift

      Returns this

      the modified extent.

    • Subdivides this extents into x and y subdivisions.

      Notes:

      • Subdivisions must be strictly positive.
      • If both subvisions are 1, an array of one element is returned, containing a copy of this extent.

      Parameters

      • xSubdivs: number

        The number of subdivisions on the X/longitude axis.

      • ySubdivs: number

        The number of subdivisions on the Y/latitude axis.

      Returns Extent[]

      the resulting extents.

      const extent = new Extent(CoordinateSystem.epsg3857, 0, 100, 0, 100);
      extent.split(2, 1);
      // [0, 50, 0, 50], [50, 100, 50, 100]
    • Returns a Box3 that matches this extent.

      Parameters

      • minHeight: number

        The min height of the box.

      • maxHeight: number

        The max height of the box.

      Returns Box3

      The box.

    • Divides this extent into a regular grid. The number of points in each direction is equal to the number of subdivisions + 1. The points are laid out row-wise, from west to east, and north to south:

      1 -- 2
      | |
      3 -- 4

      Type Parameters

      • T extends TypedArray

      Parameters

      • xSubdivs: number

        The number of grid subdivisions in the x-axis.

      • ySubdivs: number

        The number of grid subdivisions in the y-axis.

      • target: T

        The array to fill.

      • stride: number

        The number of elements per item (2 for XY, 3 for XYZ).

      Returns T

      the target.

    • Returns an extent grown or shrinked with the specified margin. If the margin is positive, the new extent is bigger, and if the margin is negative the new extent is smaller.

      Parameters

      • x: number

        The horizontal margin, in CRS units.

      • y: number

        The vertical margin, in CRS units.

      Returns Extent

      a new extent with a specified margin applied.

      const extent = new Extent(CoordinateSystem.epsg3857, 0, 100, 0, 100);
      const margin = extent.withMargin(10, 15);
      // new Extent(CoordinateSystem.epsg3857, -10, 110, -15, 115);
    • Returns an extent grown the specified relative margin. The margin is relative to the width or height of the extent.

      Parameters

      • marginRatio: number

        The margin, in normalized value ([0, 1]). A margin of 1 means 100% of the width or height of the extent.

      Returns Extent

      a new extent with a specified margin applied.

      // Create an extent with a 10% margin applied:
      const extent = new Extent(CoordinateSystem.epsg3857, 0, 100, 0, 100);
      const margin = extent.withRelativeMargin(0.1);
      // new Extent(CoordinateSystem.epsg3857, -10, 110, -10, 110);
    • Returns an extent centered at the specified coordinate, and with the specified size.

      Parameters

      • crs: CoordinateSystem

        The CRS identifier.

      • center: { x: number; y: number }

        The center.

      • width: number

        The width, in CRS units.

      • height: number

        The height, in CRS units.

      Returns Extent

      The produced extent.

    • Creates an extent from parameters of a photosphere in the 'equirectangular' projection for the given image parameters. See the Google Street View documentation for additional information.

      Parameters

      • Optionalparams: {
            croppedAreaImageHeightPixels: number;
            croppedAreaImageWidthPixels: number;
            croppedAreaLeftPixels: number;
            croppedAreaTopPixels: number;
            fullPanoImageHeightPixels: number;
            fullPanoImageWidthPixels: number;
        }

        The parameters of the image. If undefined, then it returns the extent for the full sphere equivalent to fullEquirectangularProjection

      Returns Extent

      The extent of the image in the 'equirectangular' projection.