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
-
numberDistance between the two points.
geometry.getNormalOnEdge(edge, t)
Arguments
- edge
EdgeAn edge - t
numberThe interpolation value bounded in [0;1].
Returns
-
object{x,y} The normal to the edge at t
geometry.getPointOnEdge(edge, t)
Arguments
- edge
EdgeAn edge - t
numberThe 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
numberX position of the source - y1
numberY position of the source - x2
numberX position of the target - y2
numberY position of the target - curvature
numberThe curvature factor of the edge - dest?
PointA Point to write in the result
Returns
-
PointThe control point used to draw a curved edge.
geometry.getTangentOnEdge(edge, t)
Arguments
- edge
EdgeAn edge - t
numberThe interpolation value bounded in [0;1].
Returns
-
object{x,y} The tangent to the edge at t