Package com.dkt.graphics.elements
Class GRegPoly
- java.lang.Object
-
- com.dkt.graphics.elements.GraphicE
-
- com.dkt.graphics.elements.GFillableE
-
- com.dkt.graphics.elements.GMultiPoint
-
- com.dkt.graphics.elements.GPoly
-
- com.dkt.graphics.elements.GRegPoly
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
area()
Calculates the area of this polygonGRegPoly
clone()
boolean
contains(int xx, int yy)
Tells if a point is contained in the polygonboolean
contains(GPoint p)
Tells if aGPoint
is contained in the polygonboolean
equals(java.lang.Object obj)
int
getRadius()
Returns the radius of the circle used to createint
getX()
Retrieves the X coordinate of the center of the polygonint
getY()
Retrieves the Y coordinate of the center of the polygonint
hashCode()
double
perimeter()
Calculated the perimeter of this polygonvoid
radRotate(double angle)
Rotates the currentGRegPoly
a given anglevoid
rotate(double angle)
Rotates the currentGRegPoly
a given anglevoid
traslate(int x, int y)
Traslates this element on X and Y-
Methods inherited from class com.dkt.graphics.elements.GFillableE
fill, getFillPaint, setFill, setFillPaint
-
Methods inherited from class com.dkt.graphics.elements.GMultiPoint
append, append, appendNR, clear, ensureCapacity, getPointAt, getPoints, getShape, indexOf, indexOf, indexOf, indexOf, isEmpty, iterator, remove, remove, remove, size, sortByX, trimToSize
-
-
-
-
Constructor Detail
-
GRegPoly
public GRegPoly(GRegPoly e)
Copy constructor- Parameters:
e
-GRegPoly
to copy- Throws:
java.lang.IllegalArgumentException
- ife
isnull
-
GRegPoly
public GRegPoly(int x, int y, int r, int n, double a)
Constructs a regular polygon contained in a circle- Parameters:
x
- X coordinate of the center of the circley
- Y coordinate of the center of the circler
- radius of the circlen
- number of sidesa
- angle of the first point
-
-
Method Detail
-
getX
public int getX()
Retrieves the X coordinate of the center of the polygon- Returns:
- x coordinate of the center
-
getY
public int getY()
Retrieves the Y coordinate of the center of the polygon- Returns:
- y coordinate of the center
-
getRadius
public int getRadius()
Returns the radius of the circle used to create- Returns:
- radius
-
area
public double area()
Calculates the area of this polygon- Returns:
- area of the polygon
-
perimeter
public double perimeter()
Calculated the perimeter of this polygon- Returns:
- perimeter
-
contains
public boolean contains(GPoint p) throws java.lang.IllegalArgumentException
Tells if aGPoint
is contained in the polygon- Parameters:
p
-GPoint
to evaluate- Returns:
true
if the point is contained andfalse
otherwise- Throws:
java.lang.IllegalArgumentException
- ifp
isnull
-
contains
public boolean contains(int xx, int yy)
Tells if a point is contained in the polygon- Parameters:
xx
- X coordinate of the pointyy
- Y coordinate of the point- Returns:
true
if the point is contained andfalse
otherwise
-
rotate
public void rotate(double angle)
Rotates the currentGRegPoly
a given angle- Parameters:
angle
- angle in degrees
-
radRotate
public void radRotate(double angle)
Rotates the currentGRegPoly
a given angle- Parameters:
angle
- angle in radians
-
traslate
public void traslate(int x, int y)
Description copied from class:GraphicE
Traslates this element on X and Y- Overrides:
traslate
in classGMultiPoint
- Parameters:
x
- size inpx
of the horizontal translationy
- size inpx
of the vertical translation
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGMultiPoint
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classGMultiPoint
-
-