Package | com.yworks.yfiles.geom |
Class | public class YOrientedRectangle |
Inheritance | YOrientedRectangle YObject Object |
Implements | PlaneObject |
height
extends from its anchor point (anchor) in the direction of its up vector
( ux (upX), uy (upY))
. Its width
extends from its anchor point (anchor)
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)
.
See also
Property | Defined By | ||
---|---|---|---|
anchor : YPoint
Getter:
Returns the anchor of this oriented rectangle. | YOrientedRectangle | ||
anchorX : Number [read-only]
Returns the x-coordinate of this rectangle's anchor point. | YOrientedRectangle | ||
anchorY : Number [read-only]
Returns the y-coordinate of this rectangle's anchor point. | YOrientedRectangle | ||
angle : Number
Specifies the angle (measured in radians) of this rectangle. | YOrientedRectangle | ||
boundingBox : YRectangle [read-only]
Calculates the paraxial bounding box of this oriented rectangle. | YOrientedRectangle | ||
center : YPoint
Getter:
Returns the current center of the oriented rectangle. | YOrientedRectangle | ||
empty : Boolean [read-only]
Returns whether this instance has negative width or height. | YOrientedRectangle | ||
height : Number [read-only]
Returns the height of this rectangle. | YOrientedRectangle | ||
size : YDimension
Specifies the size of this rectangle. | YOrientedRectangle | ||
upX : Number [read-only]
Returns the x-component of this rectangle's up vector. | YOrientedRectangle | ||
upY : Number [read-only]
Returns the y-component of this rectangle's up vector. | YOrientedRectangle | ||
width : Number [read-only]
Returns the width of this rectangle. | YOrientedRectangle |
Method | Defined By | ||
---|---|---|---|
YOrientedRectangle(rect:YOrientedRectangle, init:Boolean = true)
Creates a new instance using the provided rectangle's values to initialize anchor, size, and up vector. | YOrientedRectangle | ||
adoptValues(other:YOrientedRectangle):void
Copies the actual values from the given OrientedRectangle to this instance. | YOrientedRectangle | ||
calcPoints(rect:YOrientedRectangle):Vector.<Object> [static]
Determines the four corner points of an oriented rectangle. | YOrientedRectangle | ||
calcPointsInDouble(rect:YOrientedRectangle):Vector.<Number> [static]
Determines the coordinates of the four corners of an oriented rectangle. | YOrientedRectangle | ||
contains(x:Number, y:Number):Boolean
Determines whether or not the specified point lies inside this oriented rectangle. | YOrientedRectangle | ||
contains2(x:Number, y:Number, closed:Boolean):Boolean
Determines whether or not the specified point lies inside this oriented rectangle. | YOrientedRectangle | ||
[static]
Determines whether the given oriented rectangle contains the provided point, using an epsilon value. | YOrientedRectangle | ||
[static]
Determines whether the given rectangle r1 contains rectangle r2, using an epsilon value. | YOrientedRectangle | ||
contains5(rect:YOrientedRectangle, x:Number, y:Number, eps:Number):Boolean [static]
Determines whether the given oriented rectangle contains the provided point, using an epsilon value. | YOrientedRectangle | ||
equals(o:Object):Boolean [override] | YOrientedRectangle | ||
getClass():Class [override] | YOrientedRectangle | ||
getMovedInstance(dx:Number, dy:Number):YOrientedRectangle
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. | YOrientedRectangle | ||
getResizedInstance(width:Number, height:Number):YOrientedRectangle
Creates a new OrientedRectangle instance that has the specified width and height, but has the same anchor point and up vector as this rectangle. | YOrientedRectangle | ||
hashCode():int [override] | YOrientedRectangle | ||
[static]
Determines an intersection point of the specified oriented rectangle and the specified line segment. | YOrientedRectangle | ||
[static]
Determines whether a rectangle intersects an oriented rectangle, given an epsilon. | YOrientedRectangle | ||
[static]
Determines whether or not the specified oriented rectangle and the specified line segment intersect. | YOrientedRectangle | ||
moveBy(dx:Number, dy:Number):void
Moves this rectangle by applying the offset to the anchor. | YOrientedRectangle | ||
[static]
Creates a new instance using the provided rectangle's values to initialize anchor, size, and up vector. | YOrientedRectangle | ||
[static]
Creates a new instance using the provided rectangle's values to initialize anchor and size. | YOrientedRectangle | ||
[static]
Creates a new instance using the provided values to initialize the anchor and size. | YOrientedRectangle | ||
[static]
Creates a new instance using the provided values to initialize anchor, size, and up vector. | YOrientedRectangle | ||
newYOrientedRectangle5(anchorX:Number, anchorY:Number, width:Number, height:Number):YOrientedRectangle [static]
Creates a new instance using the provided values to initialize anchor and size. | YOrientedRectangle | ||
newYOrientedRectangle6(anchorX:Number, anchorY:Number, width:Number, height:Number, upX:Number, upY:Number):YOrientedRectangle [static]
Creates a new instance using the provided values to initialize anchor, size, and up vector. | YOrientedRectangle | ||
setAnchor(x:Number, y:Number):void
Sets the anchor of this rectangle. | YOrientedRectangle | ||
setCenter(cx:Number, cy:Number):void
Sets the anchor of the OrientedRectangle so that the center of the rectangle coincides with the given coordinate pair. | YOrientedRectangle | ||
setSize(width:Number, height:Number):void
Sets the size of this rectangle. | YOrientedRectangle | ||
setUpVector(upX:Number, upY:Number):void
Sets the components of the up vector to the new values. | YOrientedRectangle | ||
toString():String | YOrientedRectangle |
Method | Defined By | ||
---|---|---|---|
initYOrientedRectangle1(rect:YOrientedRectangle):void
Initializes this object. | YOrientedRectangle | ||
initYOrientedRectangle2(rect:YRectangle):void
Initializes this object. | YOrientedRectangle | ||
Initializes this object. | YOrientedRectangle | ||
Initializes this object. | YOrientedRectangle | ||
initYOrientedRectangle5(anchorX:Number, anchorY:Number, width:Number, height:Number):void
Initializes this object. | YOrientedRectangle | ||
initYOrientedRectangle6(anchorX:Number, anchorY:Number, width:Number, height:Number, upX:Number, upY:Number):void
Initializes this object. | YOrientedRectangle |
anchor | property |
anchor:YPoint
Getter: Returns the anchor of this oriented rectangle.
Setter: Sets the anchor of this rectangle. public function get anchor():YPoint
public function set anchor(value:YPoint):void
anchorX | property |
anchorX:Number
[read-only] Returns the x-coordinate of this rectangle's anchor point.
public function get anchorX():Number
anchorY | property |
anchorY:Number
[read-only] Returns the y-coordinate of this rectangle's anchor point.
public function get anchorY():Number
angle | property |
angle:Number
Specifies the angle (measured in radians) of this rectangle.
The angle of an oriented rectangle is the angle between the vector (0, -1)
and the rectangle's up vector in counter clockwise order. An angle of 0 means the up vector points up in direction (0, -1)
.
public function get angle():Number
public function set angle(value:Number):void
boundingBox | property |
boundingBox:YRectangle
[read-only] Calculates the paraxial bounding box of this oriented rectangle.
public function get boundingBox():YRectangle
center | property |
center:YPoint
Getter: Returns the current center of the oriented rectangle.
Setter: Sets the anchor of the OrientedRectangle so that the center of the rectangle coincides with the given point. public function get center():YPoint
public function set center(value:YPoint):void
empty | property |
empty:Boolean
[read-only] Returns whether this instance has negative width or height.
public function get empty():Boolean
height | property |
height:Number
[read-only] Returns the height of this rectangle.
public function get height():Number
size | property |
size:YDimension
Specifies the size of this rectangle.
public function get size():YDimension
public function set size(value:YDimension):void
upX | property |
upX:Number
[read-only] Returns the x-component of this rectangle's up vector.
public function get upX():Number
upY | property |
upY:Number
[read-only] Returns the y-component of this rectangle's up vector.
public function get upY():Number
width | property |
width:Number
[read-only] Returns the width of this rectangle.
public function get width():Number
YOrientedRectangle | () | Constructor |
public function YOrientedRectangle(rect:YOrientedRectangle, init:Boolean = true)
Creates a new instance using the provided rectangle's values to initialize anchor, size, and up vector.
Parametersrect:YOrientedRectangle — the provided rectangle.
| |
init:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
adoptValues | () | method |
public function adoptValues(other:YOrientedRectangle):void
Copies the actual values from the given OrientedRectangle
to this instance.
Parameters
other:YOrientedRectangle — the OrientedRectangle to retrieve the values from
|
calcPoints | () | method |
public static function calcPoints(rect:YOrientedRectangle):Vector.<Object>
Determines the four corner points of an oriented rectangle.
Parameters
rect:YOrientedRectangle — The rectangle to determine the bounds.
|
Vector.<Object> — the array of corner points.
|
calcPointsInDouble | () | method |
public static function calcPointsInDouble(rect:YOrientedRectangle):Vector.<Number>
Determines the coordinates of the four corners of an oriented rectangle.
Parameters
rect:YOrientedRectangle — The rectangle to determine the bounds.
|
Vector.<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
|
contains | () | method |
public function contains(x:Number, y:Number):Boolean
Determines whether or not the specified point lies inside this oriented rectangle.
Parameters
x:Number — the x-coordinate of the point to check.
| |
y:Number — the y-coordinate of the point to check.
|
Boolean — true iff the specified point lies inside; false otherwise.
|
contains2 | () | method |
public function contains2(x:Number, y:Number, closed:Boolean):Boolean
Determines whether or not the specified point lies inside this oriented rectangle.
Parameters
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.
|
Boolean — true iff the specified point lies inside; false otherwise.
|
contains3 | () | method |
public static function contains3(rect:YOrientedRectangle, p:YPoint, eps:Number):Boolean
Determines whether the given oriented rectangle contains the provided point, using an epsilon value.
Parameters
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.
|
Boolean — true if the point lies inside the rectangle; false otherwise.
|
contains4 | () | method |
public static function contains4(r1:YOrientedRectangle, r2:YOrientedRectangle, eps:Number):Boolean
Determines whether the given rectangle r1 contains rectangle r2, using an epsilon value.
Parameters
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.
|
Boolean — true iff the r1 contains r2.
|
contains5 | () | method |
public static function contains5(rect:YOrientedRectangle, x:Number, y:Number, eps:Number):Boolean
Determines whether the given oriented rectangle contains the provided point, using an epsilon value.
Parameters
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.
|
Boolean — true if the point lies inside the rectangle; false otherwise.
|
equals | () | method |
override public function equals(o:Object):Boolean
Parameters
o:Object |
Boolean |
getClass | () | method |
override public function getClass():Class
ReturnsClass |
getMovedInstance | () | method |
public function getMovedInstance(dx:Number, dy:Number):YOrientedRectangle
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
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.
|
YOrientedRectangle — a new OrientedRectangle instance whose anchor point is moved by the specified distance values.
|
getResizedInstance | () | method |
public function getResizedInstance(width:Number, height:Number):YOrientedRectangle
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
width:Number — the width of the new rectangle.
| |
height:Number — the height of the new rectangle.
|
YOrientedRectangle — a new OrientedRectangle instance that has the specified width and height.
|
hashCode | () | method |
override public function hashCode():int
Returnsint |
initYOrientedRectangle1 | () | method |
protected final function initYOrientedRectangle1(rect:YOrientedRectangle):void
Initializes this object. See the documentation of the corresponding factory method newYOrientedRectangle1()
for details.
Parameters
rect:YOrientedRectangle |
See also
initYOrientedRectangle2 | () | method |
protected final function initYOrientedRectangle2(rect:YRectangle):void
Initializes this object. See the documentation of the corresponding factory method newYOrientedRectangle2()
for details.
Parameters
rect:YRectangle |
See also
initYOrientedRectangle3 | () | method |
protected final function initYOrientedRectangle3(anchor:YPoint, size:YDimension):void
Initializes this object. See the documentation of the corresponding factory method newYOrientedRectangle3()
for details.
Parameters
anchor:YPoint | |
size:YDimension |
See also
initYOrientedRectangle4 | () | method |
protected final function initYOrientedRectangle4(position:YPoint, size:YDimension, upVector:YVector):void
Initializes this object. See the documentation of the corresponding factory method newYOrientedRectangle4()
for details.
Parameters
position:YPoint | |
size:YDimension | |
upVector:YVector |
See also
initYOrientedRectangle5 | () | method |
protected final function initYOrientedRectangle5(anchorX:Number, anchorY:Number, width:Number, height:Number):void
Initializes this object. See the documentation of the corresponding factory method newYOrientedRectangle5()
for details.
Parameters
anchorX:Number | |
anchorY:Number | |
width:Number | |
height:Number |
See also
initYOrientedRectangle6 | () | method |
protected final function initYOrientedRectangle6(anchorX:Number, anchorY:Number, width:Number, height:Number, upX:Number, upY:Number):void
Initializes this object. See the documentation of the corresponding factory method newYOrientedRectangle6()
for details.
Parameters
anchorX:Number | |
anchorY:Number | |
width:Number | |
height:Number | |
upX:Number | |
upY:Number |
See also
intersectionPoint | () | method |
public static function intersectionPoint(rect:YOrientedRectangle, line:LineSegment, eps:Number):YPoint
Determines an intersection point of the specified oriented rectangle and the specified line segment.
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
rect:YOrientedRectangle | |
line:LineSegment | |
eps:Number |
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.
|
intersects | () | method |
public static function intersects(orientedRectangle:YOrientedRectangle, rectangle:YRectangle, eps:Number):Boolean
Determines whether a rectangle intersects an oriented rectangle, given an epsilon.
Parameters
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 it's distance is less than or equal to that value, it will be considered a hit.
|
Boolean — Whether they have a non-empty intersection.
|
intersects2 | () | method |
public static function intersects2(rect:YOrientedRectangle, line:LineSegment, eps:Number):Boolean
Determines whether or not the specified oriented rectangle and the specified line segment intersect.
Parameters
rect:YOrientedRectangle | |
line:LineSegment | |
eps:Number |
Boolean — true if the rectangle and the segment intersect and false otherwise.
|
moveBy | () | method |
public function moveBy(dx:Number, dy:Number):void
Moves this rectangle by applying the offset to the anchor.
Parameters
dx:Number — The x offset to move the rectangle's position by.
| |
dy:Number — The y offset to move the rectangle's position by.
|
newYOrientedRectangle1 | () | method |
public static function newYOrientedRectangle1(rect:YOrientedRectangle):YOrientedRectangle
Creates a new instance using the provided rectangle's values to initialize anchor, size, and up vector.
Parameters
rect:YOrientedRectangle — the provided rectangle.
|
YOrientedRectangle |
newYOrientedRectangle2 | () | method |
public static function newYOrientedRectangle2(rect:YRectangle):YOrientedRectangle
Creates a new instance using the provided rectangle's values to initialize anchor and size.
The oriented rectangle's up vector will be (0, -1)
.
Parameters
rect:YRectangle — the provided rectangle.
|
YOrientedRectangle |
newYOrientedRectangle3 | () | method |
public static function newYOrientedRectangle3(anchor:YPoint, size:YDimension):YOrientedRectangle
Creates a new instance using the provided values to initialize the anchor and size.
The oriented rectangle's up vector will be (0, -1)
.
Parameters
anchor:YPoint — The provider for the dynamic anchor of this instance.
| |
size:YDimension — The provider for the dynamic size of this instance.
|
YOrientedRectangle |
newYOrientedRectangle4 | () | method |
public static function newYOrientedRectangle4(position:YPoint, size:YDimension, upVector:YVector):YOrientedRectangle
Creates a new instance using the provided values to initialize anchor, size, and up vector.
Parameters
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.
|
YOrientedRectangle |
newYOrientedRectangle5 | () | method |
public static function newYOrientedRectangle5(anchorX:Number, anchorY:Number, width:Number, height:Number):YOrientedRectangle
Creates a new instance using the provided values to initialize anchor and size.
The oriented rectangle's up vector will be (0, -1)
.
Parameters
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 |
newYOrientedRectangle6 | () | method |
public static function newYOrientedRectangle6(anchorX:Number, anchorY:Number, width:Number, height:Number, upX:Number, upY:Number):YOrientedRectangle
Creates a new instance using the provided values to initialize anchor, size, and up vector.
Parameters
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.
|
YOrientedRectangle |
setAnchor | () | method |
public function setAnchor(x:Number, y:Number):void
Sets the anchor of this rectangle.
Parameters
x:Number — the new x-coordinate of the anchor point.
| |
y:Number — the new y-coordinate of the anchor point.
|
setCenter | () | method |
public function setCenter(cx:Number, cy:Number):void
Sets the anchor of the OrientedRectangle so that the center of the rectangle coincides with the given coordinate pair.
Parameters
cx:Number — The x coordinate of the center.
| |
cy:Number — The y coordinate of the center.
|
setSize | () | method |
public function setSize(width:Number, height:Number):void
Sets the size of this rectangle.
Parameters
width:Number — the new width.
| |
height:Number — the new height.
|
setUpVector | () | method |
public function setUpVector(upX:Number, upY:Number):void
Sets the components of the up vector to the new values.
Parameters
upX:Number — The x component of the normalized up vector.
| |
upY:Number — The y component of the normalized up vector.
|
toString | () | method |
public function toString():String
ReturnsString |