AWT Shape Extruder

com.interactivemesh.j3d.community.utils.geometry
Class AWTShapeExtrusion

java.lang.Object
  extended by com.interactivemesh.j3d.community.utils.geometry.AWTShapeExtrusion

public class AWTShapeExtrusion
extends java.lang.Object

An AWTShapeExtrusion object is used to describe the extrusion path for a AWTShapeExtruder object. The extrusion path defines the edge contour of its AWT Shape object. This contour is perpendicular to the face of the AWT Shape and must be monotonic in x.

The shape of the extrusion path is, by default, a straight line from 0.0 to 0.2 (known as a straight bevel). The shape may be modified via the extrusionShape parameter, also a java.awt.Shape object that describes the 3D contour of the AWT Shape object.

User is responsible for data sanity and must make sure that extrusionShape does not cause intersections. Else undefined output may be generated.

AWTShapeExtrusion is a generalized version of javax.media.j3d.FontExtrusion.

Version:
1.4
See Also:
AWTShapeExtruder

Constructor Summary
AWTShapeExtrusion()
          Constructs an AWTShapeExtrusion object with default parameters.
AWTShapeExtrusion(float depth)
          Constructs an AWTShapeExtrusion object with a straight bevel extrusion shape, a straight line from 0.0 to depth.
AWTShapeExtrusion(java.awt.Shape extrusionShape)
          Constructs an AWTShapeExtrusion object with the specified extrusion shape, using the default tessellation tolerance.
AWTShapeExtrusion(java.awt.Shape extrusionShape, double tessellationTolerance)
          Constructs an AWTShapeExtrusion object with the specified extrusion shape, using the specified tessellation tolerance.
 
Method Summary
 float getDepth()
          Returns the length of extrusion either of the straight bevel extrusion shape or of the specified extrusion shape.
 javax.vecmath.Point2f[] getExtrusion()
          Returns the boundary of the specified extrusion shape.
 java.awt.Shape getExtrusionShape()
          Returns the AWTShapeExtrusion's shape parameter.
 double getTessellationTolerance()
          Returns the tessellation tolerance with which the geometry of the extrusion shape will be created.
 boolean isT3DStyleExtrusion()
          Returns the state of the Text3D-style extrusion enable flag.
 void setExtrusionShape(java.awt.Shape extrusionShape)
          Sets the AWTShapeExtrusion's shape parameter.
 void setStraightBevelExtrusionShape(float depth)
          Sets the AWTShapeExtrusion's shape to a straight bevel extrusion shape, a straight line from 0.0 to depth.
 void setT3DStyleExtrusion(boolean enable)
          Enables or disables Text3D-style extrusion.
 void setTessellationTolerance(double tessellationTolerance)
          Sets the tessellation tolerance with which the geometry of the extrusion shape will be created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AWTShapeExtrusion

public AWTShapeExtrusion()
Constructs an AWTShapeExtrusion object with default parameters. The default parameters are as follows:

A null extrusion shape specifies that a straight line from 0.0 to 0.2 (straight bevel) is used.

See Also:
AWTShapeExtruder

AWTShapeExtrusion

public AWTShapeExtrusion(float depth)
Constructs an AWTShapeExtrusion object with a straight bevel extrusion shape, a straight line from 0.0 to depth.

Parameters:
depth - length of extrusion
Throws:
java.lang.IllegalArgumentException - if depth is less than 0.0
See Also:
AWTShapeExtruder

AWTShapeExtrusion

public AWTShapeExtrusion(java.awt.Shape extrusionShape)
Constructs an AWTShapeExtrusion object with the specified extrusion shape, using the default tessellation tolerance. The specified shape is used to construct the edge contour. Each shape begins with an implicit point at 0.0. Contour must be monotonic in x.

Parameters:
extrusionShape - the shape object to use to generate the extrusion path. A null shape specifies that a straight line from 0.0 to 0.2 (straight bevel) is used.
Throws:
java.lang.IllegalArgumentException - if multiple contours in extrusionShape, or contour is not monotonic or least x-value of a contour point is not 0.0f
See Also:
AWTShapeExtruder

AWTShapeExtrusion

public AWTShapeExtrusion(java.awt.Shape extrusionShape,
                         double tessellationTolerance)
Constructs an AWTShapeExtrusion object with the specified extrusion shape, using the specified tessellation tolerance. The specified shape is used to construct the edge contour. Each shape begins with an implicit point at 0.0. Contour must be monotonic in x.

Parameters:
extrusionShape - the shape object to use to generate the extrusion path. A null shape specifies that a straight line from 0.0 to 0.2 (straight bevel) is used.
tessellationTolerance - the tessellation tolerance value used in tessellating the extrusion shape. This corresponds to the flatness parameter in the java.awt.Shape.getPathIterator method.
Throws:
java.lang.IllegalArgumentException - if multiple contours in extrusionShape, or contour is not monotonic or least x-value of a contour point is not 0.0f
See Also:
AWTShapeExtruder
Method Detail

getExtrusionShape

public java.awt.Shape getExtrusionShape()
Returns the AWTShapeExtrusion's shape parameter. This parameter is used to construct the edge contour.

Returns:
extrusionShape the shape object used to generate the extrusion path, or null if a straight bevel extrusion shape is set

setExtrusionShape

public void setExtrusionShape(java.awt.Shape extrusionShape)
Sets the AWTShapeExtrusion's shape parameter. This parameter is used to construct the edge contour.

Parameters:
extrusionShape - the shape object to use to generate the extrusion path. A null shape specifies that a straight line from 0.0 to 0.2 (straight bevel) is used.
Throws:
java.lang.IllegalArgumentException - if multiple contours in extrusionShape, or contour is not monotonic or least x-value of a contour point is not 0.0f

setStraightBevelExtrusionShape

public void setStraightBevelExtrusionShape(float depth)
Sets the AWTShapeExtrusion's shape to a straight bevel extrusion shape, a straight line from 0.0 to depth.

Parameters:
depth - length of extrusion
Throws:
java.lang.IllegalArgumentException - if depth is less than 0.0

getTessellationTolerance

public double getTessellationTolerance()
Returns the tessellation tolerance with which the geometry of the extrusion shape will be created.

Returns:
the tessellation tolerance used by this AWTShapeExtrusion

setTessellationTolerance

public void setTessellationTolerance(double tessellationTolerance)
Sets the tessellation tolerance with which the geometry of the extrusion shape will be created.

This corresponds to the flatness parameter in the java.awt.Shape.getPathIterator method.

Parameters:
tessellationTolerance - the tessellation tolerance value used in tessellating the extrusion shape.

isT3DStyleExtrusion

public boolean isT3DStyleExtrusion()
Returns the state of the Text3D-style extrusion enable flag. The default state is false.

Returns:
true if Text3D-style extrusion is enabled, false if it is disabled
Since:
AWT Shape Extruder 2.2

setT3DStyleExtrusion

public void setT3DStyleExtrusion(boolean enable)
Enables or disables Text3D-style extrusion.

This flag allows to switch to Text3D-style extrusion combined with the advantages of smooth shading and solid geometry. This provides an (interim) alternative for the not yet perfectly functioning curved shape extrusion. The default state is false.

Parameters:
enable - true or false to enable or disable Text3D-style extrusion
Since:
AWT Shape Extruder 2.2

getExtrusion

public javax.vecmath.Point2f[] getExtrusion()
Returns the boundary of the specified extrusion shape.

Returns:
outline of the specified extrusion shape, or null if a straight bevel extrusion shape is set

getDepth

public float getDepth()
Returns the length of extrusion either of the straight bevel extrusion shape or of the specified extrusion shape.

Returns:
length of extrusion

AWT Shape Extruder