Skip to content
Back to top

# Quad

An object representing a quadrilateral or QuadPoint.

In TypeScript the Quad type is defined as follows:

    type Quad = [ number, number, number, number number, number, number, number ]

## Constructors

class Quad()

  This is an interface, not a concrete class!

Quads are not represented by a class; they are just plain arrays of eight numbers.

## Static properties

Quad.empty

  only mutool run

  A quad whose coordinates are such that it is categorized as empty.

Quad.invalid

  only mutool run

  A quad whose coordinates are such that it is categorized as invalid.

Quad.infinite

  only mutool run

  A quad whose coordinates are such that it is categorized as infinite.

## Static methods

Quad.isEmpty(quad)

  only mutool run

  Returns a boolean indicating if the quad is empty or not.

  Arguments:

    - quad (`Quad`) – Rectangle to evaluate.

  Returns:

    boolean

      var isEmpty = mupdf.Quad.isEmpty([0, 0, 0, 0]) // true
      var isEmpty = mupdf.Quad.isEmpty([0, 0, 100, 100]) // false

Quad.isValid(quad)

  only mutool run

  Returns a boolean indicating if the quad is valid or not.

  Arguments:

    - quad (`Quad`) – Rectangle to evaluate.

  Returns:

    boolean

      var isValid = mupdf.Quad.isValid([0, 0, 100, 100]) // true
      var isValid = mupdf.Quad.isValid([0, 0, -100, 100]) // false

Quad.isInfinite(quad)

  only mutool run

  Returns a boolean indicating if the quad is infinite or not.

  Arguments:

    - quad (`Quad`) – Rectangle to evaluate.

  Returns:

    boolean

      var isInfinite = mupdf.Quad.isInfinite([0x80000000, 0x80000000, 0x7fffff80, 0x7fffff80]) //true
      var isInfinite = mupdf.Quad.isInfinite([0, 0, 100, 100]) // false

Quad.transform(quad, matrix)

  only mutool run

  Transforms the supplied quad by the given transformation matrix.

  Transforming an invalid, empty or infinite quad results in the supplied quad being returned without change.

  Arguments:

    - quad (`Quad`) – Quad to transform.

    - matrix (`Matrix`) – Matrix describing transformation to perform.

  Returns:

    Quad

      var m = mupdf.Quad.transform([0, 0, 100, 100], [1, 0.5, 1, 1, 1, 1])

Quad.isPointInside(quad, point)

  only mutool run

  Return whether the point is inside the quad.

  :returns boolean

      var inside = mupdf.Rect.isPointInside([0, 0, 100, 100], [50, 50])

Quad.quadFromRect(rect)

  only mutool run

  Create a Quad that maps exactly to the coordinate of rectangle.

  Arguments:

    - rect (`Rect`)

  Returns:

    Quad