hyperrectangle

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 26

Documentation

Overview

Package hyperrectangle defines an N-dimensional box embedded in N-dimensional ambient space.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.13.0

func Contains(r R, s R) bool

Contains checks if the input rectangle r fully encloses s. r is a closed interval.

func Disjoint added in v0.13.0

func Disjoint(r R, s R) bool

func SA added in v0.11.0

func SA(r R) float64

SA returns the "surface area" of an N-dimensional interval. For N = 2, this is the perimeter, and for N = 3, this is the total surface area of the rectangular prism.

See https://math.stackexchange.com/a/1898563 for the full method.

func V added in v0.11.0

func V(r R) float64

func Within added in v0.12.0

func Within(g R, h R) bool

func WithinEpsilon added in v0.12.0

func WithinEpsilon(g R, h R, e epsilon.E) bool

Types

type M added in v0.13.0

type M R

func (M) Copy added in v0.13.0

func (r M) Copy(s R)

func (M) Intersect added in v0.13.0

func (r M) Intersect(s R) bool

func (M) Max added in v0.13.0

func (r M) Max() vector.M

func (M) Min added in v0.13.0

func (r M) Min() vector.M

func (M) R added in v0.13.0

func (r M) R() R

func (M) Scale added in v0.14.0

func (r M) Scale(c float64)

Scale will expand or shrink each dimension of the AABB by the given scalar.

If we want to expand or shrink by the total volume instead, we can use

b.Scale(math.Pow(c, 1.0 / b.Min().Dimension()))

func (M) Union added in v0.13.0

func (r M) Union(s R)

func (M) Zero added in v0.13.0

func (r M) Zero()

type R

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

func Intersect added in v0.13.0

func Intersect(r R, s R) (R, bool)

func New

func New(min vector.V, max vector.V) *R

func Scale added in v0.14.0

func Scale(r R, c float64) R

func Union added in v0.13.0

func Union(r R, s R) R

func (R) D

func (r R) D() vector.V

func (R) In

func (r R) In(v vector.V) bool

func (R) M added in v0.13.0

func (r R) M() M

func (R) Max

func (r R) Max() vector.V

func (R) Min

func (r R) Min() vector.V

Jump to

Keyboard shortcuts

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