Class ScreenProjector

java.lang.Object
graphic.ScreenProjector

public class ScreenProjector extends Object
This class transforms 3D coordinates into 2D screen coordinates.
Author:
Andrea Zoppi.
  • 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

      protected Matrix4 modelView
    • projection

      protected Matrix4 projection
    • stack

      protected LinkedList<Matrix4> stack
  • Constructor Details

    • ScreenProjector

      public ScreenProjector()
  • Method Details

    • getScreenSize

      public Dimension getScreenSize()
    • setScreenSize

      public void setScreenSize(Dimension screenSize)
    • 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

      public void lookAt(Vector4 eyePos, Vector4 targetPos, boolean translate)
    • lookAt

      public void lookAt(Vector4 eyePos, Vector4 targetPos, Vector4 up, boolean translate)
    • trans

      public void trans(float dx, float dy, float dz)
    • trans

      public void trans(Vector4 delta)
    • rotX

      public void rotX(float w)
    • rotY

      public void rotY(float w)
    • rotZ

      public void rotZ(float w)
    • getModelView

      public Matrix4 getModelView()
    • getProjection

      public Matrix4 getProjection()
    • push

      public void push(Matrix4 matrix)
    • pop

      public Matrix4 pop()
    • stackSize

      public int stackSize()
    • updateProjection

      public void updateProjection()
      Updates the projection matrix after modifying the screen size, fov or clipping.
    • project

      public Vector4 project(Vector4 point)
      Projects a 3D point onto the screen surface, as a 2D point.
      Parameters:
      point - 3D point to project.
      Returns:
      The projected 2D point.
    • isClipped

      public boolean isClipped(Vector4 projectedPoint)
      Checks whether a projected 2D point is clipped by the frustum.
      Parameters:
      projectedPoint - Point to check.
      Returns:
      The clipped condition.