Readonly
classRequired to generate proper CSS classes and other class related IDs.
isDestroyed
Vertex
Readonly
uidThe UID of this drawable object.
Vertex
Vertex
Vertex
Static
Readonly
Private
EPSILONAn epsilon for comparison
Static
Private
Readonly
ZEROStatic
utilsGenerate a four-point arrow head, starting at the vector end minus the arrow head length.
The first vertex in the returned array is guaranteed to be the located at the vector line end minus the arrow head length.
Due to performance all params are required.
The params scaleX and scaleY are required for the case that the scaling is not uniform (x and y scaling different). Arrow heads should not look distored on non-uniform scaling.
If unsure use 1.0 for scaleX and scaleY (=no distortion). For headlen use 8, it's a good arrow head size.
Example: buildArrowHead( new Vertex(0,0), new Vertex(50,100), 8, 1.0, 1.0 )
The start vertex of the vector to calculate the arrow head for.
The end vertex of the vector.
The length of the arrow head (along the vector direction. A good value is 12).
The horizontal scaling during draw.
the vertical scaling during draw.
Convert the given vertices (array) to a JSON string.
Optional
precision: number(optional) The numeric precision to be used (number of precision digits).
Add the passed amount to x- and y- component of this vertex.
This function works with add( {number}, {number} ) and
add( {Vertex} ), as well.
The amount to add to x (or a vertex itself).
Optional
y: numberThe amount to add to y.
this
add
Vertex
Get the angle of this point (relative to (0,0) or to the given other origin point).
Optional
origin: XYCoordsThe vertex to measure the angle from.
angle
Vertex
Get the distance to the passed point (in euclidean metric)
The vertex to measure the distance to.
distance
Vertex
Check if this vertex equals the passed one.
This function uses an internal epsilon as tolerance.
The vertex to compare this with.
equals
Vertex
Perform a linear interpolation towards the given target vertex.
The amount value t
is relative, t=0.0
means no change, t=1.0
means this point will be moved to the exact target position.
t=0.5
will move this point to the middle of the connecting
linear segment.
The target position to lerp this vertex to.
The relative amount, usually in [0..1], but other values will work, too.
Perform a linear interpolation towards the given target vertex (absolute variant).
The amount value t
is absolute, which means the lerp amount is a direct distance
value. This point will have move the amount of the passed distance u
.
The target position to lerp this vertex to.
Multiply both components of this vertex with the given scalar.
Note: as in
https://threejs.org/docs/#api/math/Vector2.multiplyScalar
The scale factor; 1.0 means no change.
this
multiplyScalar
Vertex
This is a vector-like behavior and 'scales' this vertex towards/from a given center by one uniform scale factor.
The factor to 'scale' this vertex; 1.0 means no change.
Optional
center: XYCoordsThe origin of scaling; default is (0,0).
this
scale
Vertex
Substract the passed amount from x- and y- component of this vertex.
This function works with sub( {number}, {number} ) and
sub( {Vertex} ), as well.
The amount to substract from x (or a vertex itself).
Optional
y: numberThe amount to substract from y.
this
sub
Vertex
Static
random
Classdesc
A vertex is a pair of two numbers.
It is used to identify a 2-dimensional point on the x-y-plane.
Requires
IVertexAttr
Requires
SVGSerializable
Requires
UID
Requires
UIDGenerator
Requires
VertexAttr
Requires
VertexListeners
Requires
XYCoords