Class ScreenProjector
java.lang.Object
graphic.ScreenProjector
This class transforms 3D coordinates into 2D screen coordinates.
- Author:
- Andrea Zoppi.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatprotected floatprotected floatprotected floatprotected floatprotected floatprotected Matrix4protected floatprotected Matrix4protected floatprotected floatprotected LinkedList<Matrix4> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatfloatgetFov()floatbooleanChecks whether a projected 2D point is clipped by the frustum.voidvoidpop()Projects a 3D point onto the screen surface, as a 2D point.voidvoidrotX(float w) voidrotY(float w) voidrotZ(float w) voidsetFarClipping(float far) voidsetFov(float fov) Sets the Field of View.voidsetNearClipping(float near) voidsetScreenSize(Dimension screenSize) intvoidtrans(float dx, float dy, float dz) voidvoidUpdates the projection matrix after modifying the screen size, fov or clipping.
-
Field Details
-
screenW
protected float screenW -
screenH
protected float screenH -
halfW
protected float halfW -
halfH
protected float halfH -
aspect
protected float aspect -
fov
protected float fov -
near
protected float near -
far
protected float far -
focalLength
protected float focalLength -
modelView
-
projection
-
stack
-
-
Constructor Details
-
ScreenProjector
public ScreenProjector()
-
-
Method Details
-
getScreenSize
-
setScreenSize
-
getFov
public float getFov() -
setFov
public void setFov(float fov) Sets the Field of View.- Parameters:
fov- FOV in degrees.
-
getNearClipping
public float getNearClipping() -
setNearClipping
public void setNearClipping(float near) -
getFarClipping
public float getFarClipping() -
setFarClipping
public void setFarClipping(float far) -
lookAt
-
lookAt
-
trans
public void trans(float dx, float dy, float dz) -
trans
-
rotX
public void rotX(float w) -
rotY
public void rotY(float w) -
rotZ
public void rotZ(float w) -
getModelView
-
getProjection
-
push
-
pop
-
stackSize
public int stackSize() -
updateProjection
public void updateProjection()Updates the projection matrix after modifying the screen size, fov or clipping. -
project
-
isClipped
Checks whether a projected 2D point is clipped by the frustum.- Parameters:
projectedPoint- Point to check.- Returns:
- The clipped condition.
-