- All Implemented Interfaces:
GraphicsCreator
,Model3D.ImageData
- Enclosing class:
- Model3D
The constructors are the same as those for the BufferedImage class,
with there additional constructors that can use a
GraphCreator
,
Graph
or
OSGraphicsOps
instead of an internal
buffered image. The class Animation2D
implements GraphCreator
, whereas the
classes OutputStreamGraphics
and
PanelGraphics
implement
OSGraphicsOps
.
After creating an instance of this class, one will configure
parameters for rendering:
please see Model3D.ImageData
for details. For the simplest
case, one will use
Model3D.ImageData.setCoordRotation(double,double,double)
and one of the Model3D
methods
Model3D.setImageParameters(Model3D.ImageData)
,
Model3D.setImageParameters(Model3D.ImageData,double)
,
Model3D.setImageParameters(Model3D.ImageData,double,double)
,
Model3D.setImageParameters(Model3D.ImageData,double,double,double)
,
Model3D.setImageParameters(Model3D.ImageData,double,double,double,double)
, or
Model3D.setImageParameters(Model3D.ImageData,double,double,double,double,boolean)
to complete the configuration.
To render the image, one will use the Model3D
method
Model3D.render(Model3D.Image)
(several variants of this
method are available for more complex cases such as rendering
images from multiple models).
Finally, to write the image to a file or stream, one will
use the method write(String,String)
,
write(String, File)
,
write(String, FileAccessor)
,
write(String, OutputStream)
, or
write()
.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImage
(int width, int height, int imageType) Constructor.Image
(int width, int height, int imageType, IndexColorModel cm) Constructor given an index color model.Image
(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable<?, ?> properties) Constructor given a color model.Image
(OSGraphicsOps osg) ` Constructor specifying an OSGraphicsOps.Constructor given a Graph.Image
(GraphCreator gc2d) Constructor given a graph creator. -
Method Summary
Modifier and TypeMethodDescriptionCreate a graphics context.Get the color for the the side of a triangle that should not be visible due to being on the inside of a closed manifold.double
Get the color factor.Get the default backside color to use for line segments associated with triangles added for rendering.Get the color to use for line segments explicitly added or associated with triangles added for rendering.double
getDelta()
Get the minimum triangle size for rendering.Get the color used to indicate the edges of a trianglefloat
Get the height of an image.float
Get the width of an image .int
Get the height of an image as an integer.Get the corresponding ImageDataImpl.double
Get the light-source parameter phi.double
Get the light-source parameter theta.double
Get the normal factor After a coordinate transformation, the normal factor is used to reduce the color factor towards 0.0 when a surface segment' is not aligned with the Z axis.double
getPhi()
Get the Eulerian angle phi for a coordinate rotation.double
getPsi()
Get the Eulerian angle psi for a coordinate rotation.double
Get the X coordinate of the origin/target point for a coordinate rotation.double
Get the Y coordinate of the origin/target point for a coordinate rotation.double
Get the Z coordinate of the origin/target point for a coordinate rotation.double
Set the scale factor.double
getTheta()
Get the Eulerian angle theta for a coordinate rotation.int
getWidth()
Get the width of an image as an integer.float
Get the X coordinate of the origin.double
Get the coordinate translation in the X direction that will be applied after other coordinate transformations are completed.float
Get the Y coordinate of the origin Note that user space follows the standard Java convention in which increasing X values go 'right' on an image and increasing Y values do 'down'.double
Get the coordinate translation in the Y direction that will be applied after other coordinate transformations are completed.boolean
Determine if the transformed origin for (0,0,0) will be moved to the coordinate origin after the rotation is completed.void
reset()
Reset to default values.void
Set the color for the side of a triangle that should not be visible due to being on the inside of a closed manifold.void
setColorFactor
(double factor) Set the color factor.void
setCoordRotation
(double phi, double theta, double psi) Rotate the Model3D coordinates.void
Set the default backside color to use for line segments associated with triangles added for rendering.void
Set the color to use for line segments explicitly added or associated with triangles added for rendering.void
setDelta
(double delta) Set the minimum triangle size for rendering.void
Set the color to use to use to draw the edges of triangles.void
setLightSource
(double phi, double theta) Sets the direction to a light source.void
setNormalFactor
(double factor) Set the normal factor.void
Set the origin to a default value.void
setOrigin
(double offset) Set the origin given a double-precision offset.void
setOrigin
(double x, double y) Set the origin give double-precision coordinates The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0.void
setOrigin
(float offset) Set the origin given an offset.void
setOrigin
(float x, float y) Set the origin given floating-point coordinates.void
setOrigin
(int offset) Set the origin given an integer offset.void
setOrigin
(int x, int y) Set the origin given integer coordinates.void
setOriginByFraction
(double offset) Set the origin given a double-precision fractional offset.void
setOriginByFraction
(float offset) Set the origin given a single-precision fractional offset.void
setRotationOrigin
(double x, double y, double z) Move the rotation origin for a coordinate rotation.void
setRotationOrigin
(double x, double y, double z, boolean move) Move the rotation origin for a coordinate rotation with options.void
setScaleFactor
(double scaleFactor) Set the scale factor.void
setTranslation
(double x, double y) Specify translation after coordinate changes.void
write()
Write the image to its OutputStreamGraphics.void
Write the image to a file.void
write
(String type, OutputStream os) Write the image to an output stream.void
Write the image to a file given a file name.void
write
(String type, FileAccessor fa) Write the image to a file provided by a file accessor.
-
Constructor Details
-
Image
public Image(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable<?, ?> properties) Constructor given a color model.- Parameters:
cm
- the color model for the imageraster
- the Raster for the data representing the imageisRasterPremultiplied
- if true, the data in the raster has been premultiplied with alphaproperties
- a Hashtable of String/Object pairs- See Also:
-
Image
public Image(int width, int height, int imageType) Constructor. The predefined image types are the same as for BufferedImage- Parameters:
width
- the width of the imageheight
- the height of the imageimageType
- the image type- See Also:
-
Image
Constructor given an index color model.- Parameters:
width
- the width of the imageheight
- the height of the imageimageType
- the image type, restricted to either TYPE_BYTE_BINARY or TYPE_BYTE_INDEXEDcm
- the IndexColorModel to use- See Also:
-
Image
` Constructor specifying an OSGraphicsOps.- Parameters:
osg
- the OSGraphicsOps to be used to create an image
-
Image
Constructor given a graph creator. The interfaceGraphCreator
is implemented byAnimation2D
, which may construct its graph after this Constructor is called.- Parameters:
gc2d
- the object that will create a graph used by this object to provide a buffered image or graphics output stream
-
Image
Constructor given a Graph. The image created will share the graph's buffered image or output-stream graphics.- Parameters:
graph
- an instance of Graph
-
-
Method Details
-
createGraphics
Description copied from interface:GraphicsCreator
Create a graphics context.- Specified by:
createGraphics
in interfaceGraphicsCreator
- Returns:
- the graphics context
-
getImageData
Description copied from interface:Model3D.ImageData
Get the corresponding ImageDataImpl.- Specified by:
getImageData
in interfaceModel3D.ImageData
- Returns:
- the corresponding ImageDataImpl
-
getWidth
public int getWidth()Description copied from interface:Model3D.ImageData
Get the width of an image as an integer.- Specified by:
getWidth
in interfaceModel3D.ImageData
- Returns:
- the width of the image
-
getHeight
public int getHeight()Description copied from interface:Model3D.ImageData
Get the height of an image as an integer.- Specified by:
getHeight
in interfaceModel3D.ImageData
- Returns:
- the height of the image
-
getFloatWidth
public float getFloatWidth()Description copied from interface:Model3D.ImageData
Get the width of an image .- Specified by:
getFloatWidth
in interfaceModel3D.ImageData
- Returns:
- the width in image user-space coordinates
-
getFloatHeight
public float getFloatHeight()Description copied from interface:Model3D.ImageData
Get the height of an image.- Specified by:
getFloatHeight
in interfaceModel3D.ImageData
- Returns:
- the height in user-space coordinates
-
getScaleFactor
public double getScaleFactor()Description copied from interface:Model3D.ImageData
Set the scale factor. A rendered model will be scaled by this amount. When the scale factor is 1.0, a unit distance in the model is a unit distance in the image's user space (e.g. 1/72 of an inch on a display). The scale factor is applied after any rotation or translation. The coordinate whose post-rotation and post-translation value is (0.0, 0.0, 0.0) will appear at the image's origin after scaling.- Specified by:
getScaleFactor
in interfaceModel3D.ImageData
- Returns:
- the scale factor
-
setScaleFactor
public void setScaleFactor(double scaleFactor) Description copied from interface:Model3D.ImageData
Set the scale factor. A rendered model will be scaled by this amount. When the scale factor is 1.0, a unit distance in the model is a unit distance in the image's user space (e.g. 1/72 of an inch on a display). The scale factor is applied after any rotation or translation. The coordinate whose post-rotation and post-translation value is (0.0, 0.0, 0.0) will appear at the image's origin after scaling.- Specified by:
setScaleFactor
in interfaceModel3D.ImageData
- Parameters:
scaleFactor
- the scale factor
-
getXOrigin
public float getXOrigin()Description copied from interface:Model3D.ImageData
Get the X coordinate of the origin. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. Note that user space follows the standard Java convention in which increasing X values go 'right' on an image and increasing Y values do 'down'.- Specified by:
getXOrigin
in interfaceModel3D.ImageData
- Returns:
- the X coordinate of the origin in the image's user space
-
getYOrigin
public float getYOrigin()Description copied from interface:Model3D.ImageData
Get the Y coordinate of the origin Note that user space follows the standard Java convention in which increasing X values go 'right' on an image and increasing Y values do 'down'.- Specified by:
getYOrigin
in interfaceModel3D.ImageData
- Returns:
- the Y coordinate of the origin in the image's user space
-
setOrigin
public void setOrigin(int x, int y) Description copied from interface:Model3D.ImageData
Set the origin given integer coordinates. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. Note that user space follows the standard Java convention in which increasing X values go 'right' on an image and increasing Y values do 'down'.- Specified by:
setOrigin
in interfaceModel3D.ImageData
- Parameters:
x
- the X coordinate in the image's user spacey
- the Y coordinate in the image's user space
-
setOrigin
public void setOrigin(double x, double y) Description copied from interface:Model3D.ImageData
Set the origin give double-precision coordinates The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. Note that user space follows the standard Java convention in which increasing X values go 'right' on an image and increasing Y values do 'down'.- Specified by:
setOrigin
in interfaceModel3D.ImageData
- Parameters:
x
- the X coordinate in the image's user spacey
- the Y coordinate in the image's user space
-
setOrigin
public void setOrigin(float x, float y) Description copied from interface:Model3D.ImageData
Set the origin given floating-point coordinates. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. Note that user space follows the standard Java convention in which increasing X values go 'right' on an image and increasing Y values do 'down'.- Specified by:
setOrigin
in interfaceModel3D.ImageData
- Parameters:
x
- the user-space x-coordinate of the originy
- the user-space y-coordinate of the origin
-
setOrigin
public void setOrigin(int offset) Description copied from interface:Model3D.ImageData
Set the origin given an integer offset. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. When the offset is non-negative, the offset gives the distance in user-space coordinates, for both the x coordinate and the y coordinate, from the lower left corner of the image to the position of the origin. When negative, the absolute value gives the distances from the upper right corner of the image.- Specified by:
setOrigin
in interfaceModel3D.ImageData
- Parameters:
offset
- the offset
-
setOrigin
public void setOrigin(double offset) Description copied from interface:Model3D.ImageData
Set the origin given a double-precision offset. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. When the offset is non-negative, the offset gives the distance in user-space coordinates, for both the x coordinate and the y coordinate, from the lower left corner of the image to the position of the origin. When negative, the absolute value gives the distances from the upper right corner of the image.- Specified by:
setOrigin
in interfaceModel3D.ImageData
- Parameters:
offset
- the offset
-
setOrigin
public void setOrigin(float offset) Description copied from interface:Model3D.ImageData
Set the origin given an offset. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. When the offset is non-negative, the offset gives the distance in user-space coordinates, for both the x coordinate and the y coordinate, from the lower left corner of the image to the position of the origin. When negative, the absolute value gives the distances from the upper right corner of the image.- Specified by:
setOrigin
in interfaceModel3D.ImageData
- Parameters:
offset
- the offset
-
setOriginByFraction
public void setOriginByFraction(double offset) Description copied from interface:Model3D.ImageData
Set the origin given a double-precision fractional offset. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. The fractional offset sets the offset to the value of offset multiplied by the width and height for the x coordinate and y coordinate respectively. If the offset is positive, the offset is from the lower-left corner of an image. If negative, the offset is from the upper right corner.- Specified by:
setOriginByFraction
in interfaceModel3D.ImageData
- Parameters:
offset
- the fractional offset in the range (-1.0, 1.0)
-
setOriginByFraction
public void setOriginByFraction(float offset) Description copied from interface:Model3D.ImageData
Set the origin given a single-precision fractional offset. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. The fractional offset sets the offset to the value of offset multiplied by the width and height for the x coordinate and y coordinate respectively. If the offset is positive, the offset is from the lower-left corner of an image. If negative, the offset is from the upper right corner.- Specified by:
setOriginByFraction
in interfaceModel3D.ImageData
- Parameters:
offset
- the fractional offset in the range (-1.0, 1.0)
-
setOrigin
public void setOrigin()Description copied from interface:Model3D.ImageData
Set the origin to a default value. The origin is the point on the image that will correspond to points in the model for which x = 0.0 and y = 0.0. The default will place the origin in the center of an image.- Specified by:
setOrigin
in interfaceModel3D.ImageData
-
getPhi
public double getPhi()Description copied from interface:Model3D.ImageData
Get the Eulerian angle phi for a coordinate rotation. A coordinate rotation and translation refers to a new position and orientation of the coordinate system assuming the model is held stationary. The model will appear to rotate and translate in the opposite direction from that specified by these Eulerian angles.- Specified by:
getPhi
in interfaceModel3D.ImageData
- Returns:
- the value of phi in radians
- See Also:
-
getTheta
public double getTheta()Description copied from interface:Model3D.ImageData
Get the Eulerian angle theta for a coordinate rotation. A coordinate rotation and translation refers to a new position and orientation of the coordinate system assuming the model is held stationary. The model will appear to rotate and translate in the opposite direction from that specified by these Eulerian angles.- Specified by:
getTheta
in interfaceModel3D.ImageData
- Returns:
- the value of theta in radians
- See Also:
-
getPsi
public double getPsi()Description copied from interface:Model3D.ImageData
Get the Eulerian angle psi for a coordinate rotation. A coordinate rotation and translation refers to a new position and orientation of the coordinate system assuming the model is held stationary. The model will appear to rotate and translate in the opposite direction from that specified by these Eulerian angles.- Specified by:
getPsi
in interfaceModel3D.ImageData
- Returns:
- the value of psi in radians
- See Also:
-
setCoordRotation
public void setCoordRotation(double phi, double theta, double psi) Description copied from interface:Model3D.ImageData
Rotate the Model3D coordinates. When all values are zero, the original z axis is perpendicular to an image, the original x axis is horizontal, and the original y axis is vertical, all following the standard mathematical convention that the x axis goes from left to right, the y axis goes from bottom to top. The z axis points towards the viewer.The Eulerian angles follow the convention used in Goldstein, "Classical Mechanics": phi is the angle the x-axis rotates with positive values of phi indicating a counter-clockwise rotation when viewed from positive values of z towards the plane in which z=0. Theta then indicates a rotation about the new x axis, and psi indicates a rotation about the final z axis.
Note that the coordinate system is being rotated, not the object being displayed, and that the rotation applies from the original axes, as opposed to being applied incrementally.
- Specified by:
setCoordRotation
in interfaceModel3D.ImageData
- Parameters:
phi
- the Eulerian angle phi in radianstheta
- the Eulerian angle theta in radianspsi
- the Eulerian angle psi in radians
-
getRotationXOrigin
public double getRotationXOrigin()Description copied from interface:Model3D.ImageData
Get the X coordinate of the origin/target point for a coordinate rotation. This is the first argument to the most recent call toModel3D.ImageData.setRotationOrigin(double,double,double)
orModel3D.ImageData.setRotationOrigin(double,double,double,boolean)
.- Specified by:
getRotationXOrigin
in interfaceModel3D.ImageData
- Returns:
- the X coordinate in the model's coordinate system
-
getRotationYOrigin
public double getRotationYOrigin()Description copied from interface:Model3D.ImageData
Get the Y coordinate of the origin/target point for a coordinate rotation. This is the first argument to the most recent call toModel3D.ImageData.setRotationOrigin(double,double,double)
orModel3D.ImageData.setRotationOrigin(double,double,double,boolean)
.- Specified by:
getRotationYOrigin
in interfaceModel3D.ImageData
- Returns:
- the Y coordinate in the model's coordinate system
-
getRotationZOrigin
public double getRotationZOrigin()Description copied from interface:Model3D.ImageData
Get the Z coordinate of the origin/target point for a coordinate rotation. This is the second argument to the most recent call toModel3D.ImageData.setRotationOrigin(double,double,double)
orModel3D.ImageData.setRotationOrigin(double,double,double,boolean)
.- Specified by:
getRotationZOrigin
in interfaceModel3D.ImageData
- Returns:
- the Z coordinate in the model's coordinate system
-
moveOriginAfterRotation
public boolean moveOriginAfterRotation()Description copied from interface:Model3D.ImageData
Determine if the transformed origin for (0,0,0) will be moved to the coordinate origin after the rotation is completed. This is the value of the last argument to the most recent call toModel3D.ImageData.setRotationOrigin(double,double,double,boolean)
, which is also called by the three-argument methodModel3D.ImageData.setRotationOrigin(double,double,double)
with a final argument offalse
. When false, the rotation occurs about a specified point. When true, the rotation in effect occurs around (0, 0, 0) and then (0, 0, 0) is moved to the rotation origin.- Specified by:
moveOriginAfterRotation
in interfaceModel3D.ImageData
- Returns:
- true if it will be moved; false if not
- See Also:
-
setRotationOrigin
public void setRotationOrigin(double x, double y, double z) Description copied from interface:Model3D.ImageData
Move the rotation origin for a coordinate rotation. The default performs a coordinate rotation about the point (0,0,0). For another value, the point (x, y, z) before the rotation will have the same value in the new coordinate system: (x,y,z) = (x',y',z'). The x, y, and z arguments refer to the model's coordinate system.- Specified by:
setRotationOrigin
in interfaceModel3D.ImageData
- Parameters:
x
- the x coordinate about which to perform the rotationy
- the y coordinate about which to perform the rotationz
- the z coordinate about which to perform the rotation
-
setRotationOrigin
public void setRotationOrigin(double x, double y, double z, boolean move) Description copied from interface:Model3D.ImageData
Move the rotation origin for a coordinate rotation with options. Setting the 'move' argument to true is useful when you want to rotate an object and place the previous origin at a specific location. The x, y, and z arguments refer to the model's coordinate system.- Specified by:
setRotationOrigin
in interfaceModel3D.ImageData
- Parameters:
x
- the x coordinate about which to perform the rotationy
- the y coordinate about which to perform the rotationz
- the z coordinate about which to perform the rotationmove
- false if (x,y,z) will have the same value after the rotation; true if the point (0,0,0) in the old coordinate system will be mapped to the point (x,y,z) in the new coordinate system after the rotation is complete.- See Also:
-
getXTranslation
public double getXTranslation()Description copied from interface:Model3D.ImageData
Get the coordinate translation in the X direction that will be applied after other coordinate transformations are completed. (Note: because the coordinate system is being translated, objects will appear to move in the opposite direction).- Specified by:
getXTranslation
in interfaceModel3D.ImageData
- Returns:
- the translation in the X direction
-
getYTranslation
public double getYTranslation()Description copied from interface:Model3D.ImageData
Get the coordinate translation in the Y direction that will be applied after other coordinate transformations are completed. (Note: because the coordinate system is being translated, objects will appear to move in the opposite direction).- Specified by:
getYTranslation
in interfaceModel3D.ImageData
- Returns:
- the translation in the Y direction
-
setTranslation
public void setTranslation(double x, double y) Description copied from interface:Model3D.ImageData
Specify translation after coordinate changes. After other coordinate transformations are complete, the coordinate system in which a Model3D object is shown may be translated by an amount x in the x direction and an amount y in the y direction. The object displayed will appear to move in the opposite direction.- Specified by:
setTranslation
in interfaceModel3D.ImageData
- Parameters:
x
- the x-axis translationy
- the y-axis translation
-
getDelta
public double getDelta()Description copied from interface:Model3D.ImageData
Get the minimum triangle size for rendering. The size is measured in the x, y, and z directions. Larger triangles will be split into some number of smaller ones. Triangles will not be split if the value is zero.- Specified by:
getDelta
in interfaceModel3D.ImageData
- Returns:
- the minimum size
- See Also:
-
setDelta
public void setDelta(double delta) Description copied from interface:Model3D.ImageData
Set the minimum triangle size for rendering. The value of this parameter, if nonzero, specifies the maximum dimensions of a triangle that is to be rendered in the x, y, and z directions. If a triangle is larger, it is partitioned into a smaller set of triangles. This partitioning applies only during rendering. Setting the minimum size to a small, nonzero value can improve rendering by making the calculation of which triangle is in front of others more reliable. Too small a value, however, may slow rendering considerably. Units are those used for a triangle's X, Y, and Z coordinates.- Specified by:
setDelta
in interfaceModel3D.ImageData
- Parameters:
delta
- the triangle dimension limit; zero to indicate that triangles should not be split
-
getLightSourcePhi
public double getLightSourcePhi()Description copied from interface:Model3D.ImageData
Get the light-source parameter phi. The parameter partially determines the direction of the light source as described in the documentation forsetLightSource
.- Specified by:
getLightSourcePhi
in interfaceModel3D.ImageData
- Returns:
- the light-source parameter phi in radians
- See Also:
-
getLightSourceTheta
public double getLightSourceTheta()Description copied from interface:Model3D.ImageData
Get the light-source parameter theta. The parameter partially determines the direction of the light source as described in the documentation forsetLightSource
.- Specified by:
getLightSourceTheta
in interfaceModel3D.ImageData
- Returns:
- the light-source parameter theta in radians
- See Also:
-
setLightSource
public void setLightSource(double phi, double theta) Description copied from interface:Model3D.ImageData
Sets the direction to a light source. The default direction, in which theta=0, corresponds to a light source at infinity aimed vertically downwards towards the x-y plane. The brightness used for a triangle varies as the cosine of the angle between a vector pointing in the direction of the light source and a vector perpendicular to the plane of the triangle.- Specified by:
setLightSource
in interfaceModel3D.ImageData
- Parameters:
phi
- the angle in radians about the z axis of the plane containing the z axis and a unit vector pointing towards the light source. If phi is zero, this plane includes the x axis and for non-zero theta, the unit vector will have a positive x component.theta
- the angle in radians between a unit vector pointing towards the light source makes and with a vector parallel to the z axis.
-
getColorFactor
public double getColorFactor()Description copied from interface:Model3D.ImageData
Get the color factor. After coordinate transformations, the red, blue, and green components of the color of an object will be scaled depending on its height so that, for the same orientation, triangles at with the lowest values of 'z' will be dimmer than those with the maximum value of 'z' by this factor. A value of zero indicates that the color factor will be ignored. A value larger than 1.0 will result in the multiple Z values being rendered in black, but with more color separation for higher Z values.- Specified by:
getColorFactor
in interfaceModel3D.ImageData
- Returns:
- the color factor
- See Also:
-
setColorFactor
public void setColorFactor(double factor) Description copied from interface:Model3D.ImageData
Set the color factor. After coordinate transformations, the red, blue, and green components of the color of an object will be scaled depending on its height so that, for the same orientation, triangles at with the lowest values of 'z' will be dimmer than those with the maximum value of 'z' by this factor. If the value is 1.0, the smallest z value of the object will be rendered as black. A value of 0.0 indicates that the color factor will be ignored. A value larger than 1.0 will result in the multiple Z values being rendered in black, but with more color separation for higher Z values.This is intended to help emphasize differences along the 'z' axis that would normally be hard to discern visually.
- Specified by:
setColorFactor
in interfaceModel3D.ImageData
- Parameters:
factor
- the color factor given as a non-negative number
-
getNormalFactor
public double getNormalFactor()Description copied from interface:Model3D.ImageData
Get the normal factor After a coordinate transformation, the normal factor is used to reduce the color factor towards 0.0 when a surface segment' is not aligned with the Z axis. If the Z component of the segment's normal vector is nz and the normal factor is larger than 0.0, the color factor is multiplied by exp(-(1.0-nz)/normalFactor). Since the normal vector has a length of 1.0, when the normal vector does not point in the positive Z direction, nz will be less than 1.0 and the color factor will be reduced.- Specified by:
getNormalFactor
in interfaceModel3D.ImageData
- Returns:
- the normal factor; 0.0 if there is none
-
setNormalFactor
public void setNormalFactor(double factor) Description copied from interface:Model3D.ImageData
Set the normal factor. After a coordinate transformation, the normal factor is used to reduce the color factor towards 0.0 when a surface segment' is not aligned with the Z axis. If the Z component of the segment's normal vector is nz and the normal factor is larger than 0.0, the color factor is multiplied by exp(-(1.0-nz)/normalFactor). Since the normal vector has a length of 1.0, when the normal vector does not point in the positive Z direction, nz will be less than 1.0 and the color factor will be reduced.- Specified by:
setNormalFactor
in interfaceModel3D.ImageData
- Parameters:
factor
- the normal factor; 0.0 or negative if there is none
-
getBacksideColor
Description copied from interface:Model3D.ImageData
Get the color for the the side of a triangle that should not be visible due to being on the inside of a closed manifold.- Specified by:
getBacksideColor
in interfaceModel3D.ImageData
- Returns:
- the color
-
setBacksideColor
Description copied from interface:Model3D.ImageData
Set the color for the side of a triangle that should not be visible due to being on the inside of a closed manifold. This is useful for debugging a model: one class of errors results in a triangle having the wrong orientation, and setting this parameter can help indicate where the problem is in the model.- Specified by:
setBacksideColor
in interfaceModel3D.ImageData
- Parameters:
c
- the color; null if a color is not set
-
getEdgeColor
Description copied from interface:Model3D.ImageData
Get the color used to indicate the edges of a triangle- Specified by:
getEdgeColor
in interfaceModel3D.ImageData
- Returns:
- the color or null to indicate that edges will not be shown
-
setEdgeColor
Description copied from interface:Model3D.ImageData
Set the color to use to use to draw the edges of triangles.- Specified by:
setEdgeColor
in interfaceModel3D.ImageData
- Parameters:
c
- the color; null if edges should not be displayed
-
getDefaultSegmentColor
Description copied from interface:Model3D.ImageData
Get the color to use for line segments explicitly added or associated with triangles added for rendering. The phrase "[line segments] associated with triangles" refers to the additional edges of triangles that were added during the rendering process to minimize z-order issues that can occur when at least one edge of a triangle is abnormally large. Such triangles may be added whenModel3D.ImageData.setDelta(double)
is called with a non-zero argument.- Specified by:
getDefaultSegmentColor
in interfaceModel3D.ImageData
- Returns:
- the color; null if the line segments should not be shown
-
setDefaultSegmentColor
Description copied from interface:Model3D.ImageData
Set the color to use for line segments explicitly added or associated with triangles added for rendering. The phrase "[line segments] associated with triangles" refers to the additional edges of triangles that were added during the rendering process to minimize z-order issues that can occur when at least one edge of a triangle is abnormally large. Such triangles may be added whenModel3D.ImageData.setDelta(double)
is called with a non-zero argument.- Specified by:
setDefaultSegmentColor
in interfaceModel3D.ImageData
- Parameters:
c
- the color; null if line segments should not be displayed
-
getDefaultBacksideSegmentColor
Description copied from interface:Model3D.ImageData
Get the default backside color to use for line segments associated with triangles added for rendering. The phrase "[line segments] associated with triangles" refers to the additional edges of triangles that were added during the rendering process to minimize z-order issues that can occur when at least one edge of a triangle is abnormally large. Such triangles may be added whenModel3D.ImageData.setDelta(double)
is called with a non-zero argument.- Specified by:
getDefaultBacksideSegmentColor
in interfaceModel3D.ImageData
- Returns:
- the color; null if the line segments should not be shown
-
setDefaultBacksideSegmentColor
Description copied from interface:Model3D.ImageData
Set the default backside color to use for line segments associated with triangles added for rendering. The phrase "[line segments] associated with triangles" refers to the additional edges of triangles that were added during the rendering process to minimize z-order issues that can occur when at least one edge of a triangle is abnormally large. Such triangles may be added whenModel3D.ImageData.setDelta(double)
is called with a non-zero argument.- Specified by:
setDefaultBacksideSegmentColor
in interfaceModel3D.ImageData
- Parameters:
c
- the color; null if these line segments should not be displayed
-
reset
public void reset()Description copied from interface:Model3D.ImageData
Reset to default values.- Specified by:
reset
in interfaceModel3D.ImageData
-
write
Write the image to a file given a file name. The type parameters are strings naming the file format as used by the classjavax.imageio.ImageIO
- Parameters:
type
- the file typename
- the file name- Throws:
IOException
- an error occurred during writing
-
write
Write the image to a file. The type parameters are strings naming the file format as used by the classjavax.imageio.ImageIO
- Parameters:
type
- the file typefile
- the file to write- Throws:
IOException
- an error occurred during writing
-
write
Write the image to a file provided by a file accessor. The type parameters are strings naming the file format as used by the classjavax.imageio.ImageIO
- Parameters:
type
- the file typefa
- the file accessor to use- Throws:
IOException
- an error occurred during writing
-
write
Write the image to an output stream. The type parameters are strings naming the file format as used by the classjavax.imageio.ImageIO
- Parameters:
type
- the file typeos
- the output stream to which to write the image- Throws:
IOException
- an error occurred during writing
-
write
Write the image to its OutputStreamGraphics.- Throws:
IOException
- an IO error occurred.
-