- All Implemented Interfaces:
Graph.Graphic,NamedObjectOps
To create a video of a 3D model m3d, one will first create an animation a2d of type Animation2D.
Model3D m3d = new Model3D();
// add elements to the model
...
Animation2D a2d = new Animation2D();
Model3DView view = new Model3DView(a2d, "model", true);
view.setModel(m3d);
// Orient the model and set how the view will change over
// time.
...
// The view must be made visible
view.setVisible(true);
// Finally set up the animation and run it.
int maxFrameCount = a2d.estimateFrameCount(...);
a2d.initFrames(maxFrameCount, ".../img-", "png");
a2d.scheduleFrames(0, maxFrameCount);
a2d.run();
There should usually be only one Model3DView that is visible
at a time because a Model3DView will manipulate the light source,
viewing angle, magnification, etc. Two that are competing with each
other will cause unpredictable results.-
Constructor Summary
ConstructorsConstructorDescriptionModel3DView(Animation2D animation, String name, boolean intern) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTo(Graph graph, Graphics2D g2d, Graphics2D g2dGCS) Add this object to an animation's graph.booleanDetermine if this named object can be deleted.protected Objectclone()Creates and returns a copy of this object.final booleandelete()Delete an object.final booleanDetermine if an object is being deleted.voidForce the scale to be recomputed the next timeaddTo(Graph,Graphics2D,Graphics2D)is called.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.doubleGet the border's size.booleanGet whether or not the scale will be recomputed each timeaddTo(Graph,Graphics2D,Graphics2D)is called.doubleGet 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.doublegetDelta()Get the minimum triangle size for rendering.Get the color used to indicate the edges of a triangledoubleGet the light-source parameter phi.Get the function that determines light-source parameter φ.doubleGet the rate at which the light source's angle phi changes.doubleGet the light-source parameter theta.Get the function determining the light-source parameter θ.doubleGet the rate at which the light source's angle theta changes.doubleGet the logarithmic magnification rate.doubleGet the magnification factor.Get the function determining the magnification factor.final StringgetName()Get an object's name.protected SimulationGet the object namer for a named object.doublegetPhi()Get the Eulerian angle φ for a coordinate rotation.Get the function to compute the Eulerian angle φ as a function of time.doubleGet the rate at which the Eulerian angle phi changes.doublegetPsi()Get the Eulerian angle ψ for a coordinate rotation.Get the function to compute the Eulerian angle ψ as a function of time.doubleGet the rate at which the Eulerian angle psi changes.doublegetTheta()Get the Eulerian angle θ for a coordinate rotation.Get the function to compute the Eulerian angle θ as a function of time.doubleGet the rate at which the Eulerian angle theta changes.doubleGet the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.Get the function determining the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.doubleGet the rate at which the fractional distance in the x direction changes.doubleGet the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.Get the function determining the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.doubleGet the rate at which the fractional distance in the y direction changes.final booleanDetermine if an object has been deleted.booleanDetermine if an object is interned in a object namer's tables.voidprintConfiguration(String iPrefix, String prefix, boolean printName, PrintWriter out) Print this simulation object's configuration.voidprintState(String iPrefix, String prefix, boolean printName, PrintWriter out) Print this simulation object's state.voidreset()Reset to default values.voidSet the color for the side of a triangle that should not be visible due to being on the inside of a closed manifold.voidsetBorder(double border) Set the border.voidsetChangeScale(boolean changeScale) Set whether or not the scale will be recomputed each timeaddTo(Graph,Graphics2D,Graphics2D)is called.voidsetColorFactor(double factor) Set the color factor.voidsetCoordRotation(double phi, double theta, double psi) Rotate the Model3D coordinates.voidsetCoordRotationByF(RealValuedFunctOps phiF, RealValuedFunctOps thetaF, RealValuedFunctOps psiF) Rotate the Model3D coordinates by providing functions giving the rotation as a function of time.voidsetCoordRotationBySF(SimFunction phiF, SimFunction thetaF, SimFunction psiF) Rotate the Model3D coordinates by providing simulation functions giving the rotation as a function of time.voidSet the default backside color to use for line segments associated with triangles added for rendering.voidSet the color to use for line segments explicitly added or associated with triangles added for rendering.voidsetDelta(double delta) Set the minimum triangle size for rendering.voidSet the color to use to use to draw the edges of triangles.voidsetInitialViewingTime(double time0) Set the initial viewing time.voidsetLightSource(double phi, double theta) Sets the direction to a light source.voidsetLightSourceByF(RealValuedFunctOps phiF, RealValuedFunctOps thetaF) Sets functions that determine the direction to a light source.voidsetLightSourceBySF(SimFunction phiF, SimFunction thetaF) Sets simulation functions that determine the direction to a light source.voidsetLightSourcePhiRate(double phiRate) Set the rate at which the light source's angle phi changes.voidsetLightSourceThetaRate(double thetaRate) Set the rate at which the light source's angle theta changes.voidsetLogMagnificationRate(double magRate) Set the magnification rate logarithmicly.voidsetLogMagnificationRate(double magTarget, double deltaT) Set the magnification rate logarithmicly to magnification to a target value in a specified time.voidsetMagnification(double magnification) Set the magnification factor.voidSet the function determining the magnification factor.voidSet the simulation function determining the magnification factor.voidSet the model.voidsetPhiRate(double phiRate) Set the rate at which the Eulerian angle phi changes.voidsetPsiRate(double psiRate) Set the rate at which the Eulerian angle psi changes.voidsetThetaRate(double thetaRate) Set the rate at which the Eulerian angle theta changes.voidsetXFract(double xfract) Set the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.voidsetXFractByF(RealValuedFunctOps xfractFunction) Set the function determining the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.voidsetXFractBySF(SimFunction xfractFunction) Set the simulation function determining the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.voidsetXFractRate(double xfractRate) Set the rate at which the fractional distance in the x direction changes.voidsetYFract(double yfract) Set the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.voidsetYFractByF(RealValuedFunctOps yfractFunction) Set the function determining the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.voidsetYFractBySF(SimFunction yfractFunction) Set the simulation function determining the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.voidsetYFractRate(double yfractRate) Set the rate at which the fractional distance in the y direction changes.voidupdate(double t, long simtime) Update the object's state to that at a specified time.Methods inherited from class org.bzdev.anim2d.AnimationObject2D
addToFrame, addToFrame, getAnimation, getZorder, isVisible, setVisible, setZorder, setZorderMethods inherited from class org.bzdev.devqsim.SimObject
addSimulationListener, addTraceSet, bindCallable, bindCallable, bindCallable, bindCallable, bindRunnable, bindRunnable, bindRunnable, bindRunnable, callableObject, callableScript, callScriptFunction, callScriptMethod, clearTraceSets, evalScript, getEventListenerList, getScriptObject, getTraceSets, onDelete, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printState, printState, printState, printState, printState, printState, putScriptObject, removeSimulationListener, removeTraceSet, runnableObject, runnableScript, scheduleCall, scheduleCall, scheduleCall, scheduleCall, scheduleCallObject, scheduleScript, scheduleTask, scheduleTask, scheduleTask, scheduleTask, scheduleTaskObject, scheduleTaskScript, startImmediateTask, startImmediateTask, trace, trace, unscheduledTaskThread, unscheduledTaskThread, update, usesTraceSetMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bzdev.graphs.Graph.Graphic
boundingBoxMethods inherited from interface org.bzdev.obnaming.NamedObjectOps
canDelete, delete, deletePending, getName, isDeleted, isInterned
-
Constructor Details
-
Model3DView
Constructor.- Parameters:
animation- the animationname- the name of the object; null for an automatically generated nameintern- true if the object can be looked up by using the methods inSimulation; false otherwise.- Throws:
IllegalArgumentException- typically means a name is already in use- See Also:
-
-
Method Details
-
setModel
Set the model. This must be called with a non-null value before this object is used in an animation.- Parameters:
model- the model
-
setInitialViewingTime
public void setInitialViewingTime(double time0) Set the initial viewing time. When Real-valued functions are used, the argument passed to the function will be the difference between the simulation time and the initial viewing time.- Parameters:
time0- the initial viewing time
-
setChangeScale
public void setChangeScale(boolean changeScale) Set whether or not the scale will be recomputed each timeaddTo(Graph,Graphics2D,Graphics2D)is called. A value of false will not prevent the scale from being initialized.- Parameters:
changeScale- true if the scale will always be recomputed; false otherwise
-
forceScaleChange
public void forceScaleChange()Force the scale to be recomputed the next timeaddTo(Graph,Graphics2D,Graphics2D)is called. -
getChangeScale
public boolean getChangeScale()Get whether or not the scale will be recomputed each timeaddTo(Graph,Graphics2D,Graphics2D)is called. A value of false will not prevent the scale from being initialized.- Returns:
- true if the scale will always be recomputed; false otherwise
-
getPhi
public double getPhi()Get the Eulerian angle φ for a coordinate rotation.- Returns:
- the angle in radians
-
getPhiFunction
Get the function to compute the Eulerian angle φ as a function of time. The time is in units of seconds. When not null, the value computed by this function will override the values given explicitly or modified by a rate of change.- Returns:
- the function; null if there is none
-
getTheta
public double getTheta()Get the Eulerian angle θ for a coordinate rotation.- Returns:
- the angle in radians
-
getThetaFunction
Get the function to compute the Eulerian angle θ as a function of time. The time is in units of seconds. When not null, the value computed by this function will override the values given explicitly or modified by a rate of change.- Returns:
- the function; null if there is none
-
getPsi
public double getPsi()Get the Eulerian angle ψ for a coordinate rotation.- Returns:
- the angle in radians
-
getPsiFunction
Get the function to compute the Eulerian angle ψ as a function of time. The time is in units of seconds. When not null, the value computed by this function will override the values given explicitly or modified by a rate of change.- Returns:
- the function; null if there is none
-
setCoordRotation
public void setCoordRotation(double phi, double theta, double psi) Rotate the Model3D coordinates. When all values are zero, the z access is perpendicular to an image, the x axis is horizontal, and the 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, and 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.
- Parameters:
phi- the Eulerian angle phi in radianstheta- the Eulerian angle theta in radianspsi- the Eulerian angle psi in radians
-
setCoordRotationByF
public void setCoordRotationByF(RealValuedFunctOps phiF, RealValuedFunctOps thetaF, RealValuedFunctOps psiF) Rotate the Model3D coordinates by providing functions giving the rotation as a function of time. When all returned values are zero, the z access is perpendicular to an image, the x axis is horizontal, and the 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, and the z axis points towards the viewer.The functions provide Eulerian angles, in units of radians, as a function of the time returned by the animation method
Simulation.currentTime(). If a function is null, the value of the Eulerian angle is based on the value passed explicitly and any specified rate of change.The Eulerian angles follow the convention used in Goldstein, "Classical Mechanics": φ 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. The angle θ then indicates a rotation about the new x axis, and ψ indicates a rotation about the final z axis.
Note that the coordinate system is being rotated, not the object being displayed.
- Parameters:
phiF- the function that computes the Eulerian angle φ in radians; null if there is no function for this anglethetaF- the function that computes Eulerian angle θ in radians; null if there is no function for this anglepsiF- the function that computes the Eulerian angle ψ in radians; null if there is no function for this angle
-
setCoordRotationBySF
Rotate the Model3D coordinates by providing simulation functions giving the rotation as a function of time. When all returned values are zero, the z access is perpendicular to an image, the x axis is horizontal, and the 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, and the z axis points towards the viewer.The functions provide Eulerian angles, in units of radians, as a function of the time returned by the animation method
Simulation.currentTime(). If a function is null, the value of the Eulerian angle is based on the value passed explicitly and any specified rate of change.The Eulerian angles follow the convention used in Goldstein, "Classical Mechanics": φ 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. The angle θ then indicates a rotation about the new x axis, and ψ indicates a rotation about the final z axis.
Note that the coordinate system is being rotated, not the object being displayed.
- Parameters:
phiF- the function that computes the Eulerian angle φ in radians; null if there is no function for this anglethetaF- the function that computes Eulerian angle θ in radians; null if there is no function for this anglepsiF- the function that computes the Eulerian angle ψ in radians; null if there is no function for this angle
-
getBorder
public double getBorder()Get the border's size. The border is the minimum distance in user space between a model and the image's frame when the magnification is 1.0.- Returns:
- the size of the border
-
setBorder
public void setBorder(double border) Set the border. The border is the minimum distance in user space between a model and the image's frame when the magnification is 1.0.- Parameters:
border- a non-negative number giving the border
-
getXFract
public double getXFract()Get the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.- Returns:
- the fraction in the range [0.0, 1.0]
-
getXFractFunction
Get the function determining the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted. The function must return values in the range [0.0, 1.0].- Returns:
- the function; null if there is none
-
setXFract
public void setXFract(double xfract) Set the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted.- Parameters:
xfract- the fraction of the image width, excluding the borders, by which an image was shifted along the x axis, with values in the range [0.0, 1.0]
-
setXFractByF
Set the function determining the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted. The function must return values in the range [0.0, 1.0]. If the function is null, the fraction is determined by the values passed tosetXFract(double)andsetXFractRate(double).- Parameters:
xfractFunction- the function; null if no function is to be used
-
setXFractBySF
Set the simulation function determining the fraction of the image width, excluding borders, and going from left to right, by which the left side of the model is shifted. The function must return values in the range [0.0, 1.0]. If the function is null, the fraction is determined by the values passed tosetXFract(double)andsetXFractRate(double).- Parameters:
xfractFunction- the function; null if no function is to be used
-
getYFract
public double getYFract()Get the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.- Returns:
- the fraction in the range [0.0, 1.0]
-
getYFractFunction
Get the function determining the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted. The function must return values in the range [0.0, 1.0].- Returns:
- the fraction; null if none is to be used
-
setYFract
public void setYFract(double yfract) Set the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted.- Parameters:
yfract- the fraction of the image width, excluding the borders, by which an image was shifted along the y axis, with values in the range [0.0, 1.0]
-
setYFractByF
Set the function determining the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted. This function must return values in the range [0.0, 1.0]. If the function is null, the fraction is determined by the values passed tosetYFract(double)andsetXFractRate(double).- Parameters:
yfractFunction- the function; null if none is to be used
-
setYFractBySF
Set the simulation function determining the fraction of the image width, excluding borders, and going from bottom to top, by which the bottom side of the model is shifted. This function must return values in the range [0.0, 1.0]. If the function is null, the fraction is determined by the values passed tosetYFract(double)andsetXFractRate(double).- Parameters:
yfractFunction- the function; null if none is to be used
-
getDelta
public double getDelta()Get the minimum triangle size for rendering.- Returns:
- the size of an edge
- See Also:
-
setDelta
public void setDelta(double delta) 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.- Parameters:
delta- the triangle dimension limit; ignored if zero
-
getLightSourcePhi
public double getLightSourcePhi()Get the light-source parameter phi. The parameter partially determines the direction of the light source as described in the documentation forsetLightSource.- Returns:
- the light-source parameter phi
- See Also:
-
getLightSourcePhiFunction
Get the function that determines light-source parameter φ. The parameter partially determines the direction of the light source as described in the documentation forsetLightSource. The function provides the value of the parameter as a function of time in units of seconds.- Returns:
- the function; null if there is none
- See Also:
-
getLightSourceTheta
public double getLightSourceTheta()Get the light-source parameter theta. The parameter partially determines the direction of the light source as described in the documentation forsetLightSource.- Returns:
- the light-source parameter theta
- See Also:
-
getLightSourceThetaFunction
Get the function determining the light-source parameter θ. The parameter partially determines the direction of the light source as described in the documentation forsetLightSource. The function provides the value of the parameter as a function of time in units of seconds.- Returns:
- the function ; null if there is none
- See Also:
-
setLightSource
public void setLightSource(double phi, double theta) 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.- Parameters:
phi- the angle in radians about the z axis of the plane containing a unit vector pointing towards the light source will. 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 between a unit vector pointing towards the light source makes and with a vector parallel to the z axis.
-
setLightSourceByF
Sets functions that determine the direction to a light source. The default direction, in which θ=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. These parameters are:- φ - the angle in radians about the z axis of the plane containing a unit vector pointing towards the light source will. If phi is zero, this plane includes the x axis and for non-zero theta, the unit vector will have a positive x component.
- θ - the angle between a unit vector pointing towards the light source makes and with a vector parallel to the z axis.
- Parameters:
phiF- the function for φ; null if there is nonethetaF- the function for θ; null if there is none
-
setLightSourceBySF
Sets simulation functions that determine the direction to a light source. The default direction, in which θ=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. These parameters are:- φ - the angle in radians about the z axis of the plane containing a unit vector pointing towards the light source will. If phi is zero, this plane includes the x axis and for non-zero theta, the unit vector will have a positive x component.
- θ - the angle between a unit vector pointing towards the light source makes and with a vector parallel to the z axis.
- Parameters:
phiF- the function for φ; null if there is nonethetaF- the function for θ; null if there is none
-
getLightSourcePhiRate
public double getLightSourcePhiRate()Get the rate at which the light source's angle phi changes.- Returns:
- the rate in radians per second
-
setLightSourcePhiRate
public void setLightSourcePhiRate(double phiRate) Set the rate at which the light source's angle phi changes.- Parameters:
phiRate- the rate in radians per second
-
getLightSourceThetaRate
public double getLightSourceThetaRate()Get the rate at which the light source's angle theta changes.- Returns:
- the rate in radians per second
-
setLightSourceThetaRate
public void setLightSourceThetaRate(double thetaRate) Set the rate at which the light source's angle theta changes.- Parameters:
thetaRate- the rate in radians per second
-
getColorFactor
public double getColorFactor()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.- Returns:
- the color factor
- See Also:
-
setColorFactor
public void setColorFactor(double factor) 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.This is intended to help emphasize differences along the 'z' axis that would normally be hard to discern visually.
- Parameters:
factor- the color factor given as a non-negative number
-
getBacksideColor
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.- Returns:
- the color
-
setBacksideColor
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: if the model does not- Parameters:
c- the color
-
getEdgeColor
Get the color used to indicate the edges of a triangle- Returns:
- the color or null to indicate that edges will not be shown
-
setEdgeColor
Set the color to use to use to draw the edges of triangles.- Parameters:
c- the color; null if edges should not be displayed
-
getDefaultSegmentColor
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.- Returns:
- the color; null if the line segments should not be shown
-
setDefaultSegmentColor
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.- Parameters:
c- the color; null if line segments should not be displayed
-
getDefaultBacksideSegmentColor
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.- Returns:
- the color; null if these line segments should not be displayed
-
setDefaultBacksideSegmentColor
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.- Parameters:
c- the color; null if these line segments should not be displayed
-
reset
public void reset()Reset to default values. -
getThetaRate
public double getThetaRate()Get the rate at which the Eulerian angle theta changes.- Returns:
- the rate in radians per second
-
setThetaRate
public void setThetaRate(double thetaRate) Set the rate at which the Eulerian angle theta changes.- Parameters:
thetaRate- the rate in radians per second
-
getPhiRate
public double getPhiRate()Get the rate at which the Eulerian angle phi changes.- Returns:
- the rate in radians per second
-
setPhiRate
public void setPhiRate(double phiRate) Set the rate at which the Eulerian angle phi changes.- Parameters:
phiRate- the rate in radians per second
-
getPsiRate
public double getPsiRate()Get the rate at which the Eulerian angle psi changes.- Returns:
- the rate in radians per second
-
setPsiRate
public void setPsiRate(double psiRate) Set the rate at which the Eulerian angle psi changes.- Parameters:
psiRate- the rate in radians per second
-
getXFractRate
public double getXFractRate()Get the rate at which the fractional distance in the x direction changes. The fractional distance is defined so that 0.0 implies that the left edge of the model is as far left as allowed by the border, and 1.0 implies that the right edge of the model is as far to the right as allowed by the border.- Returns:
- the rate in units of seconds-1
-
setXFractRate
public void setXFractRate(double xfractRate) Set the rate at which the fractional distance in the x direction changes. The fractional distance is defined so that 0.0 implies that the left edge of the model is as far left as allowed by the border, and 1.0 implies that the right edge of the model is as far to the right as allowed by the border.- Parameters:
xfractRate- the rate in units of seconds-1
-
getYFractRate
public double getYFractRate()Get the rate at which the fractional distance in the y direction changes. The fractional distance is defined so that 0.0 implies that the bottom edge of the model is as close to the bottom of the image as allowed by the border, and 1.0 implies that the top edge of the model is as close to the top of the image as allowed by the border.- Returns:
- the rate in units of seconds-1
-
setYFractRate
public void setYFractRate(double yfractRate) Set the rate at which the fractional distance in the y direction changes. The fractional distance is defined so that 0.0 implies that the bottom edge of the model is as close to the bottom of the image as allowed by the border, and 1.0 implies that the top edge of the model is as close to the top of the image as allowed by the border.- Parameters:
yfractRate- the rate in units of seconds-1
-
getMagnification
public double getMagnification()Get the magnification factor.- Returns:
- the magnification factor.
-
getMagnificationFunction
Get the function determining the magnification factor. The function, if not null, must return a positive real number that gives the magnification as a function of the time returned by the animation methodSimulation.currentTime().- Returns:
- the function; null if there is none
-
setMagnification
public void setMagnification(double magnification) Set the magnification factor.- Parameters:
magnification- the magnification factor.
-
setMagnificationByF
Set the function determining the magnification factor. The function, if not null, must return a positive real number that gives the magnification as a function of time returned by the animation methodSimulation.currentTime(). If a function is not provided, the magnification factor provided explicitly, perhaps modified by a magnification rate, will be used.- Parameters:
magF- the function; null if there is none
-
setMagnificationBySF
Set the simulation function determining the magnification factor. The function, if not null, must return a positive real number that gives the magnification as a function of time returned by the animation methodSimulation.currentTime(). If a function is not provided, the magnification factor provided explicitly, perhaps modified by a magnification rate, will be used.- Parameters:
magF- the function; null if there is none
-
getLogMagnificationRate
public double getLogMagnificationRate()Get the logarithmic magnification rate. The magnification factor will change with time as exp(magRate * t);- Returns:
- the magnification rate
-
setLogMagnificationRate
public void setLogMagnificationRate(double magRate) Set the magnification rate logarithmicly. The magnification factor will change with time as exp(magRate * t);- Parameters:
magRate- the logarithmic magnification rate
-
setLogMagnificationRate
public void setLogMagnificationRate(double magTarget, double deltaT) Set the magnification rate logarithmicly to magnification to a target value in a specified time.- Parameters:
magTarget- the target magnification value after a time interval of deltaT elapsesdeltaT- the time interval for the magnification factor to change from its current value to the target value
-
update
public void update(double t, long simtime) Description copied from class:SimObjectUpdate the object's state to that at a specified time. The values of t passed to this method should form an increasing sequence. The default implementation does nothing, and subclasses should override this method if the state needed for drawing must be updated before the drawing is completed. Aside from a direct subclass of SimObject, classes that override this method should call the same method on their superclass unless there is documentation to the contrary. -
addTo
Add this object to an animation's graph. This is a special case. There should be only on in use per animation. It will set up the graph so that the graph displays a particular range in graph coordinate space. Angles are ignored so that Graph View will never be rotated. Graphic operations at a particular time should be performed after a graph'saddmethod is called for any GraphView defined for the graph, and afterupdateis called with the current time as its argument.- Parameters:
graph- the graph on which this object should be drawng2d- (ignored but needed by Graph.Graphics interface)g2dGCS- (ignored but needed by Graph.Graphics interface)- Throws:
IllegalStateException- initialize was not called
-
printConfiguration
Print this simulation object's configuration. Documentation for the use of this method is provided by the documentation for theSimObjectmethodSimObject.printConfiguration(String,String,boolean,PrintWriter).When the second argument has a value of true, the object name and class name will be printed in a standard format with its indentation provided by the iPrefix argument. In addition, the configuration that is printed includes the following items.
Defined in
AnimationObject2D:- the Z-order.
- whether or not this object is visible.
GraphView:- the initial viewing time.
- the change-scale-per-view flag.
- the backside color.
- the edge color.
- the default segment color.
- the default backside segment color.
- the triangle-rendering delta.
- the color factor.
- either the phi simulation function, a note that the phi function was set, or the phi rate.
- either the theta simulation function, a note that the theta function was set, or the theta rate.
- either the psi simulation function, a note that the psi function was set, or the psi rate.
- either the magnification simulation function, a note that the magnification was set, or the magnification rate (which is logarithmic).
- either the X-fraction simulation function, a note that the X-fraction function was set, or the X-fraction rate
- either the Y-fraction simulation function, a note that the Y-fraction function was set, or the Y-fraction rate
- either the lightsource phi simulation function, a note that the lightsource phi function was set, or the lightsource phi rate.
- either the lightsource theta simulation function, a note that the lightsource theta function was set, or the lightsource theta rate.
- Overrides:
printConfigurationin classAnimationObject2D- Parameters:
iPrefix- the prefix to use for an initial line when printName is true with null treated as an empty stringprefix- a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is trueprintName- requests printing the name of an objectout- the output print writer
-
printState
Print this simulation object's state. Documentation for the use of this method is provided by the documentation for theSimObjectmethodSimObject.printState(String,String,boolean,PrintWriter).When the third argument has a value of true, the object name and class name will be printed in a standard format with its indentation provided by the iPrefix argument. Defined in
Model3DView:- a note if a forced scale change is pending.
- the value of the Eulerian angle theta in radians.
- the value of the Eulerian angle phi in radians.
- the value of the Eulerian angle psi in radians.
- the X fractional distance.
- the Y fractional distance.
- the value of theta for the light sources.
- the value of phi for the light source.
- the magnification (1.0 indicates no magnification).
- Overrides:
printStatein classAnimationObject2D- Parameters:
iPrefix- the prefix to use for an initial line when printName is true with null treated as an empty stringprefix- a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is trueprintName- requests printing the name of an objectout- the output print writer
-
clone
Creates and returns a copy of this object. This method will throw the exception CloneNotSupportedException if the object is interned.- Overrides:
clonein classObject- Throws:
CloneNotSupportedException- a clone could not be created- See Also:
-
isInterned
public boolean isInterned()Determine if an object is interned in a object namer's tables.- Specified by:
isInternedin interfaceNamedObjectOps- Returns:
- true if the object is interned; false if not
-
getObjectNamer
Get the object namer for a named object.- Returns:
- the object namer for this named object
-
getName
Get an object's name.- Specified by:
getNamein interfaceNamedObjectOps- Returns:
- the name of the object
-
canDelete
public boolean canDelete()Determine if this named object can be deleted. A named object can be deleted if the method delete has not been called and if the object is not in a state that prevents the object from being deleted. Subclasses that override this method must call canDelete() for their superclasses and return false if the superclass' canDelete method returns false. The default method returns true if delete() has not been called and returned true.- Specified by:
canDeletein interfaceNamedObjectOps- Returns:
- true if this object can be deleted; false otherwise
-
delete
public final boolean delete()Delete an object. An object can only be deleted once. If this method returns true, the object (if interned) will have been removed from the object namer tables.The implementations provided by
DefaultNamedObectand generated because of a@NamedObjectannotation provide a protected method named onDelete. A subclass that overrides onDelete() must call the onDelete method of its superclass after it's onDelete method has been called and any cleanup actions performed. In some cases, this may happen at a later time (e.g., if a thread is used for some of the cleanup operations or if it is otherwise necessary to wait).- Specified by:
deletein interfaceNamedObjectOps- Returns:
- true if the deletion request was accepted; false otherwise
-
isDeleted
public final boolean isDeleted()Determine if an object has been deleted. An object is deleted if the method delete() has been called and returned true.- Specified by:
isDeletedin interfaceNamedObjectOps- Returns:
- true if deleted; false otherwise
-
deletePending
public final boolean deletePending()Determine if an object is being deleted. An deletion is pending if the method delete() has been called and returned true but the deletion has not been completed.- Specified by:
deletePendingin interfaceNamedObjectOps- Returns:
- true if deletion is pending; false otherwise
-