Class Ring

    • Constructor Detail

      • Ring

        public Ring()
        Constructs a new empty Ring.
      • Ring

        public Ring​(Polygon... polygons)
        Constructs a new Ring from the given Polygons.
        Parameters:
        polygons - The array of Polygons from which this Ring is constructed.
      • Ring

        public Ring​(Ring other)
        Constructs a new Ring from the given other Ring. The internal IShapes of the other Ring are copied to prevent actions at a distance.
        Parameters:
        other - The Ring from which this Ring is constructed.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getAllEdges

        protected Line[] getAllEdges()
        Collects all edges of the internal IShapes. For a Region the internal IShapes are Rectangles. For a Ring the internal IShapes are Polygons (triangles). The internal edges are needed to determine inner and outer segments of the IMultiShape. Based on the outline of the IMultiShape, the outline intersections can be computed. These outline intersections are required to test if an ICurve is fully-contained by the IMultiShape.
        Returns:
        the edges of all internal IShapes
      • getRotatedCCW

        public Ring 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<Ring>
        Parameters:
        angle - rotation Angle
        Returns:
        an IGeometry representing the result of the rotation
      • getRotatedCCW

        public Ring 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<Ring>
        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 Ring 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<Ring>
        Parameters:
        angle - rotation Angle
        center - relative Point for the rotation
        Returns:
        an IGeometry representing the result of the rotation
      • getRotatedCW

        public Ring 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<Ring>
        Parameters:
        angle - rotation Angle
        Returns:
        an IGeometry representing the result of the rotation
      • getRotatedCW

        public Ring 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<Ring>
        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 Ring 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<Ring>
        Parameters:
        angle - rotation Angle
        center - relative Point for the rotation
        Returns:
        an IGeometry representing the result of the rotation
      • getScaled

        public Ring 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<Ring>
        Parameters:
        factor - scale-factor
        Returns:
        the new, scaled object
      • getScaled

        public Ring getScaled​(double fx,
                              double fy)
        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<Ring>
        Parameters:
        fx - x-scale-factor
        fy - y-scale-factor
        Returns:
        the new, scaled object
      • getScaled

        public Ring 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<Ring>
        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 Ring 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<Ring>
        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 Ring getScaled​(double fx,
                              double fy,
                              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<Ring>
        Parameters:
        fx - x-scale-factor
        fy - y-scale-factor
        center - relative Point for the scaling
        Returns:
        the new, scaled object
      • getScaled

        public Ring 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<Ring>
        Parameters:
        factor - scale-factor
        center - relative Point for the scaling
        Returns:
        the new, scaled object
      • getTranslated

        public Ring 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<Ring>
        Parameters:
        dx - x-translation
        dy - y-translation
        Returns:
        a new, translated object
      • rotateCCW

        public Ring rotateCCW​(Angle angle)
        Directly rotates this Ring counter-clock-wise around its center Point by the given Angle. Direct adaptation means, that this PolyBezier is modified in-place.
        Parameters:
        angle - rotation Angle
        Returns:
        this for convenience
      • rotateCCW

        public Ring rotateCCW​(Angle angle,
                              double cx,
                              double cy)
        Directly rotates this Ring counter-clock-wise around the given point (specified by cx and cy) by the given Angle. Direct adaptation means, that this PolyBezier is modified in-place.
        Parameters:
        angle - rotation Angle
        cx - x-coordinate of the Point to rotate around
        cy - y-coordinate of the Point to rotate around
        Returns:
        this for convenience
      • rotateCCW

        public Ring rotateCCW​(Angle angle,
                              Point center)
        Directly rotates this Ring counter-clock-wise around the given Point by the given Angle. Direct adaptation means, that this PolyBezier is modified in-place.
        Parameters:
        angle - rotation Angle
        center - Point to rotate around
        Returns:
        this for convenience
      • rotateCW

        public Ring rotateCW​(Angle angle)
        Directly rotates this Ring clock-wise around its center Point by the given Angle. Direct adaptation means, that this PolyBezier is modified in-place.
        Parameters:
        angle - rotation Angle
        Returns:
        this for convenience
      • rotateCW

        public Ring rotateCW​(Angle angle,
                             double cx,
                             double cy)
        Directly rotates this Ring clock-wise around the given point (specified by cx and cy) by the given Angle. Direct adaptation means, that this PolyBezier is modified in-place.
        Parameters:
        angle - rotation Angle
        cx - x-coordinate of the Point to rotate around
        cy - y-coordinate of the Point to rotate around
        Returns:
        this for convenience
      • rotateCW

        public Ring rotateCW​(Angle angle,
                             Point center)
        Directly rotates this Ring clock-wise around the given Point by the given Angle. Direct adaptation means, that this PolyBezier is modified in-place.
        Parameters:
        angle - rotation Angle
        center - Point to rotate around
        Returns:
        this for convenience
      • scale

        public Ring 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<Ring>
        Parameters:
        factor - scale-factor
        Returns:
        this for convenience
      • scale

        public Ring 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<Ring>
        Parameters:
        fx - x-scale-factor
        fy - y-scale-factor
        Returns:
        this for convenience
      • scale

        public Ring 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<Ring>
        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 Ring 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<Ring>
        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 Ring 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<Ring>
        Parameters:
        fx - x-scale-factor
        fy - y-scale-factor
        center - relative Point for the scaling
        Returns:
        this for convenience
      • scale

        public Ring 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<Ring>
        Parameters:
        factor - scale-factor
        center - relative Point for the scaling
        Returns:
        this for convenience
      • translate

        public Ring 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<Ring>
        Parameters:
        dx - x-translation
        dy - y-translation
        Returns:
        this for convenience
      • 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.
      • getOutlineSegments

        public Line[] getOutlineSegments()

        Computes the outline segments of this AbstractMultiShape.

        The outline segments of this AbstractMultiShape are those outline segments of the internal IShapes that only exist once.

        Specified by:
        getOutlineSegments in interface IMultiShape
        Returns:
        the outline segments of this AbstractMultiShape
      • 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()