Package org.eclipse.gef.geometry.planar

## Class Ellipse

- java.lang.Object
- - org.eclipse.gef.geometry.planar.Ellipse

All Implemented Interfaces:
  `java.io.Serializable`, `java.lang.Cloneable`, `IGeometry`, `IRotatable<PolyBezier>`, `IScalable<Ellipse>`, `IShape`, `ITranslatable<Ellipse>`

    public class Ellipse
    extends java.lang.Object
    implements IShape

Represents the geometric shape of an ellipse. 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
`Ellipse​(double x, double y, double width, double height)` Constructs a new `Ellipse` so that it is fully contained within the framing rectangle defined by (x, y, width, height).
`Ellipse​(Rectangle r)` Constructs a new `Ellipse` so that it is fully contained within the given framing `Rectangle`.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.Object` `clone()` Overridden with public visibility as recommended within `Cloneable` .
`boolean` `contains​(IGeometry g)` Tests whether the given `IGeometry` is fully contained by this `IShape`.
`boolean` `contains​(Line l)` Tests whether the given `Line` is fully contained within this `Ellipse`.
`boolean` `contains​(Point p)` Returns whether the given `Point` is contained within this `IGeometry`.
`boolean` `equals​(double x, double y, double width, double height)` Tests whether this `Ellipse` and the ellipse defined by the given bounds are equal.
`boolean` `equals​(java.lang.Object o)` Tests whether this `Ellipse` is equal to the given `Object`.
`T` `expand​(double h, double v)` Expands the horizontal and vertical sides of this `AbstractRectangleBasedGeometry` with the values provided as input, and returns `this` for convenience.
`T` `expand​(double left, double top, double right, double bottom)` Expands this `AbstractRectangleBasedGeometry` by the given amounts, and returns this for convenience.
`Rectangle` `getBounds()` Returns the smallest `Rectangle` fully enclosing this `IGeometry`.
`Point` `getCenter()` Returns the center `Point` of this `AbstractRectangleBasedGeometry`.
`Ellipse` `getCopy()` Returns a new `Ellipse` with the same location and size than this one.
`T` `getExpanded​(double h, double v)` Returns a new expanded `AbstractRectangleBasedGeometry`, where the sides are incremented by the horizontal and vertical values provided.
`T` `getExpanded​(double left, double top, double right, double bottom)` Creates and returns a new `AbstractRectangleBasedGeometry` with the bounds of this `AbstractRectangleBasedGeometry` expanded by the given insets.
`double` `getHeight()` Returns the height of this `AbstractRectangleBasedGeometry`.
`Point[]` `getIntersections​(Ellipse e2)` Calculates the intersections of this `Ellipse` with the given other `Ellipse`.
`Point[]` `getIntersections​(ICurve c)` Calculates the intersections of this `Ellipse` with the given `ICurve`.
`Point[]` `getIntersections​(Line line)` Returns the intersection points of this `Ellipse`'s outline with the given `Line`.
`Point` `getLocation()` Returns a `Point` specifying the x and y coordinates of this `AbstractRectangleBasedGeometry`.
`ICurve` `getOutline()` Returns an `ICurve` representing the outline of this `IShape` .
`CubicCurve[]` `getOutlineSegments()` Calculates the outline segments of this `Ellipse`.
`PolyBezier` `getRotatedCCW​(Angle angle)` Rotates the calling object by specified `Angle` counter-clock-wise (CCW) around its center `Point`.
`PolyBezier` `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).
`PolyBezier` `getRotatedCCW​(Angle angle, Point center)` Rotates the calling object by the specified `Angle` counter-clock-wise (CCW) around the specified center `Point`.
`PolyBezier` `getRotatedCW​(Angle angle)` Rotates the calling object by specified `Angle` clock-wise (CW) around its center `Point`.
`PolyBezier` `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).
`PolyBezier` `getRotatedCW​(Angle angle, Point center)` Rotates the calling object by the specified `Angle` clock-wise (CW) around the specified center `Point`.
`T` `getScaled​(double factor)` Scales a copy of the calling object by the given factor relative to its center `Point`.
`T` `getScaled​(double factorX, double factorY)` Scales a copy of the calling object by the given factors relative to its center `Point`.
`T` `getScaled​(double factor, double centerX, double centerY)` Scales a copy of the calling object by the given factor relative to the given center `Point` (cx, cy).
`T` `getScaled​(double factorX, double factorY, double centerX, double centerY)` Scales a copy of the calling object by the given factors relative to the given center `Point` (cx, cy).
`T` `getScaled​(double factorX, double factorY, Point center)` Scales a copy of the calling object by the given factors relative to the given center `Point`.
`T` `getScaled​(double factor, Point center)` Scales a copy of the calling object by the given factor relative to the given center `Point`.
`T` `getShrinked​(double h, double v)` Returns a new `AbstractRectangleBasedGeometry`, where the sides are shrinked by the horizontal and vertical values supplied.
`T` `getShrinked​(double left, double top, double right, double bottom)` Returns a new `AbstractRectangleBasedGeometry` shrinked by the specified insets.
`Dimension` `getSize()` Returns a `Dimension` that records the width and height of this `AbstractRectangleBasedGeometry`.
`CurvedPolygon` `getTransformed​(AffineTransform t)` Default implementation returning a transformed `Path` representation of this `IGeometry`.
`T` `getTranslated​(double dx, double dy)` Translates a copy of this object by the given values in x and y direction.
`T` `getTranslated​(Point pt)` Translates a copy of this object by the given `Point`.
`double` `getWidth()` Returns the width of this `AbstractRectangleBasedGeometry`.
`double` `getX()` Returns the x coordinate this `AbstractRectangleBasedGeometry`.
`double` `getY()` Returns the y coordinate of this `AbstractRectangleBasedGeometry`.
`int` `hashCode()`
`T` `scale​(double factor)` Scales the calling object by the given factor relative to its center `Point`.
`T` `scale​(double fx, double fy)` Scales the calling object by the given factors relative to the given center `Point`.
`T` `scale​(double factor, double cx, double cy)` Scales the calling object by the given factor relative to the given center `Point` (cx, cy).
`T` `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).
`T` `scale​(double fx, double fy, Point center)` Scales the calling object by the given factors relative to the given center `Point`.
`T` `scale​(double factor, Point center)` Scales the calling object by the given factor relative to the given center `Point`.
`T` `setBounds​(double x, double y, double w, double h)` Sets the x, y, width, and height values of this `AbstractRectangleBasedGeometry` to the given values.
`T` `setBounds​(Point loc, Dimension size)` Sets the x, y, width, and height values of this `AbstractRectangleBasedGeometry` to the respective values specified by the passed-in `Point` and the passed-in `Dimension`.
`T` `setBounds​(Rectangle r)` Sets the x and y coordinates and the width and height of this `AbstractRectangleBasedGeometry` to the respective values of the given `Rectangle`.
`T` `setHeight​(double height)` Sets the height of this `AbstractRectangleBasedGeometry` to the given value.
`T` `setLocation​(double x, double y)` Sets the x and y coordinates of this `AbstractRectangleBasedGeometry` to the specified values.
`T` `setLocation​(Point p)` Sets the x and y coordinates of this `AbstractRectangleBasedGeometry` to the respective values of the given `Point`.
`T` `setSize​(double w, double h)` Sets the width and height of this `AbstractRectangleBasedGeometry` to the given values.
`T` `setSize​(Dimension d)` Sets the width and height of this `AbstractRectangleBasedGeometry` to the width and height of the given `Dimension`.
`T` `setWidth​(double width)` Sets the width of this `AbstractRectangleBasedGeometry` to the passed-in value.
`T` `setX​(double x)` Sets the x-coordinate of this `AbstractRectangleBasedGeometry` to the given value.
`T` `setY​(double y)` Sets the y-coordinate of this `AbstractRectangleBasedGeometry` to the given value.
`T` `shrink​(double h, double v)` Shrinks the sides of this `AbstractRectangleBasedGeometry` by the horizontal and vertical values provided as input, and returns this `AbstractRectangleBasedGeometry` for convenience.
`T` `shrink​(double left, double top, double right, double bottom)` Shrinks this `AbstractRectangleBasedGeometry` by the specified amounts.
`Path` `toPath()` Returns a `Path` representation of this `Ellipse`, which is an approximation of the four `outline segments` by means of `CubicCurve`s.
`java.lang.String` `toString()`
`boolean` `touches​(IGeometry g)` Returns `true` if the input `IGeometry` touches this `IGeometry`, i.e. there is at least one common point.
`T` `translate​(double dx, double dy)` Translates the object by the given values in x and y direction.
`T` `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 Detail

#### Ellipse

    public Ellipse​(double x,
                   double y,
                   double width,
                   double height)

Constructs a new `Ellipse` so that it is fully contained within the framing rectangle defined by (x, y, width, height).

Parameters:
  `x` - The x-coordinate of the framing rectangle
  `y` - The y-coordinate of the framing rectangle
  `width` - The width of the framing rectangle
  `height` - The height of the framing rectangle

#### Ellipse

    public Ellipse​(Rectangle r)

Constructs a new `Ellipse` so that it is fully contained within the given framing `Rectangle`.

Parameters:
  `r` - The framing `Rectangle` used to construct this `Ellipse`.

### Method Detail

#### 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.
See Also:
  `IShape.contains(IGeometry)`

#### contains

    public boolean contains​(Line l)

Tests whether the given `Line` is fully contained within this `Ellipse`.

Parameters:
  `l` - the `Line` to test for containment
Returns:
  `true` in case 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)`

#### equals

    public boolean equals​(double x,
                          double y,
                          double width,
                          double height)

Tests whether this `Ellipse` and the ellipse defined by the given bounds are equal.

Parameters:
  `x` - the x-coordinate of the bounds defining define the ellipse to test
  `y` - the y-coordinate of the bounds defining the ellipse to test
  `width` - the width of the bounds defining the ellipse to test
  `height` - the height of the bounds defining the ellipse to test
Returns:
  `true` if this `Ellipse` and the ellipse defined via the given bounds are (imprecisely) regarded to be equal, `false` otherwise

#### equals

    public boolean equals​(java.lang.Object o)

Tests whether this `Ellipse` is equal to the given `Object`.

Overrides:
  `equals` in class `java.lang.Object`
Returns:
  `true` if the given `Object` is an `Ellipse`, which is (imprecisely) equal to this `Ellipse`, i.e. whose bounds are (imprecisely) equal to this `Ellipse`'s bounds

#### getCopy

    public Ellipse getCopy()

Returns a new `Ellipse` with the same location and size than this one.

Specified by:
  `getCopy` in interface `IGeometry`
Returns:
  A copy of this `Ellipse`, having the same x, y, width, and height values

#### getIntersections

    public Point[] getIntersections​(Ellipse e2)

Calculates the intersections of this `Ellipse` with the given other `Ellipse`.

Parameters:
  `e2` - The `Ellipse` for which intersections are computed.
Returns:
  `Point`s of intersection

#### getIntersections

    public Point[] getIntersections​(ICurve c)

Calculates the intersections of this `Ellipse` with the given `ICurve`.

Parameters:
  `c` - The `ICurve` for which intersections are computed.
Returns:
  `Point`s of intersection

#### getIntersections

    public Point[] getIntersections​(Line line)

Returns the intersection points of this `Ellipse`'s outline with the given `Line`.

Parameters:
  `line` - the `Line` to test for intersection
Returns:
  an array containing the intersection points of this `Ellipse`'s outline with the given `Line` in case such intersection points exist, an empty array otherwise

#### getOutline

    public ICurve 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 CubicCurve[] getOutlineSegments()

Calculates the outline segments of this `Ellipse`. The outline segments are approximated by `CubicCurve`s. The outline segments are returned in the following order:

1. from `0deg` to `90deg` (quadrant I)
2. from `90deg` to `180deg` (quadrant II)
3. from `180deg` to `270deg` (quadrant III)
4. from `270deg` to `360deg` (quadrant IV)

An `Angle` of `0deg` is oriented to the right. Increasing an `Angle` rotates counter-clockwise (CCW).

Specified by:
  `getOutlineSegments` in interface `IShape`
Returns:
  an array of `CubicCurve`s representing the outline of this `Ellipse`

#### getRotatedCCW

    public PolyBezier getRotatedCCW​(Angle angle)

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<PolyBezier>`
Parameters:
  `angle` - rotation `Angle`
Returns:
  an `IGeometry` representing the result of the rotation

#### getRotatedCCW

    public PolyBezier 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<PolyBezier>`
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 PolyBezier getRotatedCCW​(Angle angle,
                                    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<PolyBezier>`
Parameters:
  `angle` - rotation `Angle`
  `center` - relative `Point` for the rotation
Returns:
  an `IGeometry` representing the result of the rotation

#### getRotatedCW

    public PolyBezier getRotatedCW​(Angle angle)

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<PolyBezier>`
Parameters:
  `angle` - rotation `Angle`
Returns:
  an `IGeometry` representing the result of the rotation

#### getRotatedCW

    public PolyBezier 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<PolyBezier>`
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 PolyBezier getRotatedCW​(Angle angle,
                                   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<PolyBezier>`
Parameters:
  `angle` - rotation `Angle`
  `center` - relative `Point` for the rotation
Returns:
  an `IGeometry` representing the result of the rotation

#### getTransformed

    public CurvedPolygon 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)`

#### toPath

    public Path toPath()

Returns a `Path` representation of this `Ellipse`, which is an approximation of the four `outline segments` by means of `CubicCurve`s.

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

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### expand

    public T expand​(double h,
                    double v)

Expands the horizontal and vertical sides of this `AbstractRectangleBasedGeometry` with the values provided as input, and returns `this` for convenience. The location of its center is kept constant.

Parameters:
  `h` - the horizontal increment
  `v` - the vertical increment
Returns:
  `this` for convenience

#### expand

    public T expand​(double left,
                    double top,
                    double right,
                    double bottom)

Expands this `AbstractRectangleBasedGeometry` by the given amounts, and returns this for convenience.

Parameters:
  `left` - the amount to expand the left side
  `top` - the amount to expand the top side
  `right` - the amount to expand the right side
  `bottom` - the amount to expand the bottom side
Returns:
  `this` for convenience

#### getBounds

    public 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`

#### getCenter

    public Point getCenter()

Returns the center `Point` of this `AbstractRectangleBasedGeometry`.

Returns:
  the center `Point` of this `AbstractRectangleBasedGeometry`

#### getExpanded

    public T getExpanded​(double h,
                         double v)

Returns a new expanded `AbstractRectangleBasedGeometry`, where the sides are incremented by the horizontal and vertical values provided. The center of the `AbstractRectangleBasedGeometry` is maintained constant.

Parameters:
  `h` - The horizontal increment
  `v` - The vertical increment
Returns:
  a new expanded `AbstractRectangleBasedGeometry`

#### getExpanded

    public T getExpanded​(double left,
                         double top,
                         double right,
                         double bottom)

Creates and returns a new `AbstractRectangleBasedGeometry` with the bounds of this `AbstractRectangleBasedGeometry` expanded by the given insets.

Parameters:
  `left` - the amount to expand the left side
  `top` - the amount to expand the top side
  `right` - the amount to expand the right side
  `bottom` - the amount to expand the bottom side
Returns:
  a new expanded `AbstractRectangleBasedGeometry`

#### getHeight

    public final double getHeight()

Returns the height of this `AbstractRectangleBasedGeometry`.

Returns:
  the height of this `AbstractRectangleBasedGeometry`

#### getLocation

    public Point getLocation()

Returns a `Point` specifying the x and y coordinates of this `AbstractRectangleBasedGeometry`.

Returns:
  a `Point` representing the x and y coordinates of this `AbstractRectangleBasedGeometry`

#### getScaled

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factor` - scale-factor
Returns:
  the new, scaled object

#### getScaled

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factorX` - x-scale-factor
  `factorY` - y-scale-factor
Returns:
  the new, scaled object

#### getScaled

    public T getScaled​(double factor,
                       double centerX,
                       double centerY)

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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factor` - scale-factor
  `centerX` - x-coordinate of the relative `Point` for the scaling
  `centerY` - y-coordinate of the relative `Point` for the scaling
Returns:
  the new, scaled object

#### getScaled

    public T getScaled​(double factorX,
                       double factorY,
                       double centerX,
                       double centerY)

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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factorX` - x-scale-factor
  `factorY` - y-scale-factor
  `centerX` - x-coordinate of the relative `Point` for the scaling
  `centerY` - y-coordinate of the relative `Point` for the scaling
Returns:
  the new, scaled object

#### getScaled

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factorX` - x-scale-factor
  `factorY` - y-scale-factor
  `center` - relative `Point` for the scaling
Returns:
  the new, scaled object

#### getScaled

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factor` - scale-factor
  `center` - relative `Point` for the scaling
Returns:
  the new, scaled object

#### getShrinked

    public T getShrinked​(double h,
                         double v)

Returns a new `AbstractRectangleBasedGeometry`, where the sides are shrinked by the horizontal and vertical values supplied. The center of this `AbstractRectangleBasedGeometry` is kept constant.

Parameters:
  `h` - horizontal reduction amount
  `v` - vertical reduction amount
Returns:
  a new, shrinked `AbstractRectangleBasedGeometry`

#### getShrinked

    public T getShrinked​(double left,
                         double top,
                         double right,
                         double bottom)

Returns a new `AbstractRectangleBasedGeometry` shrinked by the specified insets.

Parameters:
  `left` - the amount to shrink the left side
  `top` - the amount to shrink the top side
  `right` - the amount to shrink the right side
  `bottom` - the amount to shrink the bottom side
Returns:
  a new, shrinked `AbstractRectangleBasedGeometry`

#### getSize

    public final Dimension getSize()

Returns a `Dimension` that records the width and height of this `AbstractRectangleBasedGeometry`.

Returns:
  a `Dimension` that records the width and height of this `AbstractRectangleBasedGeometry`

#### getTranslated

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `dx` - x-translation
  `dy` - y-translation
Returns:
  a new, translated object

#### getTranslated

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `pt` - translation `Point`
Returns:
  a new, translated object

#### getWidth

    public final double getWidth()

Returns the width of this `AbstractRectangleBasedGeometry`.

Returns:
  the width of this `AbstractRectangleBasedGeometry`

#### getX

    public final double getX()

Returns the x coordinate this `AbstractRectangleBasedGeometry`.

Returns:
  the x coordinate this `AbstractRectangleBasedGeometry`

#### getY

    public final double getY()

Returns the y coordinate of this `AbstractRectangleBasedGeometry`.

Returns:
  the y coordinate of this `AbstractRectangleBasedGeometry`

#### scale

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factor` - scale-factor
Returns:
  `this` for convenience

#### scale

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `fx` - x-scale-factor
  `fy` - y-scale-factor
Returns:
  `this` for convenience

#### scale

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
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 T 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.AbstractRectangleBasedGeometry<?,​?>>`
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 T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `fx` - x-scale-factor
  `fy` - y-scale-factor
  `center` - relative `Point` for the scaling
Returns:
  `this` for convenience

#### scale

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `factor` - scale-factor
  `center` - relative `Point` for the scaling
Returns:
  `this` for convenience

#### setBounds

    public final T setBounds​(double x,
                             double y,
                             double w,
                             double h)

Sets the x, y, width, and height values of this `AbstractRectangleBasedGeometry` to the given values.

Parameters:
  `x` - the new x-coordinate
  `y` - the new y-coordinate
  `w` - the new width
  `h` - the new height
Returns:
  `this` for convenience

#### setBounds

    public final T setBounds​(Point loc,
                             Dimension size)

Sets the x, y, width, and height values of this `AbstractRectangleBasedGeometry` to the respective values specified by the passed-in `Point` and the passed-in `Dimension`.

Parameters:
  `loc` - the `Point` specifying the new x and y coordinates of this `AbstractRectangleBasedGeometry`
  `size` - the `Dimension` specifying the new width and height of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setBounds

    public final T setBounds​(Rectangle r)

Sets the x and y coordinates and the width and height of this `AbstractRectangleBasedGeometry` to the respective values of the given `Rectangle`.

Parameters:
  `r` - the `Rectangle` specifying the new x, y, width, and height values of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setHeight

    public final T setHeight​(double height)

Sets the height of this `AbstractRectangleBasedGeometry` to the given value.

Parameters:
  `height` - the new height
Returns:
  `this` for convenience

#### setLocation

    public final T setLocation​(double x,
                               double y)

Sets the x and y coordinates of this `AbstractRectangleBasedGeometry` to the specified values.

Parameters:
  `x` - the new x coordinate of this `AbstractRectangleBasedGeometry`
  `y` - the new y coordinate of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setLocation

    public final T setLocation​(Point p)

Sets the x and y coordinates of this `AbstractRectangleBasedGeometry` to the respective values of the given `Point`.

Parameters:
  `p` - the `Point` specifying the new x and y coordinates of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setSize

    public final T setSize​(Dimension d)

Sets the width and height of this `AbstractRectangleBasedGeometry` to the width and height of the given `Dimension`.

Parameters:
  `d` - the `Dimension` specifying the new width and height of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setSize

    public final T setSize​(double w,
                           double h)

Sets the width and height of this `AbstractRectangleBasedGeometry` to the given values.

Parameters:
  `w` - the new width of this `AbstractRectangleBasedGeometry`
  `h` - the new height of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setWidth

    public final T setWidth​(double width)

Sets the width of this `AbstractRectangleBasedGeometry` to the passed-in value.

Parameters:
  `width` - the new width of this `AbstractRectangleBasedGeometry`
Returns:
  `this` for convenience

#### setX

    public final T setX​(double x)

Sets the x-coordinate of this `AbstractRectangleBasedGeometry` to the given value.

Parameters:
  `x` - The new x-coordinate.
Returns:
  `this` for convenience.

#### setY

    public final T setY​(double y)

Sets the y-coordinate of this `AbstractRectangleBasedGeometry` to the given value.

Parameters:
  `y` - The new y-coordinate.
Returns:
  `this` for convenience.

#### shrink

    public T shrink​(double h,
                    double v)

Shrinks the sides of this `AbstractRectangleBasedGeometry` by the horizontal and vertical values provided as input, and returns this `AbstractRectangleBasedGeometry` for convenience. The center of this `AbstractRectangleBasedGeometry` is kept constant.

Parameters:
  `h` - horizontal reduction amount
  `v` - vertical reduction amount
Returns:
  `this` for convenience

#### shrink

    public T shrink​(double left,
                    double top,
                    double right,
                    double bottom)

Shrinks this `AbstractRectangleBasedGeometry` by the specified amounts.

Parameters:
  `left` - the amount to shrink the left side
  `top` - the amount to shrink the top side
  `right` - the amount to shrink the right side
  `bottom` - the amount to shrink the bottom side
Returns:
  `this` for convenience

#### translate

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `dx` - x-translation
  `dy` - y-translation
Returns:
  `this` for convenience

#### translate

    public T 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.AbstractRectangleBasedGeometry<?,​?>>`
Parameters:
  `p` - translation `Point`
Returns:
  `this` for convenience

#### clone

    public java.lang.Object clone()

Overridden with public visibility as recommended within `Cloneable` .

Overrides:
  `clone` in class `java.lang.Object`

#### hashCode

    public final int hashCode()

Overrides:
  `hashCode` in class `java.lang.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.