cmath

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Float32Bytes = 4
)

Variables

This section is empty.

Functions

func Distance

func Distance(x, y *Vec3) float64

func MNaN32

func MNaN32() float32

Types

type Transform added in v0.4.0

type Transform struct {
	Position Vec3 `db:"position" json:"position"`
	Rotation Vec3 `db:"rotation" json:"rotation"`
	Scale    Vec3 `db:"scale" json:"scale"`
}

Transform represent a transformation for an object in 3D space.

func (Transform) MarshalMUS added in v0.4.0

func (v Transform) MarshalMUS(buf []byte) int

MarshalMUS fills buf with the MUS encoding of v.

func (Transform) SizeMUS added in v0.4.0

func (v Transform) SizeMUS() int

SizeMUS returns the size of the MUS-encoded v.

func (*Transform) UnmarshalMUS added in v0.4.0

func (v *Transform) UnmarshalMUS(buf []byte) (int, error)

UnmarshalMUS parses the MUS-encoded buf, and sets the result to *v.

type TransformNoScale added in v0.4.0

type TransformNoScale struct {
	Position Vec3 `db:"position" json:"position"`
	Rotation Vec3 `db:"rotation" json:"rotation"`
}

TransformNoScale represents a transformation for an object in 3D space that has no scale. For example, users don't have a scale in the current system.

func (*TransformNoScale) Copy added in v0.4.0

func (*TransformNoScale) CopyToBuffer added in v0.4.0

func (t *TransformNoScale) CopyToBuffer(b []byte) error

func (TransformNoScale) MarshalMUS added in v0.4.0

func (v TransformNoScale) MarshalMUS(buf []byte) int

MarshalMUS fills buf with the MUS encoding of v.

func (TransformNoScale) SizeMUS added in v0.4.0

func (v TransformNoScale) SizeMUS() int

SizeMUS returns the size of the MUS-encoded v.

func (*TransformNoScale) UnmarshalMUS added in v0.4.0

func (v *TransformNoScale) UnmarshalMUS(buf []byte) (int, error)

UnmarshalMUS parses the MUS-encoded buf, and sets the result to *v.

type Vec3

type Vec3 struct {
	X float32 `json:"x" db:"x"`
	Y float32 `json:"y" db:"y"`
	Z float32 `json:"z" db:"z"`
}

Vec3 is a three dimensional vector.

func Add

func Add(v1 Vec3, v2 Vec3) Vec3

func DefaultPosition

func DefaultPosition() Vec3

DefaultPosition FIXME: Magic numbers ?

func MNan32Vec3

func MNan32Vec3() Vec3

func MultiplyN

func MultiplyN(v Vec3, n float32) Vec3

func (Vec3) MarshalMUS added in v0.4.0

func (v Vec3) MarshalMUS(buf []byte) int

MarshalMUS fills buf with the MUS encoding of v.

func (*Vec3) Plus

func (v *Vec3) Plus(v2 Vec3)

func (Vec3) SizeMUS added in v0.4.0

func (v Vec3) SizeMUS() int

SizeMUS returns the size of the MUS-encoded v.

func (*Vec3) ToVec3f64

func (v *Vec3) ToVec3f64() Vec3f64

func (*Vec3) UnmarshalMUS added in v0.4.0

func (v *Vec3) UnmarshalMUS(buf []byte) (int, error)

UnmarshalMUS parses the MUS-encoded buf, and sets the result to *v.

type Vec3f64

type Vec3f64 struct {
	X float64 `json:"x" db:"x"`
	Y float64 `json:"y" db:"y"`
	Z float64 `json:"z" db:"z"`
}

func (Vec3f64) MarshalMUS added in v0.4.0

func (v Vec3f64) MarshalMUS(buf []byte) int

MarshalMUS fills buf with the MUS encoding of v.

func (Vec3f64) SizeMUS added in v0.4.0

func (v Vec3f64) SizeMUS() int

SizeMUS returns the size of the MUS-encoded v.

func (*Vec3f64) ToVec3

func (v *Vec3f64) ToVec3() Vec3

func (*Vec3f64) UnmarshalMUS added in v0.4.0

func (v *Vec3f64) UnmarshalMUS(buf []byte) (int, error)

UnmarshalMUS parses the MUS-encoded buf, and sets the result to *v.

Jump to

Keyboard shortcuts

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