Package mathvoyage.geometry
Class Geometry
java.lang.Object
mathvoyage.geometry.Geometry
voyager.geometry.java
- Author:
- Tahsin Islam
-
Method Summary
Modifier and TypeMethodDescriptiondoubleangleBetweenTwoSlopes(double m1, double m2) Returns the angle between two slopes.doubleareaOfCircle(Point p1, Point p2) Returns the area of a circle.doubleareaOfConvexPolygon(Point[] points) Returns the area of a convex polygon using points inputted in anticlockwise order.doubleareaOfQuadrilateral(Point p1, Point p2, Point p3, Point p4) Returns the area of a quadrilateral using points inputted in anti-clockwise order.doubleareaOfQuadrilateralUsingLine(Line l1, Line l2, Line l3, Line l4) Returns the area of a quadrilateral using four lines inputted in anticlockwise order.doubleareaOfTriangle(Point p1, Point p2, Point p3) Returns the area of a triangle inputted in anti-clockwise order.doubleareaOfTriangleGivenLine(Line l1, Line l2, Line l3) Returns the area of a triangle given three lines.Returns the centroid of a triangle.doublechebyshevDistance(Point p1, Point p2) Returns the chebyshev distance between two points.doublecircumferenceOfCircle(Point p1, Point p2) Returns the circumference of a circle.doubledistanceBetweenTwoParallelLines(Line l1, Line l2) Returns the distance between two parallel lines.doubledistanceCartesian(Point p1, Point p2) Returns the distance between two points in cartesian coordinates.doubledistancePolar(Point p1, Point p2) Returns the distance between two points in polar coordinates.externalizerPoint(Point p1, Point p2, double m, double n) Returns the entstatic GeometryReturns the singleton instance of this class.getLineFromIntersectingPoint(Line l1, Line l2, Point p) Returns the line passing through the intersection point of two lines.getLineFromTwoPoints(Point p1, Point p2) Returns the line passing through two points.getParallelLine(Line l, Point p) Returns the parallel line of a line passing through a point.getPerpendicularLine(Line l, Point p) Returns the perpendicular line of a line passing through a point.interleaverPoint(Point p1, Point p2, double m, double n) Returns the interleaver point of two points that divides the connecting line in a ratio of m:n.intersectionPoint(Line l1, Line l2) Returns the intersection point of two lines.booleanisAcuteTriangle(Point p1, Point p2, Point p3) Returns if the triangle is a acute triangle or not.booleanisEquilateralTriangle(Point p1, Point p2, Point p3) Returns if the triangle is a equilateral triangle or not.booleanisIsoscelesTriangle(Point p1, Point p2, Point p3) Returns if the triangle is a isosceles triangle or not.booleanisObtuseTriangle(Point p1, Point p2, Point p3) Returns if the triangle is a obtuse triangle or not.booleanisParallel(Line l1, Line l2) Returns if the two given lines are parallel or notbooleanisParallelogram(Point p1, Point p2, Point p3, Point p4) Returns if the quadrilateral is a parallelogram or not.booleanisPerpendicular(Line l1, Line l2) Returns if the two given lines are perpendicular or notbooleanisPointInPolygon(Point[] points, Point p) Returns if the point is inside the polygon or not.booleanisRectangle(Point p1, Point p2, Point p3, Point p4) Returns if the quadrilateral is a rectangle or not.booleanReturns if the quadrilateral is a rhombus or not.booleanisRightTriangle(Point p1, Point p2, Point p3) Returns if the triangle is a right triangle or not.booleanisSameLine(Line l1, Line l2) Returns if the two given lines are same or notbooleanisScaleneTriangle(Point p1, Point p2, Point p3) Returns if the triangle is a scalene triangle or not.booleanReturns if the quadrilateral is a square or not.booleanisThreeLinesSame(Line l1, Line l2, Line l3) Returns if the given three lines are same or notdoublemanhattanDistance(Point p1, Point p2) Returns the manhattan distance between two points in cartesian coordinates.Returns the midpoint of a line between two points.doubleReturns the perpendicular distance of a line form a point.doubleReturns the slope of a line between two points.doubleslopeOfLine(Line l) Returns the slope of a line.
-
Method Details
-
getInstance
Returns the singleton instance of this class.- Returns:
- The singleton instance
-
distanceCartesian
Returns the distance between two points in cartesian coordinates.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The distance between the two points in cartesian coordinates
-
distancePolar
Returns the distance between two points in polar coordinates.- Parameters:
p1- The first point in polar coordinatesp2- The second point in polar coordinates- Returns:
- The distance between the two points in polar coordinates
-
manhattanDistance
Returns the manhattan distance between two points in cartesian coordinates.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The manhattan distance between the two points in cartesian coordinates
-
chebyshevDistance
Returns the chebyshev distance between two points.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The chebyshev distance between the two points
-
slope
Returns the slope of a line between two points.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The slope of the line between the two points
-
midpoint
Returns the midpoint of a line between two points.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The midpoint of the line between the two points
-
centroid
Returns the centroid of a triangle.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- The centroid of the triangle
-
areaOfTriangle
Returns the area of a triangle inputted in anti-clockwise order.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- The area of the triangle
-
interleaverPoint
Returns the interleaver point of two points that divides the connecting line in a ratio of m:n.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesm- The ratio of the first pointn- The ratio of the second point- Returns:
- The interleaver point of the two points
-
externalizerPoint
Returns the ent- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesm- The ratio of the first pointn- The ratio of the second point- Returns:
- The externalizer point of the two points
-
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
-
areaOfCircle
Returns the area of a circle.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The area of the circle
-
circumferenceOfCircle
Returns the circumference of a circle.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinates- Returns:
- The circumference of the circle
-
isEquilateralTriangle
Returns if the triangle is a equilateral triangle or not.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- True if the triangle is a equilateral triangle, false otherwise
-
isIsoscelesTriangle
Returns if the triangle is a isosceles triangle or not.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- True if the triangle is a isosceles triangle, false otherwise
-
isScaleneTriangle
Returns if the triangle is a scalene triangle or not.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- True if the triangle is a scalene triangle, false otherwise
-
isRightTriangle
Returns if the triangle is a right triangle or not.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- True if the triangle is a right triangle, false otherwise
-
isObtuseTriangle
Returns if the triangle is a obtuse triangle or not.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- True if the triangle is a obtuse triangle, false otherwise
-
isAcuteTriangle
Returns if the triangle is a acute triangle or not.- Parameters:
p1- The first point in cartesian coordinatesp2- The second point in cartesian coordinatesp3- The third point in cartesian coordinates- Returns:
- True if the triangle is a acute triangle, false otherwise
-
angleBetweenTwoSlopes
public double angleBetweenTwoSlopes(double m1, double m2) Returns the angle between two slopes.- Parameters:
m1- The first slopem2- The second slope- Returns:
- The angle between the two slopes
-
isRectangle
Returns if the quadrilateral is a rectangle or not.- 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:
- True if the quadrilateral is a rectangle, false otherwise
-
isSquare
Returns if the quadrilateral is a square or not.- 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:
- True if the quadrilateral is a square, false otherwise
-
isParallelogram
Returns if the quadrilateral is a parallelogram or not.- 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:
- True if the quadrilateral is a parallelogram, false otherwise
-
isRhombus
Returns if the quadrilateral is a rhombus or not.- 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:
- True if the quadrilateral is a rhombus, false otherwise
-
isSameLine
Returns if the two given lines are same or not- Parameters:
l1- The first linel2- The second line- Returns:
- True if the two given lines are same, false otherwise
-
areaOfTriangleGivenLine
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
-
isThreeLinesSame
Returns if the given three lines are same or not- Parameters:
l1- The first linel2- The second linel3- The third line- Returns:
- True if the given three lines are same, false otherwise
-
intersectionPoint
Returns the intersection point of two lines.- Parameters:
l1- The first linel2- The second line- Returns:
- The intersection point of the two lines
-
isParallel
Returns if the two given lines are parallel or not- Parameters:
l1- The first linel2- The second line- Returns:
- True if the two given lines are parallel, false otherwise
-
isPerpendicular
Returns if the two given lines are perpendicular or not- Parameters:
l1- The first linel2- The second line- Returns:
- True if the two given lines are perpendicular, false otherwise
-
slopeOfLine
Returns the slope of a line.- Parameters:
l- The line- Returns:
- The slope of the line
-
distanceBetweenTwoParallelLines
Returns the distance between two parallel lines.- Parameters:
l1- The first linel2- The second line- Returns:
- The distance between the two parallel lines
-
perpendicularDistanceFromAPoint
Returns the perpendicular distance of a line form a point.- Parameters:
l- The linep- The point- Returns:
- The perpendicular distance of the line form the point
-
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
-
getLineFromIntersectingPoint
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
-
areaOfQuadrilateralUsingLine
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
-
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
-