Class PointUtil
Provides helper methods for manipulations with points
Inherited Members
Namespace:
Assembly: .dll
Syntax
public class PointUtil
Constructors
PointUtil()
Declaration
public PointUtil()
Methods
arePointsOnSameLine(PointF pt1, PointF pt2, PointF pt3)
Checks if points lies on the same line
Declaration
public static boolean arePointsOnSameLine(PointF pt1, PointF pt2, PointF pt3)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | pt1 | The first point to check |
| android.graphics.PointF | pt2 | The second point to check |
| android.graphics.PointF | pt3 | The third point to check |
Returns
| Type | Description |
|---|---|
| boolean | True if points lie on the same line |
clipToBounds(PointF point, int width, int height)
Clip point to the bounds
Declaration
public static void clipToBounds(PointF point, int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | point | The point to clip |
| int | width | The bounds width |
| int | height | The bounds height |
distance(PointF pt1, PointF pt2)
Calculates distance between two points
Declaration
public static float distance(PointF pt1, PointF pt2)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | pt1 | The first point |
| android.graphics.PointF | pt2 | The second point |
Returns
| Type | Description |
|---|---|
| float | The distance between points |
distance(float x1, float y1, float x2, float y2)
Calculates distance between two points
Declaration
public static float distance(float x1, float y1, float x2, float y2)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x1 | The x-coordinate of the first point |
| float | y1 | The y-coordinate of the first point |
| float | x2 | The x-coordinate of the second point |
| float | y2 | The y-coordinate of the second point |
Returns
| Type | Description |
|---|---|
| float | The distance between points |
distanceFromLine(PointF pt, PointF start, PointF end)
Computes the distance from line to point
Declaration
public static float distanceFromLine(PointF pt, PointF start, PointF end)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | pt | The point measure distance from |
| android.graphics.PointF | start | The line start |
| android.graphics.PointF | end | The line end |
Returns
| Type | Description |
|---|---|
| float | The distance from line to point |
distanceFromLine(float x, float y, float startX, float startY, float endX, float endY)
Computes the distance from line to point
Declaration
public static float distanceFromLine(float x, float y, float startX, float startY, float endX, float endY)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x-coordinate of the point to measure distance from |
| float | y | The y-coordinate of the point to measure distance from |
| float | startX | The x-coordinate of the line start |
| float | startY | The y-coordinate of the line start |
| float | endX | The x-coordinate of the line end |
| float | endY | The y-coordinate of the line end |
Returns
| Type | Description |
|---|---|
| float | The distance from line to point |
distanceFromLineSegment(PointF pt, PointF start, PointF end)
Computes the distance from line to point
Declaration
public static float distanceFromLineSegment(PointF pt, PointF start, PointF end)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | pt | The point measure distance from |
| android.graphics.PointF | start | The line start |
| android.graphics.PointF | end | The line end |
Returns
| Type | Description |
|---|---|
| float | The distance from line to point |
distanceFromLineSegment(float x, float y, float startX, float startY, float endX, float endY)
Computes the distance from line to point
Declaration
public static float distanceFromLineSegment(float x, float y, float startX, float startY, float endX, float endY)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x-coordinate of the point to measure distance from |
| float | y | The y-coordinate of the point to measure distance from |
| float | startX | The x-coordinate of the line start |
| float | startY | The y-coordinate of the line start |
| float | endX | The x-coordinate of the line end |
| float | endY | The y-coordinate of the line end |
Returns
| Type | Description |
|---|---|
| float | The distance from line to point |
isInBounds(PointF point, Size viewportSize)
Checks if point lies within bounds
Declaration
public static boolean isInBounds(PointF point, Size viewportSize)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | point | The point to check |
| Size | viewportSize | The bounds |
Returns
| Type | Description |
|---|---|
| boolean | True if point lies within bounds |
isInBounds(float x, float y, RectF rect)
Checks if point lies within bounds
Declaration
public static boolean isInBounds(float x, float y, RectF rect)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x-coordinate of the point to check |
| float | y | The y-coordinate of the point to check |
| android.graphics.RectF | rect | The bounds |
Returns
| Type | Description |
|---|---|
| boolean | True if point lies within bounds |
isInBounds(float x, float y, Size viewportSize)
Checks if point lies within bounds
Declaration
public static boolean isInBounds(float x, float y, Size viewportSize)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x-coordinate of the point to check |
| float | y | The y-coordinate of the point to check |
| Size | viewportSize | The bounds |
Returns
| Type | Description |
|---|---|
| boolean | True if point lies within bounds |
isInBounds(float x, float y, float left, float top, float right, float bottom)
Checks if point lies within bounds
Declaration
public static boolean isInBounds(float x, float y, float left, float top, float right, float bottom)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x-coordinate of the point to check |
| float | y | The y-coordinate of the point to check |
| float | left | The left bounds |
| float | top | The top bounds |
| float | right | The right bounds |
| float | bottom | The bottom bounds |
Returns
| Type | Description |
|---|---|
| boolean | True if point lies within bounds |
isPointInTriangle(PointF checkPt, PointF pointA, PointF pointB, PointF pointC)
Checks if point lies within triangle
Declaration
public static boolean isPointInTriangle(PointF checkPt, PointF pointA, PointF pointB, PointF pointC)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | checkPt | The point to check |
| android.graphics.PointF | pointA | The first point of the triangle |
| android.graphics.PointF | pointB | The second point of the triangle |
| android.graphics.PointF | pointC | The third point of the triangle |
Returns
| Type | Description |
|---|---|
| boolean | True if point lies within triangle |
liesToTheLeft(PointF pointToCheck, PointF start, PointF end)
Checks if point lies to the left of the line
Declaration
public static boolean liesToTheLeft(PointF pointToCheck, PointF start, PointF end)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | pointToCheck | The point to check |
| android.graphics.PointF | start | The line start |
| android.graphics.PointF | end | The line end |
Returns
| Type | Description |
|---|---|
| boolean | True if point lies to the left of the line |
lineIntersection2D(PointF intersection, PointF firstLineStart, PointF firstLineEnd, PointF secondLineStart, PointF secondLineEnd)
Looks for the intersection point for the two lines passed in
Declaration
public static boolean lineIntersection2D(PointF intersection, PointF firstLineStart, PointF firstLineEnd, PointF secondLineStart, PointF secondLineEnd)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | intersection | If the lines intersect, holds the intersection point |
| android.graphics.PointF | firstLineStart | The start point of the first line |
| android.graphics.PointF | firstLineEnd | The end point of the first line |
| android.graphics.PointF | secondLineStart | The start point of the second line |
| android.graphics.PointF | secondLineEnd | The end point of the second line |
Returns
| Type | Description |
|---|---|
| boolean | True if the intersection occurs |
lineSegmentsIntersection2D(PointF intersection, PointF firstLineStart, PointF firstLineEnd, PointF secondLineStart, PointF secondLineEnd)
Looks for the intersection point for the two lines passed in
Declaration
public static boolean lineSegmentsIntersection2D(PointF intersection, PointF firstLineStart, PointF firstLineEnd, PointF secondLineStart, PointF secondLineEnd)
Parameters
| Type | Name | Description |
|---|---|---|
| android.graphics.PointF | intersection | If the lines intersect, holds the intersection point |
| android.graphics.PointF | firstLineStart | The start point of the first line |
| android.graphics.PointF | firstLineEnd | The end point of the first line |
| android.graphics.PointF | secondLineStart | The start point of the second line |
| android.graphics.PointF | secondLineEnd | The end point of the second line |
Returns
| Type | Description |
|---|---|
| boolean | True if the intersection occurs |