geo Class
Computational geometry algorithms, is a static class
Item Index
Methods
- createPlane
- distance2PointToPlane
- distancePointToPlane
- extractPlanes
- frustumTestBox
- frustumTestSphere
- project2DPointOnLine
- projectPointOnLine
- projectPointOnPlane
- reflectPointInPlane
- testBBoxBBox
- testPoint2DInPolygon
- testPointBBox
- testRayBBox
- testRayBox
- testRayPlane
- testRaySphere
- testRaySphere
- testSegmentPlane
- testSphereBBox
Methods
createPlane
-
P
-
N
Returns a float4 containing the info about a plane with normal N and that passes through point P
Parameters:
-
P
Vec3 -
N
Vec3
Returns:
plane values
distance2PointToPlane
-
point
-
plane
Computes the square distance between the point and the plane
Parameters:
-
point
Vec3 -
plane
Vec4
Returns:
distance*distance
distancePointToPlane
-
point
-
plane
Computes the distance between the point and the plane
Parameters:
-
point
Vec3 -
plane
Vec4
Returns:
distance
extractPlanes
-
viewprojection
extract frustum planes given a view-projection matrix
Parameters:
-
viewprojection
Mat4matrix
Returns:
returns all 6 planes in a float32array[24]
frustumTestBox
-
planes
-
boundindbox
test a BBox against the frustum
Parameters:
-
planes
Float32Arrayfrustum planes
-
boundindbox
BBoxin BBox format
Returns:
CLIP_INSIDE, CLIP_OVERLAP, CLIP_OUTSIDE
frustumTestSphere
-
center
-
radius
test a Sphere against the frustum
Parameters:
-
center
Vec3sphere center
-
radius
Numbersphere radius
Returns:
CLIP_INSIDE, CLIP_OVERLAP, CLIP_OUTSIDE
project2DPointOnLine
-
P
-
A
-
B
-
result
Projects a 2D point on a 2D line
Parameters:
-
P
Vec2 -
A
Vec2line start
-
B
Vec2line end
-
result
Vec2to store result (optional)
Returns:
projectec point
projectPointOnLine
-
P
-
A
-
B
-
result
Projects a 3D point on a 3D line
Parameters:
-
P
Vec3 -
A
Vec3line start
-
B
Vec3line end
-
result
Vec3to store result (optional)
Returns:
projectec point
projectPointOnPlane
-
point
-
P
-
N
-
result
Projects point on plane
Parameters:
-
point
Vec3 -
P
Vec3plane point
-
N
Vec3plane normal
-
result
Vec3to store result (optional)
Returns:
projectec point
reflectPointInPlane
-
point
-
P
-
N
Finds the reflected point over a plane (useful for reflecting camera position when rendering reflections)
Parameters:
-
point
Vec3point to reflect
-
P
Vec3point where the plane passes
-
N
Vec3normal of the plane
Returns:
reflected point
testBBoxBBox
-
a
-
b
test if a BBox overlaps another BBox
Returns:
true if it overlaps
testPoint2DInPolygon
-
poly
-
point
test if a 2d point is inside a 2d polygon
Parameters:
-
poly
Arrayarray of 2d points
-
point
Vec2
Returns:
true if it is inside
testPointBBox
-
point
-
bbox
test if a 3d point is inside a BBox
Parameters:
-
point
Vec3 -
bbox
BBox
Returns:
true if it is inside
testRayBBox
-
origin
-
direction
-
box
-
model
-
result
test a ray bounding-box collision, it uses the BBox class and allows to use non-axis aligned bbox
Parameters:
-
origin
Vec3ray origin
-
direction
Vec3ray direction
-
box
BBoxin BBox format
-
model
Mat4transformation of the BBox [optional]
-
result
Vec3collision position in world space unless in_local is true
Returns:
returns if the ray collides the box
testRayBox
-
start
-
direction
-
minB
-
maxB
-
result
test a ray bounding-box collision and retrieves the collision point, the BB must be Axis Aligned
Parameters:
-
start
Vec3ray start
-
direction
Vec3ray direction
-
minB
Vec3minimum position of the bounding box
-
maxB
Vec3maximim position of the bounding box
-
result
Vec3collision position
Returns:
returns if the ray collides the box
testRayPlane
-
start
-
direction
-
P
-
N
-
result
test a ray plane collision and retrieves the collision point
Parameters:
-
start
Vec3ray start
-
direction
Vec3ray direction
-
P
Vec3point where the plane passes
-
N
Vec3normal of the plane
-
result
Vec3collision position
Returns:
returns if the ray collides the plane or the ray is parallel to the plane
testRaySphere
-
start
-
direction
-
center
-
radius
-
result
-
max_dist
test a ray sphere collision and retrieves the collision point
Parameters:
-
start
Vec3ray start
-
direction
Vec3ray direction (normalized)
-
center
Vec3center of the sphere
-
radius
Numberradius of the sphere
-
result
Vec3collision position
-
max_dist
Numbernot fully tested
Returns:
returns if the ray collides the sphere
testRaySphere
-
start
-
direction
-
p
-
q
-
r
-
result
test a ray cylinder collision and retrieves the collision point
Parameters:
-
start
Vec3ray start
-
direction
Vec3ray direction
-
p
Vec3center of the cylinder
-
q
Numberheight of the cylinder
-
r
Numberradius of the cylinder
-
result
Vec3collision position
Returns:
returns if the ray collides the cylinder
testSegmentPlane
-
start
-
end
-
P
-
N
-
result
test collision between segment and plane and retrieves the collision point
Parameters:
-
start
Vec3segment start
-
end
Vec3segment end
-
P
Vec3point where the plane passes
-
N
Vec3normal of the plane
-
result
Vec3collision position
Returns:
returns if the segment collides the plane or it is parallel to the plane
testSphereBBox
-
point
-
radius
-
bounding_box
test if a sphere overlaps a BBox
Parameters:
-
point
Vec3 -
radius
Float -
bounding_box
BBox
Returns:
true if it overlaps