Interface for oriented rectangles in 2D coordinate space with double precision coordinates.
Implements
- I
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
The anchor is the lower left corner of the oriented rectangle if the up vector is
(0,-1).readonlyabstract
Implemented in
OrientedRectangle.anchorXThe anchor is the lower left corner of the oriented rectangle if the up vector is
(0,-1).readonlyabstract
Implemented in
OrientedRectangle.anchorYDetermines the bounds of an oriented rectangle.
Determines the bounds of an oriented rectangle.
Bounding rectangles are parallel to the coordinate axes.
readonly
Implemented in
OrientedRectangle.boundsreadonly
Implemented in
OrientedRectangle.centerDepending on context, the values returned may change over time.
readonlyabstract
Defined in
ISize.heightDefined in
ISize.isEmptyThe 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.upXThe 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.upYDepending on context, the values returned may change over time.
readonlyabstract
Defined in
ISize.widthMethods
Determines whether the given oriented rectangle contains the provided point, using an epsilon value.
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
trueiff the point lies inside the rectangle.
Creates an enlarged instance that is the same as this one but enlarged by the specified padding.
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.
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
nullif the rectangle and the segment do not intersect.
Determines whether an OrientedRectangle intersects another one.
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
trueif the rectangles intersect andfalseotherwise.
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
trueif the rectangle and the line segment intersect andfalseotherwise.
Creates an OrientedRectangle from a given IOrientedRectangle.
Creates an OrientedRectangle from a given IOrientedRectangle.
Return Value
Defined in
ISize.toSizeConstants
An immutable empty IOrientedRectangle with width and height of -1.
An immutable empty IOrientedRectangle with width and height of
-1.