A mutable oriented rectangle in 2D coordinate space with double precision values stored in an instance of IMutablePoint and IMutableSize as well as two doubles for the up vector components.
Remarks
Type Details
- yFiles module
- core
See Also
Constructors
Creates a new instance using the provided rectangle to initialize the anchor and size.
Remarks
(0, -1)
.Parameters
A map of options to pass to the method.
- rectangle - IRectangle
- The rectangle to initialize the anchor and size from.
Creates a new instance using the provided values to initialize.
Remarks
Parameters
A map of options to pass to the method.
- rectangle - IOrientedRectangle
- The rectangle to initialize the anchor and size and up vector from.
Creates a new instance using the provided values to initialize the anchor and size.
Remarks
(0, -1)
. The instances provided will be referenced by this instance. This instance will be used as a live view over the provided instances. Changes to them will indirectly change the state of this instance and changes applied through this instance will be written to the referenced implementations.Parameters
A map of options to pass to the method.
- anchor - IMutablePoint
- The provider for the dynamic anchor of this instance.
- size - IMutableSize
- The provider for the dynamic size of this instance.
Initializes a new instance of the OrientedRectangle class located at 0.0d,0.0d
with an empty width and height (-1.0d
).
OrientedRectangle
(anchorX: number, anchorY: number, width: number, height: number, upX?: number, upY?: number)Creates a new instance using the provided values to initialize the anchor and size.
Remarks
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 the anchor location of the oriented rectangle as Point.
Defined in
Gets or sets the x-coordinate of the anchor of this instance from the dynamicAnchor instance.
Remarks
Implements
Gets or sets the y-coordinate of the anchor of this instance from the dynamicAnchor instance.
Remarks
Implements
Gets or sets the orientation of this rectangle measured in radians.
Remarks
An angle of 0
means the up vector points up in direction (0,-1)
. The angle value is not stored and will be recalculated from upX and upY every time this is invoked, so this is a costly method. Setting the angle changes the upX and upY values accordingly.
The angle is between 0 and PI if the up vector points to quadrant 1 or 4 and between -PI and 0 if the up vector points to quadrant 2 or 3.
Calculates the paraxial bounds of this oriented rectangle.
Gets or sets the current center of this oriented rectangle.
Gets or sets the anchor of this oriented rectangle.
Remarks
Gets or sets the size of this rectangle.
Remarks
Gets or sets the height of this instance from the dynamicSize instance.
Remarks
Implements
Determines whether the specified size is empty.
Remarks
Overrides
Gets the up vector of the oriented rectangle as Point.
Defined in
Gets or sets the x component of the up vector to the new value.
Remarks
See Also
Implements
Gets or sets the y component of the up vector to the new value.
Remarks
See Also
Implements
Gets or sets the width of this instance from the dynamicSize instance.
Remarks
Implements
Gets or sets the x-coordinate of the anchor of this instance from the dynamicAnchor instance.
Remarks
Gets or sets the y-coordinate of the anchor of this instance from the dynamicAnchor instance.
Remarks
Methods
Create a clone of this object.
Determines whether the given oriented rectangle contains the provided point, using an epsilon value.
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪boolean
true
iff the point lies inside the rectangle.
Defined in
Implements the Equals method by comparing the given object's values.
Remarks
Parameters
A map of options to pass to the method.
- other - any
- The other instance to compare the values against.
Returns
- ↪boolean
- Whether the other instance is of this type or the immutable types created by this class and whether their values are the same as for this type.
Creates an enlarged instance that is the same as this one but enlarged by the specified padding.
Parameters
A map of options to pass to the method.
- padding - Insets
- The padding to use to add to the instance.
Returns
- ↪OrientedRectangle
- A new OrientedRectangle instance which is enlarged by the given
padding
.
Defined in
Determines an intersection point of the given oriented rectangle and the line segment specified by the given endpoints.
Remarks
null
if there is no intersection.Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪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.
Defined in
Determines whether an OrientedRectangle intersects another one.
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪boolean
true
if the rectangles intersect andfalse
otherwise.
Defined in
Determines whether the given oriented rectangle and the line segment defined by the two given points intersect.
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪boolean
true
if the rectangle and the line segment intersect andfalse
otherwise.
Defined in
Moves this rectangle by applying the offset to the dynamicAnchor.
Parameters
A map of options to pass to the method.
- delta - Point
- The offset to move the rectangle's anchor by.
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.
Applies the values provided by the given instance to the values of this instance.
Parameters
A map of options to pass to the method.
- rectangle - IOrientedRectangle
- The instance to retrieve the values from.
Sets the components of the up vector to the new values.
Remarks
Parameters
A map of options to pass to the method.
- upx - number
- The x component of the normalized up vector.
- upy - number
- The y component of the normalized up vector.
See Also
Creates an immutable IOrientedRectangle from a given OrientedRectangle.
Returns
Creates an OrientedRectangle from a given IOrientedRectangle.
Creates a new Size instance with the current values of this size.
Returns
Overrides
Static Methods
createImmutable
(anchorX: number, anchorY: number, width: number, height: number, upX: number, upY: number) : IOrientedRectangleCreates an immutable IOrientedRectangle with the given values.
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.
Returns
- ↪IOrientedRectangle
- An immutable IOrientedRectangle with the given values.