igeo.gui
Class IView

java.lang.Object
  extended by igeo.gui.IView

public class IView
extends java.lang.Object

Class to define view by location, direction, axonometric/perspective mode and perspective angle. An instance of IView is associated with an instance of IPane.

Author:
Satoru Sugihara

Field Summary
 boolean axonometric
          axonometric or perspective
 double axonRatio
          scale to window size
 IColor[][] bgColor
          background color: one color(1x1matrix), two color(1x2matrix) or four colors(2x2 matrix)
static float[] defaultGLAmbientLight
           
static float[] defaultGLDiffuseLight
           
static float[] defaultGLLightPosition
           
static float[] defaultGLSpecularLight
           
static boolean defaultGLTwoSidedLighting
           
 double far
           
 boolean hide
           
 IGraphicMode mode
           
 double near
           
 IPane pane
           
 double persRatio
          perspective ratio = tan(angle of view)
 double pitch
          yaw-pitch-roll ZXY conversion yaw=0 pitch=0 equals x-axis yaw is rotation around z, pitch is around y, roll is around x, in right hand rule
 IVec pos
          eye location
 double roll
          yaw-pitch-roll ZXY conversion yaw=0 pitch=0 equals x-axis yaw is rotation around z, pitch is around y, roll is around x, in right hand rule
 boolean rotateAroundTarget
           
 int screenHeight
          screen width & height
 int screenWidth
          screen width & height
 int screenX
          screen location
 int screenY
          screen location
 IVec target
          view target location
 double[] transformArray
           
 IMatrix4 transformMatrix
           
 boolean useGL
           
 double viewDistance
           
 double yaw
          yaw-pitch-roll ZXY conversion yaw=0 pitch=0 equals x-axis yaw is rotation around z, pitch is around y, roll is around x, in right hand rule
 
Constructor Summary
IView(double x, double y, double z, double yaw, double pitch)
           
IView(double x, double y, double z, double yaw, double pitch, double roll)
           
IView(double x, double y, double z, double yaw, double pitch, double roll, int screenX, int screenY, int screenWidth, int screenHeight)
           
IView(double x, double y, double z, double yaw, double pitch, double roll, int screenX, int screenY, int screenWidth, int screenHeight, boolean axonometric)
           
 
Method Summary
 void axonometric()
           
 IColor[][] bgColor()
           
 void bgColor(IColor c)
           
 void bgColor(IColor[][] c)
           
 void bgColor(IColor c1, IColor c2)
           
 void bgColor(IColor c1, IColor c2, IColor c3, IColor c4)
           
 IVec convert(IVecI orig)
          converts 3d coordinates to 2d.
 boolean convert(IVecI orig, IVec dest)
          converts 3d coordinates to 2d.
 boolean convert(IVecI orig, IVec2 dest)
          converts 3d coordinates to 2d coordinates of screen whose unit is pixels and whose origin is top left corner and positive Y is downward
 boolean convert(IVecI orig, IVec2f dest)
          converts 3d coordinates to 2d coordinates of screen whose unit is pixels and whose origin is top left corner and positive Y is downward
 void disableGL()
           
 void disableRotationAroundTarget()
           
 void enableGL()
           
 void enableRotationAroundTarget()
           
 void focus(IBounds bb)
           
 IVec frontDirection()
           
 IVec getAngles()
           
 double getAxonometricRatio()
           
static IView getBackView(int screenX, int screenY, int screenWidth, int screenHeight)
           
static IView getBottomView(int screenX, int screenY, int screenWidth, int screenHeight)
           
static IView getDefaultAxonometricView(int screenX, int screenY, int screenWidth, int screenHeight)
           
static IView getDefaultPerspectiveView(int screenX, int screenY, int screenWidth, int screenHeight)
           
static IView getFrontView(int screenX, int screenY, int screenWidth, int screenHeight)
           
static IView getLeftView(int screenX, int screenY, int screenWidth, int screenHeight)
           
 IVec getLocation()
           
 double getPerspectiveRatio()
           
 double getPitch()
           
static IView getRightView(int screenX, int screenY, int screenWidth, int screenHeight)
           
 double getRoll()
           
 double getScreenHeight()
           
 double getScreenWidth()
           
 double getScreenX()
           
 double getScreenY()
           
static IView getTopView(int screenX, int screenY, int screenWidth, int screenHeight)
           
 double getYaw()
           
 void hide()
           
 boolean isAxonometric()
           
 boolean isHidden()
           
 IVec location()
           
 IGraphicMode mode()
           
 void moveForward(double dist)
           
 void perspective()
           
 IVec rightDirection()
           
 void set(double x, double y, double z)
           
 void set(double x, double y, double z, double yaw, double pitch)
           
 void set(double x, double y, double z, double yaw, double pitch, double roll)
           
 void set(IVec location)
           
 void set(IVec location, double yaw, double pitch)
           
 void set(IVec location, double yaw, double pitch, double roll)
           
 void setAngle(double yaw, double pitch)
           
 void setAngle(double yaw, double pitch, boolean updateTarget)
           
 void setAngle(double yaw, double pitch, double roll)
           
 void setAngle(double yaw, double pitch, double roll, boolean updateTarget)
           
 void setAxonometric()
           
 void setAxonometric(double x, double y, double z)
           
 void setAxonometric(double x, double y, double z, double axonometricRatio)
           
 void setAxonometric(double x, double y, double z, double yaw, double pitch)
           
 void setAxonometric(double x, double y, double z, double yaw, double pitch, double axonometricRatio)
           
 void setAxonometricRatio(double r)
           
 void setBack()
           
 void setBack(double x, double z)
           
 void setBack(double x, double y, double z)
           
 void setBack(double x, double y, double z, double axonometricRatio)
           
 void setBottom()
           
 void setBottom(double x, double y)
           
 void setBottom(double x, double y, double z)
           
 void setBottom(double x, double y, double z, double axonometricRatio)
           
 void setFront()
           
 void setFront(double x, double z)
           
 void setFront(double x, double y, double z)
           
 void setFront(double x, double y, double z, double axonometricRatio)
           
 void setLeft()
           
 void setLeft(double y, double z)
           
 void setLeft(double x, double y, double z)
           
 void setLeft(double x, double y, double z, double axonometricRatio)
           
 void setLocation(double x, double y, double z)
           
 void setLocation(IVecI pt)
           
 void setMode(IGraphicMode m)
           
 void setPane(IPane p)
           
 void setParametersByBounds(IBounds bounds)
          update near, far, viewDistance by bounding box
 void setPerspective()
           
 void setPerspective(double perspectiveAngle)
           
 void setPerspective(double x, double y, double z)
           
 void setPerspective(double x, double y, double z, double perspectiveAngle)
           
 void setPerspective(double x, double y, double z, double yaw, double pitch)
           
 void setPerspective(double x, double y, double z, double yaw, double pitch, double perspectiveAngle)
           
 void setPerspectiveAngle(double angle)
           
 void setPerspectiveRatio(double r)
           
 void setRight()
           
 void setRight(double y, double z)
           
 void setRight(double x, double y, double z)
           
 void setRight(double x, double y, double z, double axonometricRatio)
           
 void setScreen(int x, int y, int w, int h)
           
 void setScreenPosition(int x, int y)
           
 void setScreenSize(int w, int h)
           
 void setTarget(double x, double y, double z)
           
 void setTarget(IVecI t)
           
 void setTop()
           
 void setTop(double x, double y)
           
 void setTop(double x, double y, double z)
           
 void setTop(double x, double y, double z, double axonometricRatio)
           
 void show()
           
 IVec target()
           
 double targetDistance()
           
 void update()
           
 IVec upDirection()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultGLLightPosition

public static float[] defaultGLLightPosition

defaultGLAmbientLight

public static float[] defaultGLAmbientLight

defaultGLDiffuseLight

public static float[] defaultGLDiffuseLight

defaultGLSpecularLight

public static float[] defaultGLSpecularLight

defaultGLTwoSidedLighting

public static boolean defaultGLTwoSidedLighting

pos

public IVec pos
eye location


yaw

public double yaw
yaw-pitch-roll ZXY conversion yaw=0 pitch=0 equals x-axis yaw is rotation around z, pitch is around y, roll is around x, in right hand rule


pitch

public double pitch
yaw-pitch-roll ZXY conversion yaw=0 pitch=0 equals x-axis yaw is rotation around z, pitch is around y, roll is around x, in right hand rule


roll

public double roll
yaw-pitch-roll ZXY conversion yaw=0 pitch=0 equals x-axis yaw is rotation around z, pitch is around y, roll is around x, in right hand rule


axonometric

public boolean axonometric
axonometric or perspective


screenX

public int screenX
screen location


screenY

public int screenY
screen location


screenWidth

public int screenWidth
screen width & height


screenHeight

public int screenHeight
screen width & height


persRatio

public double persRatio
perspective ratio = tan(angle of view)


axonRatio

public double axonRatio
scale to window size


near

public double near

far

public double far

viewDistance

public double viewDistance

target

public IVec target
view target location


rotateAroundTarget

public boolean rotateAroundTarget

transformMatrix

public IMatrix4 transformMatrix

transformArray

public double[] transformArray

useGL

public boolean useGL

hide

public boolean hide

pane

public IPane pane

mode

public IGraphicMode mode

bgColor

public IColor[][] bgColor
background color: one color(1x1matrix), two color(1x2matrix) or four colors(2x2 matrix)

Constructor Detail

IView

public IView(double x,
             double y,
             double z,
             double yaw,
             double pitch,
             double roll,
             int screenX,
             int screenY,
             int screenWidth,
             int screenHeight,
             boolean axonometric)

IView

public IView(double x,
             double y,
             double z,
             double yaw,
             double pitch,
             double roll,
             int screenX,
             int screenY,
             int screenWidth,
             int screenHeight)

IView

public IView(double x,
             double y,
             double z,
             double yaw,
             double pitch,
             double roll)

IView

public IView(double x,
             double y,
             double z,
             double yaw,
             double pitch)
Method Detail

enableGL

public void enableGL()

disableGL

public void disableGL()

setMode

public void setMode(IGraphicMode m)

mode

public IGraphicMode mode()

isHidden

public boolean isHidden()

hide

public void hide()

show

public void show()

bgColor

public void bgColor(IColor c)

bgColor

public void bgColor(IColor c1,
                    IColor c2)

bgColor

public void bgColor(IColor c1,
                    IColor c2,
                    IColor c3,
                    IColor c4)

bgColor

public void bgColor(IColor[][] c)

bgColor

public IColor[][] bgColor()

setPane

public void setPane(IPane p)

setScreen

public void setScreen(int x,
                      int y,
                      int w,
                      int h)

setScreenSize

public void setScreenSize(int w,
                          int h)

setScreenPosition

public void setScreenPosition(int x,
                              int y)

getScreenWidth

public double getScreenWidth()

getScreenHeight

public double getScreenHeight()

getScreenX

public double getScreenX()

getScreenY

public double getScreenY()

getAxonometricRatio

public double getAxonometricRatio()

getPerspectiveRatio

public double getPerspectiveRatio()

setAxonometricRatio

public void setAxonometricRatio(double r)

setPerspectiveRatio

public void setPerspectiveRatio(double r)

setPerspectiveAngle

public void setPerspectiveAngle(double angle)

perspective

public void perspective()

axonometric

public void axonometric()

isAxonometric

public boolean isAxonometric()

setParametersByBounds

public void setParametersByBounds(IBounds bounds)
update near, far, viewDistance by bounding box


setTarget

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

setTarget

public void setTarget(IVecI t)

enableRotationAroundTarget

public void enableRotationAroundTarget()

disableRotationAroundTarget

public void disableRotationAroundTarget()

targetDistance

public double targetDistance()

set

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

set

public void set(IVec location)

set

public void set(double x,
                double y,
                double z,
                double yaw,
                double pitch)

set

public void set(IVec location,
                double yaw,
                double pitch)

set

public void set(double x,
                double y,
                double z,
                double yaw,
                double pitch,
                double roll)

set

public void set(IVec location,
                double yaw,
                double pitch,
                double roll)

getLocation

public IVec getLocation()

setLocation

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

setLocation

public void setLocation(IVecI pt)

setAngle

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

setAngle

public void setAngle(double yaw,
                     double pitch,
                     double roll,
                     boolean updateTarget)

setAngle

public void setAngle(double yaw,
                     double pitch)

setAngle

public void setAngle(double yaw,
                     double pitch,
                     boolean updateTarget)

moveForward

public void moveForward(double dist)

location

public IVec location()

target

public IVec target()

getYaw

public double getYaw()

getPitch

public double getPitch()

getRoll

public double getRoll()

getAngles

public IVec getAngles()

frontDirection

public IVec frontDirection()

rightDirection

public IVec rightDirection()

upDirection

public IVec upDirection()

focus

public void focus(IBounds bb)

convert

public boolean convert(IVecI orig,
                       IVec2 dest)
converts 3d coordinates to 2d coordinates of screen whose unit is pixels and whose origin is top left corner and positive Y is downward

Returns:
returns if result is inside screen

convert

public boolean convert(IVecI orig,
                       IVec2f dest)
converts 3d coordinates to 2d coordinates of screen whose unit is pixels and whose origin is top left corner and positive Y is downward

Returns:
returns if result is inside screen

convert

public boolean convert(IVecI orig,
                       IVec dest)
converts 3d coordinates to 2d. Putting depth in z component of the second argument

Returns:
returns if result is inside screen

convert

public IVec convert(IVecI orig)
converts 3d coordinates to 2d. Putting depth in z component of the return vector. no check if it's inside screen

Returns:
3d vector whose x and y are 2d coordinates in screen and z is depth

update

public void update()

setTop

public void setTop()

setTop

public void setTop(double x,
                   double y)

setTop

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

setTop

public void setTop(double x,
                   double y,
                   double z,
                   double axonometricRatio)

setBottom

public void setBottom()

setBottom

public void setBottom(double x,
                      double y)

setBottom

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

setBottom

public void setBottom(double x,
                      double y,
                      double z,
                      double axonometricRatio)

setLeft

public void setLeft()

setLeft

public void setLeft(double y,
                    double z)

setLeft

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

setLeft

public void setLeft(double x,
                    double y,
                    double z,
                    double axonometricRatio)

setRight

public void setRight()

setRight

public void setRight(double y,
                     double z)

setRight

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

setRight

public void setRight(double x,
                     double y,
                     double z,
                     double axonometricRatio)

setFront

public void setFront()

setFront

public void setFront(double x,
                     double z)

setFront

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

setFront

public void setFront(double x,
                     double y,
                     double z,
                     double axonometricRatio)

setBack

public void setBack()

setBack

public void setBack(double x,
                    double z)

setBack

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

setBack

public void setBack(double x,
                    double y,
                    double z,
                    double axonometricRatio)

setPerspective

public void setPerspective()

setPerspective

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

setPerspective

public void setPerspective(double x,
                           double y,
                           double z,
                           double yaw,
                           double pitch)

setPerspective

public void setPerspective(double perspectiveAngle)

setPerspective

public void setPerspective(double x,
                           double y,
                           double z,
                           double perspectiveAngle)

setPerspective

public void setPerspective(double x,
                           double y,
                           double z,
                           double yaw,
                           double pitch,
                           double perspectiveAngle)

setAxonometric

public void setAxonometric()

setAxonometric

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

setAxonometric

public void setAxonometric(double x,
                           double y,
                           double z,
                           double axonometricRatio)

setAxonometric

public void setAxonometric(double x,
                           double y,
                           double z,
                           double yaw,
                           double pitch)

setAxonometric

public void setAxonometric(double x,
                           double y,
                           double z,
                           double yaw,
                           double pitch,
                           double axonometricRatio)

getTopView

public static IView getTopView(int screenX,
                               int screenY,
                               int screenWidth,
                               int screenHeight)

getBottomView

public static IView getBottomView(int screenX,
                                  int screenY,
                                  int screenWidth,
                                  int screenHeight)

getLeftView

public static IView getLeftView(int screenX,
                                int screenY,
                                int screenWidth,
                                int screenHeight)

getRightView

public static IView getRightView(int screenX,
                                 int screenY,
                                 int screenWidth,
                                 int screenHeight)

getFrontView

public static IView getFrontView(int screenX,
                                 int screenY,
                                 int screenWidth,
                                 int screenHeight)

getBackView

public static IView getBackView(int screenX,
                                int screenY,
                                int screenWidth,
                                int screenHeight)

getDefaultAxonometricView

public static IView getDefaultAxonometricView(int screenX,
                                              int screenY,
                                              int screenWidth,
                                              int screenHeight)

getDefaultPerspectiveView

public static IView getDefaultPerspectiveView(int screenX,
                                              int screenY,
                                              int screenWidth,
                                              int screenHeight)