Package org.jzy3d.plot3d.primitives
Class Geometry
java.lang.Object
org.jzy3d.plot3d.primitives.Drawable
org.jzy3d.plot3d.primitives.Wireframeable
org.jzy3d.plot3d.primitives.Geometry
- All Implemented Interfaces:
IMultiColorable
,ISingleColorable
,IGLRenderer
,ISortableDraw
-
Field Summary
Modifier and TypeFieldDescriptionprotected Coord3d
protected Color
protected ColorMapper
static boolean
Default setting ofsetNormalProcessingAutomatic(boolean)
.static Color
static int
static int
static Color
static boolean
Default setting ofsetNormalizeNormals(boolean)
.protected boolean
protected Normal.NormalPer
protected boolean
protected PolygonMode
static boolean
A flag to show normals for debugging lightingstatic boolean
Default setting ofsetSplitInTriangles(boolean)
.protected boolean
Fields inherited from class org.jzy3d.plot3d.primitives.Wireframeable
depthFunctionChangeForWireframe, faceDisplayed, materialAmbiantReflection, materialDiffuseReflection, materialEmission, materialShininess, materialSpecularReflection, NO_OVERLAP_DEPTH_RATIO, polygonOffsetFactor, polygonOffsetFillEnable, polygonOffsetUnit, polygonWireframeDepthTrick, reflectLight, wireframeColor, wireframeColorFromPolygonPoints, wireframeDisplayed, wireframeWidth, wireframeWithLineLoop
Fields inherited from class org.jzy3d.plot3d.primitives.Drawable
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(float x, float y, float z) void
void
void
void
void
void
void
Add a point to the polygon.void
applyGeometryTransform
(Transform transform) protected void
applyPointOrMapperColor
(IPainter painter, Point p) Apply mapper color if a mapper is defined and store the result in the point color, or use point color if mapper is undefined.protected abstract void
Invoke GL begin with the actual geometry typeinvalid @link
GL#GL_POINTS
invalid @link
GL#GL_LINES
invalid @link
GL#GL_TRIANGLES
invalid @link
GL2#GL_POLYGON
protected void
callPointForWireframe
(IPainter painter) Drawing the point list in wireframe modeprotected void
callPointsForFace
(IPainter painter) Drawing the point list in face mode (polygon content)protected void
callPointsForFace_NoSplit
(IPainter painter) protected void
protected void
protected void
protected void
protected void
callPointsForFace_SplitInTriangle_NormalAuto
(IPainter painter, Point p1, Point p2, Point p3) protected void
callPointsForFace_SplitInTriangle_NormalSupplied
(IPainter painter, Point p1, Point p2, Point p3, int t) protected Coord3d
computeNormalAutomatic
(List<Point> points) protected Coord3d
computeNormalAutomatic
(Point p1, Point p2, Point p3) void
Call OpenGL2 routines for rendering the object.protected void
protected void
drawNormal
(IPainter painter, Coord3d start, Coord3d end) protected void
protected void
drawPolygonNormal
(IPainter painter, List<Point> points, Coord3d normal) protected void
protected void
drawTriangleNormal
(IPainter painter, Point p1, Point p2, Point p3, Coord3d n1, Coord3d n2, Coord3d n3) protected void
drawWireframe
(IPainter painter) boolean
get
(int p) Return the barycentre of this object, which is computed as the center of its bounding box.getColor()
Get the color.Get the colormapper.Coord3d[]
Returns an array of the mutable coordinates held by this polygon points.Returns a list of the mutable coordinates held by this polygon points.Returns a set of the mutable coordinates held by this polygon points.double
getDistance
(Camera camera) Return the distance of the object center to theCamera
's eye.double
getLongestDistance
(Camera camera) Returns the list of the mutable points held by this polygon.Returns a set of the mutable points held by this polygon.double
getShortestDistance
(Camera camera) int
hashCode()
boolean
boolean
Normal processing is false by default, and becomes true as soon as one provide normals throughsetNormals(List, NormalPer)
boolean
void
Set the color.void
setColorMapper
(ColorMapper mapper) Set the colormapper that will be used by the Drawable, instead of using precomputed colors.void
void
setNormalizeNormals
(boolean normalizeNormals) Normalizing normals is usefull to ensure that polygons of different sizes will have a consistent light reflection.void
setNormalProcessingAutomatic
(boolean normalProcessingAutomatic) Set normal processing to be automatic or not.void
setNormals
(List<Coord3d> normals, Normal.NormalPer normalPer) Provides normals for this geometry.void
setPolygonMode
(PolygonMode polygonMode) A null polygonMode imply no any call to gl.glPolygonMode(...) at renderingvoid
setReflectLight
(boolean reflectLight) If true, drawing this object will set ambient, diffuse, specular and shininess parameters.void
setSplitInTriangles
(boolean splitInTriangles) Splitting a polygon in multiple triangles is said to be better to adress complex rendering issues in OpenGL, but has a (very small) overhead.int
size()
toString
(int depth) void
Methods inherited from class org.jzy3d.plot3d.primitives.Wireframeable
applyDepthRangeDefault, applyDepthRangeForOverlying, applyDepthRangeForUnderlying, applyMaterial, doDrawBoundsIfDisplayed, getMaterialAmbiantReflection, getMaterialDiffuseReflection, getMaterialEmission, getMaterialShininess, getMaterialSpecularReflection, getPolygonOffsetFactor, getPolygonOffsetUnit, getWireframeColor, getWireframeWidth, isFaceDisplayed, isPolygonOffsetFillEnable, isPolygonWireframeDepthTrick, isReflectLight, isWireframeColorFromPolygonPoints, isWireframeDisplayed, polygonOffsetFillDisable, polygonOffsetFillEnable, polygonOffsetLineDisable, polygonOffsetLineEnable, setFaceDisplayed, setMaterialAmbiantReflection, setMaterialDiffuseReflection, setMaterialEmission, setMaterialShininess, setMaterialSpecularReflection, setPolygonOffsetFactor, setPolygonOffsetFillEnable, setPolygonOffsetUnit, setPolygonWireframeDepthTrick, setWireframeColor, setWireframeColorFromPolygonPoints, setWireframeDisplayed, setWireframeWidth
Methods inherited from class org.jzy3d.plot3d.primitives.Drawable
addDrawableListener, asWireframeable, dispose, doTransform, fireDrawableChanged, fireDrawableChanged, getBoundingBoxColor, getBounds, getLegend, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString
-
Field Details
-
NORMAL_AUTO_DEFAULT
public static boolean NORMAL_AUTO_DEFAULTDefault setting ofsetNormalProcessingAutomatic(boolean)
. Can be globally changed to avoid setting it geometry-wise. -
SPLIT_TRIANGLE_DEFAULT
public static boolean SPLIT_TRIANGLE_DEFAULTDefault setting ofsetSplitInTriangles(boolean)
. Can be globally changed to avoid setting it geometry-wise. -
NORMALIZE_NORMAL_DEFAULT
public static boolean NORMALIZE_NORMAL_DEFAULTDefault setting ofsetNormalizeNormals(boolean)
. Can be globally changed to avoid setting it geometry-wise. -
SHOW_NORMALS
public static boolean SHOW_NORMALSA flag to show normals for debugging lighting -
NORMAL_LINE_WIDTH
public static int NORMAL_LINE_WIDTH -
NORMAL_POINT_WIDTH
public static int NORMAL_POINT_WIDTH -
NORMAL_END_COLOR
-
NORMAL_START_COLOR
-
polygonMode
-
mapper
-
points
-
color
-
center
-
normals
-
normalProcessingAutomatic
protected boolean normalProcessingAutomatic -
splitInTriangles
protected boolean splitInTriangles -
normalizeNormals
protected boolean normalizeNormals -
normalPer
-
-
Constructor Details
-
Geometry
public Geometry()Initializes an emptyGeometry
with face status defaulting to true, and wireframe status defaulting to false. -
Geometry
public Geometry(int n) -
Geometry
-
Geometry
-
Geometry
-
Geometry
-
Geometry
-
-
Method Details
-
setReflectLight
public void setReflectLight(boolean reflectLight) Description copied from class:Wireframeable
If true, drawing this object will set ambient, diffuse, specular and shininess parameters. If the drawable has no normal defined, then the normal will be automatically processed.- Overrides:
setReflectLight
in classWireframeable
-
getNormals
-
setNormals
Provides normals for this geometry. Manually setting normals will disable automatic normal processing. Not providing normals will keep the default automatic normal processing active. You may more simply set a single normal for this geometry by callingsetNormal(Coord3d)
- Parameters:
normals
-normalPer
- indicate if the supplied normals are given per vertex or per geometry. The ability to provide a list is kept for the case where one wishes toinvalid @link
{@link #setSplitInTriangles(true)
-
setNormal
-
isNormalProcessingAutomatic
public boolean isNormalProcessingAutomatic()Normal processing is false by default, and becomes true as soon as one provide normals throughsetNormals(List, NormalPer)
- Returns:
-
setNormalProcessingAutomatic
public void setNormalProcessingAutomatic(boolean normalProcessingAutomatic) Set normal processing to be automatic or not.- Parameters:
normalProcessingAutomatic
-
-
draw
Description copied from class:Drawable
Call OpenGL2 routines for rendering the object.- Specified by:
draw
in interfaceIGLRenderer
- Specified by:
draw
in classDrawable
-
drawFace
-
callPointsForFace
Drawing the point list in face mode (polygon content) -
callPointsForFace_NoSplit
-
callPointsForFace_NoSplit_NormalSupplied
-
callPointsForFace_NoSplit_NormalAuto
-
callPointsForFace_NoSplit_NoNormal
-
callPointsForFace_SplitInTriangle
-
callPointsForFace_SplitInTriangle_NormalSupplied
-
callPointsForFace_SplitInTriangle_NormalAuto
-
computeNormalAutomatic
-
computeNormalAutomatic
-
applyPointOrMapperColor
Apply mapper color if a mapper is defined and store the result in the point color, or use point color if mapper is undefined. -
drawPolygonNormal
-
drawPolygonNormal
-
drawTriangleNormal
-
drawTriangleNormal
-
drawNormal
-
drawWireframe
-
callPointForWireframe
Drawing the point list in wireframe mode -
begin
Invoke GL begin with the actual geometry typeinvalid @link
GL#GL_POINTS
invalid @link
GL#GL_LINES
invalid @link
GL#GL_TRIANGLES
invalid @link
GL2#GL_POLYGON
-
add
public void add(float x, float y, float z) -
add
-
add
-
add
-
add
-
add
Add a point to the polygon. -
add
-
add
-
applyGeometryTransform
- Specified by:
applyGeometryTransform
in classDrawable
-
updateBounds
public void updateBounds()- Specified by:
updateBounds
in classDrawable
-
getBarycentre
Description copied from class:Drawable
Return the barycentre of this object, which is computed as the center of its bounding box. If the bounding box is not available, the returned value isinvalid @link
Coord3d.INVALID
- Overrides:
getBarycentre
in classDrawable
- Returns:
- the center of the bounding box, or
invalid @link
Coord3d.INVALID
-
get
-
getPoints
Returns the list of the mutable points held by this polygon. -
getPointSet
Returns a set of the mutable points held by this polygon. -
getCoordSet
Returns a set of the mutable coordinates held by this polygon points. -
getCoordList
Returns a list of the mutable coordinates held by this polygon points. -
getCoordArray
Returns an array of the mutable coordinates held by this polygon points. -
size
public int size() -
getDistance
Description copied from class:Drawable
Return the distance of the object center to theCamera
's eye.- Specified by:
getDistance
in interfaceISortableDraw
- Overrides:
getDistance
in classDrawable
-
getShortestDistance
- Specified by:
getShortestDistance
in interfaceISortableDraw
- Overrides:
getShortestDistance
in classDrawable
-
getLongestDistance
- Specified by:
getLongestDistance
in interfaceISortableDraw
- Overrides:
getLongestDistance
in classDrawable
-
getPolygonMode
-
setPolygonMode
A null polygonMode imply no any call to gl.glPolygonMode(...) at rendering -
setColorMapper
Description copied from interface:IMultiColorable
Set the colormapper that will be used by the Drawable, instead of using precomputed colors.- Specified by:
setColorMapper
in interfaceIMultiColorable
-
getColorMapper
Description copied from interface:IMultiColorable
Get the colormapper.- Specified by:
getColorMapper
in interfaceIMultiColorable
-
setColor
Description copied from interface:ISingleColorable
Set the color.- Specified by:
setColor
in interfaceISingleColorable
- Parameters:
color
- the color
-
getColor
Description copied from interface:ISingleColorable
Get the color.- Specified by:
getColor
in interfaceISingleColorable
- Returns:
- color the color.
-
isSplitInTriangles
public boolean isSplitInTriangles() -
setSplitInTriangles
public void setSplitInTriangles(boolean splitInTriangles) Splitting a polygon in multiple triangles is said to be better to adress complex rendering issues in OpenGL, but has a (very small) overhead. -
isNormalizeNormals
public boolean isNormalizeNormals() -
setNormalizeNormals
public void setNormalizeNormals(boolean normalizeNormals) Normalizing normals is usefull to ensure that polygons of different sizes will have a consistent light reflection. Indeed, a large polygon will have a high normal value compared to a small polygon. Normalizing requires a bit more computation though. This setting will only change something as long as- The object is configured to
invalid @link
{@link #setReflectLight(true)
Light
is added to the chart. - The object is configured to
invalid @link
{@link #setNormalProcessingAutomatic(true)
- The object is configured to
-
toString
-
hashCode
public int hashCode() -
equals
-