Provides standard geometry mathematical functions including circle and linear equations, still updating. It is very helpful while drawing lines and shapes on canvas.
Features
- Provide linear equation.
- Provide circle equation.
- Calculate the relations among linear, circle equation and points.
Contents
Usage
Linear Euation
final line = MathHelper.getLineEquation(offset1, offset2);
Circle Equation
offset is center point, radius is radius of the circle.
final circle = MathHelper.getCircleEquation(offset, radius);
Distance
/// Calculate the distacne between two point
final distance = MathHelper.getDistanceBetweenTwoPoint(offset1, offset2);
/// Find the point of intersection between the given point and the given line perpendicular to it
final distance = MathHelper.getPointVerticalToLine(line, offset);
Intersections
/// Intersection between Line and Circle
final points = MathHelper.getIntersectionBetweenCircleAndLine(line, circle);
/// Get the perpendicular equation from p1 and given linear equation
final line = MathHelper.getIntersection(line, offset);
/// Get the intersection point of two linear equation, if there is no intersection point, will return null
final point = MathHelper.getTwoLineIntersection(line, line2);
/// Find the point of intersection between the given point and the given line perpendicular to it
final point = MathHelper.getPointVerticalToLine(line, offset);