Package org.eclipse.gef.geometry.planar

# Class Polygon

java.lang.Object
org.eclipse.gef.geometry.planar.Polygon

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `IGeometry`, `IRotatable<Polygon>`, `IScalable<Polygon>`, `IShape`, `ITranslatable<Polygon>`

public class Polygon extends Object implements IShape
Represents the geometric shape of a convex polygon. Note that while all manipulations (e.g. within shrink, expand) within this class are based on double precision, all comparisons (e.g. within contains, intersects, equals, etc.) are based on a limited precision (with an accuracy defined within `PrecisionUtils`) to compensate for rounding effects.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`Polygon(double... coordinates)`
Constructs a new `Polygon` from a even-numbered sequence of coordinates.
`Polygon(Point... points)`
Constructs a new `Polygon` from the given sequence of `Point` s.

## Method Summary

Modifier and Type
Method
Description
`Object`
`clone()`
Overridden with public visibility as recommended within `Cloneable` .
`boolean`
`contains(double x, double y)`
Checks whether the point that is represented by its x- and y-coordinates is contained within this `Polygon`.
`boolean`
`contains(IGeometry g)`
Tests whether the given `IGeometry` is fully contained by this `IShape`.
`boolean`
`contains(Line line)`
Checks whether the given `Line` is fully contained within this `Polygon`.
`boolean`
`contains(Point p)`
Returns whether the given `Point` is contained within this `IGeometry`.
`boolean`
`contains(Polygon p)`
Checks whether the given `Polygon` is fully contained within this `Polygon`.
`boolean`
`contains(Polyline p)`
Tests if the given `Polyline` p is contained in this `Polygon`.
`boolean`
`contains(Rectangle r)`
Checks whether the given `Rectangle` is fully contained within this `Polygon`.
`boolean`
`equals(Object o)`
`boolean`
`equals(Point[] points)`
Checks whether this `Polygon` and the one that is indirectly given via the given array of points are regarded to be equal.
`double`
`getArea()`
Computes the area of this `Polygon`.
`final Rectangle`
`getBounds()`
Returns the smallest `Rectangle` fully enclosing this `IGeometry`.
`Point`
`getCentroid()`
Computes the centroid of this `AbstractPointListBasedGeometry`.
`final double[]`
`getCoordinates()`
Returns a double array which represents the sequence of coordinates of the `Point`s that make up this `AbstractPointListBasedGeometry`.
`Polygon`
`getCopy()`
Returns a copy of this `Polygon`, which is made up by the same points.
`Polyline`
`getOutline()`
Returns an `ICurve` representing the outline of this `IShape` .
`Line[]`
`getOutlineSegments()`
Returns a sequence of `Line`s, representing the segments that are obtained by linking each two successive point of this `Polygon` (including the last and the first one).
`final Point[]`
`getPoints()`
Returns a copy of the `Point`s that make up this `AbstractPointListBasedGeometry`.
`Polygon`
`getRotatedCCW(Angle alpha)`
Rotates the calling object by specified `Angle` counter-clock-wise (CCW) around its center `Point`.
`Polygon`
`getRotatedCCW(Angle angle, double cx, double cy)`
Rotates the calling object by the specified `Angle` counter-clock-wise (CCW) around the specified center `Point` (cx, cy).
`Polygon`
`getRotatedCCW(Angle alpha, Point center)`
Rotates the calling object by the specified `Angle` counter-clock-wise (CCW) around the specified center `Point`.
`Polygon`
`getRotatedCW(Angle alpha)`
Rotates the calling object by specified `Angle` clock-wise (CW) around its center `Point`.
`Polygon`
`getRotatedCW(Angle angle, double cx, double cy)`
Rotates the calling object by the specified `Angle` clock-wise (CW) around the specified center `Point` (cx, cy).
`Polygon`
`getRotatedCW(Angle alpha, Point center)`
Rotates the calling object by the specified `Angle` clock-wise (CW) around the specified center `Point`.
`Polygon`
`getScaled(double factor)`
Scales a copy of the calling object by the given factor relative to its center `Point`.
`Polygon`
`getScaled(double factorX, double factorY)`
Scales a copy of the calling object by the given factors relative to its center `Point`.
`Polygon`
`getScaled(double factor, double cx, double cy)`
Scales a copy of the calling object by the given factor relative to the given center `Point` (cx, cy).
`Polygon`
`getScaled(double fx, double fy, double cx, double cy)`
Scales a copy of the calling object by the given factors relative to the given center `Point` (cx, cy).
`Polygon`
`getScaled(double factorX, double factorY, Point center)`
Scales a copy of the calling object by the given factors relative to the given center `Point`.
`Polygon`
`getScaled(double factor, Point center)`
Scales a copy of the calling object by the given factor relative to the given center `Point`.
`double`
`getSignedArea()`
Computes the signed area of this `Polygon`.
`Polygon`
`getTransformed(AffineTransform t)`
Default implementation returning a transformed `Path` representation of this `IGeometry`.
`Polygon`
`getTranslated(double dx, double dy)`
Translates a copy of this object by the given values in x and y direction.
`Polygon`
`getTranslated(Point pt)`
Translates a copy of this object by the given `Point`.
`Polygon[]`
`getTriangulation()`
Naive, recursive ear-clipping algorithm to triangulate this simple, planar `Polygon`.
`final int`
`hashCode()`
`Polygon`
`rotateCCW(Angle alpha)`
Rotates this `AbstractPointListBasedGeometry` counter-clockwise (CCW) by the given `Angle` around its centroid (see `getCentroid()`).
`Polygon`
`rotateCCW(Angle alpha, double cx, double cy)`
Rotates this `AbstractPointListBasedGeometry` counter-clockwise (CCW) by the given `Angle` around the `Point` specified by the passed-in x and y coordinates.
`Polygon`
`rotateCCW(Angle alpha, Point center)`
Rotates this `AbstractPointListBasedGeometry` counter-clockwise (CCW) by the given `Angle` around the given `Point`.
`Polygon`
`rotateCW(Angle alpha)`
Rotates this `AbstractPointListBasedGeometry` clockwise (CW) by the given `Angle` around its centroid (see `getCentroid()`).
`Polygon`
`rotateCW(Angle alpha, double cx, double cy)`
Rotates this `AbstractPointListBasedGeometry` clockwise (CW) by the given `Angle` around the `Point` specified by the passed-in x and y coordinates.
`Polygon`
`rotateCW(Angle alpha, Point center)`
Rotates this `AbstractPointListBasedGeometry` clockwise (CW) by the given `Angle` around the given `Point`.
`Polygon`
`scale(double factor)`
Scales the calling object by the given factor relative to its center `Point`.
`Polygon`
`scale(double fx, double fy)`
Scales the calling object by the given factors relative to the given center `Point`.
`Polygon`
`scale(double factor, double cx, double cy)`
Scales the calling object by the given factor relative to the given center `Point` (cx, cy).
`Polygon`
`scale(double fx, double fy, double cx, double cy)`
Scales the calling object by the given factors relative to the given center `Point` (cx, cy).
`Polygon`
`scale(double fx, double fy, Point center)`
Scales the calling object by the given factors relative to the given center `Point`.
`Polygon`
`scale(double factor, Point center)`
Scales the calling object by the given factor relative to the given center `Point`.
`Path`
`toPath()`
Converts this `IGeometry` into a `Path` representation.
`String`
`toString()`
`boolean`
`touches(IGeometry g)`
Returns `true` if the input `IGeometry` touches this `IGeometry`, i.e. there is at least one common point.
`Polygon`
`translate(double dx, double dy)`
Translates the object by the given values in x and y direction.
`Polygon`
`translate(Point p)`
Translates the object by the given `Point`.

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.gef.geometry.planar.IGeometry

`getBounds, touches`

## Constructor Details

### Polygon

public Polygon(double... coordinates)
Constructs a new `Polygon` from a even-numbered sequence of coordinates.

Parameters:
  `coordinates` - an alternating, even-numbered sequence of x and y coordinates, representing the `Point`s from which the `Polygon` is to be created
See Also:
  - `Polygon(Point...)`

### Polygon

public Polygon(Point... points)
Constructs a new `Polygon` from the given sequence of `Point` s. The `Polygon` that is created will be automatically closed, i.e. it will not only contain a segment between succeeding points of the sequence but as well back from the last to the first point.

Parameters:
  `points` - a sequence of points, from which the `Polygon` is to be created.

## Method Details

### contains

public boolean contains(double x, double y)
Checks whether the point that is represented by its x- and y-coordinates is contained within this `Polygon`.

Parameters:
  `x` - the x-coordinate of the point to test
  `y` - the y-coordinate of the point to test
Returns:
  `true` if the point represented by its coordinates if contained within this `Polygon`, `false` otherwise

### contains

public boolean contains(IGeometry g)
Description copied from interface: `IShape`
Tests whether the given `IGeometry` is fully contained by this `IShape`.

Specified by:
  `contains` in interface `IShape`
Parameters:
  `g` - The `IGeometry` to test for containment
Returns:
  `true` if the given `IGeometry` is fully contained by this `IShape`, `false` otherwise.

### contains

public boolean contains(Line line)
Checks whether the given `Line` is fully contained within this `Polygon`.

Parameters:
  `line` - The `Line` to test for containment
Returns:
  `true` if the given `Line` is fully contained, `false` otherwise

### contains

public boolean contains(Point p)
Description copied from interface: `IGeometry`
Returns whether the given `Point` is contained within this `IGeometry`. This includes the case that the `Point` lies on the border of this `IGeometry`.

Specified by:
  `contains` in interface `IGeometry`
Parameters:
  `p` - The `Point` being tested for containment
Returns:
  `true` if the `Point` is contained within this `IGeometry`, `false` otherwise.
See Also:
  - `IGeometry.contains(Point)`

### contains

public boolean contains(Polygon p)
Checks whether the given `Polygon` is fully contained within this `Polygon`.

Parameters:
  `p` - The `Polygon` to test for containment
Returns:
  `true` if the given `Polygon` is fully contained, `false` otherwise.

### contains

public boolean contains(Polyline p)
Tests if the given `Polyline` p is contained in this `Polygon`.

Parameters:
  `p` - The `Polyline` to test for containment.
Returns:
  true if it is contained, false otherwise

### contains

public boolean contains(Rectangle r)
Checks whether the given `Rectangle` is fully contained within this `Polygon`.

Parameters:
  `r` - the `Rectangle` to test for containment
Returns:
  `true` if the given `Rectangle` is fully contained, `false` otherwise.

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### equals

public boolean equals(Point[] points)
Checks whether this `Polygon` and the one that is indirectly given via the given array of points are regarded to be equal. The `Polygon`s will be regarded equal, if they are characterized by the same segments. As a `Polygon` is always regarded to be closed, the list of points may not have to correspond in each index value, they may also be shifted by a certain offset. Moreover, the vertices of two equally `Polygon`s may be reverted in order.

Parameters:
  `points` - an array of `Point` characterizing a `Polygon` to be checked for equality
Returns:
  `true` if the sequence of points that characterize this `Polygon` and the `Polygon` indirectly given via the array of points are regarded to form the same segments.

### getArea

public double getArea()
Computes the area of this `Polygon`.

Returns:
  the area of this `Polygon`

### getCopy

public Polygon getCopy()
Returns a copy of this `Polygon`, which is made up by the same points.

Specified by:
  `getCopy` in interface `IGeometry`
Returns:
  a new `Polygon` with an identical set of points.

### getOutline

public Polyline getOutline()
Description copied from interface: `IShape`
Returns an `ICurve` representing the outline of this `IShape` .

Specified by:
  `getOutline` in interface `IShape`
Returns:
  An `ICurve` representing this `IShape`'s outline.

### getOutlineSegments

public Line[] getOutlineSegments()
Returns a sequence of `Line`s, representing the segments that are obtained by linking each two successive point of this `Polygon` (including the last and the first one).

Specified by:
  `getOutlineSegments` in interface `IShape`
Returns:
  an array of `Line`s, representing the segments that make up this `Polygon`

### getSignedArea

public double getSignedArea()
Computes the signed area of this `Polygon`. The sign of the area is negative for counter clockwise ordered vertices. It is positive for clockwise ordered vertices.

Returns:
  the signed area of this `Polygon`

### getTransformed

public Polygon getTransformed(AffineTransform t)
Default implementation returning a transformed `Path` representation of this `IGeometry`. Subclasses may override this method to return a more specific representation.

Specified by:
  `getTransformed` in interface `IGeometry`
Specified by:
  `getTransformed` in interface `IShape`
Parameters:
  `t` - The `AffineTransform` to be applied
Returns:
  a transformed `Path` representation of this `IGeometry`
See Also:
  - `IGeometry.getTransformed(AffineTransform)`

### getTriangulation

public Polygon[] getTriangulation()
Naive, recursive ear-clipping algorithm to triangulate this simple, planar `Polygon`.

Returns:
  triangulation `Polygon`s (triangles)

### toPath

public Path toPath()
Description copied from interface: `IGeometry`
Converts this `IGeometry` into a `Path` representation.

Specified by:
  `toPath` in interface `IGeometry`
Returns:
  A new `Path` representation for this `IGeometry`.
See Also:
  - `IGeometry.toPath()`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### getBounds

public final Rectangle getBounds()
Description copied from interface: `IGeometry`
Returns the smallest `Rectangle` fully enclosing this `IGeometry`.

Specified by:
  `getBounds` in interface `IGeometry`
Returns:
  A new `Rectangle` object that fully encloses this `IGeometry`

### getCentroid

public Point getCentroid()
Computes the centroid of this `AbstractPointListBasedGeometry`. The centroid is the "center of gravity", i.e. assuming a `Polygon` is spanned by the `Point`s of this `AbstractPointListBasedGeometry` and it is made of a material of constant density, then it is in a balanced state, if you put it on a pin that is placed exactly on its centroid.

Returns:
  the center `Point` (or centroid) of this `AbstractPointListBasedGeometry`

### getCoordinates

public final double[] getCoordinates()
Returns a double array which represents the sequence of coordinates of the `Point`s that make up this `AbstractPointListBasedGeometry`.

Returns:
  an array that alternately contains the x and y coordinates of this `AbstractPointListBasedGeometry`'s points

### getPoints

public final Point[] getPoints()
Returns a copy of the `Point`s that make up this `AbstractPointListBasedGeometry`.

Returns:
  an array of `Point`s representing the `Point`s that make up this `AbstractPointListBasedGeometry`

### getRotatedCCW

public Polygon getRotatedCCW(Angle alpha)
Description copied from interface: `IRotatable`
Rotates the calling object by specified `Angle` counter-clock-wise (CCW) around its center `Point`. Does not necessarily return an object of the same type.

Specified by:
  `getRotatedCCW` in interface `IRotatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `alpha` - rotation `Angle`
Returns:
  an `IGeometry` representing the result of the rotation

### getRotatedCCW

public Polygon getRotatedCCW(Angle angle, double cx, double cy)
Description copied from interface: `IRotatable`
Rotates the calling object by the specified `Angle` counter-clock-wise (CCW) around the specified center `Point` (cx, cy). Does not necessarily return an object of the same type.

Specified by:
  `getRotatedCCW` in interface `IRotatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `angle` - rotation `Angle`
  `cx` - x-coordinate of the relative `Point` for the rotation
  `cy` - y-coordinate of the relative `Point` for the rotation
Returns:
  an `IGeometry` representing the result of the rotation

### getRotatedCCW

public Polygon getRotatedCCW(Angle alpha, Point center)
Description copied from interface: `IRotatable`
Rotates the calling object by the specified `Angle` counter-clock-wise (CCW) around the specified center `Point`. Does not necessarily return an object of the same type.

Specified by:
  `getRotatedCCW` in interface `IRotatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `alpha` - rotation `Angle`
  `center` - relative `Point` for the rotation
Returns:
  an `IGeometry` representing the result of the rotation

### getRotatedCW

public Polygon getRotatedCW(Angle alpha)
Description copied from interface: `IRotatable`
Rotates the calling object by specified `Angle` clock-wise (CW) around its center `Point`. Does not necessarily return an object of the same type.

Specified by:
  `getRotatedCW` in interface `IRotatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `alpha` - rotation `Angle`
Returns:
  an `IGeometry` representing the result of the rotation

### getRotatedCW

public Polygon getRotatedCW(Angle angle, double cx, double cy)
Description copied from interface: `IRotatable`
Rotates the calling object by the specified `Angle` clock-wise (CW) around the specified center `Point` (cx, cy). Does not necessarily return an object of the same type.

Specified by:
  `getRotatedCW` in interface `IRotatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `angle` - rotation `Angle`
  `cx` - x-coordinate of the relative `Point` for the rotation
  `cy` - y-coordinate of the relative `Point` for the rotation
Returns:
  an `IGeometry` representing the result of the rotation

### getRotatedCW

public Polygon getRotatedCW(Angle alpha, Point center)
Description copied from interface: `IRotatable`
Rotates the calling object by the specified `Angle` clock-wise (CW) around the specified center `Point`. Does not necessarily return an object of the same type.

Specified by:
  `getRotatedCW` in interface `IRotatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `alpha` - rotation `Angle`
  `center` - relative `Point` for the rotation
Returns:
  an `IGeometry` representing the result of the rotation

### getScaled

public Polygon getScaled(double factor)
Description copied from interface: `IScalable`
Scales a copy of the calling object by the given factor relative to its center `Point`.

Specified by:
  `getScaled` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factor` - scale-factor
Returns:
  the new, scaled object

### getScaled

public Polygon getScaled(double factorX, double factorY)
Description copied from interface: `IScalable`
Scales a copy of the calling object by the given factors relative to its center `Point`.

Specified by:
  `getScaled` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factorX` - x-scale-factor
  `factorY` - y-scale-factor
Returns:
  the new, scaled object

### getScaled

public Polygon getScaled(double factor, double cx, double cy)
Description copied from interface: `IScalable`
Scales a copy of the calling object by the given factor relative to the given center `Point` (cx, cy).

Specified by:
  `getScaled` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factor` - scale-factor
  `cx` - x-coordinate of the relative `Point` for the scaling
  `cy` - y-coordinate of the relative `Point` for the scaling
Returns:
  the new, scaled object

### getScaled

public Polygon getScaled(double fx, double fy, double cx, double cy)
Description copied from interface: `IScalable`
Scales a copy of the calling object by the given factors relative to the given center `Point` (cx, cy).

Specified by:
  `getScaled` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `fx` - x-scale-factor
  `fy` - y-scale-factor
  `cx` - x-coordinate of the relative `Point` for the scaling
  `cy` - y-coordinate of the relative `Point` for the scaling
Returns:
  the new, scaled object

### getScaled

public Polygon getScaled(double factorX, double factorY, Point center)
Description copied from interface: `IScalable`
Scales a copy of the calling object by the given factors relative to the given center `Point`.

Specified by:
  `getScaled` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factorX` - x-scale-factor
  `factorY` - y-scale-factor
  `center` - relative `Point` for the scaling
Returns:
  the new, scaled object

### getScaled

public Polygon getScaled(double factor, Point center)
Description copied from interface: `IScalable`
Scales a copy of the calling object by the given factor relative to the given center `Point`.

Specified by:
  `getScaled` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factor` - scale-factor
  `center` - relative `Point` for the scaling
Returns:
  the new, scaled object

### getTranslated

public Polygon getTranslated(double dx, double dy)
Description copied from interface: `ITranslatable`
Translates a copy of this object by the given values in x and y direction.

Specified by:
  `getTranslated` in interface `ITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `dx` - x-translation
  `dy` - y-translation
Returns:
  a new, translated object

### getTranslated

public Polygon getTranslated(Point pt)
Description copied from interface: `ITranslatable`
Translates a copy of this object by the given `Point`.

Specified by:
  `getTranslated` in interface `ITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `pt` - translation `Point`
Returns:
  a new, translated object

### rotateCCW

public Polygon rotateCCW(Angle alpha)
Rotates this `AbstractPointListBasedGeometry` counter-clockwise (CCW) by the given `Angle` around its centroid (see `getCentroid()`).

Parameters:
  `alpha` - the rotation `Angle`
Returns:
  `this` for convenience
See Also:
  - `rotateCCW(Angle, Point)`

### rotateCCW

public Polygon rotateCCW(Angle alpha, double cx, double cy)
Rotates this `AbstractPointListBasedGeometry` counter-clockwise (CCW) by the given `Angle` around the `Point` specified by the passed-in x and y coordinates.

Parameters:
  `alpha` - the rotation `Angle`
  `cx` - the x coordinate of the `Point` to rotate around
  `cy` - the y coordinate of the `Point` to rotate around
Returns:
  `this` for convenience
See Also:
  - `rotateCCW(Angle, Point)`

### rotateCCW

public Polygon rotateCCW(Angle alpha, Point center)
Rotates this `AbstractPointListBasedGeometry` counter-clockwise (CCW) by the given `Angle` around the given `Point`. The rotation is done by

1. translating this `AbstractPointListBasedGeometry` by the negated `Point` center
2. rotating each `Point` of this `AbstractPointListBasedGeometry` counter-clockwise by the given `Angle`
3. translating this `AbstractPointListBasedGeometry` back by the `Point` center

Parameters:
  `alpha` - the rotation `Angle`
  `center` - the `Point` to rotate around
Returns:
  `this` for convenience

### rotateCW

public Polygon rotateCW(Angle alpha)
Rotates this `AbstractPointListBasedGeometry` clockwise (CW) by the given `Angle` around its centroid (see `getCentroid()`).

Parameters:
  `alpha` - the rotation `Angle`
Returns:
  `this` for convenience
See Also:
  - `rotateCW(Angle, Point)`

### rotateCW

public Polygon rotateCW(Angle alpha, double cx, double cy)
Rotates this `AbstractPointListBasedGeometry` clockwise (CW) by the given `Angle` around the `Point` specified by the passed-in x and y coordinates.

Parameters:
  `alpha` - the rotation `Angle`
  `cx` - the x coordinate of the `Point` to rotate around
  `cy` - the y coordinate of the `Point` to rotate around
Returns:
  `this` for convenience
See Also:
  - `rotateCW(Angle, Point)`

### rotateCW

public Polygon rotateCW(Angle alpha, Point center)
Rotates this `AbstractPointListBasedGeometry` clockwise (CW) by the given `Angle` around the given `Point`. The rotation is done by

1. translating this `AbstractPointListBasedGeometry` by the negated `Point` center
2. rotating each `Point` of this `AbstractPointListBasedGeometry` clockwise by the given `Angle`
3. translating this `AbstractPointListBasedGeometry` back by the `Point` center

Parameters:
  `alpha` - the rotation `Angle`
  `center` - the `Point` to rotate around
Returns:
  `this` for convenience

### scale

public Polygon scale(double factor)
Description copied from interface: `IScalable`
Scales the calling object by the given factor relative to its center `Point`.

Specified by:
  `scale` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factor` - scale-factor
Returns:
  `this` for convenience

### scale

public Polygon scale(double fx, double fy)
Description copied from interface: `IScalable`
Scales the calling object by the given factors relative to the given center `Point`.

Specified by:
  `scale` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `fx` - x-scale-factor
  `fy` - y-scale-factor
Returns:
  `this` for convenience

### scale

public Polygon scale(double factor, double cx, double cy)
Description copied from interface: `IScalable`
Scales the calling object by the given factor relative to the given center `Point` (cx, cy).

Specified by:
  `scale` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factor` - scale-factor
  `cx` - x-coordinate of the relative `Point` for the scaling
  `cy` - y-coordinate of the relative `Point` for the scaling
Returns:
  `this` for convenience

### scale

public Polygon scale(double fx, double fy, double cx, double cy)
Description copied from interface: `IScalable`
Scales the calling object by the given factors relative to the given center `Point` (cx, cy).

Specified by:
  `scale` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `fx` - x-scale-factor
  `fy` - y-scale-factor
  `cx` - x-coordinate of the relative `Point` for the scaling
  `cy` - y-coordinate of the relative `Point` for the scaling
Returns:
  `this` for convenience

### scale

public Polygon scale(double fx, double fy, Point center)
Description copied from interface: `IScalable`
Scales the calling object by the given factors relative to the given center `Point`.

Specified by:
  `scale` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `fx` - x-scale-factor
  `fy` - y-scale-factor
  `center` - relative `Point` for the scaling
Returns:
  `this` for convenience

### scale

public Polygon scale(double factor, Point center)
Description copied from interface: `IScalable`
Scales the calling object by the given factor relative to the given center `Point`.

Specified by:
  `scale` in interface `IScalable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `factor` - scale-factor
  `center` - relative `Point` for the scaling
Returns:
  `this` for convenience

### translate

public Polygon translate(double dx, double dy)
Description copied from interface: `ITranslatable`
Translates the object by the given values in x and y direction.

Specified by:
  `translate` in interface `ITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `dx` - x-translation
  `dy` - y-translation
Returns:
  `this` for convenience

### translate

public Polygon translate(Point p)
Description copied from interface: `ITranslatable`
Translates the object by the given `Point`.

Specified by:
  `translate` in interface `ITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractPointListBasedGeometry<?>>`
Parameters:
  `p` - translation `Point`
Returns:
  `this` for convenience

### clone

public Object clone()
Overridden with public visibility as recommended within `Cloneable` .

Overrides:
  `clone` in class `Object`

### hashCode

public final int hashCode()

Overrides:
  `hashCode` in class `Object`
See Also:
  - `Object.hashCode()`

### touches

public boolean touches(IGeometry g)
Description copied from interface: `IGeometry`
Returns `true` if the input `IGeometry` touches this `IGeometry`, i.e. there is at least one common point.

Specified by:
  `touches` in interface `IGeometry`
Parameters:
  `g` - The `IGeometry` for the intersection test
Returns:
  `true` if the input `IGeometry` and this `IGeometry` have at least one common point.