s2js
    Preparing search index...

    Class Rect

    Rect represents a closed axis-aligned rectangle in the (x,y) plane.

    Index

    Constructors

    • Constructs the canonical empty rectangle. Use isEmpty() to test for empty rectangles, since they have more than one representation. new Interval(0, 0) is not the same as the empty Rect.

      Returns r2.Rect

    Other

    • Returns true if the x- and y-intervals of the two rectangles are the same up to the given tolerance.

      Parameters

      Returns boolean

    • Reports whether the rectangle contains the given point. Rectangles are closed regions, i.e. they contain their boundary.

      Parameters

      Returns boolean

    • Returns a rectangle that has been expanded in the x-direction by margin.X, and in y-direction by margin.Y. If either margin is empty, then shrink the interval on the corresponding sides instead. The resulting rectangle may be empty. Any expansion of an empty rectangle remains empty.

      Parameters

      Returns r2.Rect

    • Reports whether the interior of this rectangle contains all of the points of the given or: Rectangle (including its boundary).

      Parameters

      Returns boolean

    • Returns true iff the given point is contained in the interior of the region (i.e. the region excluding its boundary).

      Parameters

      Returns boolean

    • Reports whether the interior of this rectangle intersects any point (including the boundary) of the given or: Rectangle.

      Parameters

      Returns boolean

    • Reports whether the rectangle is valid. This requires the width to be empty iff the height is empty.

      Returns boolean

    • VertexIJ returns the vertex in direction i along the X-axis (0=left, 1=right) and direction j along the Y-axis (0=down, 1=up).

      Parameters

      • i: number
      • j: number

      Returns r2.Point