Documentation ¶
Index ¶
- type ConvexHull
- func (ch *ConvexHull) ClipAgainstHull(chB *ConvexHull, posA, posB *math32.Vector3, quatA, quatB *math32.Quaternion, ...) []collision.Contact
- func (ch *ConvexHull) ComputeWorldFaceNormalsAndUniqueEdges(quat *math32.Quaternion)
- func (ch *ConvexHull) FaceNormals() []math32.Vector3
- func (ch *ConvexHull) Faces() [][3]math32.Vector3
- func (ch *ConvexHull) FindPenetrationAxis(chB *ConvexHull, posA, posB *math32.Vector3, quatA, quatB *math32.Quaternion) (bool, math32.Vector3)
- func (ch *ConvexHull) ProjectOntoWorldAxis(worldAxis, pos *math32.Vector3, quat *math32.Quaternion) (float32, float32)
- func (ch *ConvexHull) TestPenetrationAxis(chB *ConvexHull, worldAxis, posA, posB *math32.Vector3, ...) (bool, float32)
- func (ch *ConvexHull) UniqueEdges() []math32.Vector3
- func (ch *ConvexHull) WorldFace(face [3]math32.Vector3, pos *math32.Vector3, quat *math32.Quaternion) [3]math32.Vector3
- func (ch *ConvexHull) WorldFaceNormals() []math32.Vector3
- func (ch *ConvexHull) WorldUniqueEdges() []math32.Vector3
- type IShape
- type Plane
- func (p *Plane) Area() float32
- func (p *Plane) BoundingBox() math32.Box3
- func (p *Plane) BoundingSphere() math32.Sphere
- func (p *Plane) Normal() math32.Vector3
- func (p *Plane) ProjectOntoAxis(localAxis *math32.Vector3) (float32, float32)
- func (p *Plane) RotationalInertia(mass float32) math32.Matrix3
- func (p *Plane) Volume() float32
- type Shape
- type Sphere
- func (s *Sphere) Area() float32
- func (s *Sphere) BoundingBox() math32.Box3
- func (s *Sphere) BoundingSphere() math32.Sphere
- func (s *Sphere) ProjectOntoAxis(localAxis *math32.Vector3) (float32, float32)
- func (s *Sphere) Radius() float32
- func (s *Sphere) RotationalInertia(mass float32) math32.Matrix3
- func (s *Sphere) SetRadius(radius float32)
- func (s *Sphere) Volume() float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConvexHull ¶
ConvexHull is a convex triangle-based geometry used for collision detection and contact resolution.
func NewConvexHull ¶
func NewConvexHull(geom *geometry.Geometry) *ConvexHull
func (*ConvexHull) ClipAgainstHull ¶
func (ch *ConvexHull) ClipAgainstHull(chB *ConvexHull, posA, posB *math32.Vector3, quatA, quatB *math32.Quaternion, penAxis *math32.Vector3, minDist, maxDist float32) []collision.Contact
{array} result The an array of contact point objects, see clipFaceAgainstHull
func (*ConvexHull) ComputeWorldFaceNormalsAndUniqueEdges ¶
func (ch *ConvexHull) ComputeWorldFaceNormalsAndUniqueEdges(quat *math32.Quaternion)
ComputeWorldFaceNormalsAndUniqueEdges
func (*ConvexHull) FaceNormals ¶
func (ch *ConvexHull) FaceNormals() []math32.Vector3
func (*ConvexHull) Faces ¶
func (ch *ConvexHull) Faces() [][3]math32.Vector3
func (*ConvexHull) FindPenetrationAxis ¶
func (ch *ConvexHull) FindPenetrationAxis(chB *ConvexHull, posA, posB *math32.Vector3, quatA, quatB *math32.Quaternion) (bool, math32.Vector3)
FindPenetrationAxis finds the penetration axis between two convex bodies. The normal points from bodyA to bodyB. Returns false if there is no penetration. If there is a penetration - returns true and the penetration axis.
func (*ConvexHull) ProjectOntoWorldAxis ¶
func (ch *ConvexHull) ProjectOntoWorldAxis(worldAxis, pos *math32.Vector3, quat *math32.Quaternion) (float32, float32)
ProjectOntoWorldAxis projects the geometry onto the specified world axis.
func (*ConvexHull) TestPenetrationAxis ¶
func (ch *ConvexHull) TestPenetrationAxis(chB *ConvexHull, worldAxis, posA, posB *math32.Vector3, quatA, quatB *math32.Quaternion) (bool, float32)
Both hulls are projected onto the axis and the overlap size (penetration depth) is returned if there is one. return {number} The overlap depth, or FALSE if no penetration.
func (*ConvexHull) UniqueEdges ¶
func (ch *ConvexHull) UniqueEdges() []math32.Vector3
func (*ConvexHull) WorldFace ¶
func (ch *ConvexHull) WorldFace(face [3]math32.Vector3, pos *math32.Vector3, quat *math32.Quaternion) [3]math32.Vector3
func (*ConvexHull) WorldFaceNormals ¶
func (ch *ConvexHull) WorldFaceNormals() []math32.Vector3
func (*ConvexHull) WorldUniqueEdges ¶
func (ch *ConvexHull) WorldUniqueEdges() []math32.Vector3
type IShape ¶
type IShape interface { BoundingBox() math32.Box3 BoundingSphere() math32.Sphere Area() float32 Volume() float32 RotationalInertia(mass float32) math32.Matrix3 ProjectOntoAxis(localAxis *math32.Vector3) (float32, float32) }
IShape is the interface for all collision shapes. Shapes in this package satisfy this interface and also geometry.Geometry.
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
Plane is an analytical collision Plane. A plane, facing in the +Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid.
func NewPlane ¶
func NewPlane() *Plane
NewPlane creates and returns a pointer to a new analytical collision plane.
func (*Plane) BoundingBox ¶
BoundingBox computes and returns the bounding box of the analytical collision plane.
func (*Plane) BoundingSphere ¶
BoundingSphere computes and returns the bounding sphere of the analytical collision plane.
func (*Plane) ProjectOntoAxis ¶
ProjectOntoAxis returns the minimum and maximum distances of the analytical collision plane projected onto the specified local axis.
func (*Plane) RotationalInertia ¶
RotationalInertia computes and returns the rotational inertia of the analytical collision plane.
type Shape ¶
type Shape struct {
// contains filtered or unexported fields
}
Shape is a collision shape. It can be an analytical geometry such as a sphere, plane, etc.. or it can be defined by a polygonal Geometry.
type Sphere ¶
type Sphere struct {
// contains filtered or unexported fields
}
Sphere is an analytical collision sphere.
func (*Sphere) Area ¶
Area computes and returns the surface area of the analytical collision sphere.
func (*Sphere) BoundingBox ¶
BoundingBox computes and returns the bounding box of the analytical collision sphere.
func (*Sphere) BoundingSphere ¶
BoundingSphere computes and returns the bounding sphere of the analytical collision sphere.
func (*Sphere) ProjectOntoAxis ¶
ProjectOntoAxis computes and returns the minimum and maximum distances of the analytical collision sphere projected onto the specified local axis.
func (*Sphere) RotationalInertia ¶
RotationalInertia computes and returns the rotational inertia of the analytical collision sphere.