package collision
Functions
AddSubBVH
InsertBVH
PointOutsideOfPlane
PointOutsideOfPlane returns true if the given point is outside of the plane
RemoveAllLeavesMatchingTransform
RemoveSubBVH
Types
AABB
struct
AABB is an axis-aligned bounding box
AABBFromMinMax
AABBFromMinMax creates an AABB from the minimum and maximum points
AABBFromTransform
AABBFromWidth
AABBFromWidth creates an AABB from the center and half-width
AABBUnion
Union returns the union of two AABBs
AABB.AABBIntersect
AABBIntersect returns whether the AABB intersects another AABB
AABB.Bounds
////////////////////////////////////////////////////////////////////////////// Satisfying BVH HitObject interface //////////////////////////////////////////////////////////////////////////////
AABB.ClosestDistance
ClosestDistance returns the closest distance between two AABBs
AABB.Contains
Contains returns whether the AABB contains the point
AABB.ContainsAABB
ContainsAABB returns whether the AABB contains another AABB
AABB.Corners
AABB.FromTriangle
FromTriangle returns an AABB that contains the triangle
AABB.InFrustum
InFrustum returns whether the AABB is in the frustum
AABB.LongestAxis
LongestAxis returns the longest axis of the AABB (0 = X, 1 = Y, 2 = Z)
AABB.Max
Max returns the maximum point of the AABB
AABB.Min
Min returns the minimum point of the AABB
AABB.PlaneIntersect
PlaneIntersect returns whether the AABB intersects a plane
AABB.RayHit
RayHit returns the point of intersection and whether the ray hit the AABB
AABB.RayIntersectTest
AABB.Size
Size returns the size of the AABB
AABB.SurfaceArea
AABB.TriangleIntersect
TriangleIntersect returns whether the AABB intersects a triangle
BVH
struct
CloneBVH
NewBVH
BVH.Bounds
BVH.IsLeaf
BVH.RayIntersect
BVH.RayIntersectTest
BVH.Refit
BVHItem
struct
BVHItem.Bounds
BVHItem.IsValid
BVHItem.RayIntersect
DetailedTriangle
struct
type DetailedTriangle struct {
Points [3]matrix.Vec3
Normal matrix.Vec3
Centroid matrix.Vec3
Radius matrix.Float
}
DetailedTriangleFromPoints
DetailedTriangleFromPoints creates a detailed triangle from three points, a detailed triangle is different from a regular triangle in that it contains additional information such as the centroid and radius
DetailedTriangle.Bounds
DetailedTriangle.RayIntersectTest
func (t DetailedTriangle) RayIntersectTest(ray Ray, length float32, transform *matrix.Transform) bool
Frustum
struct
HitObject
interface
type HitObject interface {
Bounds() AABB
RayIntersectTest(ray Ray, length float32, transform *matrix.Transform) bool
}
OOBB
struct
OBBFromAABB
OBBFromTransform
OOBB.Bounds
OOBB.ContainsPoint
OOBB.Corners
OOBB.Intersect
OOBB.RayIntersect
Octree
struct
type Octree struct {
Center matrix.Vec3
HalfWidth matrix.Float
Children [8]*Octree
Objects []HitObject
}
NewOctree
OctreeForMesh
Octree.AsAABB
Octree.Insert
Plane
struct
PlaneCCW
PlaneCCW creates a plane from three points in counter clockwise order
Plane.ClosestPoint
ClosestPoint returns the closest point on the plane to the given point
Plane.Distance
Distance returns the distance from the plane to the given point
Plane.SetFloatValue
SetFloatValue sets the value of the plane at the given index (X, Y, Z, Dot)
Plane.ToArray
ToArray converts the plane to an array of 4 floats
Plane.ToVec4
ToVec4 converts the plane to a Vec4 (analogous to ToArray)
Ray
struct
Ray.PlaneHit
PlaneHit returns the point of intersection with the plane and true if the ray hits the plane
Ray.Point
Point returns the point at the given distance along the ray
Ray.SphereHit
SphereHit returns true if the ray hits the sphere
Ray.TriangleHit
TriangleHit returns true if the ray hits the triangle defined by the three points
Segment
struct
LineSegmentFromRay
LineSegmentFromRay creates a line segment from a ray
Segment.TriangleHit
TriangleHit returns true if the segment hits the triangle defined by the three points
Triangle
struct