- All Known Implementing Classes:
Chart3D
,DefaultDrawable3D
public interface Drawable3D
A three dimensional scene that can be viewed from an arbitrary viewpoint
and rendered to any
Graphics2D
instance. The Chart3D
class
implements this interface.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondraw
(Graphics2D g2, Rectangle2D bounds) Draws the scene to the suppliedGraphics2D
target and returns an object containing state information about the rendering.Returns the aggregate dimensions of the objects in the 3D scene.double
Returns the projection distance.Returns the 2D offset for the scene.Returns the point from which the 3D scene is viewed.void
setProjDistance
(double dist) Sets the projection distance.void
setTranslate2D
(Offset2D offset) Sets the translation offset.void
setViewPoint
(ViewPoint3D viewPoint) Sets a new view point.
-
Method Details
-
getDimensions
Returns the aggregate dimensions of the objects in the 3D scene. This will be a bounding box for all the objects. One use for this information is to determine a suitable default viewing distance for a given scene (one that sizes the 2D projection to something appropriate for the available drawing space).- Returns:
- The dimensions (never
null
).
-
getViewPoint
Returns the point from which the 3D scene is viewed. The viewing point determines how the 3D scene is projected onto the 2D viewing plane in thedraw(java.awt.Graphics2D, java.awt.geom.Rectangle2D)
method.- Returns:
- The view point (never
null
).
-
setViewPoint
Sets a new view point. Note that theViewPoint3D
class is implemented so that its position and orientation can be updated directly, so you should use this method only when you want to set an entirely new view point.- Parameters:
viewPoint
- the view point (null
not permitted).
-
getProjDistance
double getProjDistance()Returns the projection distance. A typical value is1500
, higher numbers flatten out the perspective and reduce distortion in the projected image.- Returns:
- The projection distance.
- Since:
- 1.2
-
setProjDistance
Sets the projection distance. A typical value is1500
(but this will depend on the dimensions of the scene), higher numbers flatten out the perspective and reduce distortion in the projected image.- Parameters:
dist
- the distance.- Since:
- 1.2
-
getTranslate2D
Returns the 2D offset for the scene. Normally this will default to(0, 0)
.- Returns:
- The translation offset (never
null
).
-
setTranslate2D
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.- Parameters:
offset
- the translation offset (null
not permitted).
-
draw
Draws the scene to the suppliedGraphics2D
target and returns an object containing state information about the rendering.- Parameters:
g2
- the graphics target (null
not permitted).bounds
- the bounds (null
not permitted).- Returns:
- State information about the 3D scene that has been drawn
(never
null
).
-