math

package
v0.0.0-...-fa60462 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T Numbers](v T) T

func CountDigits

func CountDigits[T Numbers](num T) int

func Mod

func Mod(a, b int) int

func Pow

func Pow[T Numbers](base T, power uint) T

func Sign

func Sign[T Numbers](v T) int

Types

type Numbers

type Numbers interface {
	int8 | int | uint64
}

type Vector2

type Vector2[T Numbers] struct {
	X T
	Y T
}

func NewVector2

func NewVector2[T Numbers](x, y T) Vector2[T]

func (Vector2[T]) Add

func (v Vector2[T]) Add(av Vector2[T]) Vector2[T]

func (Vector2[T]) ManhattanDst

func (v Vector2[T]) ManhattanDst(v2 Vector2[T]) T

func (Vector2[T]) Mul

func (v Vector2[T]) Mul(scalar T) Vector2[T]

func (Vector2[T]) Norm

func (v Vector2[T]) Norm() Vector2[T]

func (Vector2[T]) RotateLeft

func (v Vector2[T]) RotateLeft() Vector2[T]

RotateLeft rotates the vector to the left (left-handed system)

func (Vector2[T]) RotateRight

func (v Vector2[T]) RotateRight() Vector2[T]

RotateRight rotates the vector to the right (left-handed system)

func (Vector2[T]) String

func (v Vector2[T]) String() string

func (Vector2[T]) Sub

func (v Vector2[T]) Sub(av Vector2[T]) Vector2[T]

Jump to

Keyboard shortcuts

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