java.lang.Object | |
↳ | sofia.graphics.Geometry |
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(float x1, float y1, float x2, float y2)
Calculates the distance between two points.
| ||||||||||
static float |
distanceBetween(PointF origin, PointF extent)
Calculates the distance between two points.
| ||||||||||
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 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)".
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
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.
origin | the first point (the origin) |
---|---|
extent | the other point |
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.
x1 | the x-coordinate of the first point (the origin) |
---|---|
y1 | the y-coordinate of the first point (the origin) |
x2 | the x-coordinate of the other point |
y2 | the y-coordinate of the other point |
Creates a copy of the specified point.
point | the point to copy |
---|
Calculates the distance between two points.
x1 | the x-coordinate of the origin |
---|---|
y1 | the y-coordinate of the origin |
x2 | the x-coordinate of the extent |
y2 | the y-coordinate of the extent |
Calculates the distance between two points.
origin | the first point |
---|---|
extent | the second point |
Calculates the magnitude of a vector given by its x- and y-coordinates.
vector | the vector |
---|
Calculates the magnitude of a vector given by its x- and y-coordinates.
x | the x-coordinate of the vector |
---|---|
y | the y-coordinate of the vector |
Computes the midpoint between two points.
x1 | the x-coordinate of the first point |
---|---|
y1 | the y-coordinate of the first point |
x2 | the x-coordinate of the second point |
y2 | the y-coordinate of the second point |
Computes the midpoint between two points.
p1 | the first point |
---|---|
p2 | the second point |
Calculates the translation of a point based on the specified angle and distance.
origin | the point to be translated |
---|---|
angle | the angle by which to move the point, in degrees clockwise |
distance | the distance to move the 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.
rect | the rectangle |
---|
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.
point | the point |
---|