Appearance
geometry
Ogma static toolbox for geometry purposes
geometry.computeCentroid(points)
Returns the average of the specified points
Arguments
- points
Array<{x: number, y: number}>
Returns
-
{x: number, y: number}
geometry.distance(x1, y1, x2, y2)
Arguments
- x1
number
- y1
number
- x2
number
- y2
number
Returns
-
number
Distance between the two points.
geometry.getNormalOnEdge(edge, t)
Arguments
- edge
Edge
An edge - t
number
The interpolation value bounded in [0;1].
Returns
-
object
{x,y} The normal to the edge at t
geometry.getPointOnEdge(edge, t)
Arguments
- edge
Edge
An edge - t
number
The interpolation value bounded in [0;1].
Returns
-
object
{x,y} The position on the edge at t
geometry.getQuadraticCurveControlPoint(x1, y1, x2, y2, curvature, dest?)
Arguments
- x1
number
X position of the source - y1
number
Y position of the source - x2
number
X position of the target - y2
number
Y position of the target - curvature
number
The curvature factor of the edge - dest?
Point
A Point to write in the result
Returns
-
Point
The control point used to draw a curved edge.
geometry.getTangentOnEdge(edge, t)
Arguments
- edge
Edge
An edge - t
number
The interpolation value bounded in [0;1].
Returns
-
object
{x,y} The tangent to the edge at t