Package | com.yworks.canvas.geom |
Class | public class OrientedRectangle |
Inheritance | OrientedRectangle Object |
Implements | IMovable, IMutableOrientedRectangle |
IMutablePoint
and IMutableSize
as well as two doubles for the up vector components.
This implementation delegates the storage to implementations of
IMutablePoint
for the anchor of the oriented rectangle.
and IMutableSize
for the size of the oriented rectangle.
members. As a convenience it implements the IMovable
and the
IMutablePoint
interfaces.
Property | Defined By | ||
---|---|---|---|
anchor : IPoint
The IPointinstance that stores the anchor of this oriented rectangle. | OrientedRectangle | ||
anchorX : Number
The x coordinate of the anchor of this instance from the
anchor instance. | OrientedRectangle | ||
anchorY : Number
The y coordinate of the anchor of this instance from the
anchor instance. | OrientedRectangle | ||
angle : Number
The orientation of this rectangle. | OrientedRectangle | ||
EMPTY : OrientedRectangle [static]
An OrientedRectangle instance with width and height set to -1
| OrientedRectangle | ||
height : Number
The height of this instance from the ISize instance. | OrientedRectangle | ||
size : ISize
The ISize instance that stores the size of this rectangle. | OrientedRectangle | ||
upX : Number
Gets or sets the x component of the up vector to the new value. | OrientedRectangle | ||
upY : Number
The y component of the up vector to the new value. | OrientedRectangle | ||
width : Number
The width of this instance from the ISize instance. | OrientedRectangle | ||
x : Number
Gets or sets the y coordinate of the anchor of this instance from the anchor instance. | OrientedRectangle | ||
y : Number
The y coordinate of the anchor of this instance from the anchor instance. | OrientedRectangle |
Method | Defined By | ||
---|---|---|---|
Creates a new instance using the provided values to initialize the anchor and size. | OrientedRectangle | ||
create(x:Number = 0, y:Number = 0, w:Number = -1, h:Number = -1, upX:Number = 0, upY:Number = -1):OrientedRectangle [static]
Creates a new instance using the provided values to initialize
the anchor and size. | OrientedRectangle | ||
[static]
Creates a new instance using the provided rectangle to initialize itself. | OrientedRectangle | ||
empty():Boolean
Returns whether this instance has negative width or height. | OrientedRectangle | ||
Determines the bounds of an oriented rectangle. | OrientedRectangle | ||
moveBy(dx:Number, dy:Number):Boolean
Moves this rectangle by applying the offset to the anchor
| OrientedRectangle | ||
moveByDx(dx:Number):Boolean
Moves this rectangle by applying the offset to the anchor
| OrientedRectangle | ||
moveByDy(dy:Number):Boolean
Moves this rectangle by applying the offset to the anchor
| OrientedRectangle | ||
setAngle(value:Number):void Deprecated: Please Use angle
Sets the orientation of this rectangle. | OrientedRectangle | ||
Sets the center of the oriented rectangle to the given value. | OrientedRectangle | ||
setUpVector(upX:Number, upY:Number):void
Sets the components of the up vector to the new values. | OrientedRectangle | ||
setValues(rectangle:IOrientedRectangle):void
Sets the values of this instance to the values provided by the given instance. | OrientedRectangle |
anchor | property |
anchor:IPoint
The IPoint
instance that stores the anchor of this oriented rectangle.
This will return a live view of the anchor of this rectangle. However setting an anchor instance will only copy the values of the point provided to the current anchor.
public function get anchor():IPoint
public function set anchor(value:IPoint):void
anchorX | property |
anchorX:Number
The x coordinate of the anchor of this instance from the
anchor
instance.
public function get anchorX():Number
public function set anchorX(value:Number):void
anchorY | property |
anchorY:Number
The y coordinate of the anchor of this instance from the
anchor
instance.
public function get anchorY():Number
public function set anchorY(value:Number):void
angle | property |
angle:Number
The orientation of this rectangle.
An angle of 0
means the up vector points up in direction
(0,-1)
.
The value is not stored and will be recalculated
using Math.atan2( -upY, -upX );
every time this is invoked, so
this is a costly method.
Setting the angle results in:
upX = -Math.sin( value );
upY = -Math.cos( value );
public function get angle():Number
public function set angle(value:Number):void
EMPTY | property |
public static var EMPTY:OrientedRectangle
An OrientedRectangle
instance with width
and height
set to -1
height | property |
height:Number
The height of this instance from the ISize
instance.
public function get height():Number
public function set height(value:Number):void
size | property |
size:ISize
The ISize
instance that stores the size of this rectangle.
This will return a live view of the size of this rectangle. However setting a size instance will only copy the values of the size provided to the current size.
public function get size():ISize
public function set size(value:ISize):void
upX | property |
upX:Number
Gets or sets the x component of the up vector to the new value.
It is up to the caller to assure that the values describe a vector of length 1.
public function get upX():Number
public function set upX(value:Number):void
upY | property |
upY:Number
The y component of the up vector to the new value.
It is up to the caller to assure that the values describe a vector of length 1.
public function get upY():Number
public function set upY(value:Number):void
width | property |
width:Number
The width of this instance from the ISize
instance.
public function get width():Number
public function set width(value:Number):void
x | property |
x:Number
Gets or sets the y coordinate of the anchor of this instance from the anchor
instance.
public function get x():Number
public function set x(value:Number):void
y | property |
y:Number
The y coordinate of the anchor of this instance from the anchor
instance.
public function get y():Number
public function set y(value:Number):void
OrientedRectangle | () | Constructor |
public function OrientedRectangle(position:YPoint, size:IMutableSize, upX:Number = 0, upY:Number = -1)
Creates a new instance using the provided values to initialize the anchor and size.
The up vector will be initialized to (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.
Parametersposition:YPoint — The provider for the dynamic anchor of this instance.
| |
size:IMutableSize — The provider for the dynamic size of this instance.
| |
upX:Number (default = 0 )
| |
upY:Number (default = -1 )
|
create | () | method |
public static function create(x:Number = 0, y:Number = 0, w:Number = -1, h:Number = -1, upX:Number = 0, upY:Number = -1):OrientedRectangle
Creates a new instance using the provided values to initialize the anchor and size.
The up vector will be initialized to (0, -1)
.
Parameters
x:Number (default = 0 ) — The x coordinate of the anchor of the oriented rectangle.
| |
y:Number (default = 0 ) — The y coordinate of the anchor of the oriented rectangle.
| |
w:Number (default = -1 ) — The width of the rectangle.
| |
h:Number (default = -1 ) — The height of the rectangle.
| |
upX:Number (default = 0 )
| |
upY:Number (default = -1 )
|
OrientedRectangle |
createFromOrientedRectangle | () | method |
public static function createFromOrientedRectangle(orientedRectangle:IOrientedRectangle):OrientedRectangle
Creates a new instance using the provided rectangle to initialize itself.
This will basically create a copy of the given rectangle.
Parameters
orientedRectangle:IOrientedRectangle — The rectangle to initialize the anchor and size from.
|
OrientedRectangle |
empty | () | method |
public function empty():Boolean
Returns whether this instance has negative width or height.
ReturnsBoolean — true if width or height is negative
|
getBounds | () | method |
public function getBounds():IRectangle
Determines the bounds of an oriented rectangle.
Bounding rectangles are parallel to the coordinate axes.
ReturnsIRectangle — the bounds.
|
moveBy | () | method |
public function moveBy(dx:Number, dy:Number):Boolean
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.
|
Boolean — true if dx != 0 || dy != 0 .
|
moveByDx | () | method |
public function moveByDx(dx:Number):Boolean
Moves this rectangle by applying the offset to the anchor
Parameters
dx:Number — The offset to move the rectangle's position by.
|
Boolean — true if dx != 0 .
|
moveByDy | () | method |
public function moveByDy(dy:Number):Boolean
Moves this rectangle by applying the offset to the anchor
Parameters
dy:Number — The offset to move the rectangle's position by.
|
Boolean — true if dy != 0 .
|
setAngle | () | method |
public function setAngle(value:Number):void
Sets the orientation of this rectangle.
Parameters
value:Number |
setCenter | () | method |
public function setCenter(center:IPoint):void
Sets the center of the oriented rectangle to the given value.
Parameters
center:IPoint — The coordinates of the new center.
|
setUpVector | () | method |
public function setUpVector(upX:Number, upY:Number):void
Sets the components of the up vector to the new values.
It is up to the caller to assure that the values describe a vector of length 1.
Parameters
upX:Number — The x component of the normalized up vector.
| |
upY:Number — The y component of the normalized up vector.
|
setValues | () | method |
public function setValues(rectangle:IOrientedRectangle):void
Sets the values of this instance to the values provided by the given instance.
Parameters
rectangle:IOrientedRectangle |