Package draw
Class Point3D
java.lang.Object
draw.Point3D
- All Implemented Interfaces:
Serializable
,Comparable<Point3D>
Class for colored 3D points and their projection.
- Since:
- 2004.06.02
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
the color of the pointprotected double[]
the projection of the point in 2D spaceprotected double
the x-coordinate of the point in 3D spaceprotected double
the y-coordinate of the point in 3D spaceprotected double
the z-coordinate of the point in 3D space -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
x
protected double xthe x-coordinate of the point in 3D space -
y
protected double ythe y-coordinate of the point in 3D space -
z
protected double zthe z-coordinate of the point in 3D space -
c
protected int cthe color of the point -
p
protected double[] pthe projection of the point in 2D space
-
-
Constructor Details
-
Point3D
public Point3D(double x, double y, double z, int c) Create a colored 3D point.- Parameters:
x
- the x-coordinate of the pointy
- the y-coordinate of the pointz
- the z-coordinate of the pointc
- the color of the point- Since:
- 2004.06.02 (Christian Borgelt)
-
Point3D
public Point3D(double x, double y, double z) Create an uncolored 3D point (color 0).- Parameters:
x
- the x-coordinate of the pointy
- the y-coordinate of the pointz
- the z-coordinate of the point- Since:
- 2004.06.02 (Christian Borgelt)
-
-
Method Details
-
scale
public void scale(double s) Scale a colored 3D point.- Parameters:
s
- the scaling factor for multiplying the coordinates- Since:
- 2014.01.27 (Christian Borgelt)
-
project
Project a colored 3D point.- Parameters:
proj
- the 3D to 2D projection to use- Returns:
- whether the point is inside the viewing frustrum
- Since:
- 2004.06.02 (Christian Borgelt)
-
compareTo
Compare the depths of the projections of two points.- Specified by:
compareTo
in interfaceComparable<Point3D>
- Parameters:
obj
- the point to compare to- Returns:
- -1, if this point is nearer to the eye,
+1, if this point is farther from the eye,
0, if both points have the same distance - Since:
- 2004.06.02 (Christian Borgelt)
-