|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.physicsEngine.geometry.shapes.ShapeFactory
public class ShapeFactory
Factory class that creates new instances of various kinds of shapes. Although
one can create the shapes directly using Shape
constructors,
this can facilitate the creation of simple shapes such as squares,
rectangles. Furthermore, one can use this to generate a bounding
approximation for a complex shape (for example, one may take an image of a
car and use this to generate a simpler Polygon
that contains the
car).
Constructor Summary | |
---|---|
ShapeFactory()
|
Method Summary | |
---|---|
static java.awt.Shape |
getJavaShapeFromShape(Shape shape)
Create a JavaShape object from a Shape object. |
static java.awt.Shape |
getShapeFromImage(java.awt.image.BufferedImage image,
int offsetx,
int offsety)
Creates a polygonal approximation of a shape from an image. |
static JavaShape |
JavaCircle(double radius)
Create a circle with given radius, implemented using Java.awt.Shape . |
static JavaShape |
JavaRectangle(double width,
double height)
Create a rectangle of given width and height, using the java.awt.Shape framework for the backend. |
static Shape |
makeRectangle(double width,
double height)
Creates a rectangle ( Polygon ) of given width and height. |
static Shape |
makeRectangleWithCentroid(double width,
double height,
double xOffset,
double yOffset)
Create a rectangle ( Polygon ) of given width and height and
coordinate of top left corner. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShapeFactory()
Method Detail |
---|
public static Shape makeRectangle(double width, double height)
Polygon
) of given width and height.
width
- height
-
public static Shape makeRectangleWithCentroid(double width, double height, double xOffset, double yOffset)
Polygon
) of given width and height and
coordinate of top left corner. This allows one to specify the centroid of
the rectangle.
width
- height
- xOffset
- yOffset
-
public static JavaShape JavaCircle(double radius)
Java.awt.Shape
.
radius
-
public static JavaShape JavaRectangle(double width, double height)
java.awt.Shape
framework for the backend.
width
- height
-
public static java.awt.Shape getJavaShapeFromShape(Shape shape)
JavaShape
object from a Shape
object.
This involves rendering the Shape and obtaining the
java.awt.Shape
information from the image.
shape
-
public static java.awt.Shape getShapeFromImage(java.awt.image.BufferedImage image, int offsetx, int offsety)
Shape
of a PhysicalParameters
or GeometricParameters
object. Create a convex outline
around the given image. If given image defines transparent region, then
the outline will trace a convex polygon around that edge. Otherwise, it
will simply create a rectangular region around the image. Created by R.
Duvall
image
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |