Documentation ¶
Index ¶
- func Angle(v Vector2D) float64
- func AngleReg(v Vector2D) (theta float64)
- func Components(v Vector2D) (x, y float64)
- func Distance(v, v2 Vector2D) float64
- func IntersectionPoint(a, b Vector2D, t float64) (x, y float64)
- func IsIntersect(a, b, c, d Vector2D) (t, u float64, intersected bool)
- func IsSeen(pos, newPos, otherPos *Vector2D) (cosAngle float64)
- func RotatePoints(theta float64, origin Vector2D, points ...*Vector2D)
- func Sign(num float64) float64
- type Vector2D
- func (v *Vector2D) Add(v2 Vector2D)
- func (v *Vector2D) Divide(z float64)
- func (v *Vector2D) Limit(max float64)
- func (v *Vector2D) MagnitudeSquared() float64
- func (v *Vector2D) Mini(max float64)
- func (v *Vector2D) Multiply(z float64)
- func (v *Vector2D) Normalize()
- func (v *Vector2D) SetMagnitude(z float64)
- func (v *Vector2D) Subtract(v2 Vector2D)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Angle ¶
Finds angle relative to the y-axis. Clockwise is positive and Counterclockwise is negative.
func Components ¶
Ccomponents returns the components of the vector
func IntersectionPoint ¶
IntersectionPoints finds the actual intersection points. Will return non-valid numbers if t vector was invalid from IsIntersect. Uses the t arguement from IsIntersect. a and b are position and newPos of boid respectively.
func IsIntersect ¶
IsIntersect detects if two linesegments intersect. Intersect if 0 <= t <= 1 and 0 <= u <= 1 https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection Points a and b is 1 segment Points c and d is the 2 segment
func RotatePoints ¶
RotatePoints Rotates points by an angle theta about an origin point Rotates in-place