|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.util.ZUtil
ZUtil provides some generic, useful routines.
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
Constructor Summary | |
ZUtil() |
Method Summary | |
static double |
angleBetweenPoints(double x, double y, double ax, double ay, double bx, double by) Returns the angle in radians between point a and point b from point pt, that is the angle between a-pt-b. |
static double |
angleBetweenPoints(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b) Returns the angle in radians between point a and point b from point pt, that is the angle between a-pt-b. |
static java.awt.image.BufferedImage |
createThumbnailImage(ZNode node, java.awt.Dimension thumbnailSize) Returns a BufferedImage of thumbnailSize with the node rendered into the image. |
static boolean |
intersectsPolygon(java.awt.geom.Rectangle2D rect, double[] xp, double[] yp) Determines if any part of the rectangle is inside this polygon. |
static double |
inverseTransformDimension(java.awt.geom.Dimension2D aDimension, java.awt.geom.AffineTransform aTransform) Modify the dimension paramater by applying the inverse of the given transform. |
static double |
inverseTransformRectangle(java.awt.geom.Rectangle2D aRectangle, java.awt.geom.AffineTransform aTransform) Modify the aRectangle paramater by applying the inverse of the given transform. |
static boolean |
isInsidePolygon(double x, double y, int np, double[] xp, double[] yp) Determines if the point is inside the polygon. |
static boolean |
isInsidePolygon(java.awt.geom.Rectangle2D rect, int np, double[] xp, double[] yp) Determines if a rectangle is inside a polygon. |
static boolean |
rectIntersectsLine(java.awt.geom.Rectangle2D rect, double x1, double y1, double x2, double y2) Tests if the specified line segment intersects the interior of the specified Rectangle2D . |
static boolean |
rectIntersectsPolyline(java.awt.geom.Rectangle2D rect, double[] xp, double[] yp, double penWidth) Determine if the specified rectangle intersects the specified polyline. |
static double |
transformDimension(java.awt.geom.Dimension2D aDimension, java.awt.geom.AffineTransform aTransform) Modify the dimension paramater by applying the the given transform. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZUtil()
Method Detail |
public static java.awt.image.BufferedImage createThumbnailImage(ZNode node, java.awt.Dimension thumbnailSize)
thumbnailSize
with the node
rendered into the image. The node is scaled to fit within the image without changing its aspect ratio.
NOTE: ZSceneGraphObjects that access the ZDrawingSurface or ZCamera in their render method without checking for null values will throw exceptions when passed to this method.
Contributed by Philippe Converset.
node
- The node to render.thumbnailSize
- The size of the resulting BufferedImage.public static boolean rectIntersectsLine(java.awt.geom.Rectangle2D rect, double x1, double y1, double x2, double y2)
Rectangle2D
.
true
if the specified line segment intersects the interior of this Rectangle2D
; false
otherwise.public static boolean rectIntersectsPolyline(java.awt.geom.Rectangle2D rect, double[] xp, double[] yp, double penWidth)
rect
- The rectangle that is being tested for intersectionxp
- The array of X-coordinates that determines the polylineyp
- The array of Y-coordinates that determines the polylinepenWidth
- The width of the polylinepublic static double angleBetweenPoints(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
public static double angleBetweenPoints(double x, double y, double ax, double ay, double bx, double by)
public static boolean intersectsPolygon(java.awt.geom.Rectangle2D rect, double[] xp, double[] yp)
rect
- The rectangle being tested for intersecting this polygonpublic static boolean isInsidePolygon(double x, double y, int np, double[] xp, double[] yp)
public static boolean isInsidePolygon(java.awt.geom.Rectangle2D rect, int np, double[] xp, double[] yp)
rect
- The rectangle being tested for containment within a polygonpublic static double transformDimension(java.awt.geom.Dimension2D aDimension, java.awt.geom.AffineTransform aTransform)
aDimension
- the dimension to which the transform will be applied.aTransform
- the transform that will be applied to the dimension.public static double inverseTransformDimension(java.awt.geom.Dimension2D aDimension, java.awt.geom.AffineTransform aTransform) throws java.awt.geom.NoninvertibleTransformException
aDimension
- the dimension to which the inverse transform will be applied.aTransform
- the transform who's inverse will be applied to the dimension.java.awt.geom.NoninvertibleTransformException
public static double inverseTransformRectangle(java.awt.geom.Rectangle2D aRectangle, java.awt.geom.AffineTransform aTransform) throws java.awt.geom.NoninvertibleTransformException
aRectangle
- the rectangle to which the inverse transform will be applied.aTransform
- the transform who's inverse will be applied to the size.java.awt.geom.NoninvertibleTransformException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |