android.graphics.PointF
PointF holds two float coordinates
Summary
Fields
| public |
|
|
float |
x |
|
| public |
|
|
float |
y |
|
Public Constructors
Public Methods
| |
|
final |
|
void |
add(PointF v) |
| |
|
|
static |
float |
crossProduct(PointF a, PointF b) |
| |
|
|
static |
PointF |
difference(PointF a, PointF b) |
| |
|
|
static |
float |
distance(PointF a, PointF b) |
| |
|
|
static |
float |
dotProduct(PointF a, PointF b) |
| |
|
final |
|
boolean |
equals(float _x, float _y) |
| |
|
|
static |
float |
length(float x, float y) |
| |
|
final |
|
float |
length() |
| |
|
final |
|
void |
negate() |
| |
|
final |
|
boolean |
normalize() |
| |
|
final |
|
void |
rotateCCW() |
| |
|
final |
|
void |
rotateCW() |
| |
|
final |
|
void |
scale(float scale) |
| |
|
final |
|
void |
set(float x, float y) |
| |
|
final |
|
void |
set(int x, int y) |
| |
|
final |
|
void |
set(PointF p) |
| |
|
final |
|
boolean |
setLength(float length) |
| |
|
final |
|
boolean |
setLength(float x, float y, float length) |
| |
|
final |
|
boolean |
setUnit(float x, float y) |
| |
|
final |
|
void |
subtract(PointF v) |
| |
|
|
static |
PointF |
sum(PointF a, PointF b) |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Fields
Public Constructors
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
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
Returns a new point whose coordinates are the sum of a's and b's (a + b)