Multiline

Multiline

Class Multiline represent connected path of edges, where each edge may be segment, arc, line or ray

Constructor

new Multiline()

Source:

Classes

Multiline

Members

box

(Getter) Return bounding box of the multiline
Source:

edges

(Getter) Return array of edges
Source:

vertices

(Getter) Returns array of vertices
Source:

Methods

addVertex(pt, edge) → {Edge}

Split edge and add new vertex, return new edge inserted
Source:
Parameters:
Name Type Description
pt Point point on edge that will be added as new vertex
edge Edge edge to split
Returns:
Type:
Edge

clone() → {Multiline}

Return new cloned instance of Multiline
Source:
Returns:
Type:
Multiline

dpath() → {*}

Return string to be assigned to 'd' attribute of element
Source:
Returns:
Type:
*

findEdgeByPoint(pt) → {Edge}

Returns edge which contains given point
Source:
Parameters:
Name Type Description
pt Point
Returns:
Type:
Edge

rotate(angle, center) → {Multiline}

Return new multiline rotated by given angle around given point If point omitted, rotate around origin (0,0) Positive value of angle defines rotation counterclockwise, negative - clockwise
Source:
Parameters:
Name Type Default Description
angle number 0 rotation angle in radians
center Point rotation center, default is (0,0)
Returns:
Type:
Multiline
- new rotated polygon

setArcLength()

Set arc_length property for each of the edges in the face. Arc_length of the edge it the arc length from the first edge of the face
Source:

split(ip) → {Multiline}

Split edges of multiline with intersection points and return mutated multiline
Source:
Parameters:
Name Type Description
ip Array.<Point> array of points to be added as new vertices
Returns:
Type:
Multiline

svg(attrs) → {string}

Return string to draw multiline in svg
Source:
Parameters:
Name Type Description
attrs an object with attributes for svg path element TODO: support semi-infinite Ray and infinite Line
Returns:
Type:
string

svgPoints() → {string}

Return string to be inserted into 'points' attribute of element
Source:
Returns:
Type:
string

toJSON() → {Object}

This method returns an object that defines how data will be serialized when called JSON.stringify() method
Source:
Returns:
Type:
Object

toShapes() → {Array.<Shape>}

Transform multiline into array of shapes
Source:
Returns:
Type:
Array.<Shape>

transform(matrix) → {Multiline}

Return new multiline transformed using affine transformation matrix Method does not support unbounded shapes
Source:
Parameters:
Name Type Description
matrix Matrix affine transformation matrix
Returns:
Type:
Multiline
- new multiline

translate(vec) → {Multiline}

Returns new multiline translated by vector vec
Source:
Parameters:
Name Type Description
vec Vector
Returns:
Type:
Multiline