Required to generate proper CSS classes and other class related IDs.
An epsilon for comparison
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
Create a copy of this vertex.
A new vertex, an exact copy of this.
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
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
Convert this vertex to SVG code.
An optional set of options, like 'className'.
A string representing the SVG code for this vertex.
Get a string representation of this vertex.
The string representation of this vertex.
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
VertexAttr
VertexListeners
XYCoords