Documentation ¶
Index ¶
- Variables
- type AABB
- func (aabb AABB) Center() vector3.Float64
- func (aabb AABB) ClosestPoint(v vector3.Float64) vector3.Float64
- func (aabb AABB) Contains(p vector3.Float64) bool
- func (aabb *AABB) EncapsulateBounds(b AABB)
- func (aabb *AABB) EncapsulatePoint(p vector3.Float64)
- func (aabb *AABB) Expand(amount float64)
- func (aabb AABB) Intersects(other AABB) bool
- func (aabb AABB) IntersectsRayInRange(ray Ray, min, max float64) bool
- func (aabb AABB) MarshalJSON() ([]byte, error)
- func (aabb AABB) Max() vector3.Float64
- func (aabb AABB) Min() vector3.Float64
- func (aabb *AABB) SetMinMax(min, max vector3.Float64)
- func (aabb AABB) Size() vector3.Float64
- func (aabb *AABB) UnmarshalJSON(data []byte) error
- func (aabb AABB) Volume() float64
- type Line2D
- func (l Line2D) ClosestPointOnLine(p vector2.Float64) vector2.Float64
- func (l Line2D) Dir() vector2.Float64
- func (l Line2D) ExtendEnd(amount float64) Line2D
- func (l Line2D) ExtendStart(amount float64) Line2D
- func (l Line2D) GetEndPoint() vector2.Float64
- func (l Line2D) GetStartPoint() vector2.Float64
- func (l Line2D) Intersection(other Line2D) (vector2.Float64, error)
- func (l Line2D) Intersects(other Line2D) bool
- func (l Line2D) ScaleOutwards(amount float64) Line2D
- type Line3D
- func (l Line3D) ClosestPointOnLine(p vector3.Float64) vector3.Float64
- func (l Line3D) ClosestTimeOnLine(p vector3.Float64) float64
- func (l Line3D) GetEndPoint() vector3.Float64
- func (l Line3D) GetStartPoint() vector3.Float64
- func (l Line3D) IntersectionPointOnPlane(plane Plane) (vector3.Float64, bool)
- func (l Line3D) IntersectionTimeOnPlane(plane Plane) (float64, bool)
- func (l Line3D) Length() float64
- func (l Line3D) ScaleOutwards(amount float64) Line3D
- func (l Line3D) SetEndPoint(newEnd vector3.Float64) Line3D
- func (l Line3D) SetStartPoint(newStart vector3.Float64) Line3D
- func (l Line3D) Translate(amt vector3.Float64) Line3D
- func (l Line3D) YIntersection(x float64, z float64) float64
- type Orientation
- type Plane
- type Ray
- type Shape
- func (s Shape) GetBoundingBoxDimensions() (width, height float64)
- func (s Shape) GetBounds() (vector2.Float64, vector2.Float64)
- func (s Shape) IsInside(p vector2.Float64) bool
- func (s Shape) Len() int
- func (s Shape) Less(i, j int) bool
- func (s Shape) RandomPointInShape() vector2.Float64
- func (s Shape) Rotate(amount float64, pivot vector2.Float64) Shape
- func (s Shape) Scale(amount float64, origin vector2.Float64) Shape
- func (s Shape) Split(vericalLine float64) ([]Shape, []Shape)
- func (s Shape) Swap(i, j int)
- func (s Shape) Translate(amount vector2.Float64) Shape
Constants ¶
This section is empty.
Variables ¶
var ErrNoIntersection = errors.New("no intersection")
ErrNoIntersection is thrown when Intersection() contains no intersection
Functions ¶
This section is empty.
Types ¶
type AABB ¶ added in v0.3.0
type AABB struct {
// contains filtered or unexported fields
}
func NewAABBFromPoints ¶ added in v0.3.0
func NewEmptyAABB ¶ added in v0.3.0
func NewEmptyAABB() AABB
func (AABB) ClosestPoint ¶ added in v0.3.0
func (*AABB) EncapsulateBounds ¶ added in v0.3.0
func (*AABB) EncapsulatePoint ¶ added in v0.3.0
func (AABB) Intersects ¶ added in v0.15.0
func (AABB) IntersectsRayInRange ¶ added in v0.3.0
IntersectsRayInRange determines whether or not a ray intersects the bounding box with the range of the ray between min and max
Intersection method by Andrew Kensler at Pixar, found in the book "Ray Tracing The Next Week" by Peter Shirley
func (AABB) MarshalJSON ¶ added in v0.8.0
func (*AABB) UnmarshalJSON ¶ added in v0.8.0
type Line2D ¶
type Line2D struct {
// contains filtered or unexported fields
}
Line2D represents a line segment
func (Line2D) ClosestPointOnLine ¶
func (Line2D) ExtendStart ¶ added in v0.10.0
func (Line2D) GetEndPoint ¶
GetEndPoint returns the end point of the line segment
func (Line2D) GetStartPoint ¶
GetStartPoint returns the starting point of the line segment
func (Line2D) Intersection ¶
Intersection finds where two lines intersect https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
func (Line2D) Intersects ¶
Intersects determines whether two lines intersect eachother
func (Line2D) ScaleOutwards ¶
ScaleOutwards multiplies the current length of the line by extending it out further in the two different directions it's heading
type Line3D ¶
type Line3D struct {
// contains filtered or unexported fields
}
Line3D is a series of ordered points that make up a line segment through 3D space.
func (Line3D) ClosestPointOnLine ¶
func (Line3D) ClosestTimeOnLine ¶ added in v0.10.0
func (Line3D) GetEndPoint ¶
GetEndPoint returns the end point of the line segment
func (Line3D) GetStartPoint ¶
GetStartPoint returns the starting point of the line segment
func (Line3D) IntersectionPointOnPlane ¶ added in v0.6.0
func (Line3D) IntersectionTimeOnPlane ¶ added in v0.6.0
func (Line3D) ScaleOutwards ¶
ScaleOutwards assumes line segment 3d is only two points multiplies the current length of the line by extending it out further in the two different directions it's heading
type Orientation ¶
type Orientation int
const ( Colinear Orientation = iota Clockwise Counterclockwise )
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
func NewPlaneFromPoints ¶
type Shape ¶
Shape is a flat (2D) arrangement of points.
func (Shape) GetBoundingBoxDimensions ¶
func (Shape) IsInside ¶
IsInside returns true if the point p lies inside the polygon[] with n vertices
func (Shape) Less ¶
Less determines which point is more oriented more clockwise from the center than the other
func (Shape) RandomPointInShape ¶
RandomPointInShape returns a random point inside of the shape
func (Shape) Rotate ¶
Rotate will rotate all points in the shape around the pivot by the passed in amount
func (Shape) Split ¶
Split figures out which points land on which side of the vertical line and builds new shapes from that