Required to generate proper CSS classes and other class related IDs.
The UID of this drawable object.
An epsilon for comparison
Set both coordinates of this vertex to their absolute value (abs(x), abs(y)).
this
Add the passed amounts to the x-component of this vertex.
this
Add the passed amounts to the x- and y- components of this vertex.
this
Add the passed amounts to the y-component of this vertex.
this
Get the angle of this point (relative to (0,0) or to the given other origin point).
The vertex to measure the angle from.
Create a copy of this vertex.
A new vertex, an exact copy of this.
This function should invalidate any installed listeners and invalidate this object. After calling this function the object might not hold valid data any more and should not be used.
Get the distance to the passed point (in euclidean metric)
The vertex to measure the distance to.
Check if this vertex equals the passed one.
This function uses an internal epsilon as tolerance.
The vertex to compare this with.
Change this vertex (x,y) to its inverse (-x,-y).
this
Set the x-component if this vertex to the inverse of its value.
this
Set the y-component if this vertex to the inverse of its value.
this
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
Round the two components x and y of this vertex.
this
Set the x-component of this vertex.
The new x-component.
this
Set the y-component of this vertex.
The new y-component.
this
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).
The amount to substract from y.
this
Substract the passed amounts from the x-component of this vertex.
this
Substract the passed amounts from the x- and y- components of this vertex.
this
Substract the passed amounts from the y-component of this vertex.
this
Get a string representation of this vertex.
The string representation of this vertex.
Convert the given vertices (array) to a JSON string.
(optional) The numeric precision to be used (number of precision digits).
Generate 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.
Generated using TypeDoc
A vertex is a pair of two numbers.
It is used to identify a 2-dimensional point on the x-y-plane.
IVertexAttr
SVGSerializable
UID
UIDGenerator
VertexAttr
VertexListeners
XYCoords