English | Site Directory

Android - An Open Handset Alliance Project

android.graphics
public class

android.graphics.PointF

java.lang.Object
android.graphics.PointF

PointF holds two float coordinates

Summary

Fields

public      float  x   
public      float  y   

Public Constructors

          PointF()
          PointF(float x, float y)
Set the point's X and Y coordinates
          PointF(int x, int y)
Set the point's X and Y coordinates by automatically promoting (x,y) to float values.
          PointF(Point p)
Set the point's X and Y coordinates by automatically promoting p's coordinates to float values.

Public Methods

    final    void  add(PointF v)
Add v's coordinates to the point's
      static  float  crossProduct(PointF a, PointF b)
Returns the cross product of a and b, treating them as 2D vectors
      static  PointF  difference(PointF a, PointF b)
Returns a new point whose coordinates are the difference between a's and b's (a - b)
      static  float  distance(PointF a, PointF b)
Returns the euclidian distance between a and b
      static  float  dotProduct(PointF a, PointF b)
Returns the dot product of a and b, treating them as 2D vectors
    final    boolean  equals(float _x, float _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    float  length()
Return the euclidian distance from (0,0) to the point
    final    void  negate()
Negate the point's coordinates
    final    boolean  normalize()
Set the point (vector) to be unit-length in the same direction as it currently is, and return its old length.
    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.
    final    void  scale(float scale)
Scale the point's coordinates by scale, writing the answer into dst.
    final    void  set(float x, float y)
Set the point's X and Y coordinates
    final    void  set(int x, int y)
Set the point's X and Y coordinates by automatically promoting (x,y) to float values.
    final    void  set(PointF p)
Set the point's X and Y coordinates to the coordinates of p
    final    boolean  setLength(float length)
Scale the point to have the specified length, and return that length.
    final    boolean  setLength(float x, float y, float length)
Set the point to have the specified length in the same direction as (x,y), and return the old length of (x,y).
    final    boolean  setUnit(float x, float y)
Set the point (vector) to be unit-length in the same direction as the x,y params, and return their old length.
    final    void  subtract(PointF v)
Subtract v's coordinates from the point's
      static  PointF  sum(PointF a, PointF 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 float x

public float y

Public Constructors

public PointF()

public PointF(float x, float y)

Set the point's X and Y coordinates

public PointF(int x, int y)

Set the point's X and Y coordinates by automatically promoting (x,y) to float values.

public PointF(Point p)

Set the point's X and Y coordinates by automatically promoting p's coordinates to float values.

Public Methods

public final void add(PointF v)

Add v's coordinates to the point's

public static float crossProduct(PointF a, PointF b)

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

public static PointF difference(PointF a, PointF b)

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

public static float distance(PointF a, PointF b)

Returns the euclidian distance between a and b

public static float dotProduct(PointF a, PointF b)

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

public final boolean equals(float _x, float _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 float length()

Return the euclidian distance from (0,0) to the point

public final void negate()

Negate the point's coordinates

public final boolean normalize()

Set the point (vector) to be unit-length in the same direction as it currently is, and return its old length. If the old length is degenerately small (nearly zero), do nothing and return 0.

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 final void scale(float scale)

Scale the point's coordinates by scale, writing the answer into dst.

public final void set(float x, float y)

Set the point's X and Y coordinates

public final void set(int x, int y)

Set the point's X and Y coordinates by automatically promoting (x,y) to float values.

public final void set(PointF p)

Set the point's X and Y coordinates to the coordinates of p

public final boolean setLength(float length)

Scale the point to have the specified length, and return that length. If the original length is degenerately small (nearly zero), do nothing and return 0.

public final boolean setLength(float x, float y, float length)

Set the point to have the specified length in the same direction as (x,y), and return the old length of (x,y). If that old length is degenerately small (nearly zero), do nothing and return 0.

public final boolean setUnit(float x, float y)

Set the point (vector) to be unit-length in the same direction as the x,y params, and return their old length. If the old length is degenerately small (nearly zero), do nothing and return 0.

public final void subtract(PointF v)

Subtract v's coordinates from the point's

public static PointF sum(PointF a, PointF 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