|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.GeometryGenerator org.j3d.geom.CylinderGenerator
public class CylinderGenerator
A simple cylinder that can be configured to have end caps.
The generator is used to create cylinder shaped geometry for the code. Internally we use a triangle array to generate the information as a collection of single triangles. A triangle strip would be more efficient for rendering, but that's too hard for this first cut :) The height of the cone is along the Y axis with the point in the positive Y direstion. The radius is around the X-Z plane. The whole object is centered on the origin.
Constructor Summary | |
---|---|
CylinderGenerator()
Construct a default cylinder with end caps. |
|
CylinderGenerator(boolean ends)
Construct a default cylinder with the option of having end caps. |
|
CylinderGenerator(float height,
float radius)
Construct a cylinder of a given height and radius with ends. |
|
CylinderGenerator(float height,
float radius,
boolean ends,
boolean side)
Construct a cylinder of a given height and radius with the option of ends. |
|
CylinderGenerator(float height,
float radius,
boolean top,
boolean bottom,
boolean side)
Construct a cylinder of a given height and radius with the option of ends. |
|
CylinderGenerator(float height,
float radius,
int facets)
Construct a cylinder of a given height and radius with ends and selectable number of faces around the radius. |
|
CylinderGenerator(float height,
float radius,
int facets,
boolean ends,
boolean side)
Construct a cylinder of a given height and radius with the option of ends and selectable number of faces around the radius. |
|
CylinderGenerator(float height,
float radius,
int facets,
boolean top,
boolean bottom,
boolean side)
Construct a cylinder of a given height and radius with the option of ends and selectable number of faces around the radius. |
|
CylinderGenerator(int facets)
Construct a default cylinder with end caps and selectable number of faces around the radius. |
|
CylinderGenerator(int facets,
boolean ends)
Construct a default cylinder with the option of having end caps and selectable number of faces around the radius. |
Method Summary | |
---|---|
void |
generate(GeometryData data)
Generate a new set of geometry items based on the passed data. |
float[] |
getDimensions()
Get the dimensions of the cylinder. |
int |
getVertexCount(GeometryData data)
Get the number of vertices that this generator will create for the shape given in the definition. |
boolean |
hasEnds()
Check to see that this cylinder has ends in use or not |
void |
setDimensions(float height,
float radius,
boolean ends,
boolean side)
Change the dimensions of the cone to be generated. |
void |
setFacetCount(int facets)
Change the number of facets used to create this cone. |
Methods inherited from class org.j3d.geom.GeometryGenerator |
---|
createFaceNormal, createFaceNormal, createRadialNormal, createRadialNormal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CylinderGenerator()
public CylinderGenerator(boolean ends)
ends
- true to use end capspublic CylinderGenerator(int facets)
facets
- The number of faces to use around the radius
java.lang.IllegalArgumentException
- The number of facets is less than 3public CylinderGenerator(int facets, boolean ends)
facets
- The number of faces to use around the radiusends
- true to use end caps
java.lang.IllegalArgumentException
- The number of facets is less than 3public CylinderGenerator(float height, float radius)
height
- The height of the cylinder to generateradius
- The radis of the cylinder to generatepublic CylinderGenerator(float height, float radius, int facets)
height
- The height of the cylinder to generateradius
- The radis of the cylinder to generatefacets
- The number of faces to use around the radius
java.lang.IllegalArgumentException
- The number of facets is less than 3public CylinderGenerator(float height, float radius, boolean ends, boolean side)
height
- The height of the cylinder to generateradius
- The radis of the cylinder to generateends
- true to use end capsside
- true to display the sidespublic CylinderGenerator(float height, float radius, boolean top, boolean bottom, boolean side)
height
- The height of the cylinder to generateradius
- The radis of the cylinder to generatetop
- Whether to generate the top of the cylinderbottom
- Whether to generate the bottom of the cylinderside
- Whether to generate the side of the cylinderpublic CylinderGenerator(float height, float radius, int facets, boolean ends, boolean side)
height
- The height of the cylinder to generateradius
- The radis of the cylinder to generatefacets
- The number of faces to use around the radiusends
- true to use end capsside
- true to display the side
java.lang.IllegalArgumentException
- The number of facets is less than 3public CylinderGenerator(float height, float radius, int facets, boolean top, boolean bottom, boolean side)
height
- The height of the cylinder to generateradius
- The radis of the cylinder to generatefacets
- The number of faces to use around the radiustop
- Whether to generate the top of the cylinderbottom
- Whether to generate the bottom of the cylinderside
- Whether to generate the side of the cylinder
java.lang.IllegalArgumentException
- The number of facets is less than 3Method Detail |
---|
public boolean hasEnds()
public float[] getDimensions()
public void setDimensions(float height, float radius, boolean ends, boolean side)
height
- The height of the cone to generateradius
- The radius of the bottom of the coneends
- True if to generate faces for the endsside
- true if to generate faces for the sidespublic void setFacetCount(int facets)
facets
- The number of facets on the side of the cone
java.lang.IllegalArgumentException
- The number of facets is less than 3public int getVertexCount(GeometryData data) throws UnsupportedTypeException
getVertexCount
in class GeometryGenerator
data
- The data to base the calculations on
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested.public void generate(GeometryData data) throws UnsupportedTypeException, InvalidArraySizeException
generate
in class GeometryGenerator
data
- The data to base the calculations on
InvalidArraySizeException
- The array is not big enough to contain
the requested geometry
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |