Package | com.yworks.yfiles.geom |
Class | public class YVector |
Inheritance | YVector YObject Object |
Property | Defined By | ||
---|---|---|---|
x : Number [read-only]
Returns the first coordinate of the vector. | YVector | ||
y : Number [read-only]
Returns the second coordinate of the vector. | YVector |
Method | Defined By | ||
---|---|---|---|
YVector(dx:Number, dy:Number, init:Boolean = true)
Creates a new vector with given direction. | YVector | ||
Adds a vector to this vector. | YVector | ||
[static]
Adds the vector to a point and returns the resulting point. | YVector | ||
[static]
Adds two vectors and returns the result. | YVector | ||
[static]
Returns the angle (measured in radians) between two vectors in clockwise order (with regards to screen coordinates) from v1 to v2. | YVector | ||
equals(o:Object):Boolean | YObject | ||
getClass():Class [override] | YVector | ||
[static]
Returns this vector with unit length. | YVector | ||
hashCode():int | YObject | ||
length():Number
Returns the length of the vector, this is the value of the euclidean norm. | YVector | ||
[static]
Creates a new vector, whose direction is given by a point. | YVector | ||
[static]
Creates a new vector which is a copy of another vector. | YVector | ||
newYVector3(dx:Number, dy:Number):YVector [static]
Creates a new vector with given direction. | YVector | ||
[static]
Creates a new vector, whose direction is given by two points. | YVector | ||
newYVector5(x1:Number, y1:Number, x2:Number, y2:Number):YVector [static]
Creates a new vector, whose direction is given by two points. | YVector | ||
norm():void
Assigns unit length to the vector.
Postcondition length() == 1.
| YVector | ||
[static]
Returns the vector which is orthogonal to the given one and has unit length. | YVector | ||
[static]
Returns true if vector v1 is on the right side of v2. | YVector | ||
Returns a new YVector instance that is obtained by rotating this vector by the given angle (measured in radians) in clockwise direction (with regards to screen coordinates). | YVector | ||
[static]
Returns the value of the scalar product of two vectors. | YVector | ||
scale(factor:Number):void
Scales the vector by an factor. | YVector | ||
toString():String
Returns a string representation of this vector. | YVector |
Method | Defined By | ||
---|---|---|---|
initYVector1(p1:YPoint):void
Initializes this object. | YVector | ||
initYVector2(v:YVector):void
Initializes this object. | YVector | ||
initYVector3(dx:Number, dy:Number):void
Initializes this object. | YVector | ||
Initializes this object. | YVector | ||
initYVector5(x1:Number, y1:Number, x2:Number, y2:Number):void
Initializes this object. | YVector |
x | property |
x:Number
[read-only] Returns the first coordinate of the vector.
public function get x():Number
y | property |
y:Number
[read-only] Returns the second coordinate of the vector.
public function get y():Number
YVector | () | Constructor |
public function YVector(dx:Number, dy:Number, init:Boolean = true)
Creates a new vector with given direction.
Parametersdx:Number — the first coordinate
| |
dy:Number — the second coordinate
| |
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.
|
add | () | method |
public function add(v:YVector):void
Adds a vector to this vector.
Parameters
v:YVector — the vector to add.
|
addToPoint | () | method |
public static function addToPoint(p:YPoint, v:YVector):YPoint
Adds the vector to a point and returns the resulting point.
Parameters
p:YPoint — a point.
| |
v:YVector — the vector to add to the point.
|
YPoint — p+v
|
addVectors | () | method |
public static function addVectors(v:YVector, w:YVector):YVector
Adds two vectors and returns the result.
Parameters
v:YVector — first vector to sum.
| |
w:YVector — second vector to sum.
|
YVector — v+w
|
angle | () | method |
public static function angle(v1:YVector, v2:YVector):Number
Returns the angle (measured in radians) between two vectors in clockwise order (with regards to screen coordinates) from v1 to v2. Screen coordinates mean positive x-direction is from left to right and positive y-direction is from top to bottom:
0 --> 1 | v 1
Parameters
v1:YVector | |
v2:YVector |
Number |
getClass | () | method |
override public function getClass():Class
ReturnsClass |
getNormal | () | method |
public static function getNormal(v:YVector):YVector
Returns this vector with unit length.
Parameters
v:YVector |
YVector |
initYVector1 | () | method |
protected final function initYVector1(p1:YPoint):void
Initializes this object. See the documentation of the corresponding factory method newYVector1()
for details.
Parameters
p1:YPoint |
See also
initYVector2 | () | method |
protected final function initYVector2(v:YVector):void
Initializes this object. See the documentation of the corresponding factory method newYVector2()
for details.
Parameters
v:YVector |
See also
initYVector3 | () | method |
protected final function initYVector3(dx:Number, dy:Number):void
Initializes this object. See the documentation of the corresponding factory method newYVector3()
for details.
Parameters
dx:Number | |
dy:Number |
See also
initYVector4 | () | method |
protected final function initYVector4(p1:YPoint, p2:YPoint):void
Initializes this object. See the documentation of the corresponding factory method newYVector4()
for details.
Parameters
p1:YPoint | |
p2:YPoint |
See also
initYVector5 | () | method |
protected final function initYVector5(x1:Number, y1:Number, x2:Number, y2:Number):void
Initializes this object. See the documentation of the corresponding factory method newYVector5()
for details.
Parameters
x1:Number | |
y1:Number | |
x2:Number | |
y2:Number |
See also
length | () | method |
public function length():Number
Returns the length of the vector, this is the value of the euclidean norm.
ReturnsNumber — a value > 0.
|
newYVector1 | () | method |
public static function newYVector1(p1:YPoint):YVector
Creates a new vector, whose direction is given by a point.
The vector is defined by p1
- (0,0).
Parameters
p1:YPoint — the point.
|
YVector |
newYVector2 | () | method |
public static function newYVector2(v:YVector):YVector
Creates a new vector which is a copy of another vector.
Parameters
v:YVector — the vector, whose values are copied.
|
YVector |
newYVector3 | () | method |
public static function newYVector3(dx:Number, dy:Number):YVector
Creates a new vector with given direction.
Parameters
dx:Number — the first coordinate
| |
dy:Number — the second coordinate
|
YVector |
newYVector4 | () | method |
public static function newYVector4(p1:YPoint, p2:YPoint):YVector
Creates a new vector, whose direction is given by two points.
The vector is defined by p1
- p2
.
Parameters
p1:YPoint — the first point.
| |
p2:YPoint — the second point.
|
YVector |
newYVector5 | () | method |
public static function newYVector5(x1:Number, y1:Number, x2:Number, y2:Number):YVector
Creates a new vector, whose direction is given by two points.
The vector is defined by (x1 - x2, y1 - y2)
.
Parameters
x1:Number — the X-coordinate of the first point.
| |
y1:Number — the Y-coordinate of the first point.
| |
x2:Number — the X-coordinate of the second point.
| |
y2:Number — the Y-coordinate of the second point.
|
YVector |
norm | () | method |
public function norm():void
Assigns unit length to the vector.
Postcondition length() == 1.
orthoNormal | () | method |
public static function orthoNormal(v:YVector):YVector
Returns the vector which is orthogonal to the given one and has unit length.
Parameters
v:YVector — a vector.
|
YVector — a vector which is orthogonal to v with unit length.
|
rightOf | () | method |
public static function rightOf(v1:YVector, v2:YVector):Boolean
Returns true if vector v1 is on the right side of v2.
Parameters
v1:YVector | |
v2:YVector |
Boolean |
rotate | () | method |
public function rotate(angle:Number):YVector
Returns a new YVector
instance that is obtained by rotating this vector by the given angle (measured in radians) in clockwise direction (with regards to screen coordinates).
Screen coordinates mean positive x-direction is from left to right and positive y-direction is from top to bottom:
0 --> 1 | v 1
Parameters
angle:Number — the angle of rotation in radians.
|
YVector — the rotated vector.
|
scalarProduct | () | method |
public static function scalarProduct(v1:YVector, v2:YVector):Number
Returns the value of the scalar product of two vectors.
Parameters
v1:YVector — the first vector.
| |
v2:YVector — the second vector.
|
Number — v1.x * v2.x + v1.y * v2.y
|
scale | () | method |
public function scale(factor:Number):void
Scales the vector by an factor.
Parameters
factor:Number — the scale factor, with which the length is multiplied.
|
toString | () | method |
public function toString():String
Returns a string representation of this vector.
ReturnsString |