An oriented rectangle in 2D coordinate space with double precision coordinates.
Remarks
height
extends from its anchor point in the direction of its up
vector (ux, uy). Its width
extends from its anchor point in direction (-uy, ux)
(i.e. perpendicular to the up vector). This means that an oriented rectangle with anchor point (0, 0)
width 100
, height 10
, and up vector (0, -1)
is a paraxial rectangle with upper left corner (0, -10)
and lower right corner (100, 0)
.Type Details
- yfiles module
- algorithms
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.algorithms.YOrientedRectangle
Constructors
Creates a new instance using the provided rectangle's values to initialize anchor and size.
Remarks
(0, -1)
.Parameters
A map of options to pass to the method.
- rect - YRectangle
- the provided rectangle.
Creates a new instance using the provided rectangle's values to initialize anchor, size, and up vector.
Parameters
A map of options to pass to the method.
- rect - YOrientedRectangle
- the provided rectangle.
Creates a new instance using the provided values to initialize the anchor and size.
Remarks
(0, -1)
.Parameters
A map of options to pass to the method.
- anchor - YPoint
- The provider for the dynamic anchor of this instance.
- size - YDimension
- The provider for the dynamic size of this instance.
Creates a new instance using the provided values to initialize anchor, size, and up vector.
Parameters
A map of options to pass to the method.
- position - YPoint
- The provider for the dynamic anchor of this instance.
- size - YDimension
- The provider for the dynamic size of this instance.
- upVector - YVector
- The up vector.
Creates a new instance using the provided values to initialize anchor and size.
Remarks
(0, -1)
.Parameters
A map of options to pass to the method.
- anchorX - number
- The x coordinate of the anchor of the oriented rectangle.
- anchorY - number
- The y coordinate of the anchor of the oriented rectangle.
- width - number
- The width of the rectangle.
- height - number
- The height of the rectangle.
YOrientedRectangle
(anchorX: number, anchorY: number, width: number, height: number, upX: number, upY: number)Creates a new instance using the provided values to initialize anchor, size, and up vector.
Parameters
A map of options to pass to the method.
- anchorX - number
- The x coordinate of the anchor of the oriented rectangle.
- anchorY - number
- The y coordinate of the anchor of the oriented rectangle.
- width - number
- The width of the rectangle.
- height - number
- The height of the rectangle.
- upX - number
- The x component of the up vector.
- upY - number
- The y component of the up vector.
Properties
Gets or sets the anchor of this oriented rectangle.
Calculates the paraxial bounding box of this oriented rectangle.
Implements
Gets or sets the current center of this oriented rectangle.
Gets or sets the size of this rectangle.
Methods
Copies the actual values from the given OrientedRectangle
to this instance.
Parameters
A map of options to pass to the method.
- other - YOrientedRectangle
- the
OrientedRectangle
to retrieve the values from
Determines whether or not the specified point lies inside this oriented rectangle.
Parameters
A map of options to pass to the method.
- x - number
- the x-coordinate of the point to check.
- y - number
- the y-coordinate of the point to check.
- closed - boolean
- if
true
, all points on the border of the rectangle are considered to be contained.
Returns
- ↪boolean
true
iff the specified point lies inside;false
otherwise.
Creates a new OrientedRectangle
instance whose anchor point is moved by the specified distance values, but has the same width, height, and up vector as this rectangle.
Parameters
A map of options to pass to the method.
- dx - number
- the distance to move the anchor point in x-direction. A positive value means "move" to the right, a negative value means "move" to the left.
- dy - number
- the distance to move the anchor point in y-direction. A positive value means "move" downwards, a negative value means "move" upwards.
Returns
- ↪YOrientedRectangle
- a new
OrientedRectangle
instance whose anchor point is moved by the specified distance values.
Creates a new OrientedRectangle
instance that has the specified width and height, but has the same anchor point and up vector as this rectangle.
Parameters
A map of options to pass to the method.
- width - number
- the width of the new rectangle.
- height - number
- the height of the new rectangle.
Returns
- ↪YOrientedRectangle
- a new
OrientedRectangle
instance that has the specified width and height.
Returns a hash code for this object.
Remarks
The hash code is a numeric value that can be used to treat this object as a key in a hash table or similar data structure.
Two objects that are considered equal must have the same hash code. However, the reverse does not hold and two objects having the same hash code don't have to be equal. Ideally, the hash code should be roughly uniformly-distributed to prevent hash tables from performing poorly. Calculating the hash code is also a potentially frequent operation and should therefore be fast.
Returns
- ↪number
- the hash code for this object
Sets the anchor of this oriented rectangle so that the center of the rectangle coincides with the given coordinate pair.
Parameters
A map of options to pass to the method.
- cx - number
- The x coordinate of the center.
- cy - number
- The y coordinate of the center.
Creates an immutable IOrientedRectangle from a given YOrientedRectangle.
Returns
Class.ensure(LayoutExecutor)
More information.Static Methods
Determines the four corner points of an oriented rectangle.
Parameters
A map of options to pass to the method.
- rect - YOrientedRectangle
- The rectangle to determine the bounds.
Returns
- ↪YPoint[]
- the array of corner points.
Determines the coordinates of the four corners of an oriented rectangle.
Parameters
A map of options to pass to the method.
- rect - YOrientedRectangle
- The rectangle to determine the bounds.
Returns
- ↪number[]
- the array of coordinates of the corner points in which each even index has the x-coordinate and each odd index the y-coordinate
Determines whether the given oriented rectangle contains the provided point, using an epsilon value.
Parameters
A map of options to pass to the method.
- rect - YOrientedRectangle
- The rectangle.
- p - YPoint
- The point to test.
- eps - number
- fuzziness range. A positive value allows for fuzzy hit testing. If a point lies outside the given rectangle, but its distance is less than or equal to that value, it will be considered a hit.
Returns
- ↪boolean
true
if the point lies inside the rectangle;false
otherwise.
Determines whether the given oriented rectangle contains the provided point, using an epsilon value.
Parameters
A map of options to pass to the method.
- rect - YOrientedRectangle
- The rectangle.
- x - number
- x-coordinate of the point to test.
- y - number
- y-coordinate of the point to test.
- eps - number
- fuzziness range. A positive value allows for fuzzy hit testing. If a point lies outside the given rectangle, but its distance is less than or equal to that value, it will be considered a hit.
Returns
- ↪boolean
true
if the point lies inside the rectangle;false
otherwise.
Determines whether the given rectangle r1 contains rectangle r2, using an epsilon value.
Parameters
A map of options to pass to the method.
- r1 - YOrientedRectangle
- The first rectangle.
- r2 - YOrientedRectangle
- The second rectangle.
- eps - number
- A positive value allows for fuzzy hit testing. If the point lies outside the given object but it's distance is less than or equal to that value, it will be considered a hit.
Returns
- ↪boolean
- true iff the r1 contains r2.
Determines an intersection point of the specified oriented rectangle and the specified line segment.
Remarks
null
if there is no intersection.Returns
- ↪YPoint
- an intersection point of the specified oriented rectangle and the specified line segment or
null
if the rectangle and the segment do not intersect.
Determines whether an YOrientedRectangle intersects another one.
Parameters
A map of options to pass to the method.
- rect1 - YOrientedRectangle
- The first oriented rectangle to test.
- rect2 - YOrientedRectangle
- 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.
Returns
- ↪boolean
true
if the rectangles intersect andfalse
otherwise.
Determines whether a rectangle intersects an oriented rectangle, given an epsilon.
Parameters
A map of options to pass to the method.
- orientedRectangle - YOrientedRectangle
- The oriented rectangle to test.
- rectangle - YRectangle
- The 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.
Returns
- ↪boolean
- Whether they have a non-empty intersection.
Determines whether or not the specified oriented rectangle and the specified line segment intersect.
Returns
- ↪boolean
true
if the rectangle and the segment intersect andfalse
otherwise.
Determines whether or not the specified oriented rectangle and the line segment defined by the two specified points intersect.
Returns
- ↪boolean
true
if the rectangle and the segment intersect andfalse
otherwise.