peasy
Class PeasyCam

java.lang.Object
  extended by peasy.PeasyCam

public class PeasyCam
extends java.lang.Object

Author:
Jonathan Feinberg

Nested Class Summary
 class PeasyCam.AbstractInterp
           
 class PeasyCam.PeasyMouseListener
           
 
Field Summary
static java.lang.String VERSION
           
 
Constructor Summary
PeasyCam(processing.core.PApplet parent, double distance)
           
PeasyCam(processing.core.PApplet parent, double lookAtX, double lookAtY, double lookAtZ, double distance)
           
 
Method Summary
static void apply(processing.core.PGraphics g, Vector3D center, Rotation rotation, double distance)
           
 void beginHUD()
          Thanks to A.W.
 void endHUD()
           
 void feed()
           
 PeasyDragHandler getCenterDragHandler()
           
 double getDistance()
           
 PeasyDragHandler getLeftDragHandler()
           
 float[] getLookAt()
           
 double getMaximumDistance()
           
 double getMaximumPanDistance()
           
 double getMinimumDistance()
           
 java.awt.Point getMouseExit()
           
 PeasyDragHandler getPanDragHandler()
           
 double getPanScale()
           
 float[] getPosition()
          Where is the PeasyCam in world space?
 PeasyDragHandler getRightDraghandler()
           
 PeasyDragHandler getRotateDragHandler()
           
 float[] getRotations()
          Express the current camera rotation as an equivalent series of world rotations, in X, Y, Z order.
 double getRotationScale()
           
 CameraState getState()
           
 double getVelocity()
           
 PeasyWheelHandler getWheelHandler()
           
 double getWheelScale()
           
 PeasyDragHandler getZoomDragHandler()
           
 double getZoomScale()
           
 PeasyWheelHandler getZoomWheelHandler()
           
 boolean isActive()
           
 boolean isMouseOverSketch()
           
 boolean isMoving()
           
 boolean isReversePan()
           
 boolean isReverseRotate()
           
 boolean isReverseZoom()
           
 void lookAt(double x, double y, double z)
           
 void lookAt(double x, double y, double z, double distance)
           
 void lookAt(double x, double y, double z, double distance, long animationTimeMillis)
           
 void lookAt(double x, double y, double z, long animationTimeMillis)
           
 void lookThrough(double x, double y, double z)
           
 void lookThrough(double x, double y, double z, double distance)
           
 void lookThrough(double x, double y, double z, double distance, long animationTimeMillis)
           
 void lookThrough(double x, double y, double z, long animationTimeMillis)
           
 void pan(double dx, double dy)
           
 void reset()
           
 void reset(long animationTimeInMillis)
           
 void rotateX(double angle)
           
 void rotateY(double angle)
           
 void rotateZ(double angle)
           
 void setActive(boolean active)
           
 void setcam()
           
 void setCenterDragHandler(PeasyDragHandler handler)
           
 void setDamping(double rdamp, double zdamp, double pdamp)
           
 void setDistance(double newDistance)
           
 void setDistance(double newDistance, long animationTimeMillis)
           
 void setFreeRotationMode()
          Permit arbitrary rotation.
 void setLeftDragHandler(PeasyDragHandler handler)
           
 void setMaximumDistance(double maximumDistance)
           
 void setMaximumPanDistance(double maximumDistance)
           
 void setMinimumDistance(double minimumDistance)
           
 void setMouseControlled(boolean isMouseControlled)
          Deprecated. use setActive(boolean)
 void setMouseOverSketch(boolean mouseIsOverSketch)
           
 void setPanOnScreenEdge(boolean panOnScreenEdge)
           
 void setPanScale(double panScale)
           
 void setPitchRotationMode()
          Only permit pitch.
 void setResetOnDoubleClick(boolean resetOnDoubleClick)
           
 void setReversePan(boolean reverse)
           
 void setReverseRotate(boolean reverse)
           
 void setReverseZoom(boolean reverse)
           
 void setRightDragHandler(PeasyDragHandler handler)
           
 void setRollRotationMode()
          Only permit roll.
 void setRotations(double pitch, double yaw, double roll)
           
 void setRotations(double pitch, double yaw, double roll, long animationTimeMillis)
           
 void setRotationScale(double rotateScale)
           
 void setSpeedLock(boolean framelock)
           
 void setSpeedRate(double targetRate)
           
 void setState(CameraState state)
           
 void setState(CameraState state, long animationTimeMillis)
           
 void setSuppressPitchRotationMode()
          Only suppress pitch.
 void setSuppressRollRotationMode()
          Only suppress roll.
 void setSuppressYawRotationMode()
          Only suppress yaw.
 void setWheelHandler(PeasyWheelHandler wheelHandler)
           
 void setWheelScale(double wheelScale)
           
 void setYawRotationMode()
          Only permit yaw.
 void setZoomScale(double zoomScale)
           
 void stop()
           
 java.lang.String version()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

PeasyCam

public PeasyCam(processing.core.PApplet parent,
                double distance)

PeasyCam

public PeasyCam(processing.core.PApplet parent,
                double lookAtX,
                double lookAtY,
                double lookAtZ,
                double distance)
Method Detail

setcam

public void setcam()

setDamping

public void setDamping(double rdamp,
                       double zdamp,
                       double pdamp)

setSpeedLock

public void setSpeedLock(boolean framelock)

setSpeedRate

public void setSpeedRate(double targetRate)

setActive

public void setActive(boolean active)

isActive

public boolean isActive()

setReverseZoom

public void setReverseZoom(boolean reverse)

setReverseRotate

public void setReverseRotate(boolean reverse)

setReversePan

public void setReversePan(boolean reverse)

isReversePan

public boolean isReversePan()

isReverseZoom

public boolean isReverseZoom()

isReverseRotate

public boolean isReverseRotate()

setMouseControlled

@Deprecated
public void setMouseControlled(boolean isMouseControlled)
Deprecated. use setActive(boolean)

Turn on or off default mouse-handling behavior:

left-drag rotate camera around look-at point
center-drag pan camera (change look-at point)
right-drag zoom
wheel zoom

Parameters:
isMouseControlled -

getWheelScale

public double getWheelScale()

setWheelScale

public void setWheelScale(double wheelScale)

getPanDragHandler

public PeasyDragHandler getPanDragHandler()

getRotateDragHandler

public PeasyDragHandler getRotateDragHandler()

getZoomDragHandler

public PeasyDragHandler getZoomDragHandler()

getZoomWheelHandler

public PeasyWheelHandler getZoomWheelHandler()

getLeftDragHandler

public PeasyDragHandler getLeftDragHandler()

getCenterDragHandler

public PeasyDragHandler getCenterDragHandler()

getRightDraghandler

public PeasyDragHandler getRightDraghandler()

setLeftDragHandler

public void setLeftDragHandler(PeasyDragHandler handler)

setCenterDragHandler

public void setCenterDragHandler(PeasyDragHandler handler)

setRightDragHandler

public void setRightDragHandler(PeasyDragHandler handler)

getWheelHandler

public PeasyWheelHandler getWheelHandler()

setWheelHandler

public void setWheelHandler(PeasyWheelHandler wheelHandler)

getZoomScale

public double getZoomScale()

setZoomScale

public void setZoomScale(double zoomScale)

getPanScale

public double getPanScale()

setPanScale

public void setPanScale(double panScale)

getRotationScale

public double getRotationScale()

setRotationScale

public void setRotationScale(double rotateScale)

version

public java.lang.String version()

getDistance

public double getDistance()

setDistance

public void setDistance(double newDistance)

setDistance

public void setDistance(double newDistance,
                        long animationTimeMillis)

getLookAt

public float[] getLookAt()

lookAt

public void lookAt(double x,
                   double y,
                   double z)

lookAt

public void lookAt(double x,
                   double y,
                   double z,
                   double distance)

lookAt

public void lookAt(double x,
                   double y,
                   double z,
                   long animationTimeMillis)

lookAt

public void lookAt(double x,
                   double y,
                   double z,
                   double distance,
                   long animationTimeMillis)

lookThrough

public void lookThrough(double x,
                        double y,
                        double z)

lookThrough

public void lookThrough(double x,
                        double y,
                        double z,
                        double distance)

lookThrough

public void lookThrough(double x,
                        double y,
                        double z,
                        long animationTimeMillis)

lookThrough

public void lookThrough(double x,
                        double y,
                        double z,
                        double distance,
                        long animationTimeMillis)

feed

public void feed()

apply

public static void apply(processing.core.PGraphics g,
                         Vector3D center,
                         Rotation rotation,
                         double distance)

getPosition

public float[] getPosition()
Where is the PeasyCam in world space?

Returns:
float[]{x,y,z}

reset

public void reset()

reset

public void reset(long animationTimeInMillis)

pan

public void pan(double dx,
                double dy)

rotateX

public void rotateX(double angle)

rotateY

public void rotateY(double angle)

rotateZ

public void rotateZ(double angle)

getState

public CameraState getState()

setFreeRotationMode

public void setFreeRotationMode()
Permit arbitrary rotation. (Default mode.)


setYawRotationMode

public void setYawRotationMode()
Only permit yaw.


setPitchRotationMode

public void setPitchRotationMode()
Only permit pitch.


setRollRotationMode

public void setRollRotationMode()
Only permit roll.


setSuppressRollRotationMode

public void setSuppressRollRotationMode()
Only suppress roll.


setSuppressYawRotationMode

public void setSuppressYawRotationMode()
Only suppress yaw.


setSuppressPitchRotationMode

public void setSuppressPitchRotationMode()
Only suppress pitch.


getMinimumDistance

public double getMinimumDistance()

getMaximumDistance

public double getMaximumDistance()

setMinimumDistance

public void setMinimumDistance(double minimumDistance)

setMaximumDistance

public void setMaximumDistance(double maximumDistance)

setMaximumPanDistance

public void setMaximumPanDistance(double maximumDistance)

getMaximumPanDistance

public double getMaximumPanDistance()

setResetOnDoubleClick

public void setResetOnDoubleClick(boolean resetOnDoubleClick)

setPanOnScreenEdge

public void setPanOnScreenEdge(boolean panOnScreenEdge)

getVelocity

public double getVelocity()

stop

public void stop()

isMoving

public boolean isMoving()

setState

public void setState(CameraState state)

setState

public void setState(CameraState state,
                     long animationTimeMillis)

setRotations

public void setRotations(double pitch,
                         double yaw,
                         double roll)

setRotations

public void setRotations(double pitch,
                         double yaw,
                         double roll,
                         long animationTimeMillis)

getRotations

public float[] getRotations()
Express the current camera rotation as an equivalent series of world rotations, in X, Y, Z order. This is useful when, for example, you wish to orient text towards the camera at all times, as in
 float[] rotations = cam.getRotations(rotations);
 rotateX(rotations[0]);
 rotateY(rotations[1]);
 rotateZ(rotations[2]);
 text("Here I am!", 0, 0, 0);
 


beginHUD

public void beginHUD()
Thanks to A.W. Martin for the code to do HUD


endHUD

public void endHUD()

setMouseOverSketch

public void setMouseOverSketch(boolean mouseIsOverSketch)

isMouseOverSketch

public boolean isMouseOverSketch()

getMouseExit

public java.awt.Point getMouseExit()


processing library peasycam by Jonathan Feinberg. (c) 2011