public class XyRegularPolygon extends java.lang.Object implements XyArea<XyRegularPolygon>
Regular polygons are also referred to as n-gons (e.g. 5-gon, 8-gon, etc.).
Copyright 2007 Partner Software, Inc.
| Constructor and Description |
|---|
XyRegularPolygon(XyPoint center,
double radius,
int pointCount) |
XyRegularPolygon(XyPoint center,
double radius,
int pointCount,
XyRotation rotation) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(XyPoint point)
Tests if a point is inside this area.
|
boolean |
equals(java.lang.Object nother) |
double |
getArea()
Returns the 2-dimensional area covered by this...
|
XyBounds |
getBounds()
Returns an XyBounds object representing the rectangular extents of this
shape.
|
double |
getPerimeter()
Returns the total length of the lines and/or curves bounding the area.
|
java.util.Iterator<XyPoint> |
iterator() |
XyRegularPolygon |
scaledBy(double factor)
Return a scaled version of the shape by multiplying all coordinates by
the given factor in both dimensions.
|
XyPolygon |
toPolygon()
Same as
XyArea.toPolygon(XyAngle) with a default angle granularity of
1/60 circle (1 degree, pi/30 radians). |
XyPolygon |
toPolygon(XyAngle granularity)
Converts this area to a polygon which approximates it in some fashion.
|
XyPolyline |
toPolyline() |
java.lang.String |
toString() |
XyShape |
transformedBy(XyTransform transform)
Transform the shape using the given transform.
|
XyRegularPolygon |
translatedBy(double offsetX,
double offsetY)
Translate the shape by adding all coordinates to the given x and y
offsets.
|
public XyRegularPolygon(XyPoint center, double radius, int pointCount)
public XyRegularPolygon(XyPoint center, double radius, int pointCount, XyRotation rotation)
public XyPolyline toPolyline()
public XyRegularPolygon scaledBy(double factor)
XyShapescaledBy in interface XyShape<XyRegularPolygon>factor - scaling factorpublic XyRegularPolygon translatedBy(double offsetX, double offsetY)
XyShapetranslatedBy in interface XyShape<XyRegularPolygon>offsetX - offset for the x dimensionoffsetY - offset for the y dimensionpublic XyShape transformedBy(XyTransform transform)
XyShapetransformedBy in interface XyShape<XyRegularPolygon>transform - affine transform to apply.public boolean contains(XyPoint point)
XyAreacontains in interface XyArea<XyRegularPolygon>point - point to test for containmentpublic XyPolygon toPolygon()
XyAreaXyArea.toPolygon(XyAngle) with a default angle granularity of
1/60 circle (1 degree, pi/30 radians).toPolygon in interface XyArea<XyRegularPolygon>public XyPolygon toPolygon(XyAngle granularity)
XyAreaThe angle parameter allows a certain level of control of the output. Essentially it dictates the minimum angular granularity used to approximate curved paths. For example, a circle would be turned into a polygon by placing points around the circle, separated by the given angle.
toPolygon in interface XyArea<XyRegularPolygon>public double getArea()
XyAreagetArea in interface XyArea<XyRegularPolygon>public double getPerimeter()
XyAreagetPerimeter in interface XyArea<XyRegularPolygon>public XyBounds getBounds()
XyShapegetBounds in interface XyShape<XyRegularPolygon>public java.util.Iterator<XyPoint> iterator()
iterator in interface java.lang.Iterable<XyPoint>public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object nother)
equals in class java.lang.Object