JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.math.VectorUtil Class Reference
Collaboration diagram for com.jogamp.math.VectorUtil:

Static Public Member Functions

static boolean isVec2Zero (final Vec3f vec)
 Return true if 2D vector components are zero, no FloatUtil#EPSILON is taken into consideration. More...
 
static boolean isZero (final float x, final float y, final float z, final float epsilon)
 Return true if all three vector components are zero, i.e. More...
 
static boolean isZero (final float x, final float y, final float z)
 Return true if all three vector components are zero, i.e. More...
 
static float distSquareVec3 (final float[] v1, final float[] v2)
 Return the squared distance between the given two points described vector v1 and v2. More...
 
static float distVec3 (final float[] v1, final float[] v2)
 Return the distance between the given two points described vector v1 and v2. More...
 
static float normSquareVec2 (final float[] vec)
 Return the squared length of a vector, a.k.a the squared norm or squared magnitude More...
 
static float normSquareVec3 (final float[] vec)
 Return the squared length of a vector, a.k.a the squared norm or squared magnitude More...
 
static float normSquareVec3 (final float[] vec, final int offset)
 Return the squared length of a vector, a.k.a the squared norm or squared magnitude More...
 
static float normVec2 (final float[] vec)
 Return the length of a vector, a.k.a the norm or magnitude More...
 
static float[] normalizeVec3 (final float[] vector)
 Normalize a vector in place. More...
 
static float[] normalizeVec3 (final float[] vector, final int offset)
 Normalize a vector in place. More...
 
static float[] scaleVec2 (final float[] result, final float[] vector, final float scale)
 Scales a vector by param using given result float[], result = vector * scale. More...
 
static float[] scaleVec2 (final float[] result, final float[] vector, final float[] scale)
 Scales a vector by param using given result float[], result = vector * scale. More...
 
static float[] divVec2 (final float[] result, final float[] vector, final float scale)
 Divides a vector by param using given result float[], result = vector / scale. More...
 
static float[] divVec2 (final float[] result, final float[] vector, final float[] scale)
 Divides a vector by param using given result float[], result = vector / scale. More...
 
static float[] addVec2 (final float[] result, final float[] v1, final float[] v2)
 Adds two vectors, result = v1 + v2. More...
 
static float[] subVec2 (final float[] result, final float[] v1, final float[] v2)
 Subtracts two vectors, result = v1 - v2. More...
 
static float[] crossVec3 (final float[] r, final int r_offset, final float[] v1, final int v1_offset, final float[] v2, final int v2_offset)
 cross product vec1 x vec2 More...
 
static Vec3f midpoint (final Vec3f result, final Vec3f p1, final Vec3f p2)
 Calculate the midpoint of two points. More...
 
static float determinant (final Vec3f a, final Vec3f b, final Vec3f c)
 Return the determinant of 3 vectors. More...
 
static boolean isCollinear (final Vec3f v1, final Vec3f v2, final Vec3f v3)
 Check if three vertices are collinear. More...
 
static boolean isInCircle (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d)
 Check if vertices in triangle circumcircle given d vertex, from paper by Guibas and Stolfi (1985). More...
 
static double inCircleVal (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d)
 
static double triArea (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c)
 Computes oriented double area of a triangle, i.e. More...
 
static boolean isInTriangle (final Vec3f a, final Vec3f b, final Vec3f c, final Vec3f p, final Vec3f ac, final Vec3f ab, final Vec3f ap)
 Check if a vertex is in triangle using barycentric coordinates computation. More...
 
static boolean isInTriangle3 (final Vec3f a, final Vec3f b, final Vec3f c, final Vec3f p1, final Vec3f p2, final Vec3f p3, final Vec3f ac, final Vec3f ab, final Vec3f ap)
 Check if one of three vertices are in triangle using barycentric coordinates computation. More...
 
static boolean isInTriangle3 (final Vec3f a, final Vec3f b, final Vec3f c, final Vec3f p1, final Vec3f p2, final Vec3f p3, final Vec3f ac, final Vec3f ab, final Vec3f ap, final float epsilon)
 Check if one of three vertices are in triangle using barycentric coordinates computation, using given epsilon for comparison. More...
 
static boolean isCCW (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c)
 Check if points are in ccw order. More...
 
static Winding getWinding (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c)
 Compute the winding of the 3 given points. More...
 
static double area (final List<? extends Vert2fImmutable > vertices)
 Computes the area of a list of vertices via shoelace formula. More...
 
static Winding getWinding (final List<? extends Vert2fImmutable > vertices)
 Compute the winding using the area(List) function over all vertices for complex shapes. More...
 
static Vec4f getPlaneVec3 (final Vec4f resultV4, final Vec3f normalVec3, final Vec3f pVec3)
 Finds the plane equation of a plane given its normal and a point on the plane. More...
 
static Vec4f getPlaneVec3 (final Vec4f resultVec4, final Vec3f v1, final Vec3f v2, final Vec3f v3, final Vec3f temp1V3, final Vec3f temp2V3, final Vec3f temp3V3)
 This finds the plane equation of a triangle given three vertices. More...
 
static Vec3f line2PlaneIntersection (final Vec3f result, final Ray ray, final Vec4f plane, final float epsilon)
 Return intersection of an infinite line with a plane if exists, otherwise null. More...
 
static Vec3f line2lineIntersection0 (final Vec3f result, final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d)
 Compute intersection between two lines. More...
 
static Vec3f seg2SegIntersection0 (final Vec3f result, final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d)
 Compute intersection between two segments. More...
 
static boolean testSeg2SegIntersection0 (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d)
 Compute intersection between two segments. More...
 
static boolean testTri2SegIntersection0 (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d, final Vert2fImmutable e)
 Check if a segment intersects with a triangle. More...
 
static boolean seg2SegIntersection (final Vec3f result, final Vec2f p, final Vec2f p2, final Vec2f q, final Vec2f q2, final float epsilon, final boolean doCollinear)
 Line segment intersection test and returning the intersecting point. More...
 
static boolean testSeg2SegIntersection (final Vec2f p, final Vec2f p2, final Vec2f q, final Vec2f q2, final float epsilon, final boolean doCollinear)
 Line segment intersection test. More...
 
static boolean testSeg2SegIntersection (final Vert2fImmutable p, final Vert2fImmutable p2, final Vert2fImmutable q, final Vert2fImmutable q2, final float epsilon, final boolean doCollinear)
 Line segment intersection test. More...
 
static boolean testTri2SegIntersection (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d, final Vert2fImmutable e, final float epsilon, final boolean doCollinear)
 Check if a segment intersects with a triangle. More...
 
static boolean testSeg2SegIntersection (final Vert2fImmutable p, final Vert2fImmutable p2, final Vert2fImmutable q, final Vert2fImmutable q2)
 Line segment intersection test using FloatUtil#EPSILON w/o considering collinear-case. More...
 
static boolean testTri2SegIntersection (final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d, final Vert2fImmutable e)
 Check if a segment intersects with a triangle using FloatUtil#EPSILON w/o considering collinear-case. More...
 
static boolean isConvex0 (final List<? extends Vert2fImmutable > polyline, final boolean shortIsConvex)
 Returns whether the given polyline denotes a convex shape with O(n) complexity. More...
 
static boolean isConvex1 (final List< Vertex > polyline, final boolean shortIsConvex)
 Returns whether the given on-curve polyline points denotes a convex shape with O(n) complexity. More...
 
static boolean isSelfIntersecting1 (final List< Vertex > polyline)
 Returns whether the given polyline is self-intersecting shape (crossing over) with O(n*n) complexity. More...
 

Detailed Description

Definition at line 35 of file VectorUtil.java.

Member Function Documentation

◆ addVec2()

static float[] com.jogamp.math.VectorUtil.addVec2 ( final float[]  result,
final float[]  v1,
final float[]  v2 
)
static

Adds two vectors, result = v1 + v2.

Parameters
resultfloat[2] result vector, may be either v1 or v2 (in-place)
v1vector 1
v2vector 2
Returns
result vector for chaining

Definition at line 222 of file VectorUtil.java.

◆ area()

static double com.jogamp.math.VectorUtil.area ( final List<? extends Vert2fImmutable vertices)
static

Computes the area of a list of vertices via shoelace formula.

This method is utilized e.g. to reliably compute the Winding of complex shapes.

Implementation uses double precision.

Parameters
vertices
Returns
positive area if ccw else negative area value
See also
#getWinding(List)

Definition at line 558 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crossVec3()

static float[] com.jogamp.math.VectorUtil.crossVec3 ( final float[]  r,
final int  r_offset,
final float[]  v1,
final int  v1_offset,
final float[]  v2,
final int  v2_offset 
)
static

cross product vec1 x vec2

Parameters
v1vector 1
v2vector 2
Returns
the resulting vector

Definition at line 247 of file VectorUtil.java.

Here is the caller graph for this function:

◆ determinant()

static float com.jogamp.math.VectorUtil.determinant ( final Vec3f  a,
final Vec3f  b,
final Vec3f  c 
)
static

Return the determinant of 3 vectors.

Parameters
avector 1
bvector 2
cvector 3
Returns
the determinant value

Definition at line 275 of file VectorUtil.java.

Here is the caller graph for this function:

◆ distSquareVec3()

static float com.jogamp.math.VectorUtil.distSquareVec3 ( final float[]  v1,
final float[]  v2 
)
static

Return the squared distance between the given two points described vector v1 and v2.

When comparing the relative distance between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square root operation.

Definition at line 74 of file VectorUtil.java.

Here is the caller graph for this function:

◆ distVec3()

static float com.jogamp.math.VectorUtil.distVec3 ( final float[]  v1,
final float[]  v2 
)
static

Return the distance between the given two points described vector v1 and v2.

Definition at line 84 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ divVec2() [1/2]

static float[] com.jogamp.math.VectorUtil.divVec2 ( final float[]  result,
final float[]  vector,
final float  scale 
)
static

Divides a vector by param using given result float[], result = vector / scale.

Parameters
resultvector for the result, may be vector (in-place)
vectorinput vector
scalesingle scale constant for all vector components
Returns
result vector for chaining

Definition at line 195 of file VectorUtil.java.

◆ divVec2() [2/2]

static float[] com.jogamp.math.VectorUtil.divVec2 ( final float[]  result,
final float[]  vector,
final float[]  scale 
)
static

Divides a vector by param using given result float[], result = vector / scale.

Parameters
resultvector for the result, may be vector (in-place)
vectorinput vector
scale2 component scale constant for each vector component
Returns
result vector for chaining

Definition at line 208 of file VectorUtil.java.

◆ getPlaneVec3() [1/2]

static Vec4f com.jogamp.math.VectorUtil.getPlaneVec3 ( final Vec4f  resultV4,
final Vec3f  normalVec3,
final Vec3f  pVec3 
)
static

Finds the plane equation of a plane given its normal and a point on the plane.

Parameters
resultV4vec4 plane equation
normalVec3
pVec3
Returns
result for chaining

Definition at line 594 of file VectorUtil.java.

Here is the call graph for this function:

◆ getPlaneVec3() [2/2]

static Vec4f com.jogamp.math.VectorUtil.getPlaneVec3 ( final Vec4f  resultVec4,
final Vec3f  v1,
final Vec3f  v2,
final Vec3f  v3,
final Vec3f  temp1V3,
final Vec3f  temp2V3,
final Vec3f  temp3V3 
)
static

This finds the plane equation of a triangle given three vertices.

Parameters
resultVec4vec4 plane equation
v1vec3
v2vec3
v3vec3
temp1V3
temp2V3
Returns
result for chaining

Definition at line 616 of file VectorUtil.java.

Here is the call graph for this function:

◆ getWinding() [1/2]

static Winding com.jogamp.math.VectorUtil.getWinding ( final List<? extends Vert2fImmutable vertices)
static

Compute the winding using the area(List) function over all vertices for complex shapes.

Uses the area(List) function over all points on complex shapes for a reliable result!

Implementation uses double precision.

Parameters
verticesarray of Vertices
Returns
Winding#CCW or Winding#CW
See also
#area(List)

Definition at line 582 of file VectorUtil.java.

Here is the call graph for this function:

◆ getWinding() [2/2]

static Winding com.jogamp.math.VectorUtil.getWinding ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c 
)
static

Compute the winding of the 3 given points.

Consider using getWinding(List) using the area(List) function over all points on complex shapes for a reliable result!

Parameters
afirst vertex
bsecond vertex
cthird vertex
Returns
Winding#CCW or Winding#CW
See also
#getWinding(List)

Definition at line 542 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inCircleVal()

static double com.jogamp.math.VectorUtil.inCircleVal ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d 
)
static

Definition at line 304 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCCW()

static boolean com.jogamp.math.VectorUtil.isCCW ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c 
)
static

Check if points are in ccw order.

Consider using getWinding(List) using the area(List) function over all points on complex shapes for a reliable result!

Parameters
afirst vertex
bsecond vertex
cthird vertex
Returns
true if the points a,b,c are in a ccw order
See also
#getWinding(List)

Definition at line 526 of file VectorUtil.java.

Here is the call graph for this function:

◆ isCollinear()

static boolean com.jogamp.math.VectorUtil.isCollinear ( final Vec3f  v1,
final Vec3f  v2,
final Vec3f  v3 
)
static

Check if three vertices are collinear.

Parameters
v1vertex 1
v2vertex 2
v3vertex 3
Returns
true if collinear, false otherwise

Definition at line 286 of file VectorUtil.java.

Here is the call graph for this function:

◆ isConvex0()

static boolean com.jogamp.math.VectorUtil.isConvex0 ( final List<? extends Vert2fImmutable polyline,
final boolean  shortIsConvex 
)
static

Returns whether the given polyline denotes a convex shape with O(n) complexity.

See Determine whether a polygon is convex based on its vertices

Parameters
polylineconnected Vert2fImmutable, i.e. a poly-line
shortIsConvexreturn value if vertices have less than three elements, allows simplification

Definition at line 1092 of file VectorUtil.java.

Here is the call graph for this function:

◆ isConvex1()

static boolean com.jogamp.math.VectorUtil.isConvex1 ( final List< Vertex polyline,
final boolean  shortIsConvex 
)
static

Returns whether the given on-curve polyline points denotes a convex shape with O(n) complexity.

See Determine whether a polygon is convex based on its vertices

All off-curve points are ignored.

Parameters
polylineconnected Vert2fImmutable, i.e. a poly-line
shortIsConvexreturn value if vertices have less than three elements, allows simplification

Definition at line 1213 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInCircle()

static boolean com.jogamp.math.VectorUtil.isInCircle ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d 
)
static

Check if vertices in triangle circumcircle given d vertex, from paper by Guibas and Stolfi (1985).

Implementation uses double precision.

Parameters
atriangle vertex 1
btriangle vertex 2
ctriangle vertex 3
dvertex in question
Returns
true if the vertex d is inside the circle defined by the vertices a, b, c.

Definition at line 301 of file VectorUtil.java.

Here is the call graph for this function:

◆ isInTriangle()

static boolean com.jogamp.math.VectorUtil.isInTriangle ( final Vec3f  a,
final Vec3f  b,
final Vec3f  c,
final Vec3f  p,
final Vec3f  ac,
final Vec3f  ab,
final Vec3f  ap 
)
static

Check if a vertex is in triangle using barycentric coordinates computation.

Parameters
afirst triangle vertex
bsecond triangle vertex
cthird triangle vertex
pthe vertex in question
actemporary storage
abtemporary storage
aptemporary storage
Returns
true if p is in triangle (a, b, c), false otherwise.

Definition at line 347 of file VectorUtil.java.

Here is the call graph for this function:

◆ isInTriangle3() [1/2]

static boolean com.jogamp.math.VectorUtil.isInTriangle3 ( final Vec3f  a,
final Vec3f  b,
final Vec3f  c,
final Vec3f  p1,
final Vec3f  p2,
final Vec3f  p3,
final Vec3f  ac,
final Vec3f  ab,
final Vec3f  ap 
)
static

Check if one of three vertices are in triangle using barycentric coordinates computation.

Parameters
afirst triangle vertex
bsecond triangle vertex
cthird triangle vertex
p1the vertex in question
p2the vertex in question
p3the vertex in question
actemporary storage
abtemporary storage
aptemporary storage
Returns
true if p1 or p2 or p3 is in triangle (a, b, c), false otherwise.

Definition at line 384 of file VectorUtil.java.

Here is the call graph for this function:

◆ isInTriangle3() [2/2]

static boolean com.jogamp.math.VectorUtil.isInTriangle3 ( final Vec3f  a,
final Vec3f  b,
final Vec3f  c,
final Vec3f  p1,
final Vec3f  p2,
final Vec3f  p3,
final Vec3f  ac,
final Vec3f  ab,
final Vec3f  ap,
final float  epsilon 
)
static

Check if one of three vertices are in triangle using barycentric coordinates computation, using given epsilon for comparison.

Parameters
afirst triangle vertex
bsecond triangle vertex
cthird triangle vertex
p1the vertex in question
p2the vertex in question
p3the vertex in question
tmpAC
tmpAB
tmpAP
Returns
true if p1 or p2 or p3 is in triangle (a, b, c), false otherwise.

Definition at line 452 of file VectorUtil.java.

Here is the call graph for this function:

◆ isSelfIntersecting1()

static boolean com.jogamp.math.VectorUtil.isSelfIntersecting1 ( final List< Vertex polyline)
static

Returns whether the given polyline is self-intersecting shape (crossing over) with O(n*n) complexity.

Definition at line 1340 of file VectorUtil.java.

Here is the call graph for this function:

◆ isVec2Zero()

static boolean com.jogamp.math.VectorUtil.isVec2Zero ( final Vec3f  vec)
static

Return true if 2D vector components are zero, no FloatUtil#EPSILON is taken into consideration.

Definition at line 39 of file VectorUtil.java.

Here is the caller graph for this function:

◆ isZero() [1/2]

static boolean com.jogamp.math.VectorUtil.isZero ( final float  x,
final float  y,
final float  z 
)
static

Return true if all three vector components are zero, i.e.

it's their absolute value < FloatUtil#EPSILON.

Implementation uses FloatUtil#isZero(float), see API doc for details.

Definition at line 61 of file VectorUtil.java.

Here is the call graph for this function:

◆ isZero() [2/2]

static boolean com.jogamp.math.VectorUtil.isZero ( final float  x,
final float  y,
final float  z,
final float  epsilon 
)
static

Return true if all three vector components are zero, i.e.

it's their absolute value < epsilon.

Implementation uses FloatUtil#isZero(float, float), see API doc for details.

Definition at line 49 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ line2lineIntersection0()

static Vec3f com.jogamp.math.VectorUtil.line2lineIntersection0 ( final Vec3f  result,
final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d 
)
static

Compute intersection between two lines.

Parameters
avertex 1 of first line
bvertex 2 of first line
cvertex 1 of second line
dvertex 2 of second line
Returns
the intersection coordinates if the lines intersect, otherwise returns null
Deprecated:
analyze correctness

Definition at line 663 of file VectorUtil.java.

Here is the call graph for this function:

◆ line2PlaneIntersection()

static Vec3f com.jogamp.math.VectorUtil.line2PlaneIntersection ( final Vec3f  result,
final Ray  ray,
final Vec4f  plane,
final float  epsilon 
)
static

Return intersection of an infinite line with a plane if exists, otherwise null.

Thanks to Norman Vine – nhv@y.nosp@m.ahoo.nosp@m..com (with hacks by Steve)

Parameters
resultvec3 result buffer for intersecting coords
rayhere representing an infinite line, origin and direction.
planevec4 plane equation
epsilon
Returns
resulting intersecting if exists, otherwise null

Definition at line 641 of file VectorUtil.java.

Here is the call graph for this function:

◆ midpoint()

static Vec3f com.jogamp.math.VectorUtil.midpoint ( final Vec3f  result,
final Vec3f  p1,
final Vec3f  p2 
)
static

Calculate the midpoint of two points.

Parameters
p1first point vector
p2second point vector
Returns
midpoint

Definition at line 261 of file VectorUtil.java.

Here is the call graph for this function:

◆ normalizeVec3() [1/2]

static float[] com.jogamp.math.VectorUtil.normalizeVec3 ( final float[]  vector)
static

Normalize a vector in place.

Parameters
vectorinput vector
Returns
normalized output vector

Definition at line 126 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeVec3() [2/2]

static float[] com.jogamp.math.VectorUtil.normalizeVec3 ( final float[]  vector,
final int  offset 
)
static

Normalize a vector in place.

Parameters
vectorinput vector
Returns
normalized output vector

Definition at line 146 of file VectorUtil.java.

Here is the call graph for this function:

◆ normSquareVec2()

static float com.jogamp.math.VectorUtil.normSquareVec2 ( final float[]  vec)
static

Return the squared length of a vector, a.k.a the squared norm or squared magnitude

Definition at line 91 of file VectorUtil.java.

Here is the caller graph for this function:

◆ normSquareVec3() [1/2]

static float com.jogamp.math.VectorUtil.normSquareVec3 ( final float[]  vec)
static

Return the squared length of a vector, a.k.a the squared norm or squared magnitude

Definition at line 98 of file VectorUtil.java.

Here is the caller graph for this function:

◆ normSquareVec3() [2/2]

static float com.jogamp.math.VectorUtil.normSquareVec3 ( final float[]  vec,
final int  offset 
)
static

Return the squared length of a vector, a.k.a the squared norm or squared magnitude

Definition at line 105 of file VectorUtil.java.

◆ normVec2()

static float com.jogamp.math.VectorUtil.normVec2 ( final float[]  vec)
static

Return the length of a vector, a.k.a the norm or magnitude

Definition at line 117 of file VectorUtil.java.

Here is the call graph for this function:

◆ scaleVec2() [1/2]

static float[] com.jogamp.math.VectorUtil.scaleVec2 ( final float[]  result,
final float[]  vector,
final float  scale 
)
static

Scales a vector by param using given result float[], result = vector * scale.

Parameters
resultvector for the result, may be vector (in-place)
vectorinput vector
scalesingle scale constant for all vector components
Returns
result vector for chaining

Definition at line 168 of file VectorUtil.java.

◆ scaleVec2() [2/2]

static float[] com.jogamp.math.VectorUtil.scaleVec2 ( final float[]  result,
final float[]  vector,
final float[]  scale 
)
static

Scales a vector by param using given result float[], result = vector * scale.

Parameters
resultvector for the result, may be vector (in-place)
vectorinput vector
scale2 component scale constant for each vector component
Returns
result vector for chaining

Definition at line 181 of file VectorUtil.java.

◆ seg2SegIntersection()

static boolean com.jogamp.math.VectorUtil.seg2SegIntersection ( final Vec3f  result,
final Vec2f  p,
final Vec2f  p2,
final Vec2f  q,
final Vec2f  q2,
final float  epsilon,
final boolean  doCollinear 
)
static

Line segment intersection test and returning the intersecting point.

See p + t r = q + u s and its terse C# implementation

Implementation uses float precision.

Parameters
pvertex 1 of first segment
p2vertex 2 of first segment
qvertex 1 of second segment
q2vertex 2 of second segment
epsilonoptional epsilon. If 0 just compare against 0, otherwise compare against this epsilon. See FloatUtil#EPSILON
doCollinearconsider collinear case, i.e. overlapping segments as an intersection returning true
Returns
true if line segments are intersecting, otherwise false

Definition at line 771 of file VectorUtil.java.

Here is the call graph for this function:

◆ seg2SegIntersection0()

static Vec3f com.jogamp.math.VectorUtil.seg2SegIntersection0 ( final Vec3f  result,
final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d 
)
static

Compute intersection between two segments.

Parameters
avertex 1 of first segment
bvertex 2 of first segment
cvertex 1 of second segment
dvertex 2 of second segment
Returns
the intersection coordinates if the segments intersect, otherwise returns null
Deprecated:
use seg2SegIntersection(Vec3f, Vec2f, Vec2f, Vec2f, Vec2f, boolean)

Definition at line 687 of file VectorUtil.java.

Here is the call graph for this function:

◆ subVec2()

static float[] com.jogamp.math.VectorUtil.subVec2 ( final float[]  result,
final float[]  v1,
final float[]  v2 
)
static

Subtracts two vectors, result = v1 - v2.

Parameters
resultfloat[2] result vector, may be either v1 or v2 (in-place)
v1vector 1
v2vector 2
Returns
result vector for chaining

Definition at line 235 of file VectorUtil.java.

◆ testSeg2SegIntersection() [1/3]

static boolean com.jogamp.math.VectorUtil.testSeg2SegIntersection ( final Vec2f  p,
final Vec2f  p2,
final Vec2f  q,
final Vec2f  q2,
final float  epsilon,
final boolean  doCollinear 
)
static

Line segment intersection test.

See p + t r = q + u s and its terse C# implementation

Implementation uses float precision.

Parameters
pvertex 1 of first segment
p2vertex 2 of first segment
qvertex 1 of second segment
q2vertex 2 of second segment
epsilonoptional epsilon. If 0 just compare against 0, otherwise compare against this epsilon. See FloatUtil#EPSILON
doCollinearconsider collinear case, i.e. overlapping segments as an intersection returning true
Returns
true if line segments are intersecting, otherwise false

Definition at line 849 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testSeg2SegIntersection() [2/3]

static boolean com.jogamp.math.VectorUtil.testSeg2SegIntersection ( final Vert2fImmutable  p,
final Vert2fImmutable  p2,
final Vert2fImmutable  q,
final Vert2fImmutable  q2 
)
static

Line segment intersection test using FloatUtil#EPSILON w/o considering collinear-case.

See p + t r = q + u s and its terse C# implementation

Implementation uses float precision.

Parameters
pvertex 1 of first segment
p2vertex 2 of first segment
qvertex 1 of second segment
q2vertex 2 of second segment
Returns
true if line segments are intersecting, otherwise false

Definition at line 1026 of file VectorUtil.java.

Here is the call graph for this function:

◆ testSeg2SegIntersection() [3/3]

static boolean com.jogamp.math.VectorUtil.testSeg2SegIntersection ( final Vert2fImmutable  p,
final Vert2fImmutable  p2,
final Vert2fImmutable  q,
final Vert2fImmutable  q2,
final float  epsilon,
final boolean  doCollinear 
)
static

Line segment intersection test.

See p + t r = q + u s and its terse C# implementation

Implementation uses float precision.

Parameters
pvertex 1 of first segment
p2vertex 2 of first segment
qvertex 1 of second segment
q2vertex 2 of second segment
epsilonoptional epsilon. If 0 just compare against 0, otherwise compare against this epsilon. See FloatUtil#EPSILON
doCollinearconsider collinear case, i.e. overlapping segments as an intersection returning true
Returns
true if line segments are intersecting, otherwise false

Definition at line 923 of file VectorUtil.java.

Here is the call graph for this function:

◆ testSeg2SegIntersection0()

static boolean com.jogamp.math.VectorUtil.testSeg2SegIntersection0 ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d 
)
static

Compute intersection between two segments.

Parameters
avertex 1 of first segment
bvertex 2 of first segment
cvertex 1 of second segment
dvertex 2 of second segment
Returns
true if the segments intersect, otherwise returns false
Deprecated:
use testSeg2SegIntersection(Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, float, boolean)

Definition at line 715 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testTri2SegIntersection() [1/2]

static boolean com.jogamp.math.VectorUtil.testTri2SegIntersection ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d,
final Vert2fImmutable  e 
)
static

Check if a segment intersects with a triangle using FloatUtil#EPSILON w/o considering collinear-case.

Implementation uses float precision.

Parameters
avertex 1 of the triangle
bvertex 2 of the triangle
cvertex 3 of the triangle
dvertex 1 of first segment
evertex 2 of first segment
Returns
true if the segment intersects at least one segment of the triangle, false otherwise
See also
testSeg2SegIntersection(Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, float, boolean)

Definition at line 1077 of file VectorUtil.java.

Here is the call graph for this function:

◆ testTri2SegIntersection() [2/2]

static boolean com.jogamp.math.VectorUtil.testTri2SegIntersection ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d,
final Vert2fImmutable  e,
final float  epsilon,
final boolean  doCollinear 
)
static

Check if a segment intersects with a triangle.

Implementation uses float precision.

Parameters
avertex 1 of the triangle
bvertex 2 of the triangle
cvertex 3 of the triangle
dvertex 1 of first segment
evertex 2 of first segment
epsilonoptional epsilon. If 0 just compare against 0, otherwise compare against this epsilon. See FloatUtil#EPSILON
doCollinearconsider collinear case, i.e. overlapping segments as an intersection returning true
Returns
true if the segment intersects at least one segment of the triangle, false otherwise
See also
testSeg2SegIntersection(Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, float, boolean)

Definition at line 1004 of file VectorUtil.java.

Here is the call graph for this function:

◆ testTri2SegIntersection0()

static boolean com.jogamp.math.VectorUtil.testTri2SegIntersection0 ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c,
final Vert2fImmutable  d,
final Vert2fImmutable  e 
)
static

Check if a segment intersects with a triangle.

Parameters
avertex 1 of the triangle
bvertex 2 of the triangle
cvertex 3 of the triangle
dvertex 1 of first segment
evertex 2 of first segment
Returns
true if the segment intersects at least one segment of the triangle, false otherwise
Deprecated:
use testTri2SegIntersection(Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, Vert2fImmutable, float, boolean)

Definition at line 747 of file VectorUtil.java.

Here is the call graph for this function:

◆ triArea()

static double com.jogamp.math.VectorUtil.triArea ( final Vert2fImmutable  a,
final Vert2fImmutable  b,
final Vert2fImmutable  c 
)
static

Computes oriented double area of a triangle, i.e.

the 2x2 determinant with b-a and c-a per column.

      | bx-ax, cx-ax |
det = | by-ay, cy-ay |
Parameters
afirst vertex
bsecond vertex
cthird vertex
Returns
area > 0 CCW, ..

Definition at line 329 of file VectorUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: