Class PointCloud_2

Direct Known Subclasses:
PolyLine_2

public class PointCloud_2 extends PointCloud<Point_2>
Class representing a collection of points (in 2D)
Version:
dec 2012
Author:
Luca Castelli Aleardi, Ecole Polytechnique (INF562)
  • Constructor Details

    • PointCloud_2

      public PointCloud_2()
      Create a new empty point cloud
    • PointCloud_2

      public PointCloud_2(int n)
      Create a point cloud of size n
      Parameters:
      n - number of points
    • PointCloud_2

      public PointCloud_2(ArrayList<Point_2> points)
      Create a new point cloud (a copy) from a collection of points
      Parameters:
      a - list of points (stored as an ArrayList)
  • Method Details

    • boundingBox

      public Point_2[] boundingBox()
      Compute the bounding box (enclosing all points)
      Specified by:
      boundingBox in class PointCloud<Point_2>
      Returns:
      Point_2[] the array containing the min and max bounds
    • max

      public Point_2 max(int d)
      Return the point with greatest coordinate value (in direction d)
      Specified by:
      max in class PointCloud<Point_2>
      Parameters:
      d - dimension (0 or 1, corresponding to x or y axis)
      Returns:
      Point_2 the greatest point (with greatest d-coordinate)
    • min

      public Point_2 min(int d)
      Return the point with smallest coordinate value (in direction d)
      Specified by:
      min in class PointCloud<Point_2>
      Parameters:
      d - dimension (0 or 1, corresponding to x or y axis)
      Returns:
      Point_2 the smallest point (with smallest d-coordinate)
    • pointsInCircle

      public static PointCloud_2 pointsInCircle(int n)
      Generate points inside a circle at random
      Parameters:
      n - the number of points