|
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.ConeGenerator
public class ConeGenerator
Generator of Cone raw coordinates and geometry normals.
The generator is used to create cone shapes for the code. It only generates the geometry array. Internally the representation uses a triangle array and generates all the values requested - textures oordinates, normals and coordinates. Normals are always generated per vertex calculated rather than per-face.
The height of the cone is along the Y axis with the point in the positive Y direstion and starting at the origin. The radius is around the X-Z plane and is centered on the origin.
When generating strips, we create a strip for all the top and a strip for all the bottom (if used). Generating quads are a bit useless for this geometry type, but is supported non-the-less for completeness.
Constructor Summary | |
---|---|
ConeGenerator()
Construct a default cone of height 2 and bottom radius of 1. |
|
ConeGenerator(float height,
float radius)
Create a custom cone of the given height and radius that includes the bottom faces. |
|
ConeGenerator(float height,
float radius,
boolean hasTop,
boolean hasBottom)
Create a custom cone of the given height and radius and can toggle the use of the bottom faces. |
|
ConeGenerator(float height,
float radius,
int facets)
Create a custom cone of the given height and radius and can control the number of facets in the cone. |
|
ConeGenerator(float height,
float radius,
int facets,
boolean hasTop,
boolean hasBottom)
Create a custom cone of the given height and radius and can toggle the use of the bottom faces and control the number of facets in the cone. |
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 cone. |
int |
getVertexCount(GeometryData data)
Get the number of vertices that this generator will create for the shape given in the definition. |
boolean |
hasBottom()
Check to see that this cone has a bottom in use or not |
void |
setDimensions(float height,
float radius,
boolean hasBottom)
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 ConeGenerator()
public ConeGenerator(float height, float radius)
height
- The height of the cone to generateradius
- The radius of the bottom of the conepublic ConeGenerator(float height, float radius, int facets)
height
- The height of the cone to generateradius
- The radius of the bottom of the conefacets
- The number of facets on the side of the cone
java.lang.IllegalArgumentException
- The number of facets is less than 3public ConeGenerator(float height, float radius, boolean hasTop, boolean hasBottom)
height
- The height of the cone to generateradius
- The radius of the bottom of the conehasTop
- True if to generate faces for the tophasBottom
- True if to generate faces for the bottompublic ConeGenerator(float height, float radius, int facets, boolean hasTop, boolean hasBottom)
height
- The height of the cone to generateradius
- The radius of the bottom of the conefacets
- The number of facets on the side of the conehasTop
- True if to generate faces for the tophasBottom
- True if to generate faces for the bottom
java.lang.IllegalArgumentException
- The number of facets is less than 3
or the radius is not positiveMethod Detail |
---|
public float[] getDimensions()
public boolean hasBottom()
public void setDimensions(float height, float radius, boolean hasBottom)
height
- The height of the cone to generateradius
- The radius of the bottom of the conehasBottom
- True if to generate faces for the bottom
java.lang.IllegalArgumentException
- The radius is not positivepublic 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 |