es.ucm.look.ar.math.geom
Class Point2

java.lang.Object
  extended by es.ucm.look.ar.math.geom.Point2
Direct Known Subclasses:
Point3

public class Point2
extends java.lang.Object

Represents a 2D point


Field Summary
 float x
          x coordinate
 float y
          y coordinate
 
Constructor Summary
Point2(float x, float y)
          Constructs a point from its 2D coordinates
Point2(Point3 p, int remove)
          Constructs a 2D point from a 3D point, giving one coordinate to be removed from the 3D point
 
Method Summary
 void add(float x, float y)
          Adds given x and y to point x and way
 void add(Point2 p)
          Adds a point to this one, adding given point x and y coordinates to this x and y point
 float[] getCoordinatesArray()
          Returns an array with the point's coordinates
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public float x
x coordinate


y

public float y
y coordinate

Constructor Detail

Point2

public Point2(float x,
              float y)
Constructs a point from its 2D coordinates

Parameters:
x - x coordinate
y - y coordinate

Point2

public Point2(Point3 p,
              int remove)
Constructs a 2D point from a 3D point, giving one coordinate to be removed from the 3D point

Parameters:
p - 3D point
remove - coordinate index to be removed. If 0, x will be removed, assigning 2D x to 3D y and 2D y to 3D z. If 1, y will be removed, and so on... If remove if greater than 2 or less than 0, the z coordinate will be removed
Method Detail

add

public void add(float x,
                float y)
Adds given x and y to point x and way

Parameters:
x -
y -

add

public void add(Point2 p)
Adds a point to this one, adding given point x and y coordinates to this x and y point

Parameters:
p - the point

getCoordinatesArray

public float[] getCoordinatesArray()
Returns an array with the point's coordinates

Returns:
an array with the point's coordinates