Class Canvas

All Implemented Interfaces:
HumanFaceListener, ImageObserver, MenuContainer, Serializable, Accessible

public class Canvas extends JPanel implements HumanFaceListener
OpenGL canvas.
See Also:
  • Constructor Details

  • Method Details

    • getSceneRenderer

      public SceneRenderer getSceneRenderer()
      Returns the scene
      Returns:
      the scene
    • renderScene

      public void renderScene()
      Renders the scene.
    • getCanvasPanel

      public JPanel getCanvasPanel()
    • getScene

      public Scene getScene()
    • getState

      public CanvasState getState()
      Creates the set of the canvas. Primarily stores the camera, background color, transparency and rendering mode of the faces.
      Returns:
      the state of the canvas
    • setState

      public void setState(CanvasState state)
      Sets the state of the canvas. Primarily adjusts the camera, background color, transparency and rendering mode of the faces.
      Parameters:
      state - the state to set
    • getCamera

      public Camera getCamera()
      Returns camera.
      Returns:
      camera
    • setCamera

      public void setCamera(Camera camera)
    • getGLCanvas

      public com.jogamp.opengl.awt.GLCanvas getGLCanvas()
      Returns the underlying OpenGL canvas.
      Returns:
      the underlying OpenGL canvas.
    • getListener

      public CanvasListener getListener()
    • setDarkBackground

      public void setDarkBackground(boolean dark)
      Sets background color
      Parameters:
      dark - If true, then a dark background is set
    • addToolBox

      public void addToolBox(JPanel toolbox)
      Adds a toolbox to the scene toolbar.
      Parameters:
      toolbox - New toolbox
    • getMasksCorrespondence

      public MasksCorrespondence getMasksCorrespondence()
      Returns the MaskCorrespondence object associated with the canvas.
      Returns:
      the MaskCorrespondence object
    • acceptEvent

      public void acceptEvent(HumanFaceEvent event)
      Description copied from interface: HumanFaceListener
      Subscription method, which is invoked when an event appears.
      Specified by:
      acceptEvent in interface HumanFaceListener
      Parameters:
      event - A fired event.
    • captureCanvas

      public BufferedImage captureCanvas()
      Captures the canvas and returns it as a buffered image.
      Returns:
      the captured canvas
    • castRay

      public org.apache.commons.lang3.tuple.Pair<StoredHumanFace,RayIntersection> castRay(javax.vecmath.Point3d startPoint, javax.vecmath.Vector3d direction)
      Casts a ray through a point in 3D space and finds the intersection with the closest face.
      Parameters:
      startPoint - The starting point of the ray
      direction - The direction of the ray
      Returns:
      The intersection with the closest face
    • castRayThroughPixel

      public org.apache.commons.lang3.tuple.Pair<StoredHumanFace,RayIntersection> castRayThroughPixel(int pixelX, int pixelY)
      Cast a ray through a pixel and find the intersection with visible faces only (hidden faces and other graphical objects are omitted).
      Parameters:
      pixelX - The X coordinate of mouse pointer
      pixelY - The X coordinate of mouse pointer
      Returns:
      The intersection with the closest visible face