Class PrecisionPointList

java.lang.Object
org.eclipse.draw2d.geometry.PointList
org.eclipse.draw2d.geometry.PrecisionPointList
All Implemented Interfaces:
Serializable, Translatable

public final class PrecisionPointList extends PointList
A PointList implementation using floating point values. The use of floating point prevents rounding errors from accumulating. For the sake of compatibility with the integer-precision PointList, the integer coordinates and their decimal part are stored in two separate arrays. EXPERIMENTAL This class has been added as part of a work in progress and there is no guarantee that this API will remain unchanged. This is likely to not function properly outside some very specific use-cases.
Since:
3.21
See Also:
@noreference
This class is not intended to be referenced by clients.
  • Constructor Details

    • PrecisionPointList

      public PrecisionPointList()
      Constructs an empty PrecisionPointList
    • PrecisionPointList

      public PrecisionPointList(int size)
      Constructs a PrecisionPointList with the given size.
      Parameters:
      size - Number of points to hold.
    • PrecisionPointList

      public PrecisionPointList(int[] points)
      Constructs a PrecisionPointList with the given points.
      Parameters:
      points - int array where two consecutive ints form the coordinates of a point
    • PrecisionPointList

      public PrecisionPointList(PointList points)
      Constructs a PrecisionPointList with the given points.
      Parameters:
      points - PointList from which the initial values are taken
  • Method Details

    • addAll

      public void addAll(PointList points)
      Description copied from class: PointList
      Appends all of the given points to this PointList.
      Overrides:
      addAll in class PointList
      Parameters:
      points - the source pointlist
      See Also:
    • addPoint

      public void addPoint(Point point)
      Description copied from class: PointList
      Adds Point p to this PointList.
      Overrides:
      addPoint in class PointList
      Parameters:
      point - the point to be added
      See Also:
    • getCopy

      public PointList getCopy()
      Description copied from class: PointList
      Creates a copy
      Overrides:
      getCopy in class PointList
      Returns:
      PointList A copy of this PointList
      See Also:
    • getPoint

      public Point getPoint(int index)
      Description copied from class: PointList
      Returns the Point in the list at the specified index.
      Overrides:
      getPoint in class PointList
      Parameters:
      index - Index of the desired Point
      Returns:
      The requested Point
      See Also:
    • getPoint

      public Point getPoint(Point point, int index)
      Description copied from class: PointList
      Copies the x and y values at given index into a specified Point. This method exists to avoid the creation of a new Point.
      Overrides:
      getPoint in class PointList
      Parameters:
      point - The Point which will be set with the <x, y> values
      index - The index being requested
      Returns:
      The parameter p is returned for convenience
      See Also:
    • insertPoint

      public void insertPoint(Point p, int index)
      Description copied from class: PointList
      Inserts a given point at a specified index.
      Overrides:
      insertPoint in class PointList
      Parameters:
      p - Point to be inserted.
      index - Position where the point is to be inserted.
      See Also:
    • performScale

      public void performScale(double factor)
      Description copied from interface: Translatable
      Scales this object by the scale factor.
      Specified by:
      performScale in interface Translatable
      Overrides:
      performScale in class PointList
      Parameters:
      factor - The scale factor
      See Also:
    • removePoint

      public Point removePoint(int index)
      Description copied from class: PointList
      Removes the point at the specified index from the PointList, and returns it.
      Overrides:
      removePoint in class PointList
      Parameters:
      index - Index of the point to be removed.
      Returns:
      The point which has been removed
      See Also:
    • reverse

      public void reverse()
      Description copied from class: PointList
      Reverses the order of the points in the list.
      Overrides:
      reverse in class PointList
      See Also:
    • setPoint

      public void setPoint(Point point, int index)
      Description copied from class: PointList
      Overwrites a point at a given index in the list with the specified Point.
      Overrides:
      setPoint in class PointList
      Parameters:
      point - Point which is to be stored at the index.
      index - Index where the given point is to be stored.
      See Also:
    • setSize

      public void setSize(int newSize)
      Description copied from class: PointList
      Sets the size of this PointList.
      Overrides:
      setSize in class PointList
      Parameters:
      newSize - the new size
      See Also:
    • toDoubleArray

      public double[] toDoubleArray()
      Returns the decimal fractions of this PointList as an double array. The returned array is by reference. Any changes made to the array will also be changing the original PointList.
      Returns:
      the double array of decimal fractions by reference
      @noreference
      This method is not intended to be referenced by clients.
    • transpose

      public void transpose()
      Description copied from class: PointList
      Transposes all x and y values. Useful for orientation changes.
      Overrides:
      transpose in class PointList
      See Also: