Class Point_d

java.lang.Object
Jcg.geometry.Point_d
All Implemented Interfaces:
Comparable<Point_>, Point_

public class Point_d extends Object implements Point_
Class for representing a point in d-dimensional space R^d
Version:
dec 2012
Author:
Luca Castelli Aleardi, Ecole Polytechnique (INF562)
  • Field Details

    • coordinates

      public Double[] coordinates
  • Constructor Details

    • Point_d

      public Point_d(int d)
    • Point_d

      public Point_d(double[] coord)
    • Point_d

      public Point_d(Point_ p)
  • Method Details

    • barycenter

      public void barycenter(Point_[] points)
      Description copied from interface: Point_
      Set the current point as the barycenter of an array of points
      Specified by:
      barycenter in interface Point_
    • linearCombination

      public void linearCombination(Point_[] points, Number[] coefficients)
      Description copied from interface: Point_
      Set the current point a linear combination of an array of points. Coefficients must sum to 1
      Specified by:
      linearCombination in interface Point_
    • translateOf

      public void translateOf(Vector_ v)
      Translate the current position of vector v
      Specified by:
      translateOf in interface Point_
      Parameters:
      v - the vector describing the translation
    • equals

      public boolean equals(Object o)
      Check equality between point coordinates
      Overrides:
      equals in class Object
      Parameters:
      o - the point to be compared
      Returns:
      true whether the coordinates of the current point coincide with 'o' coordinates
    • toString

      public String toString()
      Description copied from interface: Point_
      Return a string (representation of the point)
      Specified by:
      toString in interface Point_
      Overrides:
      toString in class Object
    • dimension

      public int dimension()
      Description copied from interface: Point_
      Return the dimension of the space
      Specified by:
      dimension in interface Point_
    • getCartesian

      public Number getCartesian(int i)
      Description copied from interface: Point_
      return the i-th cartesian coordinate of the point
      Specified by:
      getCartesian in interface Point_
    • setCartesian

      public void setCartesian(int i, Number x)
      Description copied from interface: Point_
      set the i-th cartesian coordinate
      Specified by:
      setCartesian in interface Point_
    • setOrigin

      public void setOrigin()
      Description copied from interface: Point_
      set the coordinates of the origin
      Specified by:
      setOrigin in interface Point_
    • minus

      public Vector_ minus(Point_ b)
      Description copied from interface: Point_
      Return the vector (p-q), where q is the current point
      Specified by:
      minus in interface Point_
    • squareDistance

      public Number squareDistance(Point_ p)
      Description copied from interface: Point_
      Return the square distance ||p-q||^2, where q is the current point
      Specified by:
      squareDistance in interface Point_
    • compareTo

      public int compareTo(Point_ o)
      Specified by:
      compareTo in interface Comparable<Point_>
    • compareCartesian

      public int compareCartesian(Point_ o, int i)
      Compare the i-th coordinate of two points
      Specified by:
      compareCartesian in interface Point_
      Parameters:
      o - the point to compare
      i - the i-th coordinate to compare
      Returns:
      the result is -1 if first point is smaller then point o, return 1 is first point is greater then o, and 0 otherwise