I

IOrientedRectangle

Interface for oriented rectangles in 2D coordinate space with double precision coordinates.
ImplementsInheritance Hierarchy

Remarks

The rectangle described by this interface has its lower left corner at the anchor as described by the anchorX and anchorY properties and is oriented in space so that its upper left corner lies in the direction of the (upX,upY) vector. The size of the instance does not describe the bounds of the instance but the lengths of the sides of the rectangle. An IRectangle would thus be an oriented rectangle, whose anchor is the lower left corner of the rectangle, whose size is the same as that of the rectangle and whose up vector is (0,-1). This interface provides read access to the features of the oriented rectangle only, however this does not mean that an instance that implements IOrientedRectangle will always return the same values for its properties. Often times the instance provides a dynamic read access to the current state of a rectangle. It depends on the context whether it is allowed to or even necessary to copy the state of the properties or whether the reference to the instance should always be used to query the values.

See Also

Developer's Guide

API

ISize, IRectangle, OrientedRectangle, MutableRectangle

Members

Show:

Properties

Gets the anchor location of the oriented rectangle as Point.
Gets the x-coordinate of the anchor of the oriented rectangle.
The anchor is the lower left corner of the oriented rectangle if the up vector is (0,-1).
readonlyabstract
Gets the y-coordinate of the anchor of the oriented rectangle.
The anchor is the lower left corner of the oriented rectangle if the up vector is (0,-1).
readonlyabstract
Determines the bounds of an oriented rectangle.
Bounding rectangles are parallel to the coordinate axes.
readonly
Gets the current center of the oriented rectangle as Point.
readonly
Gets the current height of this instance.
Depending on context, the values returned may change over time.
readonlyabstract

Defined in

ISize.height
Determines whether the specified size is empty.
ISize instances are considered empty if their width or height is less than 0.0d.
readonly

Defined in

ISize.isEmpty
Gets the up vector of the oriented rectangle as Point.
Gets the x value of the up vector.
The up vector points from the lower left corner to the upper left corner and is always normalized, i.e. its length is always 1.
readonlyabstract

Implemented in

OrientedRectangle.upX
Gets the y value of the up vector.
The up vector points from the lower left corner to the upper left corner and is always normalized, i.e. its length is always 1.
readonlyabstract

Implemented in

OrientedRectangle.upY
Gets the current width of this instance.
Depending on context, the values returned may change over time.
readonlyabstract

Defined in

ISize.width

Methods

Determines whether the given oriented rectangle contains the provided point, using an epsilon value.

Parameters

point: IPoint
The coordinates of the point to test.
eps: number
A positive value allows for fuzzy hit testing. If the point lies outside the given object but its distance is less than or equal to that value, it will be considered a hit.

Return Value

boolean
true iff the point lies inside the rectangle.
Creates an enlarged instance that is the same as this one but enlarged by the specified padding.

Parameters

padding: Insets
The padding to use to add to the instance.

Return Value

OrientedRectangle
A new OrientedRectangle instance which is enlarged by the given padding.
Determines an intersection point of the given oriented rectangle and the line segment specified by the given endpoints.
Note: there might be more than one intersection point. However, this method only returns one intersection point or null if there is no intersection.

Parameters

lineP1: Point
The first endpoint of the line segment.
lineP2: Point
The second endpoint of the line segment.
eps: number
A positive value allows for fuzzy hit testing. The rectangle will be enlarged by the given value (or reduced in size by a negative value), so that an intersection point that otherwise would not be found may be returned.

Return Value

Point
An intersection point of the given oriented rectangle and the specified line segment or null if the rectangle and the segment do not intersect.
Determines whether an OrientedRectangle intersects another one.

Parameters

rect2: IOrientedRectangle
The second oriented rectangle to test.
eps: number
A positive value allows for fuzzy hit testing. If the point lies outside the given object but its distance is less than or equal to that value, it will be considered a hit.

Return Value

boolean
true if the rectangles intersect and false otherwise.
Determines whether the given oriented rectangle and the line segment defined by the two given points intersect.

Parameters

lineP1: Point
The first point defining the line segment.
lineP2: Point
The second point defining the line segment.
eps: number
A positive value allows for fuzzy hit testing. If the point lies outside the given object but its distance is less than or equal to that value, it will be considered a hit.

Return Value

boolean
true if the rectangle and the line segment intersect and false otherwise.
Creates an OrientedRectangle from a given IOrientedRectangle.
Creates a new Size instance with the current values of this size.

Return Value

Size
A new Size instance that has been initialized with the current values of size.

Defined in

ISize.toSize

Constants

An immutable empty IOrientedRectangle with width and height of -1.