public class Sphere extends AbstractWireframeable implements ISingleColorable
setData()
method. Moreover, a Sphere3d is Wireframeable3d and support only one color
that is defined trough its setColor()
method.Modifier and Type | Field and Description |
---|---|
protected Color |
color |
protected static com.jogamp.opengl.util.gl2.GLUT |
glut |
protected Coord3d |
position |
protected float |
radius |
protected int |
slices |
protected int |
stacks |
facestatus, wfcolor, wfstatus, wfwidth
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
Constructor and Description |
---|
Sphere()
Initialize a black sphere at the origin with a radius of 10, and slicing
of 15.
|
Sphere(Coord3d position,
float radius,
int slicing,
Color color)
Initialize a sphere with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
applyGeometryTransform(Transform transform) |
void |
draw(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera cam)
Call OpenGL2 routines for rendering the object.
|
Color |
getColor()
Get the color.
|
Coord3d |
getPosition() |
void |
setColor(Color color)
Set the color.
|
void |
setData(Coord3d position,
float radius,
float height,
int slices,
int stacks)
Set the sphere data.
|
void |
setPosition(Coord3d position)
Set the position of the Sphere and the dimensions of its boundingbox.
|
void |
setSlicing(int verticalWires,
int horizontalWires)
Set the sphere slicing parameters, i.e. the subtlety of the circle
estimation.
|
void |
setVolume(float radius)
Set the radius of the sphere, and the dimensions of its boundingbox.
|
String |
toString(int depth) |
void |
updateBounds() |
getFaceDisplayed, getWireframeColor, getWireframeDisplayed, getWireframeWidth, setFaceDisplayed, setWireframeColor, setWireframeDisplayed, setWireframeWidth
addDrawableListener, call, call, callWithAlphaFactor, colorGL2, colorGLES2, dispose, doDrawBounds, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getBounds, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, negative, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString, vertexGL2, vertexGLES2
protected Coord3d position
protected float radius
protected int slices
protected int stacks
protected Color color
protected static com.jogamp.opengl.util.gl2.GLUT glut
public Sphere()
public void draw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)
AbstractDrawable
draw
in interface IGLRenderer
draw
in class AbstractDrawable
gl
- GL2 contextglu
- GLU contextcam
- a reference to a shooting Camera.public void applyGeometryTransform(Transform transform)
applyGeometryTransform
in class AbstractDrawable
public void setData(Coord3d position, float radius, float height, int slices, int stacks)
position
- sphere position (may be handled differently in future version)radius
- radius of the sphereslices
- number of vertical slices (i.e. wireframes)stacks
- number of horizontal stacks (i.e. wireframes)public void setPosition(Coord3d position)
position
- public Coord3d getPosition()
public void updateBounds()
updateBounds
in class AbstractDrawable
public void setVolume(float radius)
radius
- sphere radiuspublic void setSlicing(int verticalWires, int horizontalWires)
verticalWires
- number of vertical sliceshorizontalWires
- number of horizontal slicespublic void setColor(Color color)
ISingleColorable
setColor
in interface ISingleColorable
color
- the colorpublic Color getColor()
ISingleColorable
getColor
in interface ISingleColorable
public String toString(int depth)
toString
in class AbstractDrawable
Copyright © 2016. All rights reserved.