com.orsoncharts.graphics3d

## Class DefaultDrawable3D

- java.lang.Object
- - com.orsoncharts.graphics3d.DefaultDrawable3D

- All Implemented Interfaces:
    Drawable3D

      public class DefaultDrawable3D
      extends java.lang.Object
      implements Drawable3D

  Provides a default implementation of the `Drawable3D` interface. This is not used directly in Orson Charts, since the `Chart3D` class implements the `Drawable3D` interface itself. However, it is used in testing to ensure that the `com.orsoncharts.graphics3d` package can function on a stand-alone basis.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `DEFAULT_PROJ_DIST` The default projection distance.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultDrawable3D(World world)` Creates a new instance to display the content of the specified `world`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RenderingInfo` | `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds)` Draws the current view to a `Graphics2D` instance.
    `Dimension3D` | `getDimensions()` Returns the dimensions of the 3D object.
    `double` | `getProjDistance()` Returns the projection distance.
    `Offset2D` | `getTranslate2D()` Returns the 2D offset for the scene.
    `ViewPoint3D` | `getViewPoint()` Returns the view point.
    `void` | `setProjDistance(double dist)` Sets the projection distance.
    `void` | `setTranslate2D(Offset2D offset)` Sets the translation offset.
    `void` | `setViewPoint(ViewPoint3D viewPoint)` Sets the view point.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_PROJ_DIST

          public static final double DEFAULT_PROJ_DIST

      The default projection distance.
      Since:
        1.2
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultDrawable3D

          public DefaultDrawable3D(World world)

      Creates a new instance to display the content of the specified `world`.
      Parameters:
        `world` - the world to view (`null` not permitted).

  - ### Method Detail

    - #### getDimensions

          public Dimension3D getDimensions()

      Returns the dimensions of the 3D object.
      Specified by:
        `getDimensions` in interface `Drawable3D`
      Returns:
        The dimensions.

    - #### getViewPoint

          public ViewPoint3D getViewPoint()

      Returns the view point.
      Specified by:
        `getViewPoint` in interface `Drawable3D`
      Returns:
        The view point (never `null`).

    - #### setViewPoint

          public void setViewPoint(ViewPoint3D viewPoint)

      Sets the view point.
      Specified by:
        `setViewPoint` in interface `Drawable3D`
      Parameters:
        `viewPoint` - the view point (`null` not permitted).

    - #### getProjDistance

          public double getProjDistance()

      Returns the projection distance. The default value is `DEFAULT_PROJ_DIST`, higher numbers flatten out the perspective and reduce distortion in the projected image.
      Specified by:
        `getProjDistance` in interface `Drawable3D`
      Returns:
        The projection distance.
      Since:
        1.2

    - #### setProjDistance

          public void setProjDistance(double dist)

      Sets the projection distance.
      Specified by:
        `setProjDistance` in interface `Drawable3D`
      Parameters:
        `dist` - the distance.
      Since:
        1.2

    - #### getTranslate2D

          public Offset2D getTranslate2D()

      Description copied from interface: `Drawable3D`
      Returns the 2D offset for the scene. Normally this will default to `(0, 0)`.
      Specified by:
        `getTranslate2D` in interface `Drawable3D`
      Returns:
        The translation offset (never `null`).

    - #### setTranslate2D

          public void setTranslate2D(Offset2D offset)

      Description copied from interface: `Drawable3D`
      Sets the translation offset. This is typically used to allow the user to modify the offset of a 2D projection on-screen by dragging with the mouse.
      Specified by:
        `setTranslate2D` in interface `Drawable3D`
      Parameters:
        `offset` - the translation offset (`null` not permitted).

    - #### draw

          public RenderingInfo draw(java.awt.Graphics2D g2,
                                    java.awt.geom.Rectangle2D bounds)

      Draws the current view to a `Graphics2D` instance.
      Specified by:
        `draw` in interface `Drawable3D`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `bounds` - the bounds (`null` not permitted).
      Returns:
        The rendering state.