Package mathvoyage
Class vmath.geometry
java.lang.Object
mathvoyage.vmath.geometry
- Enclosing class:
vmath
Contains functions to calculate coordinate geometric operations.
- Author:
- Tahsin Islam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleangleBetweenTwoSlopes(double m1, double m2) Return the angle between two slopes.static doubleareaOfCircle(Point p1, Point p2) Returns the area of a circle given two end points of the radius.static doubleareaOfConvexPolygon(Point[] points) Returns the area of a convex polygon using points inputted in anticlockwise order.static doubleareaOfQuadrilateral(Line l1, Line l2, Line l3, Line l4) Returns the area of a quadrilateral using four lines inputted in anticlockwise order.static doubleareaOfQuadrilateral(Point p1, Point p2, Point p3, Point p4) Returns the area of a quadrilateral using points inputted in anti-clockwise order.static doubleareaOfTriangle(Line l1, Line l2, Line l3) Returns the area of a triangle given three lines.static doubleareaOfTriangle(Point p1, Point p2, Point p3) Returns the area of a triangle given three points.static booleanareThreeLinesSame(Line l1, Line l2, Line l3) Returns if the given three lines are samestatic PointReturns the centroid of given three points.static doublecircumferenceOfCircle(Point p1, Point p2) Returns the circumference of a circle given two end points of the radius.static doubledistance(Point p1, Point p2, DistanceType c) Returns the distance between two points.static doubledistanceBetweenTwoParallelLines(Line l1, Line l2) Returns the distance between two parallel lines.static PointexternalizerPoint(Point p1, Point p2, double m, double n) Returns the externalizer point of two points.static LinegetLineFromIntersectionPoint(Line l1, Line l2, Point p) Returns the line passing through the intersection point of two lines.static LinegetLineFromTwoPoints(Point p1, Point p2) Returns the line passing through two points.static LinegetParallelLine(Line l, Point p) Returns the parallel line of a line passing through a point.static LinegetPerpendicularLine(Line l, Point p) Returns the perpendicular line of a line passing through a point.static PointinterleaverPoint(Point p1, Point p2, double m, double n) Returns the interleave point of two points.static PointintersectionOfTwoLines(Line l1, Line l2) Returns the intersection point of two lines.static booleanReturns if the given two lines are of the given type.static booleanisPointInPolygon(Point[] points, Point p) Returns if the point is inside the polygon or not.static booleanisQuadrilateral(Point p1, Point p2, Point p3, Point p4, quadrilateralType c) Returns if the given four points form a quadrilateral is of the given type.static booleanisTriangle(Point p1, Point p2, Point p3, triangleType c) Returns if the given three points form a triangle is of the given type.static PointReturns the midpoint of given two points.static doubleReturns the perpendicular distance of a point from a line.static doubleReturns the slope of a line.static doubleReturns the slope of a line given two points.
-
Constructor Details
-
geometry
public geometry()
-
-
Method Details
-
distance
Returns the distance between two points.- Parameters:
p1- The first pointp2- The second pointc- The type of distance to return- Returns:
- The distance between the two points
-
slope
Returns the slope of a line given two points.- Parameters:
p1- The first pointp2- The second point- Returns:
- The slope
-
midpoint
Returns the midpoint of given two points.- Parameters:
p1- The first pointp2- The second point- Returns:
- The midpoint
-
centroid
Returns the centroid of given three points.- Parameters:
p1- The first pointp2- The second pointp3- The third point- Returns:
- The centroid
-
areaOfTriangle
Returns the area of a triangle given three points.- Parameters:
p1- The first pointp2- The second pointp3- The third point- Returns:
- The area of the triangle
-
interleaverPoint
Returns the interleave point of two points.- Parameters:
p1- The first pointp2- The second pointm- the mn- the n- Returns:
- The interleave point
-
externalizerPoint
Returns the externalizer point of two points.- Parameters:
p1- The first pointp2- The second pointm- the mn- the n- Returns:
- The externalizer point
-
areaOfCircle
Returns the area of a circle given two end points of the radius.- Parameters:
p1- The first pointp2- The second point- Returns:
- The area of the circle
-
circumferenceOfCircle
Returns the circumference of a circle given two end points of the radius.- Parameters:
p1- The first pointp2- The second point- Returns:
- The circumference of the circle
-
isTriangle
Returns if the given three points form a triangle is of the given type.- Parameters:
p1- The first pointp2- The second pointp3- The third pointc- The type of triangle to check- Returns:
- true if the triangle is of the given type, else false
-
angleBetweenTwoSlopes
public static double angleBetweenTwoSlopes(double m1, double m2) Return the angle between two slopes.- Parameters:
m1- The first slopem2- The second slope- Returns:
- The angle between the two slopes
-
isQuadrilateral
Returns if the given four points form a quadrilateral is of the given type.- Parameters:
p1- The first pointp2- The second pointp3- The third pointp4- The fourth pointc- The type of quadrilateral to check- Returns:
- true if the quadrilateral is of the given type, else false
-
isLine
Returns if the given two lines are of the given type.- Parameters:
l1- The first linel2- The second linec- The type of line to check- Returns:
- true if the line is of the given type, else false
-
areThreeLinesSame
Returns if the given three lines are same- Parameters:
l1- The first linel2- The second linel3- The third line- Returns:
- true if the lines are same, else false
-
intersectionOfTwoLines
Returns the intersection point of two lines.- Parameters:
l1- The first linel2- The second line- Returns:
- The intersection point
-
slope
Returns the slope of a line.- Parameters:
l- The line- Returns:
- The slope
-
distanceBetweenTwoParallelLines
Returns the distance between two parallel lines.- Parameters:
l1- The first linel2- The second line- Returns:
- The distance between the two lines
-
perpendicularDistanceFromAPointToALine
Returns the perpendicular distance of a point from a line.- Parameters:
l- The linep- The point- Returns:
- The perpendicular distance
-
getPerpendicularLine
Returns the perpendicular line of a line passing through a point.- Parameters:
l- The linep- The point- Returns:
- The perpendicular line of the line passing through the point
-
getParallelLine
Returns the parallel line of a line passing through a point.- Parameters:
l- The linep- The point- Returns:
- The parallel line of the line passing through the point
-
getLineFromIntersectionPoint
Returns the line passing through the intersection point of two lines.- Parameters:
l1- The first linel2- The second linep- the p- Returns:
- The line passing through the intersection point of the two lines
-
areaOfQuadrilateral
Returns the area of a quadrilateral using four lines inputted in anticlockwise order.- Parameters:
l1- The first linel2- The second linel3- The third linel4- The fourth line- Returns:
- The area of the quadrilateral
-
areaOfQuadrilateral
Returns the area of a quadrilateral using points inputted in anti-clockwise order.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinatesp4- The fourth point in cartesian coordinates- Returns:
- The area of the quadrilateral
-
areaOfTriangle
Returns the area of a triangle given three lines.- Parameters:
l1- The first linel2- The second linel3- The third line- Returns:
- The area of the triangle
-
areaOfConvexPolygon
Returns the area of a convex polygon using points inputted in anticlockwise order.- Parameters:
points- The points of the convex polygon- Returns:
- The area of the convex polygon
-
isPointInPolygon
Returns if the point is inside the polygon or not.- Parameters:
points- The points of the polygonp- The point- Returns:
- True if the point is inside the polygon, false otherwise
-
getLineFromTwoPoints
Returns the line passing through two points.- Parameters:
p1- The first pointp2- The second point- Returns:
- The line passing through the two points
-