This class contains various geometry-related static helper methods.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static
float
|
angleBetween(PointF origin, PointF extent)
Returns the angle, in degrees, between the two points origin and extent.
| ||||||||||
static
float
|
angleBetween(float x1, float y1, float x2, float y2)
Returns the angle, in degrees, between the two points (x1, y1) and
(x2, y2).
| ||||||||||
static
PointF
|
clone(PointF point)
Creates a copy of the specified point.
| ||||||||||
static
float
|
distanceBetween(PointF origin, PointF extent)
Calculates the distance between two points.
| ||||||||||
static
float
|
distanceBetween(float x1, float y1, float x2, float y2)
Calculates the distance between two points.
| ||||||||||
static
PointF
|
intersection(PointF p1, PointF p2, PointF q1, PointF q2)
Computes the point of intersection between the lines (p1, p2) and
(q1, q2).
| ||||||||||
static
boolean
|
isPointOn(PointF p, PointF q1, PointF q2)
Returns true if point
p is on the line formed by points
q1 and q2 (in other words, all three points are
collinear). | ||||||||||
static
boolean
|
isPointToLeft(PointF p, PointF q1, PointF q2)
Returns true if point
p lies to the left of the line formed by
points q1 and q2 . | ||||||||||
static
boolean
|
isPointToLeftOrOn(PointF p, PointF q1, PointF q2)
Returns true if point
p lies to the left of or is on the line
formed by points q1 and q2 . | ||||||||||
static
boolean
|
isPointToRight(PointF p, PointF q1, PointF q2)
Returns true if point
p lies to the right of the line formed by
points q1 and q2 . | ||||||||||
static
boolean
|
isPointToRightOrOn(PointF p, PointF q1, PointF q2)
Returns true if point
p lies to the right of or is on the line
formed by points q1 and q2 . | ||||||||||
static
float
|
magnitude(PointF vector)
Calculates the magnitude of a vector given by its x- and y-coordinates.
| ||||||||||
static
float
|
magnitude(float x, float y)
Calculates the magnitude of a vector given by its x- and y-coordinates.
| ||||||||||
static
PointF
|
midpoint(float x1, float y1, float x2, float y2)
Computes the midpoint between two points.
| ||||||||||
static
PointF
|
midpoint(PointF p1, PointF p2)
Computes the midpoint between two points.
| ||||||||||
static
float
|
perpendicularDistance(PointF p, PointF q1, PointF q2)
Computes the distance between a point and a line, measured perpendicular
to that line.
| ||||||||||
static
PointF
|
polarShift(PointF origin, float angle, float distance)
Calculates the translation of a point based on the specified angle and
distance.
| ||||||||||
static
String
|
toString(RectF rect)
Converts a rectangle to a string of the form
"(left, top)-(right, bottom)".
| ||||||||||
static
String
|
toString(PointF point)
Converts a point to a string of the form "(x, y)".
|
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
Returns the angle, in degrees, between the two points origin and extent. Angles increase clockwise since y-coordinates increase in the downward direction; this is the opposite of a standard Cartesian coordinate system. The returned angle will be between -180 and 180 degrees.
the angle between origin and extent, in degrees clockwise, between -180 and 180
Returns the angle, in degrees, between the two points (x1, y1) and (x2, y2). Angles increase clockwise since y-coordinates increase in the downward direction; this is the opposite of a standard Cartesian coordinate system. The returned angle will be between -180 and 180 degrees.
the angle between (x1, y1) and (x2, y2), in degrees clockwise, between -180 and 180
Creates a copy of the specified point.
a new point with the same coordinates as the original
Calculates the distance between two points.
the distance between origin and extent
Calculates the distance between two points.
the distance between (x1, y1) and (x2, y2)
Computes the point of intersection between the lines (p1, p2) and (q1, q2). If the lines are parallel, then this method returns null.
the point of intersection of the two lines, or null if they are parallel
Returns true if point p
is on the line formed by points
q1
and q2
(in other words, all three points are
collinear).
true if the point is on the line
Returns true if point p
lies to the left of the line formed by
points q1
and q2
.
true if the point is to the left of the line
Returns true if point p
lies to the left of or is on the line
formed by points q1
and q2
.
true if the point is to the left of or on the line
Returns true if point p
lies to the right of the line formed by
points q1
and q2
.
true if the point is to the right of the line
Returns true if point p
lies to the right of or is on the line
formed by points q1
and q2
.
true if the point is to the right of or is on the line
Calculates the magnitude of a vector given by its x- and y-coordinates.
the magnitude of the vector (x, y)
Calculates the magnitude of a vector given by its x- and y-coordinates.
the magnitude of the vector (x, y)
Computes the midpoint between two points.
the midpoint of the two points
Computes the midpoint between two points.
the midpoint of the two points
Computes the distance between a point and a line, measured perpendicular to that line.
the perpendicular distance between the point and the line
Calculates the translation of a point based on the specified angle and distance.
the translated point
Converts a rectangle to a string of the form
"(left, top)-(right, bottom)". This method mainly just exists for
symmetry with the one for PointF
above.
a string of the form "(left, top)-(right, bottom)"
Converts a point to a string of the form "(x, y)". This method is
necessary because the Android PointF
class does not override
toString
in a meaningful way.
a string of the form "(x, y)"