Package org.jzy3d.painters
Class AbstractPainter
java.lang.Object
org.jzy3d.painters.AbstractPainter
- All Implemented Interfaces:
IPainter
- Direct Known Subclasses:
EmulGLPainter
,NativeDesktopPainter
,NativeEmbeddedPainter
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
box
(BoundingBox3d box, Color color, float width, SpaceTransformer spaceTransformer) A helper to draw a bounding box.void
void
clearColor
(Color color) void
A convenient shortcut to invoke a clipping plane using an ID in [0;5] instead of the original OpenGL ID value.void
clip
(BoundingBox3d box) A convenient shortcut to glClipPlane that defines the 6 clipping planes according to the min/max values of the bounding box.void
clipOff()
Disable all clipping planesvoid
clipOn()
Enable all clipping planesboolean[]
Indicates status of clipping planes (on/off)void
A convenient shortcut to glColor4fvoid
colorAlphaFactor
(Color color, float alpha) A convenient shortcut to glColor4f which multiplies the color's alpha channel by the given factorvoid
colorAlphaOverride
(Color color, float alpha) A convenient shortcut to glColor4f which overrides the color's alpha channelprotected double[]
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.getOS()
Return the Quality setting of the chart, which may be different from the one given at theIPainter.configureGL(Quality)
step.getView()
boolean
gluProject
(float objX, float objY, float objZ, float[] model, float[] proj, int[] view, float[] winPos) Project 3D (world) coordinates in the 2D screenboolean
gluUnProject
(float winX, float winY, float winZ, float[] model, float[] proj, int[] view, float[] objPos) Project 2D (screen) coordinates in the 3D worldboolean
Verify if pixel scale of JVM is different than the one return by the canvasboolean
isJVMScaleLargerThanNativeScale
(Coord2d scaleHardware, Coord2d scaleJVM) void
modelToScreen
(ArrayList<ArrayList<Coord3d>> polygons) Project a list of lists of coordinates.modelToScreen
(List<Coord3d> points) Project a list of coordinates.modelToScreen
(Coord3d point) Transform a 3d point coordinate into its screen position.Coord3d[]
modelToScreen
(Coord3d[] points) Project an array of coordinates.Coord3d[][]
modelToScreen
(Coord3d[][] points) Project an array of coordinates.modelToScreen
(Coord3d point, int[] viewport, float[] modelView, float[] projection) Transform a 3d coordinate to 2D screen coordinate.modelToScreen
(PolygonArray polygon) PolygonArray[][]
modelToScreen
(PolygonArray[][] polygons) void
A convenient shortcut to glNormal3fvoid
raster
(Coord3d coord, SpaceTransformer transform) screenToModel
(Coord3d screen) Transform a 2d screen coordinate into a 3d coordinate.screenToModel
(Coord3d screen, int[] viewport, float[] modelView, float[] projection) Transform a 2d screen coordinate into a 3d coordinate.void
void
void
void
void
vertex
(float x, float y, float z, SpaceTransformer transform) A convenient shortcut to glVertex3f, able to apply a space transform in case it is not nullvoid
A convenient shortcut to glVertex3fvoid
vertex
(Coord3d coord, SpaceTransformer transform) A convenient shortcut to glVertex3f, able to apply a space transform in case it is not nullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jzy3d.painters.IPainter
acquireGL, clipPlaneId, configureGL, drawImage, drawText, getModelViewAsDouble, getModelViewAsFloat, getProjectionAsDouble, getProjectionAsFloat, getTextLengthInPixels, getTextLengthInPixels, getViewPortAsInt, glBegin, glBegin_Line, glBegin_LineLoop, glBegin_LineStrip, glBegin_Point, glBegin_Polygon, glBegin_Quad, glBegin_Triangle, glBitmap, glBlendFunc, glCallList, glClear, glClearColor, glClearColorAndDepthBuffers, glClearDepth, glClearStencil, glClipPlane, glColor3f, glColor4f, glCullFace, glCullFace_Front, glDeleteLists, glDepthFunc, glDepthFunc, glDepthRangef, glDisable, glDisable_Blend, glDisable_ClipPlane, glDisable_CullFace, glDisable_DepthTest, glDisable_Light, glDisable_Lighting, glDisable_LineStipple, glDisable_PolygonOffsetFill, glDisable_PolygonOffsetLine, glDisable_Stencil, glDrawPixels, glEnable, glEnable_Blend, glEnable_ClipPlane, glEnable_ColorMaterial, glEnable_CullFace, glEnable_DepthTest, glEnable_Light, glEnable_Lighting, glEnable_LineStipple, glEnable_PointSmooth, glEnable_PolygonOffsetFill, glEnable_PolygonOffsetLine, glEnable_Stencil, glEnd, glEndList, glEvalCoord2f, glFeedbackBuffer, glFlush, glFrontFace, glFrontFace_ClockWise, glFrustum, glGenLists, glGetDoublev, glGetFloatv, glGetIntegerv, glHint, glHint_PointSmooth_Nicest, glInitNames, glIsList, glLight_Ambiant, glLight_Diffuse, glLight_Position, glLight_Shininess, glLight_Specular, glLightf, glLightf, glLightfv, glLightModel, glLightModel, glLightModelfv, glLightModeli, glLineStipple, glLineWidth, glLoadIdentity, glLoadName, glMap2f, glMaterial, glMaterial, glMaterialfv, glMatrixMode, glMatrixMode_ModelView, glMatrixMode_Projection, glNewList, glNewList, glNormal3f, glOrtho, glPassThrough, glPixelStore, glPixelStorei, glPixelZoom, glPointSize, glPolygonMode, glPolygonMode, glPolygonOffset, glPopMatrix, glPopName, glPushMatrix, glPushName, glRasterPos3f, glRenderMode, glRenderMode, glRotatef, glScalef, glSelectBuffer, glShadeModel, glShadeModel, glShadeModel_Flat, glShadeModel_Smooth, glStencilFunc, glStencilMask, glStencilMask_False, glStencilMask_True, glStencilOp, glTexCoord2f, glTexEnvf, glTexEnvi, glTranslatef, gluCylinder, gluDisk, gluLookAt, gluOrtho2D, gluPerspective, gluPickMatrix, gluProject, gluSphere, glutBitmapLength, glutBitmapString, glutBitmapString, glutSolidCube, glutSolidSphere, glutSolidTeapot, glutWireTeapot, gluUnProject, glVertex3d, glVertex3f, glViewport, releaseGL
-
Field Details
-
camera
-
view
-
canvas
-
os
-
-
Constructor Details
-
AbstractPainter
public AbstractPainter()
-
-
Method Details
-
getOS
-
getWindowingToolkit
- Specified by:
getWindowingToolkit
in interfaceIPainter
-
clearCache
public void clearCache()- Specified by:
clearCache
in interfaceIPainter
-
getView
-
setView
-
getCanvas
-
setCanvas
-
getCamera
-
setCamera
-
getQuality
Description copied from interface:IPainter
Return the Quality setting of the chart, which may be different from the one given at theIPainter.configureGL(Quality)
step.- Specified by:
getQuality
in interfaceIPainter
-
transform
-
color
Description copied from interface:IPainter
A convenient shortcut to glColor4f -
colorAlphaOverride
Description copied from interface:IPainter
A convenient shortcut to glColor4f which overrides the color's alpha channel- Specified by:
colorAlphaOverride
in interfaceIPainter
-
colorAlphaFactor
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 interfaceIPainter
-
clearColor
- Specified by:
clearColor
in interfaceIPainter
-
vertex
Description copied from interface:IPainter
A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null -
vertex
Description copied from interface:IPainter
A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null -
box
Description copied from interface:IPainter
A helper to draw a bounding box. -
vertex
Description copied from interface:IPainter
A convenient shortcut to glVertex3f -
normal
Description copied from interface:IPainter
A convenient shortcut to glNormal3f -
clip
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 withIPainter.clipOn()
. -
clipOn
public void clipOn()Description copied from interface:IPainter
Enable all clipping planes -
clipOff
public void clipOff()Description copied from interface:IPainter
Disable all clipping planes -
clipStatus
public boolean[] clipStatus()Description copied from interface:IPainter
Indicates status of clipping planes (on/off)- Specified by:
clipStatus
in interfaceIPainter
-
clip
A convenient shortcut to invoke a clipping plane using an ID in [0;5] instead of the original OpenGL ID value. -
equation
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.
- Parameters:
eq
-value
-- Returns:
-
raster
-
material
-
screenToModel
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 theCamera
. 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 usingIPainter.acquireGL()
- Specified by:
screenToModel
in interfaceIPainter
-
screenToModel
Transform a 2d screen coordinate into a 3d coordinate. Allow to pass custom viewport, modelview matrix and projection matrix. To use current one, invokescreenToModel(Coord3d)
- Specified by:
screenToModel
in interfaceIPainter
-
modelToScreen
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 usingpainter.acquireGL(); // make context current Coord3d screen2dCoord = painter.modelToScreen(world3dCoord); painter.releaseGL(); // release context to let other use it
- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
Transform a 3d coordinate to 2D screen coordinate. Allow to pass custom viewport, modelview matrix and projection matrix. To use current one, invokemodelToScreen(Coord3d)
- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
Project an array of coordinates.- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
Project an array of coordinates.- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
Project a list of coordinates.- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
Project a list of lists of coordinates.- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
- Specified by:
modelToScreen
in interfaceIPainter
-
modelToScreen
- Specified by:
modelToScreen
in interfaceIPainter
-
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 interfaceIPainter
-
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 interfaceIPainter
-
isJVMScaleLargerThanNativeScale
- Specified by:
isJVMScaleLargerThanNativeScale
in interfaceIPainter
-
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 interfaceIPainter
-