Documentation
¶
Index ¶
- Variables
- type Line2D
- func (l Line2D) ClosestPointOnLine(p vector2.Float64) vector2.Float64
- func (l Line2D) Dir() vector2.Float64
- 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) GetEndPoint() vector3.Float64
- func (l Line3D) GetStartPoint() vector3.Float64
- func (l Line3D) Intersection(plane Plane) vector3.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 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 Line2D ¶
type Line2D struct {
// contains filtered or unexported fields
}
Line2D represents a line segment
func (Line2D) ClosestPointOnLine ¶
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) GetEndPoint ¶
GetEndPoint returns the end point of the line segment
func (Line3D) GetStartPoint ¶
GetStartPoint returns the starting point of the line segment
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