public final class GeometryUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static float |
area(float[] points,
int size)
Returns the unsigned area of polygon.
|
static float |
area(float[] a,
int p1,
int p2,
int p3) |
static float |
area(float ax,
float ay,
float bx,
float by,
float cx,
float cy) |
static float[] |
bisectionNorm2D(float[] v1,
float[] v2) |
static float[] |
center(float[] points,
int pointPos,
int n,
float[] out)
Calculates the center of a set of points.
|
static float[] |
diffVec(float[] a,
float[] b) |
static double |
distance(float[] p,
int a,
int b) |
static double |
distance2D(float[] a,
float[] b) |
static float |
distancePointLine2D(float[] pP,
float[] pL,
float[] vL) |
static float |
dotProduct(float[] a,
float[] b) |
static double |
dotProduct(float[] p,
int a,
int b,
int c) |
static float[] |
intersectionLinePlane(float[] pL,
float[] vL,
float[] pP,
float[] vP)
Calculate intersection of a plane with a line
|
static float[] |
intersectionLines2D(float[] pA,
float[] vA,
float[] pB,
float[] vB) |
static float |
isClockwise(float[] points,
int size)
Is polygon clockwise.
|
static float |
isTrisClockwise(float[] pA,
float[] pB,
float[] pC)
Indicates the turn of tris pA-pB-pC.
|
static double |
length(float[] vec) |
static float[] |
normalize(float[] vec) |
static java.util.List<float[]> |
normalizedVectors2D(java.util.List<float[]> points,
java.util.List<java.lang.Float> outLengths)
Calculate the normalized direction vectors of point list (polygon)
|
static float[] |
normalOfPlane(float[] pA,
float[] pB,
float[] pC) |
static boolean |
pointInPoly(float x,
float y,
float[] vertices,
int length,
int offset)
Test if point x/y is in polygon defined by vertices[offset ...
|
static float[] |
scale(float[] v,
float scale) |
static float |
squaredDistance(float[] p,
int a,
int b) |
static float |
squareSegmentDistance(float[] p,
int a,
int b,
int c)
square distance from a point a to a segment b,c
|
static float[] |
sumVec(float[] a,
float[] b) |
public static boolean pointInPoly(float x,
float y,
float[] vertices,
int length,
int offset)
public static float area(float[] points,
int size)
size - the number of point coordinatespublic static float area(float ax,
float ay,
float bx,
float by,
float cx,
float cy)
public static float area(float[] a,
int p1,
int p2,
int p3)
public static float[] bisectionNorm2D(float[] v1,
float[] v2)
v1 - the first normalized vectorv2 - the second normalized vectorpublic static float[] center(float[] points,
int pointPos,
int n,
float[] out)
points - the points arraypointPos - the start position of pointsn - the number of pointsout - the center outputpublic static float[] diffVec(float[] a,
float[] b)
a - first vectorb - second vectorpublic static float[] sumVec(float[] a,
float[] b)
a - first vectorb - second vectorpublic static float squaredDistance(float[] p,
int a,
int b)
public static float squareSegmentDistance(float[] p,
int a,
int b,
int c)
public static double distance(float[] p,
int a,
int b)
public static double distance2D(float[] a,
float[] b)
a - point a[x,y]b - point b[x,y]public static float distancePointLine2D(float[] pP,
float[] pL,
float[] vL)
pP - pointpL - point of linevL - vector of linepublic static double dotProduct(float[] p,
int a,
int b,
int c)
public static float dotProduct(float[] a,
float[] b)
a - first vectorb - second vectorpublic static float[] intersectionLines2D(float[] pA,
float[] vA,
float[] pB,
float[] vB)
pA - position vector of AvA - direction vector of ApB - position vector of BvB - direction vector of Bpublic static float[] intersectionLinePlane(float[] pL,
float[] vL,
float[] pP,
float[] vP)
pL - position vector of linevL - direction vector of linepP - position vector of planevP - normal vector of planepublic static float isClockwise(float[] points,
int size)
points - the points arraysize - the number of point coordinatespublic static float isTrisClockwise(float[] pA,
float[] pB,
float[] pC)
public static double length(float[] vec)
public static float[] normalize(float[] vec)
public static java.util.List<float[]> normalizedVectors2D(java.util.List<float[]> points,
java.util.List<java.lang.Float> outLengths)
points - the list of 2D pointsoutLengths - the optional list to store lengths of vectorspublic static float[] normalOfPlane(float[] pA,
float[] pB,
float[] pC)
pA - first point of planepB - second point of planepC - third point of planepublic static float[] scale(float[] v,
float scale)
v - the vectorscale - the scale