Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Class SquareGrid

    The square grid class.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    alpha: number

    The opacity of the grid.

    color: Color

    The color of the grid.

    diagonals: GridDiagonalRule

    The rule for diagonal measurement (see CONST.GRID_DIAGONALS).

    distance: number

    The distance of a grid space in units.

    size: number

    The size of a grid space in pixels.

    sizeX: number

    The width of a grid space in pixels.

    sizeY: number

    The height of a grid space in pixels.

    style: string

    The style of the grid.

    thickness: number

    The thickness of the grid.

    type: 1 = GRID_TYPES.SQUARE
    units: string

    The distance units used in this grid.

    Accessors

    • get isGridless(): boolean

      Is this a gridless grid?

      Returns boolean

    • get isHexagonal(): boolean

      Is this a hexagonal grid?

      Returns boolean

    • get isSquare(): boolean

      Is this a square grid?

      Returns boolean

    Methods

    • Parameters

      • waypoints: any
      • __namedParameters: { cost: any }
      • result: any

      Returns void

    • Parameters

      • sceneWidth: any
      • sceneHeight: any
      • padding: any

      Returns { columns: number; height: any; rows: number; width: any; x: number; y: number }

    • Parameters

      • coords: any

      Returns { i: any; j: any }[] | { i: any; j: any; k: any }[]

    • Parameters

      • coords: any

      Returns
          | { elevation?: undefined; x: number; y: number }
          | { elevation: number; x: number; y: number }

    • Get the cone polygon given the radius in grid units and the angle in degrees for this grid. The points of the polygon are returned ordered in positive orientation. In gridless grids an approximation of the true cone with a deviation of less than 0.25 pixels is returned. If the angle less than 360 and the cone not empty, the first point of the polygon is the origin.

      Parameters

      • origin: Point

        The origin point of the cone

      • radius: number

        The radius in grid units

      • direction: number

        The direction in degrees

      • angle: number

        The angle in degrees

      Returns Point[]

      The points of the cone polygon

    • Get the ellipse polygon given the radius in grid units for this grid. The points of the polygon are returned ordered in positive orientation. In gridless grids an approximation of the true ellipse with a deviation of less than 0.25 pixels is returned.

      Parameters

      • center: any

        The center point of the ellipse.

      • radiusX: any

        The x-radius in grid units.

      • radiusY: any

        The y-radius in grid units.

      • rotation: any

        The rotation in degrees.

      Returns Point[]

      The points of the ellipse polygon.

    • Get the line polygon given the length and width in grid units for this grid. The points of the polygon are returned ordered in positive orientation.

      Parameters

      • origin: Point

        The origin point of the line.

      • length: number

        The length in grid units.

      • width: number

        The width in grid units.

      • direction: number

        The direction in degrees.

      Returns Point[]

      The points of the line polygon.

    • Parameters

      • coords: any

      Returns { i: any; j: any; k: any } | { i: any; j: any; k?: undefined }

    • Parameters

      • __namedParameters: { height: any; width: any; x: any; y: any }

      Returns number[]

    • Get the rectangle polygon given the width and height in grid units for this grid. The points of the polygon are returned ordered in positive orientation.

      Parameters

      • origin: Point

        The origin point of the rectangle.

      • width: number

        The width in grid units.

      • height: number

        The height in grid units.

      • anchor: Point

        The anchor.

      • rotation: number

        The rotation in degrees.

      Returns Point[]

      The points of the rectangle polygon.

    • Get the ring polygon given the radius and width in grid units for this grid. The points of the polygons are returned ordered in positive orientation. In gridless grids an approximation of the true ring with a deviation of less than 0.25 pixels is returned.

      Parameters

      • center: any

        The center point of the ring.

      • radius: any

        The radius in grid units.

      • innerWidth: any

        The inner width in grid units.

      • outerWidth: any

        The outer width in grid units.

      Returns Point[][]

      The inner and outer circles of the ring polygon.

    • Returns { x: number; y: number }[]

    • Parameters

      • coords: any
      • direction: any

      Returns { i: any; j: any; k: any } | { i: any; j: any; k?: undefined }

    • Parameters

      • point: any
      • direction: any

      Returns
          | { elevation?: undefined; x: number; y: number }
          | { elevation: number; x: number; y: number }

    • Parameters

      • point: any
      • __namedParameters: { mode: any; resolution?: number }

      Returns
          | { elevation: any; x: any; y: any }
          | { elevation?: undefined; x: any; y: any }
          | undefined

    • Parameters

      • coords: any

      Returns
          | { elevation?: undefined; x: number; y: number }
          | { elevation: number; x: number; y: number }

    • Parameters

      • point: any
      • direction: any
      • distance: any

      Returns { elevation: any; x: any; y: any } | { elevation?: undefined; x: any; y: any }

    • Parameters

      • coords: any

      Returns { x: number; y: number }[]

    • Parameters

      • coords1: any
      • coords2: any

      Returns boolean