d3

package
v0.0.0-...-6596a10 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsElem

func AbsElem(a r3.Vec) r3.Vec

func CeilElem

func CeilElem(a r3.Vec) r3.Vec

func Clamp

func Clamp(x, a, b r3.Vec) r3.Vec

func CosElem

func CosElem(a r3.Vec) r3.Vec

func DivElem

func DivElem(a, b r3.Vec) r3.Vec

func Elem

func Elem(sides float64) r3.Vec

func EqualWithin

func EqualWithin(a, b r3.Vec, tol float64) bool

func FromR2

func FromR2(v r2.Vec, z float64) r3.Vec

func LTEZero

func LTEZero(a r3.Vec) bool

LTEZero returns true if any vector components are <= 0.

func LTZero

func LTZero(a r3.Vec) bool

LTZero returns true if any vector components are < 0.

func Max

func Max(a r3.Vec) float64

func MaxElem

func MaxElem(a, b r3.Vec) r3.Vec

MaxElem return a vector with the maximum components of two vectors.

func Min

func Min(a r3.Vec) float64

func MinElem

func MinElem(a, b r3.Vec) r3.Vec

MinElem return a vector with the minimum components of two vectors.

func MulElem

func MulElem(a, b r3.Vec) r3.Vec

func SinElem

func SinElem(a r3.Vec) r3.Vec

Types

type Box

type Box r3.Box

d3.Box is a 3d bounding box.

func CenteredBox

func CenteredBox(center, size r3.Vec) Box

CenteredBox creates a Box with a given center and size. Negative components of size will be interpreted as zero.

func NewBox

func NewBox(center, size r3.Vec) Box

Newd3.Box creates a 3d box with a given center and size.

func (Box) Center

func (a Box) Center() r3.Vec

Center returns the center of a 3d box.

func (Box) Contains

func (a Box) Contains(v r3.Vec) bool

Contains checks if the 3d box contains the given vector (considering bounds as inside).

func (Box) Enlarge

func (a Box) Enlarge(v r3.Vec) Box

Enlarge returns a new 3d box enlarged by a size vector.

func (Box) Equals

func (a Box) Equals(b Box, tol float64) bool

Equals test the equality of 3d boxes.

func (Box) Extend

func (a Box) Extend(b Box) Box

Extend returns a box enclosing two 3d boxes.

func (Box) Include

func (a Box) Include(v r3.Vec) Box

Include enlarges a 3d box to include a point.

func (Box) MinMaxDist2

func (a Box) MinMaxDist2(p r3.Vec) (min, max float64)

MinMaxDist2 returns the minimum and maximum dist * dist from a point to a box. Points within the box have minimum distance = 0.

func (*Box) Random

func (b *Box) Random() r3.Vec

Random returns a random point within a bounding box.

func (*Box) RandomSet

func (b *Box) RandomSet(n int) Set

RandomSet returns a set of random points from within a bounding box.

func (Box) ScaleAboutCenter

func (a Box) ScaleAboutCenter(k float64) Box

ScaleAboutCenter returns a new 3d box scaled about the center of a box.

func (Box) Size

func (a Box) Size() r3.Vec

Size returns the size of a 3d box.

func (Box) Translate

func (a Box) Translate(v r3.Vec) Box

Translate translates a 3d box.

func (Box) Vertices

func (a Box) Vertices() Set

Vertices returns a slice of 3d box corner vertices.

type Set

type Set []r3.Vec

func (Set) Max

func (a Set) Max() r3.Vec

Max return the maximum components of a set of vectors.

func (Set) Min

func (a Set) Min() r3.Vec

Min return the minimum components of a set of vectors.

type Transform

type Transform struct {
	// contains filtered or unexported fields
}

Transform represents a 3D spatial transformation. The zero value of Transform is the identity transform.

func ComposeTransform

func ComposeTransform(position, scale r3.Vec, q r3.Rotation) Transform

ComposeTransform creates a new transform for a given translation to positon, scaling vector scale and quaternion rotation. The identity Transform is constructed with

ComposeTransform(Vec{}, Vec{1,1,1}, Rotation{})

func NewTransform

func NewTransform(a []float64) Transform

NewTransform returns a new Transform type and populates its elements with values passed in row-major form. If val is nil then NewTransform returns a Transform filled with zeros.

func (Transform) Det

func (t Transform) Det() float64

Det returns the determinant of the Transform.

func (Transform) Inv

func (t Transform) Inv() Transform

Inv returns the inverse of the transform such that t.Inv() * t is the identity Transform. If matrix is singular then Inv() returns the zero transform.

func (Transform) Mul

func (t Transform) Mul(b Transform) Transform

Mul multiplies the Transforms a and b and returns the result. This is the equivalent of combining two transforms in one.

func (Transform) Scale

func (t Transform) Scale(origin, factor r3.Vec) Transform

Scale returns the transform with scaling added around the argumnt origin.

func (Transform) SliceCopy

func (t Transform) SliceCopy() []float64

SliceCopy returns a copy of the Transform's data in row major storage format. It returns 16 elements.

func (Transform) Transform

func (t Transform) Transform(v r3.Vec) r3.Vec

Transform applies the Transform to the argument vector and returns the result.

func (Transform) Translate

func (t Transform) Translate(v r3.Vec) Transform

Translate adds Vec to the positional Transform.

Jump to

Keyboard shortcuts

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