Documentation ¶
Index ¶
- Variables
- type Vector2
- func (v *Vector2) Add(other *Vector2) *Vector2
- func (v *Vector2) AddScalar(scalar float64) *Vector2
- func (v *Vector2) AddScalars(x, y float64) *Vector2
- func (v *Vector2) AsB2() box2d.B2Vec2
- func (v *Vector2) AsTuple() (x, y float64)
- func (v *Vector2) Copy() *Vector2
- func (v *Vector2) Distance(other *Vector2) float64
- func (v *Vector2) Div(other *Vector2) *Vector2
- func (v *Vector2) DivScalar(scalar float64) *Vector2
- func (v *Vector2) DivScalars(x, y float64) *Vector2
- func (v *Vector2) Dot(other *Vector2) float64
- func (v *Vector2) Equals(other *Vector2) bool
- func (v *Vector2) Greater(other *Vector2) bool
- func (v *Vector2) GreaterEq(other *Vector2) bool
- func (v *Vector2) IsInf(sign int) bool
- func (v *Vector2) IsNaN() bool
- func (v *Vector2) IsNull() bool
- func (v *Vector2) Len() float64
- func (v *Vector2) Len2() float64
- func (v *Vector2) Lerp(other *Vector2, t float64) *Vector2
- func (v *Vector2) Lesser(other *Vector2) bool
- func (v *Vector2) LesserEq(other *Vector2) bool
- func (v *Vector2) Mul(other *Vector2) *Vector2
- func (v *Vector2) MulScalar(scalar float64) *Vector2
- func (v *Vector2) MulScalars(x, y float64) *Vector2
- func (v *Vector2) Normalize() *Vector2
- func (v *Vector2) Perp() *Vector2
- func (v *Vector2) Reflect(other *Vector2) *Vector2
- func (v *Vector2) Reverse() *Vector2
- func (v *Vector2) Rotate(angle float64) *Vector2
- func (v *Vector2) Scale(x float64) *Vector2
- func (v *Vector2) Set(x, y float64) *Vector2
- func (v *Vector2) SignedAngle(other *Vector2) float64
- func (v *Vector2) SmoothDamp(target, currentVelocity *Vector2, smoothTime, deltaTime float64) *Vector2
- func (v *Vector2) SmoothDampMaxSpeed(target, currentVelocity *Vector2, smoothTime, deltaTime, maxSpeed float64) *Vector2
- func (v *Vector2) String() string
- func (v *Vector2) Sub(other *Vector2) *Vector2
- func (v *Vector2) SubScalar(scalar float64) *Vector2
- func (v *Vector2) SubScalars(x, y float64) *Vector2
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Vector2 ¶
type Vector2 struct {
X, Y float64
}
func (*Vector2) AddScalars ¶
func (*Vector2) DivScalars ¶
Divide vector coordinates by the given values.
func (*Vector2) IsInf ¶
IsInf reports whether any vector coordinate is an infinity, according to sign. If sign > 0, IsInf reports whether any coordinate is positive infinity. If sign < 0, IsInf reports whether any coordinate is negative infinity. If sign == 0, IsInf reports whether any coordinate is either infinity.
func (*Vector2) MulScalars ¶
func (*Vector2) Rotate ¶
Returns a new vector rotated counter-clockwise by the specified number of radians.
func (*Vector2) SignedAngle ¶
Returns signed angle (theta) between two vectors.
func (*Vector2) SmoothDamp ¶
func (v *Vector2) SmoothDamp(target, currentVelocity *Vector2, smoothTime, deltaTime float64) *Vector2
Gradually changes a vector towards a desired goal over time. The vector is smoothed by some spring-damper like function, which will never overshoot. The most common use is for smoothing a follow camera. Original code by Unity.
func (*Vector2) SmoothDampMaxSpeed ¶
func (v *Vector2) SmoothDampMaxSpeed(target, currentVelocity *Vector2, smoothTime, deltaTime, maxSpeed float64) *Vector2
Gradually changes a vector towards a desired goal over time. The vector is smoothed by some spring-damper like function, which will never overshoot. The most common use is for smoothing a follow camera. Original code by Unity.