Class: Line

algo.layout. Line

new Line(x1, y1, x2, y2)

a line object. Has vector like properties as well an intersection testing. Most usefully, it has a static getConnector method that returns a line attached to the boundary of any pair of objects with vector/line/circle/box type properties
Parameters:
Name Type Description
x1
y1
x2
y2
Source:

Methods

<static> bottomEdge(r) → {algo.layout.Line}

return a line representing the bottom edge of any box/rectangle like object
Parameters:
Name Type Description
r * a rectangle like object
Source:
Returns:
Type
algo.layout.Line

<static> getConnector(start, end)

return a line object that connects the boundary of start to the boundary of end. degenerates cases (overlapping objects etc) will return a line connecting the center of the objects. start and end can be any combination of point like, rectangle like or circle like objects e.g. algo.layout.Vector or {x:0, y:0} or algo.layout.Rect or algo.render.Rect etc.
Parameters:
Name Type Description
start see above
end see above
Source:

<static> leftEdge(r) → {algo.layout.Line}

return a line representing the left edge of any box/rectangle like object
Parameters:
Name Type Description
r * a rectangle like object
Source:
Returns:
Type
algo.layout.Line

<static> rightEdge(r) → {algo.layout.Line}

return a line representing the right edge of any box/rectangle like object
Parameters:
Name Type Description
r * a rectangle like object
Source:
Returns:
Type
algo.layout.Line

<static> topEdge(r) → {algo.layout.Line}

return a line representing the top edge of any box/rectangle like object
Parameters:
Name Type Description
r * a rectangle like object
Source:
Returns:
Type
algo.layout.Line

angleStartEnd() → {number}

get the angle in radians between the start and the end of the line
Source:
Returns:
angle in radians between start and end of line
Type
number

intersectWithBox(box) → {algo.layout.Intersection}

intersect the line with a Box. This can result in 0,1,2 points of intersection.
Parameters:
Name Type Description
box any rectangle like object
Source:
Returns:
Type
algo.layout.Intersection

intersectWithCircle(circle) → {algo.layout.Intersection}

line with circle intersection from
Parameters:
Name Type Description
circle circle like object (x/y/radius)
Source:
Returns:
- containing 0 or 1 or 2 points
Type
algo.layout.Intersection

intersectWithLine(other) → {algo.layout.Vector}

intersection of this line with another line.
Parameters:
Name Type Description
other algo.layout.Line other line segment to intersect with
Source:
Returns:
Type
algo.layout.Vector