Point3D is a Java library for implementing and utilising 3D coordinates in the Java language. It is an extension of the Point2D library in Java, the code for which can be found here.
To utilise the library, clone/download the code in your Computer and store it in a directory alongside your code (or whatever directory suits you) and just use the regular import statement ( import <packagename>
) to import the library into your program. The main class is in src/Point3D/Point3D.java
The JavaDoc file for the code contains all the details regarding the functions and classes in the code.
For the input,
Point3D FirstPoint = new Point3D.Double(1,3,5);
Point3D SecondPoint = new Point3D.Double(2,3,4);
System.out.println(FirstPoint.distance(SecondPoint));
System.out.println(FirstPoint.distance(0, 0, 0));
The output is,
1.4142135623730951
5.916079783099616
An additional function called the RandomCoordinateGenerator()
has been added in the library. This function generates a random 3D coordinate in xyz plane.