Class Util


public class Util extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static Random
    Random generator
    static int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    compute2DBoundingBox(Jcg.geometry.Point_2[] points)
    Compute the 2D bounding box containing all input points
    static Jcg.geometry.Point_2[]
    generateRandom2DPoints(int n, double w, double h)
    Generate 'n' points at random locations in the plane (in a square of given size WxH)
    static Jcg.geometry.Point_3[]
    generateRandom3DPoints(int n, double w, double l, double h)
    Generate 'n' points at random locations in 3D (in a box of given size WxLxH)
    static Jcg.geometry.Point_2[]
    regularPolygonVertices(int k, double r)
    Return the vertices of a regular polygon (equally spaced on a circle of radius r)

    Methods inherited from class java.lang.Object

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

    • seed

      public static int seed
    • generator

      static Random generator
      Random generator
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • regularPolygonVertices

      public static Jcg.geometry.Point_2[] regularPolygonVertices(int k, double r)
      Return the vertices of a regular polygon (equally spaced on a circle of radius r)
      Parameters:
      k - the number of points on the outer cycle
      r - the radius of the circle
      Returns:
      Point_2[] an array of 2D points, storing the vertices of a regular polygon
    • generateRandom2DPoints

      public static Jcg.geometry.Point_2[] generateRandom2DPoints(int n, double w, double h)
      Generate 'n' points at random locations in the plane (in a square of given size WxH)
    • generateRandom3DPoints

      public static Jcg.geometry.Point_3[] generateRandom3DPoints(int n, double w, double l, double h)
      Generate 'n' points at random locations in 3D (in a box of given size WxLxH)
    • compute2DBoundingBox

      public static double[] compute2DBoundingBox(Jcg.geometry.Point_2[] points)
      Compute the 2D bounding box containing all input points
      Parameters:
      points - a collection of 2D points (real coordinates)