English | Site Directory

Android - An Open Handset Alliance Project

android.graphics
public class

android.graphics.Point

java.lang.Object
android.graphics.Point

Point holds two integer coordinates

Summary

Fields

public      int  x   
public      int  y   

Public Constructors

          Point()
          Point(int x, int y)
Set the point's X and Y coordinates

Public Methods

    final    void  add(Point v)
Add v's coordinates to the point's
      static  float  crossProduct(Point a, Point b)
Returns the cross product of a and b, treating them as 2D vectors
      static  Point  difference(Point a, Point b)
Returns a new point whose coordinates are the difference between a's and b's (a - b)
      static  float  distance(Point a, Point b)
Returns the euclidian distance between a and b
      static  float  dotProduct(Point a, Point b)
Returns the dot product of a and b, treating them as 2D vectors
    final    boolean  equals(int _x, int _y)
Returns true if the point's coordinates equal (x,y)
      static  float  length(float x, float y)
Returns the euclidian distance from (0,0) to (x,y)
    final    void  negate()
Negate the point's coordinates
    final    void  rotateCCW()
Rotate the point counter-clockwise by 90 degrees, writing the answer back into the point.
    final    void  rotateCW()
Rotate the point clockwise by 90 degrees, writing the answer back into the point.
        void  set(int x, int y)
Set the point's X and Y coordinates
    final    void  subtract(Point v)
Subtract v's coordinates from the point's
      static  Point  sum(Point a, Point b)
Returns a new point whose coordinates are the sum of a's and b's (a + b)
Methods inherited from class java.lang.Object

Details

Fields

public int x

public int y

Public Constructors

public Point()

public Point(int x, int y)

Set the point's X and Y coordinates

Public Methods

public final void add(Point v)

Add v's coordinates to the point's

public static float crossProduct(Point a, Point b)

Returns the cross product of a and b, treating them as 2D vectors

public static Point difference(Point a, Point b)

Returns a new point whose coordinates are the difference between a's and b's (a - b)

public static float distance(Point a, Point b)

Returns the euclidian distance between a and b

public static float dotProduct(Point a, Point b)

Returns the dot product of a and b, treating them as 2D vectors

public final boolean equals(int _x, int _y)

Returns true if the point's coordinates equal (x,y)

public static float length(float x, float y)

Returns the euclidian distance from (0,0) to (x,y)

public final void negate()

Negate the point's coordinates

public final void rotateCCW()

Rotate the point counter-clockwise by 90 degrees, writing the answer back into the point.

public final void rotateCW()

Rotate the point clockwise by 90 degrees, writing the answer back into the point.

public void set(int x, int y)

Set the point's X and Y coordinates

public final void subtract(Point v)

Subtract v's coordinates from the point's

public static Point sum(Point a, Point b)

Returns a new point whose coordinates are the sum of a's and b's (a + b)
Build m5-rc15g - 14 May 2008 12:50