|
AWT Shape Extruder | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.interactivemesh.j3d.community.utils.geometry.AWTShapeExtruder
public class AWTShapeExtruder
AWTShapeExtruder converts a Java 2D Shape
, called here AWT Shape,
to a 3D geometry in a factory manner.
Each AWTShapeExtruder object has the following parameters:
According to the current state of these parameters a AWTShapeExtruder object
creates for a given AWT Shape or for given characters a javax.media.j3d.GeometryArray
getGeometry(Shape, AffineTransform)
getGeometry(char[], Font, boolean)
getOutlineGeometry(Shape, AffineTransform)
javax.media.j3d.Font3D
.
AWTShapeExtrusion
,
String3D
Constructor Summary | |
---|---|
AWTShapeExtruder()
Constructs an AWTShapeExtruder object using the default values for the extrusion path, the tessellation tolerance, the crease angle, and the geometry transform. |
|
AWTShapeExtruder(AWTShapeExtrusion extrudePath)
Constructs an AWTShapeExtruder object from the specified AWTShapeExtrusion object, using the default values for the tessellation tolerance, the crease angle, and the geometry transform. |
|
AWTShapeExtruder(double tessellationTolerance,
AWTShapeExtrusion extrudePath)
Constructs an AWTShapeExtruder object from the specified AWTShapeExtrusion object, using the specified tessellation tolerance and the default values for the crease angle and the geometry transform. |
|
AWTShapeExtruder(double tessellationTolerance,
AWTShapeExtrusion extrudePath,
double creaseAngle)
Constructs an AWTShapeExtruder object from the specified AWTShapeExtrusion object, using the specified tessellation tolerance and crease angle and the default value for the geometry transform. |
Method Summary | |
---|---|
static java.awt.Shape |
createAWTShape(char[] chars,
java.awt.Font font,
boolean flip)
Returns an AWT Shape of the specified characters according to the specified Font object which describes the font name (Helvetica, Courier, etc.), the font style (bold, italic, etc.), and point size. |
double |
getCreaseAngle()
Returns the crease angle. |
javax.media.j3d.GeometryArray |
getGeometry(char[] chars,
java.awt.Font font,
boolean flip)
Returns a GeometryArray for the given characters according to the specified extrusion path, tessellation tolerance, crease angle, and geometry transform of this AWTShapeExtruder object and according to the specified Font object which describes the font name (Helvetica, Courier, etc.), the font style (bold, italic, etc.), and point size. |
javax.media.j3d.GeometryArray |
getGeometry(java.awt.Shape shape,
java.awt.geom.AffineTransform trans)
Returns a GeometryArray for the given AWT Shape object according to the specified extrusion path, tessellation tolerance, crease angle, and geometry transform of this AWTShapeExtruder object. |
void |
getGeometryTransform(javax.media.j3d.Transform3D transform)
Copies the transform component of this AWTShapeExtruder object into the passed Transform3D object. |
javax.media.j3d.GeometryArray |
getOutlineGeometry(java.awt.Shape shape,
java.awt.geom.AffineTransform trans)
Returns a GeometryArray representing the outline of the given AWT Shape object according to the specified tessellation tolerance and geometry transform of this AWTShapeExtruder object. |
AWTShapeExtrusion |
getShapeExtrusion()
Returns the AWTShapeExtrusion object used to describe how the edge of the AWT Shape varies along the Z axis. |
double |
getTessellationTolerance()
Returns the tessellation tolerance with which the geometry of the AWT Shape will be created. |
void |
setCreaseAngle(double creaseAngle)
Sets the crease angle in radians. |
void |
setGeometryTransform(javax.media.j3d.Transform3D transform)
Sets the transform component of this AWTShapeExtruder object to the value of the passed transform. |
void |
setShapeExtrusion(AWTShapeExtrusion extrudePath)
Sets the AWTShapeExtrusion object used to describe how the edge of the AWT Shape varies along the Z axis. |
void |
setTessellationTolerance(double tessellationTolerance)
Sets the tessellation tolerance with which the geometry of the AWT Shape will be created. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AWTShapeExtruder()
The default values are as follows:
public AWTShapeExtruder(AWTShapeExtrusion extrudePath)
The default values are as follows:
The AWTShapeExtrusion object contains the extrusion path to use on the AWT Shape object. Passing null for the AWTShapeExtrusion parameter results in no extrusion being done.
extrudePath
- the extrusion path used to describe how
the edge of the AWT Shape varies along the Z axispublic AWTShapeExtruder(double tessellationTolerance, AWTShapeExtrusion extrudePath)
The default values are as follows:
The AWTShapeExtrusion object contains the extrusion path to use on the AWT Shape. Passing null for the AWTShapeExtrusion parameter results in no extrusion being done.
tessellationTolerance
- the tessellation tolerance value
used in tessellating the AWT Shape.
This corresponds to the flatness
parameter in
the java.awt.Shape.getPathIterator
method.extrudePath
- the extrusion path used to describe how
the edge of the AWT Shape varies along the Z axis.public AWTShapeExtruder(double tessellationTolerance, AWTShapeExtrusion extrudePath, double creaseAngle)
The default value is as follows:
The AWTShapeExtrusion object contains the extrusion path to use on the AWT Shape. Passing null for the AWTShapeExtrusion parameter results in no extrusion being done.
tessellationTolerance
- the tessellation tolerance value
used in tessellating the AWT Shape.
This corresponds to the flatness
parameter in
the java.awt.Shape.getPathIterator
method.extrudePath
- the extrusion path used to describe how
the edge of the AWT Shape varies along the Z axis.creaseAngle
- an angle between surface normals in radians to determin if
adjacent triangles are shaded smoothly across the edge, clamped to [0, Math.PI]Method Detail |
---|
public AWTShapeExtrusion getShapeExtrusion()
The default extrusion path is null
.
public void setShapeExtrusion(AWTShapeExtrusion extrudePath)
The default extrusion path is null
.
extrudePath
- the extrusion path used to describe how
the edge of the AWT Shape varies along the Z axis.public double getTessellationTolerance()
The default tolerance value is 0.01.
public void setTessellationTolerance(double tessellationTolerance)
The default tolerance value is 0.01.
tessellationTolerance
- the tessellation tolerance value
used in tessellating the AWT Shapepublic double getCreaseAngle()
The default value is 0.767944871 radians (44 degrees)
public void setCreaseAngle(double creaseAngle)
The default value is 0.767944871 radians (44 degrees)
creaseAngle
- an angle between surface normals to determin if
adjacent triangles are shaded smoothly across the edgepublic void getGeometryTransform(javax.media.j3d.Transform3D transform)
The default transform is the identity matrix.
transform
- the Transform3D object to be copied into
java.lang.NullPointerException
- if transform is null
public void setGeometryTransform(javax.media.j3d.Transform3D transform)
The specified transform will be applied to the generated coordinates and normals in addition to a shape's affine transformation resp. a string's position value.
The font size of a text string and the tesselation tolerance determine the precision and resolution of the tesselated geometry. These values should be set according to the desired quality. Finally, this transform allows to scale the geometry to achieve a scene conform character size. Of course, rotation and translation components can be set as well.
See also the sample code on this javadoc's overview page.
The default transform is the identity matrix, so that the generated geometry remains unchanged.
transform
- the Transform3D object to be copied
java.lang.NullPointerException
- if transform is null
java.lang.IllegalArgumentException
- if transform is not invertablepublic javax.media.j3d.GeometryArray getGeometry(java.awt.Shape shape, java.awt.geom.AffineTransform trans)
The returned GeometryArray includes triangle primitives and normals which are determined by the current crease angle.
shape
- AWT Shape from which to generate a tessellated extruded geometrytrans
- an optional AffineTransform to be applied to the coordinates
of the shape's path iterater, or null
if untransformed coordinates are desired
null
if no GeometryArray could be createdpublic javax.media.j3d.GeometryArray getOutlineGeometry(java.awt.Shape shape, java.awt.geom.AffineTransform trans)
The returned GeometryArray includes line primitives and normals which are directed along the positive Z axis (0, 0, 1).
shape
- AWT Shape from which to generate an outline geometrytrans
- an optional AffineTransform to be applied to the coordinates
of the shape's path iterater, or null
if untransformed coordinates are desired
null
if no GeometryArray could be createdpublic javax.media.j3d.GeometryArray getGeometry(char[] chars, java.awt.Font font, boolean flip)
The returned GeometryArray includes triangle primitives and normals which are determined by the current crease angle.
Sample characters:
char[] chars0 = {'A'}; char[] chars1 = {'Y', 'e', 's', ' ', '?'}; char[] chars2 = new String("Text").toCharArray(); // Unicode code point int codePoint = 64; char[] chars3 = Character.toChars(codePoint);
chars
- characters from which to generate tessellated glyphsfont
- the Java 2D Font used to create the glyphsflip
- if true
the Font's Y-axis downwards orientaton is reversed
null
if no GeometryArray could be createdString3D
public static java.awt.Shape createAWTShape(char[] chars, java.awt.Font font, boolean flip)
Sample characters:
char[] chars0 = {'A'}; char[] chars1 = {'Y', 'e', 's', ' ', '?'}; char[] chars2 = new String("Text").toCharArray(); // Unicode code point int codePoint = 64; char[] chars3 = Character.toChars(codePoint);
chars
- characters from which to generate an AWT Shapefont
- the Java 2D Font used to create the glyphsflip
- if true
the Font's Y-axis downwards orientation is reversed
|
AWT Shape Extruder | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |