Documentation of 'org.jzy3d.plot3d.rendering.view.Camera' Java class
Camera
org.jzy3d.plot3d.rendering.view

Class Camera



  • public class Camera
    extends AbstractViewportManager
    A Camera allow to define on the view and target points in a cartesian coordinate system. The Camera provides the following services:
    • allows setting perspective/orthogonal rendering mode through CameraMode.
    • selects the appropriate clipping planes according to a given target box.
    • ensure the modelview matrix is always available for GL2 calls related to anything else than projection.
    • methods to convert screen coordinates into 3d coordinates and vice-versa
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static boolean DEFAULT_CAMERA_DISTANCE_MODE
      Defines if camera distance is real, or only squared (squared distance avoid computing Math.sqrt() and is thus faster).
      static Coord3d DEFAULT_VIEW
      The polar default view point, i.e.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Camera(Coord3d target)
      Set up a Camera looking at target, with a viewpoint standing at target+(0,0,100).
    • Field Detail

      • DEFAULT_VIEW

        public static final Coord3d DEFAULT_VIEW
        The polar default view point, i.e. Coord3d(Math.PI/3,Math.PI/5,500).
      • DEFAULT_CAMERA_DISTANCE_MODE

        public static final boolean DEFAULT_CAMERA_DISTANCE_MODE
        Defines if camera distance is real, or only squared (squared distance avoid computing Math.sqrt() and is thus faster). Second mode requires value true
        See Also:
        Constant Field Values
    • Constructor Detail

      • Camera

        public Camera(Coord3d target)
        Set up a Camera looking at target, with a viewpoint standing at target+(0,0,100). The top of the camera is set up toward the positive Z direction.
    • Method Detail

      • setScale

        public void setScale(float scale)
        Set the eye's position.
      • setEye

        public void setEye(Coord3d eye)
        Set the eye's position.
      • getEye

        public Coord3d getEye()
        Returns the eye's position.
      • setTarget

        public void setTarget(Coord3d target)
        Set the target point of the camera.
      • getTarget

        public Coord3d getTarget()
        Returns the target's position that was set at the last call to lookAt().
      • setUp

        public void setUp(Coord3d up)
        Set the top of the camera.
      • getUp

        public Coord3d getUp()
        Returns the top of the camera.
      • isTiltUp

        public boolean isTiltUp()
        Returns true if the camera is 'looking up', in other word if the eye's Z value is inferior to the target's Z value.
      • setRenderingSphereRadius

        public void setRenderingSphereRadius(float radius)
        Set the radius of the sphere that will be contained into the rendered view. As a side effect, the "far" clipping plane is modified according to the eye-target distance, and the position of the "near" clipping plane.
      • getRenderingSphereRadius

        public float getRenderingSphereRadius()
        Return the radius of the sphere that will be contained into the rendered view.
      • setRenderingDepth

        public void setRenderingDepth(float near,
                                      float far)
        Manually set the rendering depth (near and far clipping planes). Note that Camera.setRenderingSphereRadius modified the "far" clipping plane.
      • getNear

        public float getNear()
        Return the position of the "near" clipping plane
      • getFar

        public float getFar()
        Return the position of the "far" clipping plane
      • side

        public boolean side(Coord3d point)
        Return true if the given point is on the left of the vector eye->target.
      • screenToModel

        public Coord3d screenToModel(com.jogamp.opengl.GL gl,
                                     com.jogamp.opengl.glu.GLU glu,
                                     Coord3d screen)
        Transform a 2d screen coordinate into a 3d coordinate. The z component of the screen coordinate indicates a depth value between the near and far clipping plane of the Camera.
        Throws:
        a - RuntimeException if an error occured while trying to retrieve model coordinates
      • modelToScreen

        public Coord3d modelToScreen(com.jogamp.opengl.GL gl,
                                     com.jogamp.opengl.glu.GLU glu,
                                     Coord3d point)
        Transform a 3d point coordinate into its screen position.
        Throws:
        a - RuntimeException if an error occured while trying to retrieve model coordinates
      • modelToScreen

        public Coord3d[] modelToScreen(com.jogamp.opengl.GL gl,
                                       com.jogamp.opengl.glu.GLU glu,
                                       Coord3d[] points)
      • modelToScreen

        public Coord3d[][] modelToScreen(com.jogamp.opengl.GL gl,
                                         com.jogamp.opengl.glu.GLU glu,
                                         Coord3d[][] points)
      • modelToScreen

        public java.util.List<Coord3d> modelToScreen(com.jogamp.opengl.GL gl,
                                                     com.jogamp.opengl.glu.GLU glu,
                                                     java.util.List<Coord3d> points)
      • modelToScreen

        public java.util.ArrayList<java.util.ArrayList<Coord3d>> modelToScreen(com.jogamp.opengl.GL gl,
                                                                               com.jogamp.opengl.glu.GLU glu,
                                                                               java.util.ArrayList<java.util.ArrayList<Coord3d>> polygons)
      • modelToScreen

        public PolygonArray modelToScreen(com.jogamp.opengl.GL gl,
                                          com.jogamp.opengl.glu.GLU glu,
                                          PolygonArray polygon)
      • modelToScreen

        public Grid modelToScreen(com.jogamp.opengl.GL gl,
                                  com.jogamp.opengl.glu.GLU glu,
                                  Grid grid)
      • modelToScreen

        public PolygonArray[][] modelToScreen(com.jogamp.opengl.GL gl,
                                              com.jogamp.opengl.glu.GLU glu,
                                              PolygonArray[][] polygons)
      • show

        public void show(com.jogamp.opengl.GL gl,
                         Transform transform,
                         Coord3d scaling)
      • shoot

        public void shoot(com.jogamp.opengl.GL gl,
                          com.jogamp.opengl.glu.GLU glu,
                          CameraMode projection)
        Sets the projection and the mapping of the 3d model to 2d screen. The projection must be either Camera.PERSPECTIVE or Camera.ORTHOGONAL.
        shoot() finally calls the GL function glLookAt, according to the stored eye, target, up and scale values.
        Note that the Camera set by itselft the MatrixMode to model view at the end of a shoot().
        Parameters:
        gl - GL2 context.
        glu - GLU context.
        projection - the projection mode.
        Throws:
        a - Runtime Exception if the projection mode is neither Camera.PERSPECTIVE nor Camera.ORTHOGONAL.
      • shoot

        public void shoot(com.jogamp.opengl.GL gl,
                          com.jogamp.opengl.glu.GLU glu,
                          CameraMode projection,
                          boolean doPushMatrixBeforeShooting)
      • doShoot

        public void doShoot(com.jogamp.opengl.GL gl,
                            com.jogamp.opengl.glu.GLU glu,
                            CameraMode projection)
      • getDistance

        public double getDistance(AbstractDrawable drawable)
        Return the distance between the camera eye and the given drawable's barycenter.
      • getDistance

        public double getDistance(AbstractDrawable drawable,
                                  Coord3d viewScale)
        Apply scaling before computing distance between the camera eye and the given drawable's barycenter.
      • getDistance

        public double getDistance(Coord3d coord)
        Return the distance between the camera eye and the given coordinate.
      • getDistance

        public double getDistance(Coord3d coord,
                                  Coord3d viewScale)
        Apply scaling before computing distance between the camera eye and the given coordinate.
      • isUseSquaredDistance

        public boolean isUseSquaredDistance()
      • setUseSquaredDistance

        public void setUseSquaredDistance(boolean useSquaredDistance)
        Defines what getDistance(...) will return, either:
        • Squared distance (faster to compute since no Math.sqrt(...) at the end)
        • Real distance
        Default value is set to true, meaning it use the faster squared distance.
      • toString

        public java.lang.String toString()
        Print out in console information concerning the camera.
        Overrides:
        toString in class java.lang.Object

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.