Documentation ¶
Index ¶
- type BoundingBox
- func (self *BoundingBox) Clr() *BoundingBox
- func (self *BoundingBox) Contains(b *BoundingBox) bool
- func (self *BoundingBox) ContainsV3(v *Vector3) bool
- func (self *BoundingBox) Ext(x, y, z float32) *BoundingBox
- func (self *BoundingBox) ExtB(bounds *BoundingBox) *BoundingBox
- func (self *BoundingBox) ExtBT(bounds *BoundingBox, transform *Matrix4) *BoundingBox
- func (self *BoundingBox) ExtV3(point *Vector3) *BoundingBox
- func (self *BoundingBox) GetCenter(out *Vector3) *Vector3
- func (self *BoundingBox) GetCenterX() float32
- func (self *BoundingBox) GetCenterY() float32
- func (self *BoundingBox) GetCenterZ() float32
- func (self *BoundingBox) GetCorner000(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner001(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner010(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner011(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner100(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner101(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner110(out *Vector3) *Vector3
- func (self *BoundingBox) GetCorner111(out *Vector3) *Vector3
- func (self *BoundingBox) GetDepth() float32
- func (self *BoundingBox) GetDimensions(out *Vector3) *Vector3
- func (self *BoundingBox) GetHeight() float32
- func (self *BoundingBox) GetMax(out *Vector3) *Vector3
- func (self *BoundingBox) GetMin(out *Vector3) *Vector3
- func (self *BoundingBox) GetWidth() float32
- func (self *BoundingBox) Inf() *BoundingBox
- func (self *BoundingBox) Intersects(b *BoundingBox) bool
- func (self *BoundingBox) IsValid() bool
- func (self *BoundingBox) Mul(transform *Matrix4) *BoundingBox
- func (self *BoundingBox) Set(min, max *Vector3) *BoundingBox
- func (self *BoundingBox) SetB(bounds *BoundingBox) *BoundingBox
- func (self *BoundingBox) SetV(points []*Vector3) *BoundingBox
- func (self *BoundingBox) String() string
- type Ray
- func (self *Ray) Copy() *Ray
- func (self *Ray) GetEndPoint(out *Vector3, distance float32) *Vector3
- func (self *Ray) Mul(matrix *Matrix4) *Ray
- func (self *Ray) Set(x, y, z, dx, dy, dz float32) *Ray
- func (self *Ray) SetRay(ray *Ray) *Ray
- func (self *Ray) SetV3(origin, direction *Vector3) *Ray
- func (self *Ray) String() string
- type Segment
- type Sphere
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoundingBox ¶
type BoundingBox struct {
Min, Max, Cnt, Dim *Vector3
}
Encapsulates an axis aligned bounding box represented by a minimum and a maximum Vector. Additionally you can query for the bounding box's center, dimensions and corner points.
func NewBoundingBox ¶
func NewBoundingBox() *BoundingBox
Constructs a new bounding box with the minimum and maximum vector set to zeros.
func NewBoundingBoxCopy ¶
func NewBoundingBoxCopy(bounds *BoundingBox) *BoundingBox
Constructs a new bounding box from the given bounding box. param bounds The bounding box to copy
func NewBoundingBoxVector3 ¶
func NewBoundingBoxVector3(minimum, maximum *Vector3) *BoundingBox
Constructs the new bounding box using the given minimum and maximum vector. param minimum The minimum vector param maximum The maximum vector
func (*BoundingBox) Clr ¶
func (self *BoundingBox) Clr() *BoundingBox
Sets the minimum and maximum vector to zeros. return This bounding box for chaining.
func (*BoundingBox) Contains ¶
func (self *BoundingBox) Contains(b *BoundingBox) bool
Returns whether the given bounding box is contained in this bounding box. param b The bounding box return Whether the given bounding box is contained
func (*BoundingBox) ContainsV3 ¶
func (self *BoundingBox) ContainsV3(v *Vector3) bool
Returns whether the given vector is contained in this bounding box. param v The vector return Whether the vector is contained or not.
func (*BoundingBox) Ext ¶
func (self *BoundingBox) Ext(x, y, z float32) *BoundingBox
Extends the bounding box by the given vector. param x The x-coordinate param y The y-coordinate param z The z-coordinate return This bounding box for chaining.
func (*BoundingBox) ExtB ¶
func (self *BoundingBox) ExtB(bounds *BoundingBox) *BoundingBox
Extends this bounding box by the given bounding box. param bounds The bounding box return This bounding box for chaining.
func (*BoundingBox) ExtBT ¶
func (self *BoundingBox) ExtBT(bounds *BoundingBox, transform *Matrix4) *BoundingBox
Extends this bounding box by the given transformed bounding box. param bounds The bounding box param transform The transformation matrix to apply to bounds, before using it to extend this bounding box. return This bounding box for chaining.
func (*BoundingBox) ExtV3 ¶
func (self *BoundingBox) ExtV3(point *Vector3) *BoundingBox
Extends the bounding box to incorporate the given {@link Vector3}. param point The vector return This bounding box for chaining.
func (*BoundingBox) GetCenter ¶
func (self *BoundingBox) GetCenter(out *Vector3) *Vector3
@param out The {@link Vector3} to receive the center of the bounding box. return The vector specified with the out argument.
func (*BoundingBox) GetCenterX ¶
func (self *BoundingBox) GetCenterX() float32
func (*BoundingBox) GetCenterY ¶
func (self *BoundingBox) GetCenterY() float32
func (*BoundingBox) GetCenterZ ¶
func (self *BoundingBox) GetCenterZ() float32
func (*BoundingBox) GetCorner000 ¶
func (self *BoundingBox) GetCorner000(out *Vector3) *Vector3
func (*BoundingBox) GetCorner001 ¶
func (self *BoundingBox) GetCorner001(out *Vector3) *Vector3
func (*BoundingBox) GetCorner010 ¶
func (self *BoundingBox) GetCorner010(out *Vector3) *Vector3
func (*BoundingBox) GetCorner011 ¶
func (self *BoundingBox) GetCorner011(out *Vector3) *Vector3
func (*BoundingBox) GetCorner100 ¶
func (self *BoundingBox) GetCorner100(out *Vector3) *Vector3
func (*BoundingBox) GetCorner101 ¶
func (self *BoundingBox) GetCorner101(out *Vector3) *Vector3
func (*BoundingBox) GetCorner110 ¶
func (self *BoundingBox) GetCorner110(out *Vector3) *Vector3
func (*BoundingBox) GetCorner111 ¶
func (self *BoundingBox) GetCorner111(out *Vector3) *Vector3
func (*BoundingBox) GetDepth ¶
func (self *BoundingBox) GetDepth() float32
func (*BoundingBox) GetDimensions ¶
func (self *BoundingBox) GetDimensions(out *Vector3) *Vector3
@param out The {@link Vector3} to receive the dimensions of this bounding box on all three axis. return The vector specified with the out argument
func (*BoundingBox) GetHeight ¶
func (self *BoundingBox) GetHeight() float32
func (*BoundingBox) GetMax ¶
func (self *BoundingBox) GetMax(out *Vector3) *Vector3
@param out The {@link Vector3} to receive the maximum values. return The vector specified with the out argument
func (*BoundingBox) GetMin ¶
func (self *BoundingBox) GetMin(out *Vector3) *Vector3
@param out The {@link Vector3} to receive the minimum values. return The vector specified with the out argument
func (*BoundingBox) GetWidth ¶
func (self *BoundingBox) GetWidth() float32
func (*BoundingBox) Inf ¶
func (self *BoundingBox) Inf() *BoundingBox
Todo check Infinity Sets the minimum and maximum vector to positive and negative infinity. return This bounding box for chaining.
func (*BoundingBox) Intersects ¶
func (self *BoundingBox) Intersects(b *BoundingBox) bool
Returns whether the given bounding box is intersecting this bounding box (at least one point in). param b The bounding box return Whether the given bounding box is intersected
func (*BoundingBox) IsValid ¶
func (self *BoundingBox) IsValid() bool
Returns whether this bounding box is valid. This means that {@link #max} is greater than {@link #min}. return True in case the bounding box is valid, false otherwise
func (*BoundingBox) Mul ¶
func (self *BoundingBox) Mul(transform *Matrix4) *BoundingBox
Multiplies the bounding box by the given matrix. This is achieved by multiplying the 8 corner points and then calculating the minimum and maximum vectors from the transformed points. param transform The matrix return This bounding box for chaining.
func (*BoundingBox) Set ¶
func (self *BoundingBox) Set(min, max *Vector3) *BoundingBox
Sets the given minimum and maximum vector. param minimum The minimum vector param maximum The maximum vector return This bounding box for chaining.
func (*BoundingBox) SetB ¶
func (self *BoundingBox) SetB(bounds *BoundingBox) *BoundingBox
Sets the given bounding box. param bounds The bounds. return This bounding box for chaining.
func (*BoundingBox) SetV ¶
func (self *BoundingBox) SetV(points []*Vector3) *BoundingBox
Sets the bounding box minimum and maximum vector from the given points. param points The points. return This bounding box for chaining.
func (*BoundingBox) String ¶
func (self *BoundingBox) String() string
type Ray ¶
type Ray struct { Origin *Vector3 Direction *Vector3 }
Encapsulates a ray having a starting position and a unit length direction.
func NewRay ¶
func NewRay(origin, direction *Vector3) *Ray
Constructor, sets the starting position of the ray and the direction. param origin The starting position param direction The direction
func NewRayEmpty ¶
func NewRayEmpty() *Ray
func (*Ray) GetEndPoint ¶
Returns the endpoint given the distance. This is calculated as startpoint + distance * direction. param out The vector to set to the result param distance The distance from the end point to the start point.
func (*Ray) Mul ¶
Multiplies the ray by the given matrix. Use this to transform a ray into another coordinate system. param matrix The matrix
func (*Ray) Set ¶
Sets this ray from the given starting position and direction. param x The x-component of the starting position param y The y-component of the starting position param z The z-component of the starting position param dx The x-component of the direction param dy The y-component of the direction param dz The z-component of the direction
type Segment ¶
type Segment struct { // the starting position A *Vector3 // the ending position B *Vector3 }
A Segment is a line in 3-space having a staring and an ending position.
func NewSegment ¶
Constructs a new Segment from the two points given. param aX the x-coordinate of the first point param aY the y-coordinate of the first point param aZ the z-coordinate of the first point param bX the x-coordinate of the second point param bY the y-coordinate of the second point param bZ the z-coordinate of the second point
func NewSegmentV ¶
func NewSegmentV(a, b *Vector3) *Segment
Constructs a new Segment from the two points given. param b the second point
type Sphere ¶
type Sphere struct { Radius float32 Center *Vector3 }
Encapsulates a 3D sphere with a center and a radius
func NewSphere ¶
Constructs a sphere with the given center and radius param center The center param radius The radius
func (*Sphere) Overlaps ¶
@param sphere the other sphere return whether this and the other sphere overlap