Show:

ia.Rectangle Class

Module: ia

Rectangle object.

Constructor

ia.Rectangle

(
  • [x=0]
  • [y=0]
  • [width=0]
  • [height=0]
)

Parameters:

  • [x=0] Number optional

    The x coordinate of the origin.

  • [y=0] Number optional

    The y coordinate of the origin.

  • [width=0] Number optional

    The width.

  • [height=0] Number optional

    The height.

Methods

bottom

() Number

The value of the bottom edge.

Returns:

Number:

clone

() ia.Rectangle

Returns a clone of the rectangle.

Returns:

ia.Rectangle: The rectangle.

intersects

(
  • px
  • py
)
Boolean

Tests whether a point intersects the rectangle.

Parameters:

  • px Number

    The x coordinate.

  • py Number

    The y coordinate.

Returns:

Boolean: true if intercepts, otherwise false.

intersectsLine

(
  • p1
  • p2
)
Boolean

Tests whether a line segment intersects the rectangle.

Parameters:

  • p1 Object

    First point {x, y}.

  • p2 Object

    Second point {x, y}.

Returns:

Boolean: true if intercepts, otherwise false.

left

() Number

The value of the left edge.

Returns:

Number:

lineIntersectsLine

(
  • a1
  • a2
  • b1
  • b2
)
Boolean

Tests whether a line segment intersects another line.

Parameters:

  • a1 Object

    First point of line one {x, y}.

  • a2 Object

    Second point of line one {x, y}.

  • b1 Object

    First point of line two {x, y}.

  • b2 Object

    Second point of line two {x, y}.

Returns:

Boolean: true if intercepts, otherwise false.

right

() Number

The value of the right edge.

Returns:

Number:

top

() Number

The value of the top edge.

Returns:

Number:

toString

() String

Get a simple text representation of this object.

Returns:

String: A text String.

Properties

height

Number

The height.

Default: 0

width

Number

The width.

Default: 0

x

Number

The x coord.

Default: 0

y

Number

The y coord.

Default: 0