new Vector(vertA, vertB)
The constructor.
Parameters:
Name | Type | Description |
---|---|---|
vertA |
Vertex | The start vertex of the vector. |
vertB |
Vertex | The end vertex of the vector. |
Extends
Members
a :Vertex
Type:
b :Vertex
Type:
Methods
angle(line) → {number}
Get the angle between this and the passed line (in radians).
Parameters:
Name | Type | Description |
---|---|---|
line |
Line | The line to calculate the angle to. |
- Inherited From:
- Source:
Returns:
this
- Type
- number
getClosestT(p) → {number}
Get the closest position T from this line to the specified point.
The counterpart for this function is Line.vertAt(Number).
Parameters:
Name | Type | Description |
---|---|---|
p |
Vertex | The point (vertex) to measre the distance to. |
- Inherited From:
- Source:
Returns:
The line position t of minimal distance to p.
- Type
- number
intersection(line) → {Vertex}
Get the intersection if this line and the specified line.
Parameters:
Name | Type | Description |
---|---|---|
line |
Line | The second line. |
- Inherited From:
- Source:
Returns:
The intersection (may lie outside the end-points).
- Type
- Vertex
length()
Get the length of this line.
- Inherited From:
- Source:
normalize() → {Line}
Normalize this line (set to length 1).
- Inherited From:
- Source:
Returns:
this
- Type
- Line
pointDistance(p) → {number}
The the minimal distance between this line and the specified point.
Parameters:
Name | Type | Description |
---|---|---|
p |
Vertex | The point (vertex) to measre the distance to. |
- Inherited From:
- Source:
Returns:
The absolute minimal distance.
- Type
- number
scale(factor) → {Line}
Scale this line by the given factor.
Parameters:
Name | Type | Description |
---|---|---|
factor |
number | The factor for scaling (1.0 means no scale). |
- Inherited From:
- Source:
Returns:
this
- Type
- Line
sub(amount) → {Line}
Substract the given vertex from this line's end points.
Parameters:
Name | Type | Description |
---|---|---|
amount |
Vertex | The amount (x,y) to substract. |
Returns:
this
- Type
- Line
toSVGString(p) → {string}
Create an SVG representation of this line.
Parameters:
Name | Type | Description |
---|---|---|
p |
options | A set of options, like the 'classname' to use for the line object. |
- Overrides:
- Source:
Returns:
The SVG string representing this line.
- Type
- string
totring() → {string}
Create a string representation of this line.
- Inherited From:
- Source:
Returns:
The string representing this line.
- Type
- string
vertAt(t) → {Vertex}
Get line point at position t in [0 ... 1]:
The counterpart of this function is Line.getClosestT(Vertex).
[P(0)]=[A]--------------------[P(t)]------[B]=[P(1)]
The counterpart of this function is Line.getClosestT(Vertex).
Parameters:
Name | Type | Description |
---|---|---|
t |
number | The position scalar. |
- Inherited From:
- Source:
Returns:
The vertex a position t.
- Type
- Vertex