|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jzy3d.plot3d.rendering.view.Camera
public class Camera
A Camera
provides an easy control on the view and target points
in a cartesian coordinate system.
The Camera
handles the following services:
CameraMode
.
Field Summary | |
---|---|
protected static Coord3d |
DEFAULT_VIEW
The polar default view point, i.e. |
protected Coord3d |
eye
|
protected float |
far
|
protected ViewPort |
lastViewPort
|
protected float |
near
|
protected float |
radius
|
protected float |
ratioHeight
|
protected float |
ratioWidth
|
protected boolean |
screenGridDisplayed
|
protected int |
screenHeight
|
protected int |
screenLeft
|
protected int |
screenRight
|
protected int |
screenSquaredDim
|
protected int |
screenWidth
|
protected int |
screenXOffset
|
protected int |
screenYOffset
|
protected boolean |
stretchToFill
|
protected Coord3d |
target
|
protected Coord3d |
up
|
Constructor Summary | |
---|---|
Camera(Coord3d target)
Set up a Camera looking at target, with a viewpoint standing at target+(0,0,100). |
Method Summary | |
---|---|
protected void |
applyViewPort(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
Apply the GL viewport according to the settings given to setViewPort. |
protected double |
computeFieldOfView(double size,
double distance)
Compute the field of View, in order to occupy the entire screen in PERSPECTIVE mode. |
void |
doShoot(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
CameraMode projection)
|
protected void |
failedProjection(String message)
|
Coord3d |
getEye()
Returns the eye's position. |
float |
getFar()
Return the position of the "far" clipping plane |
ViewPort |
getLastViewPort()
|
protected double[] |
getModelViewAsDouble(javax.media.opengl.GL2 gl)
|
protected float[] |
getModelViewAsFloat(javax.media.opengl.GL2 gl)
|
float |
getNear()
Return the position of the "near" clipping plane |
protected double[] |
getProjectionAsDouble(javax.media.opengl.GL2 gl)
|
protected float[] |
getProjectionAsFloat(javax.media.opengl.GL2 gl)
|
Rectangle |
getRectangle()
Returns the (x,y) offset that was applied to make this AbstractViewport stand in the appropriate canvas part. |
float |
getRenderingSphereRadius()
Return the radius of the sphere that will be contained into the rendered view. |
boolean |
getStretchToFill()
|
Coord3d |
getTarget()
Returns the target's position that was set at the last call to lookAt(). |
Coord3d |
getUp()
Returns the top of the camera. |
protected int[] |
getViewPortAsInt(javax.media.opengl.GL2 gl)
|
boolean |
isTiltUp()
|
ArrayList<ArrayList<Coord3d>> |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
ArrayList<ArrayList<Coord3d>> polygons)
|
Coord3d |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
Coord3d point)
Transform a 3d point coordinate into its screen position. |
Coord3d[] |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
Coord3d[] points)
|
Coord3d[][] |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
Coord3d[][] points)
|
Grid |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
Grid grid)
|
List<Coord3d> |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
List<Coord3d> points)
|
PolygonArray |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
PolygonArray polygon)
|
PolygonArray[][] |
modelToScreen(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
PolygonArray[][] polygons)
|
Coord3d |
screenToModel(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
Coord3d screen)
Transform a 2d screen coordinate into a 3d coordinate. |
void |
setEye(Coord3d eye)
Set the eye's position. |
void |
setRenderingDepth(float near,
float far)
Manually set the rendering depth (near and far clipping planes). |
void |
setRenderingSphereRadius(float radius)
Set the radius of the sphere that will be contained into the rendered view. |
void |
setScreenGridDisplayed(boolean status)
Set the status of the screen grid. |
void |
setStretchToFill(boolean status)
Set the status of the stretching mode (activated or not). |
void |
setTarget(Coord3d target)
Set the target point of the camera. |
void |
setUp(Coord3d up)
Set the top of the camera. |
void |
setViewPort(int width,
int height)
Set the view port (size of the renderer). |
void |
setViewPort(int width,
int height,
float left,
float right)
Set the view port (size of the renderer). |
void |
setViewPort(ViewPort viewport)
|
void |
shoot(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
CameraMode projection)
Sets the projection, and the mapping of 3d environement to 2d screen. |
void |
shoot(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
CameraMode projection,
boolean doPushMatrixBeforeShooting)
|
boolean |
side(Coord3d point)
Return true if the given point is on the left of the vector eye->target. |
String |
toString()
Print out in console information concerning the surface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Coord3d eye
protected Coord3d target
protected Coord3d up
protected float radius
protected float near
protected float far
protected static final Coord3d DEFAULT_VIEW
protected ViewPort lastViewPort
protected int screenLeft
protected int screenRight
protected int screenXOffset
protected int screenYOffset
protected int screenWidth
protected int screenHeight
protected int screenSquaredDim
protected boolean screenGridDisplayed
protected boolean stretchToFill
protected float ratioWidth
protected float ratioHeight
Constructor Detail |
---|
public Camera(Coord3d target)
Method Detail |
---|
public void setEye(Coord3d eye)
public Coord3d getEye()
public void setTarget(Coord3d target)
public Coord3d getTarget()
public void setUp(Coord3d up)
public Coord3d getUp()
public boolean isTiltUp()
public void setRenderingSphereRadius(float radius)
public float getRenderingSphereRadius()
public void setRenderingDepth(float near, float far)
Camera.setRenderingSphereRadius
modified the "far"
clipping plane.
public float getNear()
public float getFar()
public boolean side(Coord3d point)
public Coord3d screenToModel(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Coord3d screen)
Camera
.
a
- RuntimeException if an error occured while trying to retrieve model coordinatespublic Coord3d modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Coord3d point)
a
- RuntimeException if an error occured while trying to retrieve model coordinatespublic Coord3d[] modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Coord3d[] points)
public Coord3d[][] modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Coord3d[][] points)
public List<Coord3d> modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, List<Coord3d> points)
public ArrayList<ArrayList<Coord3d>> modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, ArrayList<ArrayList<Coord3d>> polygons)
public PolygonArray modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, PolygonArray polygon)
public Grid modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Grid grid)
public PolygonArray[][] modelToScreen(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, PolygonArray[][] polygons)
protected void failedProjection(String message)
protected int[] getViewPortAsInt(javax.media.opengl.GL2 gl)
protected double[] getProjectionAsDouble(javax.media.opengl.GL2 gl)
protected float[] getProjectionAsFloat(javax.media.opengl.GL2 gl)
protected double[] getModelViewAsDouble(javax.media.opengl.GL2 gl)
protected float[] getModelViewAsFloat(javax.media.opengl.GL2 gl)
public void shoot(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, CameraMode projection)
gl
- GL2 context.glu
- GLU context.projection
- the projection mode.
a
- Runtime Exception if the projection mode is neither Camera.PERSPECTIVE nor Camera.ORTHOGONAL.public void shoot(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, CameraMode projection, boolean doPushMatrixBeforeShooting)
public void doShoot(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, CameraMode projection)
protected double computeFieldOfView(double size, double distance)
public String toString()
toString
in class Object
public void setStretchToFill(boolean status)
status
- public boolean getStretchToFill()
public void setViewPort(int width, int height)
width
- the width of the target window.height
- the height of the target window.public void setViewPort(int width, int height, float left, float right)
width
- the width of the target window.height
- the height of the target window.left
- the width's ratio where this subscreen starts in the target window.right
- the width's ratio where this subscreen stops in the target window.
an
- IllegalArgumentException if right is not greater than left.public void setViewPort(ViewPort viewport)
public ViewPort getLastViewPort()
protected void applyViewPort(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
applyViewPort
, one can query the offset that was
applied to the viewport relative to the canvas. Indeed, when the stretchToFill
option is disabled, the viewport is computed so that the content appears in
a squared subpart of the canvas.
gl
- glu
- public Rectangle getRectangle()
AbstractViewport
stand in the appropriate canvas part.
and the actual width and height of the viewport.
Only relevant after a call to applyViewPort
.
public void setScreenGridDisplayed(boolean status)
status
- the grid is displayed if status is set to true
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |