Class AbstractPainter

java.lang.Object
org.jzy3d.painters.AbstractPainter
All Implemented Interfaces:
IPainter
Direct Known Subclasses:
EmulGLPainter, NativeDesktopPainter, NativeEmbeddedPainter

public abstract class AbstractPainter extends Object implements IPainter
  • Field Details

  • Constructor Details

    • AbstractPainter

      public AbstractPainter()
  • Method Details

    • getOS

      public OperatingSystem getOS()
      Specified by:
      getOS in interface IPainter
    • getWindowingToolkit

      public WindowingToolkit getWindowingToolkit()
      Specified by:
      getWindowingToolkit in interface IPainter
    • clearCache

      public void clearCache()
      Specified by:
      clearCache in interface IPainter
    • getView

      public View getView()
      Specified by:
      getView in interface IPainter
    • setView

      public void setView(View view)
      Specified by:
      setView in interface IPainter
    • getCanvas

      public ICanvas getCanvas()
      Specified by:
      getCanvas in interface IPainter
    • setCanvas

      public void setCanvas(ICanvas canvas)
      Specified by:
      setCanvas in interface IPainter
    • getCamera

      public Camera getCamera()
      Specified by:
      getCamera in interface IPainter
    • setCamera

      public void setCamera(Camera camera)
      Specified by:
      setCamera in interface IPainter
    • getQuality

      public Quality getQuality()
      Description copied from interface: IPainter
      Return the Quality setting of the chart, which may be different from the one given at the IPainter.configureGL(Quality) step.
      Specified by:
      getQuality in interface IPainter
    • transform

      public void transform(Transform transform, boolean loadIdentity)
      Specified by:
      transform in interface IPainter
    • color

      public void color(Color color)
      Description copied from interface: IPainter
      A convenient shortcut to glColor4f
      Specified by:
      color in interface IPainter
    • colorAlphaOverride

      public void colorAlphaOverride(Color color, float alpha)
      Description copied from interface: IPainter
      A convenient shortcut to glColor4f which overrides the color's alpha channel
      Specified by:
      colorAlphaOverride in interface IPainter
    • colorAlphaFactor

      public void colorAlphaFactor(Color color, float alpha)
      Description copied from interface: IPainter
      A convenient shortcut to glColor4f which multiplies the color's alpha channel by the given factor
      Specified by:
      colorAlphaFactor in interface IPainter
    • clearColor

      public void clearColor(Color color)
      Specified by:
      clearColor in interface IPainter
    • vertex

      public void vertex(Coord3d coord, SpaceTransformer transform)
      Description copied from interface: IPainter
      A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null
      Specified by:
      vertex in interface IPainter
    • vertex

      public void vertex(float x, float y, float z, SpaceTransformer transform)
      Description copied from interface: IPainter
      A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null
      Specified by:
      vertex in interface IPainter
    • box

      public void box(BoundingBox3d box, Color color, float width, SpaceTransformer spaceTransformer)
      Description copied from interface: IPainter
      A helper to draw a bounding box.
      Specified by:
      box in interface IPainter
    • vertex

      public void vertex(Coord3d coord)
      Description copied from interface: IPainter
      A convenient shortcut to glVertex3f
      Specified by:
      vertex in interface IPainter
    • normal

      public void normal(Coord3d norm)
      Description copied from interface: IPainter
      A convenient shortcut to glNormal3f
      Specified by:
      normal in interface IPainter
    • clip

      public void clip(BoundingBox3d box)
      Description copied from interface: IPainter
      A convenient shortcut to glClipPlane that defines the 6 clipping planes according to the min/max values of the bounding box. Then requires to enable clipping with IPainter.clipOn().
      Specified by:
      clip in interface IPainter
    • clipOn

      public void clipOn()
      Description copied from interface: IPainter
      Enable all clipping planes
      Specified by:
      clipOn in interface IPainter
    • clipOff

      public void clipOff()
      Description copied from interface: IPainter
      Disable all clipping planes
      Specified by:
      clipOff in interface IPainter
    • clipStatus

      public boolean[] clipStatus()
      Description copied from interface: IPainter
      Indicates status of clipping planes (on/off)
      Specified by:
      clipStatus in interface IPainter
    • clip

      public void clip(int plane, ClipEq equation, double value)
      A convenient shortcut to invoke a clipping plane using an ID in [0;5] instead of the original OpenGL ID value.
      Specified by:
      clip in interface IPainter
    • equation

      protected double[] equation(ClipEq eq, double value)
      The four coefs of the plane equation that are returned by this method are : Nx, Ny, Nz, D The solve the formula : Nx*x + Ny*y + Nz*z + D = 0 where Nx, Ny and Nz are the 3 components of the normal to the plane. The x, y and z in the equation are the coordinates of any point on the plane. The variable D is the distance of the plane from the origin. A point that is being tested can give three results based on where it is with respect to the plane :
      • The point is in front of the plane - In this case, the result obtained will be positive. The value obtained is the distance of the point from the plane being tested.
      • The point is behind the plane - In this case, the result will be negative. The value obtained is the distance of the point from the plane being tested.
      • The point is on the plane - The result will, quite obviously, be zero.
      A good explanation on vector form of a plane equation :
      Parameters:
      eq -
      value -
      Returns:
    • raster

      public void raster(Coord3d coord, SpaceTransformer transform)
      Specified by:
      raster in interface IPainter
    • material

      public void material(int face, int pname, Color color)
      Specified by:
      material in interface IPainter
    • screenToModel

      public Coord3d screenToModel(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. A null coordinate can be returned if the projection could not be performed for some reasons. This may occur if projection or modelview matrices are not invertible or if these matrices where unavailable (hence resulting to zero matrices) while invoking this method. Zero matrices can be avoided by ensuring the GL context is current using IPainter.acquireGL()
      Specified by:
      screenToModel in interface IPainter
    • screenToModel

      public Coord3d screenToModel(Coord3d screen, int[] viewport, float[] modelView, float[] projection)
      Transform a 2d screen coordinate into a 3d coordinate. Allow to pass custom viewport, modelview matrix and projection matrix. To use current one, invoke screenToModel(Coord3d)
      Specified by:
      screenToModel in interface IPainter
    • modelToScreen

      public Coord3d modelToScreen(Coord3d point)
      Transform a 3d point coordinate into its screen position. This method requires the GL context to be current. If not called inside a rendering loop, that method may not apply correctly and output {0,0,0}. In that case and if the chart is based on JOGL (native), one may force the context to be current using
       
       painter.acquireGL(); // make context current
       Coord3d screen2dCoord = painter.modelToScreen(world3dCoord);
       painter.releaseGL(); // release context to let other use it
       
       
      A null coordinate can be returned if the projection could not be performed for some reasons.
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public Coord3d modelToScreen(Coord3d point, int[] viewport, float[] modelView, float[] projection)
      Transform a 3d coordinate to 2D screen coordinate. Allow to pass custom viewport, modelview matrix and projection matrix. To use current one, invoke modelToScreen(Coord3d)
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public Coord3d[] modelToScreen(Coord3d[] points)
      Project an array of coordinates.
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public Coord3d[][] modelToScreen(Coord3d[][] points)
      Project an array of coordinates.
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public List<Coord3d> modelToScreen(List<Coord3d> points)
      Project a list of coordinates.
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public List<ArrayList<Coord3d>> modelToScreen(ArrayList<ArrayList<Coord3d>> polygons)
      Project a list of lists of coordinates.
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public PolygonArray modelToScreen(PolygonArray polygon)
      Specified by:
      modelToScreen in interface IPainter
    • modelToScreen

      public PolygonArray[][] modelToScreen(PolygonArray[][] polygons)
      Specified by:
      modelToScreen in interface IPainter
    • gluUnProject

      public boolean gluUnProject(float winX, float winY, float winZ, float[] model, float[] proj, int[] view, float[] objPos)
      Description copied from interface: IPainter
      Project 2D (screen) coordinates in the 3D world
      Specified by:
      gluUnProject in interface IPainter
    • gluProject

      public boolean gluProject(float objX, float objY, float objZ, float[] model, float[] proj, int[] view, float[] winPos)
      Description copied from interface: IPainter
      Project 3D (world) coordinates in the 2D screen
      Specified by:
      gluProject in interface IPainter
    • isJVMScaleLargerThanNativeScale

      public boolean isJVMScaleLargerThanNativeScale(Coord2d scaleHardware, Coord2d scaleJVM)
      Specified by:
      isJVMScaleLargerThanNativeScale in interface IPainter
    • isJVMScaleLargerThanNativeScale

      public boolean isJVMScaleLargerThanNativeScale()
      Description copied from interface: IPainter
      Verify if pixel scale of JVM is different than the one return by the canvas
      Specified by:
      isJVMScaleLargerThanNativeScale in interface IPainter