vector2d

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp[T Numeric](value, low, high T) T

func Max

func Max[T Numeric](a, b T) T

func Min

func Min[T Numeric](a, b T) T

Types

type Numeric

type Numeric interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~float32 | ~float64
}

type Vector2d

type Vector2d[T Numeric] struct {
	X, Y T
}

func New

func New[T Numeric](x, y T) Vector2d[T]

func (*Vector2d[T]) Add

func (v *Vector2d[T]) Add(other Vector2d[T]) Vector2d[T]

func (*Vector2d[T]) AddInPlace

func (v *Vector2d[T]) AddInPlace(other Vector2d[T]) *Vector2d[T]

func (*Vector2d[T]) AddScalar

func (v *Vector2d[T]) AddScalar(s T) Vector2d[T]

func (*Vector2d[T]) AddScalarInPlace

func (v *Vector2d[T]) AddScalarInPlace(s T) *Vector2d[T]

func (*Vector2d[T]) DistanceFrom

func (v *Vector2d[T]) DistanceFrom(other Vector2d[T]) float64

func (*Vector2d[T]) Div

func (v *Vector2d[T]) Div(other Vector2d[T]) Vector2d[T]

func (*Vector2d[T]) DivInPlace

func (v *Vector2d[T]) DivInPlace(other Vector2d[T]) *Vector2d[T]

func (*Vector2d[T]) DivScalar

func (v *Vector2d[T]) DivScalar(s T) Vector2d[T]

func (*Vector2d[T]) DivScalarInPlace

func (v *Vector2d[T]) DivScalarInPlace(s T) *Vector2d[T]

func (*Vector2d[T]) Equals

func (v *Vector2d[T]) Equals(other Vector2d[T]) bool

func (*Vector2d[T]) GetAngle

func (v *Vector2d[T]) GetAngle() float64

func (*Vector2d[T]) Length

func (v *Vector2d[T]) Length() float64

func (*Vector2d[T]) LengthSQ

func (v *Vector2d[T]) LengthSQ() T

func (*Vector2d[T]) MidPoint

func (v *Vector2d[T]) MidPoint(o Vector2d[T]) Vector2d[T]

func (*Vector2d[T]) Mul

func (v *Vector2d[T]) Mul(other Vector2d[T]) Vector2d[T]

func (*Vector2d[T]) MulInPlace

func (v *Vector2d[T]) MulInPlace(other Vector2d[T]) *Vector2d[T]

func (*Vector2d[T]) Negate

func (v *Vector2d[T]) Negate() Vector2d[T]

func (*Vector2d[T]) Nor

func (v *Vector2d[T]) Nor() Vector2d[T]

func (*Vector2d[T]) Normalize

func (v *Vector2d[T]) Normalize() *Vector2d[T]

func (*Vector2d[T]) NotEquals

func (v *Vector2d[T]) NotEquals(other Vector2d[T]) bool

func (*Vector2d[T]) RotateBy

func (v *Vector2d[T]) RotateBy(degrees float64, center Vector2d[T]) *Vector2d[T]

func (*Vector2d[T]) Scale

func (v *Vector2d[T]) Scale(s T) Vector2d[T]

func (*Vector2d[T]) ScaleInPlace

func (v *Vector2d[T]) ScaleInPlace(s T) *Vector2d[T]

func (*Vector2d[T]) Set

func (v *Vector2d[T]) Set(nx, ny T) *Vector2d[T]

func (*Vector2d[T]) Sub

func (v *Vector2d[T]) Sub(other Vector2d[T]) Vector2d[T]

func (*Vector2d[T]) SubInPlace

func (v *Vector2d[T]) SubInPlace(other Vector2d[T]) *Vector2d[T]

func (*Vector2d[T]) SubScalar

func (v *Vector2d[T]) SubScalar(s T) Vector2d[T]

func (*Vector2d[T]) SubScalarInPlace

func (v *Vector2d[T]) SubScalarInPlace(s T) *Vector2d[T]

type Vector2dd

type Vector2dd = Vector2d[float64]

type Vector2df

type Vector2df = Vector2d[float32]

type Vector2di

type Vector2di = Vector2d[int32]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL