Package org.bzdev.p3d

Class Model3DView

All Implemented Interfaces:
Graph.Graphic, NamedObjectOps

public class Model3DView extends AnimationObject2D
Class for creating an animated view of a 3D model. The model's default orientation has the x axis pointing left, the y axis pointing up, and z axis pointing towards the viewer. It is convenient to be able to create a video showing the model in various orientations.

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 Details

  • Method Details

    • setModel

      public void setModel(Model3D model)
      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 time addTo(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 time addTo(Graph,Graphics2D,Graphics2D) is called.
    • getChangeScale

      public boolean getChangeScale()
      Get whether or not the scale will be recomputed each time addTo(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

      public RealValuedFunction 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

      public RealValuedFunction 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

      public RealValuedFunction 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 radians
      theta - the Eulerian angle theta in radians
      psi - 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 angle
      thetaF - the function that computes Eulerian angle θ in radians; null if there is no function for this angle
      psiF - the function that computes the Eulerian angle ψ in radians; null if there is no function for this angle
    • setCoordRotationBySF

      public void setCoordRotationBySF(SimFunction phiF, SimFunction thetaF, SimFunction psiF)
      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 angle
      thetaF - the function that computes Eulerian angle θ in radians; null if there is no function for this angle
      psiF - 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

      public RealValuedFunction 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

      public void setXFractByF(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. 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 to setXFract(double) and setXFractRate(double).
      Parameters:
      xfractFunction - the function; null if no function is to be used
    • setXFractBySF

      public void setXFractBySF(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. 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 to setXFract(double) and setXFractRate(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

      public RealValuedFunction 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

      public void setYFractByF(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. 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 to setYFract(double) and setXFractRate(double).
      Parameters:
      yfractFunction - the function; null if none is to be used
    • setYFractBySF

      public void setYFractBySF(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. 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 to setYFract(double) and setXFractRate(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 for setLightSource.
      Returns:
      the light-source parameter phi
      See Also:
    • getLightSourcePhiFunction

      public RealValuedFunction getLightSourcePhiFunction()
      Get the function that determines light-source parameter φ. The parameter partially determines the direction of the light source as described in the documentation for setLightSource. 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 for setLightSource.
      Returns:
      the light-source parameter theta
      See Also:
    • getLightSourceThetaFunction

      public RealValuedFunction getLightSourceThetaFunction()
      Get the function determining the light-source parameter θ. The parameter partially determines the direction of the light source as described in the documentation for setLightSource. 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

      public void setLightSourceByF(RealValuedFunctOps phiF, RealValuedFunctOps thetaF)
      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.
      The functions determine these values as a function of time, with time provided in units of seconds.
      Parameters:
      phiF - the function for φ; null if there is none
      thetaF - the function for θ; null if there is none
    • setLightSourceBySF

      public void setLightSourceBySF(SimFunction phiF, SimFunction thetaF)
      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.
      The functions determine these values as a function of time, with time provided in units of seconds.
      Parameters:
      phiF - the function for φ; null if there is none
      thetaF - 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

      public Color 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

      public void setBacksideColor(Color c)
      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

      public 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

      public void setEdgeColor(Color c)
      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

      public Color 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 when Model3D.ImageData.setDelta(double) is called with a non-zero argument.
      Returns:
      the color; null if the line segments should not be shown
    • setDefaultSegmentColor

      public void setDefaultSegmentColor(Color c)
      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 when Model3D.ImageData.setDelta(double) is called with a non-zero argument.
      Parameters:
      c - the color; null if line segments should not be displayed
    • getDefaultBacksideSegmentColor

      public Color 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 when Model3D.ImageData.setDelta(double) is called with a non-zero argument.
      Returns:
      the color; null if these line segments should not be displayed
    • setDefaultBacksideSegmentColor

      public void setDefaultBacksideSegmentColor(Color c)
      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 when Model3D.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

      public RealValuedFunction 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 method Simulation.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

      public void setMagnificationByF(RealValuedFunctOps magF)
      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 method Simulation.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

      public void setMagnificationBySF(SimFunction magF)
      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 method Simulation.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 elapses
      deltaT - 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: SimObject
      Update 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.
      Overrides:
      update in class SimObject
      Parameters:
      t - the time for which the object should be calculated.
      simtime - the simulation time
    • addTo

      public void addTo(Graph graph, Graphics2D g2d, Graphics2D g2dGCS) throws IllegalStateException
      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's add method is called for any GraphView defined for the graph, and after update is called with the current time as its argument.
      Parameters:
      graph - the graph on which this object should be drawn
      g2d - (ignored but needed by Graph.Graphics interface)
      g2dGCS - (ignored but needed by Graph.Graphics interface)
      Throws:
      IllegalStateException - initialize was not called
    • printConfiguration

      public void printConfiguration(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print this simulation object's configuration. Documentation for the use of this method is provided by the documentation for the SimObject method SimObject.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.
      Defined in 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:
      printConfiguration in class AnimationObject2D
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • printState

      public void printState(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print this simulation object's state. Documentation for the use of this method is provided by the documentation for the SimObject method SimObject.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:
      printState in class AnimationObject2D
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • clone

      protected Object clone() throws CloneNotSupportedException
      Creates and returns a copy of this object. This method will throw the exception CloneNotSupportedException if the object is interned.
      Overrides:
      clone in class Object
      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:
      isInterned in interface NamedObjectOps
      Returns:
      true if the object is interned; false if not
    • getObjectNamer

      protected Simulation getObjectNamer()
      Get the object namer for a named object.
      Returns:
      the object namer for this named object
    • getName

      public final String getName()
      Get an object's name.
      Specified by:
      getName in interface NamedObjectOps
      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:
      canDelete in interface NamedObjectOps
      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 DefaultNamedObect and generated because of a @NamedObject annotation 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:
      delete in interface NamedObjectOps
      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:
      isDeleted in interface NamedObjectOps
      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:
      deletePending in interface NamedObjectOps
      Returns:
      true if deletion is pending; false otherwise