public class Point
extends java.lang.Object
implements android.os.Parcelable
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator |
CREATOR |
| Modifier | Constructor and Description |
|---|---|
|
Point()
Constructor that creates default point at position (0,0).
|
|
Point(float x,
float y)
Constructor that creates point at position (x,y).
|
protected |
Point(android.os.Parcel in) |
| Modifier and Type | Method and Description |
|---|---|
Point |
clamp(float length)
Calculate and return point clamped to given norm (length).
|
Point |
clamp(float minLength,
float maxLength)
Calculate and return point clamped to given norm (lengths).
|
int |
describeContents() |
float |
distance(Point other)
Calculates and returns the distance to given point.
|
void |
draw(android.graphics.Canvas canvas,
android.graphics.Paint paint,
int pointRadius)
Draws the point to given canvas with given paint.
|
boolean |
equals(java.lang.Object o) |
float |
getX() |
float |
getY() |
boolean |
isZero()
Returns true if point has coordinates (0,0).
|
void |
log()
Logs the point coordinates to LOG_DEBUG log.
|
Point |
makeCopy() |
Point |
mirrorX(float maxXDimension)
Return point mirrored around X axis.
|
void |
mirrorXInPlace(float maxXDimension)
Mirrors point around X axis.
|
Point |
mirrorXY(float maxXDimension,
float maxYDimension)
Return point mirrored around both X and Y axis
|
void |
mirrorXYInPlace(float maxXDimension,
float maxYDimension)
Mirrors point around both X and Y axis
|
Point |
mirrorY(float maxYDimension)
Return point mirrored around Y axis.
|
void |
mirrorYInPlace(float maxYDimension)
Mirrors point around Y axis.
|
Point |
negative() |
Point |
negativeClone()
Calculate and return negative of current point.
|
float |
norm()
Calculate and return norm of the point.
|
Point |
normalize()
Calculate and return point that has same direction as this point, but norm 1.
|
Point |
normalize(float length)
Calculate and return point that has same direction as this point, but norm as given.
|
Point |
operatorMinus(Point other)
- operator on the point.
|
Point |
operatorMinusEquals(Point other) |
Point |
operatorMultiply(float factor)
Multiplication of the point with scalar.
|
Point |
operatorMultiplyEquals(float factor) |
Point |
operatorPlus(Point other)
+ operator on the point.
|
void |
operatorPlusEquals(Point other)
+= operator on the point.
|
void |
setX(float x)
Sets the x coordinate of the point.
|
void |
setY(float y)
Sets the y coordinate of the point.
|
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public Point()
public Point(float x,
float y)
x - x-coordinate of the pointy - y-coordinate of the poingprotected Point(@NonNull
android.os.Parcel in)
@NonNull public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isZero()
@NonNull public Point operatorPlus(@NonNull Point other)
other - Point to be added to current pointpublic void operatorPlusEquals(@NonNull
Point other)
other - Point to be added to current point@NonNull public Point operatorMinus(@NonNull Point other)
other - Point to be substracted from current point@NonNull public Point operatorMultiply(float factor)
factor - Scalar with which point should be multiplied@NonNull public Point operatorMultiplyEquals(float factor)
@NonNull public Point negativeClone()
@NonNull public Point negative()
public float norm()
@NonNull public Point normalize()
@NonNull public Point normalize(float length)
length - Desired norm of the point.@NonNull public Point clamp(float length)
length - Desired norm to which point should be clamped.@NonNull public Point clamp(float minLength, float maxLength)
minLength - Minimum desired norm of the point.maxLength - Maximum desired norm of the point.@NonNull public Point mirrorX(float maxXDimension)
maxXDimension - Maximum dimension of X axis.public void mirrorXInPlace(float maxXDimension)
maxXDimension - Maximum dimension of X axis.@NonNull public Point mirrorY(float maxYDimension)
maxYDimension - Maximum dimension of Y axis.public void mirrorYInPlace(float maxYDimension)
maxYDimension - Maximum dimension of Y axis.@NonNull public Point mirrorXY(float maxXDimension, float maxYDimension)
maxXDimension - Maximum dimension of X axis.maxYDimension - Maximum dimension of Y axis.public void mirrorXYInPlace(float maxXDimension,
float maxYDimension)
maxXDimension - Maximum dimension of X axis.maxYDimension - Maximum dimension of Y axis.@NonNull public Point makeCopy()
public boolean equals(@Nullable
java.lang.Object o)
equals in class java.lang.Objectpublic float distance(@NonNull
Point other)
other - Point to which distance is calculated.public void log()
public void draw(@NonNull
android.graphics.Canvas canvas,
@NonNull
android.graphics.Paint paint,
int pointRadius)
canvas - Canvas to which point should be drawn.paint - Paint used to draw point.pointRadius - Radius of the circle that represents the point.public float getX()
public void setX(float x)
x - x coordinate of the pointpublic float getY()
public void setY(float y)
y - y coordinate of the pointpublic int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(@NonNull
android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelable