maspack.render
Class RenderableUtils

java.lang.Object
  extended by maspack.render.RenderableUtils

public class RenderableUtils
extends java.lang.Object

Provides utility routines for Renderable objects.


Constructor Summary
RenderableUtils()
           
 
Method Summary
static void cloneRenderProps(Renderable r)
          Sets the RenderProps of a Renderable object to a copy of its existing RenderProps.
static void getBounds(Renderable r, Point3d min, Point3d max)
          Computes the bounds for a Renderable.
static double getRadius(GLRenderable r)
          Returns a "radius" for a Renderable.
static double getRadiusAndCenter(Point3d center, GLRenderable r)
          Returns a "radius" and a center for a Renderable.
static boolean isVisible(HasRenderProps renderable)
          Returns true if a Renderable is visible.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderableUtils

public RenderableUtils()
Method Detail

isVisible

public static boolean isVisible(HasRenderProps renderable)
Returns true if a Renderable is visible.


cloneRenderProps

public static void cloneRenderProps(Renderable r)
Sets the RenderProps of a Renderable object to a copy of its existing RenderProps. If the object does not currently have any RenderProps, (i.e., getRenderProps returns null), then this method does nothing.

This routine is used to prevent side-effects when the existing RenderProps are shared by more than one object.

Parameters:
r - Renderable objects whose RenderProps are to be cloned.

getRadius

public static double getRadius(GLRenderable r)
Returns a "radius" for a Renderable. This is done by computing the distance from the center to the vertices of the bpunding box.


getRadiusAndCenter

public static double getRadiusAndCenter(Point3d center,
                                        GLRenderable r)
Returns a "radius" and a center for a Renderable.


getBounds

public static void getBounds(Renderable r,
                             Point3d min,
                             Point3d max)
Computes the bounds for a Renderable.

Parameters:
r - Renderable to compute bounds for
min - minimum coordinate values (optional)
max - maximum coordinate values (optional)