Package com.ijurnove.cpu3d
Class Point3d
java.lang.Object
com.ijurnove.cpu3d.Point3d
- All Implemented Interfaces:
Rotatable,Scalable,Translatable
A
Point3d is a specific point in 3D space. Point3d objects store two different positions as Matrixes,
one for its position in 3D space, and one for its position on the screen.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopy()Returns a copy of this Point3d with a new reference.doubledepth()Returns the depth of thisPoint3d, or how far away it is from the camera.protected Matrixprotected Matrixprotected voidorthoProjection(Camera cam) protected voidperspProjection(Camera cam) protected voidprotected double[][]protected voidrotate(int axis, double theta) voidRotates this object about a given point on a specified axis.voidScales this object by a given amount from a point.voidsetX(double newPos) Sets the X position.voidsetY(double newPos) Sets the Y position.voidsetZ(double newPos) Sets the Z position.protected voidshiftValue(int axis, double distance) voidtranslate(double xShift, double yShift, double zShift) Shifts this object's X, Y, and Z position by the given values.doublexReal()Returns the X position in 3D space.doublexRend()Returns the X position on the screen.doubleyReal()Returns the Y position in 3D space.doubleyRend()Returns the Y position on the screen.doublezReal()Returns the Z position in 3D space.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ijurnove.cpu3d.Translatable
translate
-
Field Details
-
ORIGIN
APoint3dat (0, 0, 0)
-
-
Constructor Details
-
Point3d
Constructs aPoint3dat the coordinates specified in a givenMatrix. TheMatrixshould have 1 column and 3 or 4 rows. Row 1 is the X position, row 2 is the Y, and row 3 is the Z.- Parameters:
pos- the Matrix representing the constructed Point3d's coordinates
-
Point3d
public Point3d(double x, double y, double z) Constructs a newPoint3dat the given X, Y, and Z.- Parameters:
x- the X position of the constructed Point3dy- the Y position of the constructed Point3dz- the Z position of the constructed Point3d
-
-
Method Details
-
addAdjTri
-
getAdjacentTris
-
getMatrix
-
getRenderCoords
-
renderArray
protected double[][] renderArray() -
xRend
public double xRend()Returns the X position on the screen.- Returns:
- the X position on the screen
-
yRend
public double yRend()Returns the Y position on the screen.- Returns:
- the Y position on the screen
-
depth
public double depth()Returns the depth of thisPoint3d, or how far away it is from the camera.- Returns:
- the depth
-
xReal
public double xReal()Returns the X position in 3D space.- Returns:
- the X position in 3D space
-
yReal
public double yReal()Returns the Y position in 3D space.- Returns:
- the Y position in 3D space
-
zReal
public double zReal()Returns the Z position in 3D space.- Returns:
- the Z position in 3D space
-
copy
Returns a copy of this Point3d with a new reference.- Returns:
- a copy of this Point3d
-
shiftValue
protected void shiftValue(int axis, double distance) -
setX
public void setX(double newPos) Sets the X position.- Parameters:
newPos- the new X position
-
setY
public void setY(double newPos) Sets the Y position.- Parameters:
newPos- the new Y position
-
setZ
public void setZ(double newPos) Sets the Z position.- Parameters:
newPos- the new Z position
-
translate
public void translate(double xShift, double yShift, double zShift) Description copied from interface:TranslatableShifts this object's X, Y, and Z position by the given values.- Specified by:
translatein interfaceTranslatable- Parameters:
xShift- how far the object should be translated along the X axisyShift- how far the object should be translated along the Y axiszShift- how far the object should be translated along the Z axis
-
scale
Description copied from interface:ScalableScales this object by a given amount from a point. -
rotate
Description copied from interface:RotatableRotates this object about a given point on a specified axis. 0 corresponds to the X axis, 1 corresponds to the Y axis, and 2 corresponds to the Z axis. -
rotate
protected void rotate(int axis, double theta) -
perspProjection
-
perspProjectionForPointShadowMap
-
orthoProjection
-