Class PointsUtil

java.lang.Object
org.csstudio.swt.widgets.util.PointsUtil

public final class PointsUtil extends Object
This class can be used to manimuplate points.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.draw2d.geometry.PrecisionPoint
    doRotate(org.eclipse.draw2d.geometry.PrecisionPoint point, double angle, org.eclipse.draw2d.geometry.PrecisionPoint rotationPoint)
    Rotates the given Point with the given angle relative to the rotation point.
    static org.eclipse.draw2d.geometry.Point
    flipPointHorizontally(org.eclipse.draw2d.geometry.Point point, int center)
    Flip point horizontally from center point.
    static org.eclipse.draw2d.geometry.PointList
    flipPointsHorizontally(org.eclipse.draw2d.geometry.PointList points)
    Flip points horizontally.
    static org.eclipse.draw2d.geometry.PointList
    flipPointsHorizontally(org.eclipse.draw2d.geometry.PointList points, int centerX)
    Flip points horizontally.
    static org.eclipse.draw2d.geometry.PointList
    flipPointsVertically(org.eclipse.draw2d.geometry.PointList points)
    Flip points vertically.
    static org.eclipse.draw2d.geometry.PointList
    flipPointsVertically(org.eclipse.draw2d.geometry.PointList points, int centerY)
    Flip points vertically.
    static org.eclipse.draw2d.geometry.Point
    flipPointVertically(org.eclipse.draw2d.geometry.Point point, int center)
    Flip point vertically from center point.
    static org.eclipse.draw2d.geometry.PrecisionPoint
    rotate(org.eclipse.draw2d.geometry.Point point, double angle, org.eclipse.draw2d.geometry.Point rotationPoint)
    Rotates the given Point with the given angle relative to the rotation point.
    static org.eclipse.draw2d.geometry.PointList
    rotatePoints(org.eclipse.draw2d.geometry.PointList points, double angle)
    Rotates all points.
    static org.eclipse.draw2d.geometry.PointList
    rotatePoints(org.eclipse.draw2d.geometry.PointList points, double angle, org.eclipse.draw2d.geometry.Point center)
    Rotates all points.
    static void
    scalePoints(org.eclipse.draw2d.geometry.PointList points, double widthRatio, double heightRatio)
    Scale the geometry size of a pointlist.
    static org.eclipse.draw2d.geometry.PointList
    scalePointsBySize(org.eclipse.draw2d.geometry.PointList points, int width, int height)
    Scale the bound size of a point list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • rotate

      public static org.eclipse.draw2d.geometry.PrecisionPoint rotate(org.eclipse.draw2d.geometry.Point point, double angle, org.eclipse.draw2d.geometry.Point rotationPoint)
      Rotates the given Point with the given angle relative to the rotation point. Converts the given point to a PrecisionPoint and calls doRotate(PrecisionPoint, double, PrecisionPoint).
      Parameters:
      point - The Point to rotate
      angle - The angle to rotate (in Degrees)
      rotationPoint - The rotation point
      Returns:
      The rotated Point
    • doRotate

      public static org.eclipse.draw2d.geometry.PrecisionPoint doRotate(org.eclipse.draw2d.geometry.PrecisionPoint point, double angle, org.eclipse.draw2d.geometry.PrecisionPoint rotationPoint)
      Rotates the given Point with the given angle relative to the rotation point.
      Parameters:
      point - The Point to rotate
      angle - The angle to rotate (in Degrees)
      rotationPoint - The rotation point
      Returns:
      The rotated Point
    • rotatePoints

      public static org.eclipse.draw2d.geometry.PointList rotatePoints(org.eclipse.draw2d.geometry.PointList points, double angle)
      Rotates all points.
      Parameters:
      points - The PoinList, which points should be rotated
      angle - The angle to rotate
      Returns:
      The rotated PointList
    • rotatePoints

      public static org.eclipse.draw2d.geometry.PointList rotatePoints(org.eclipse.draw2d.geometry.PointList points, double angle, org.eclipse.draw2d.geometry.Point center)
      Rotates all points.
      Parameters:
      points - The PoinList, which points should be rotated
      angle - The angle to rotate
      Returns:
      The rotated PointList
    • flipPointHorizontally

      public static org.eclipse.draw2d.geometry.Point flipPointHorizontally(org.eclipse.draw2d.geometry.Point point, int center)
      Flip point horizontally from center point.
      Parameters:
      point - the point to be flipped.
      center - the center point.
      Returns:
      the point after flipping.
    • flipPointVertically

      public static org.eclipse.draw2d.geometry.Point flipPointVertically(org.eclipse.draw2d.geometry.Point point, int center)
      Flip point vertically from center point.
      Parameters:
      point - the point to be flipped.
      center - the center point.
      Returns:
      the point after flipping.
    • flipPointsHorizontally

      public static org.eclipse.draw2d.geometry.PointList flipPointsHorizontally(org.eclipse.draw2d.geometry.PointList points)
      Flip points horizontally.
      Parameters:
      points - the points to be flipped.
      Returns:
      the flipped points.
    • flipPointsHorizontally

      public static org.eclipse.draw2d.geometry.PointList flipPointsHorizontally(org.eclipse.draw2d.geometry.PointList points, int centerX)
      Flip points horizontally.
      Parameters:
      points - the points to be flipped.
      centerX - the center X position
      Returns:
      the flipped points.
    • flipPointsVertically

      public static org.eclipse.draw2d.geometry.PointList flipPointsVertically(org.eclipse.draw2d.geometry.PointList points)
      Flip points vertically.
      Parameters:
      points - the points to be flipped.
      Returns:
      the flipped points.
    • flipPointsVertically

      public static org.eclipse.draw2d.geometry.PointList flipPointsVertically(org.eclipse.draw2d.geometry.PointList points, int centerY)
      Flip points vertically.
      Parameters:
      points - the points to be flipped.
      centerY - the center Y position.
      Returns:
      the flipped points.
    • scalePoints

      public static void scalePoints(org.eclipse.draw2d.geometry.PointList points, double widthRatio, double heightRatio)
      Scale the geometry size of a pointlist.
      Parameters:
      points - points to be scaled.
      widthRatio - width scale ratio.
      heightRatio - height scale ratio.
    • scalePointsBySize

      public static org.eclipse.draw2d.geometry.PointList scalePointsBySize(org.eclipse.draw2d.geometry.PointList points, int width, int height)
      Scale the bound size of a point list.
      Parameters:
      points - the points to be scaled.
      width - the new width.
      height - the new height
      Returns:
      the points after scaled. If no scale is needed, return the input points.