geo

package
v0.0.0-...-6250647 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Area

type Area struct {
	Min, Max cube.Pos
}

Area contains the points with Min.X <= X <= Max.X, Min.Y <= Y <= Max.Y, and Min.Z <= Z <= Max.Z It is well-formed if Min.X <= Max.X and likewise for Y and Z. Points are always well-formed. An area's methods always return well-formed outputs for well-formed inputs.

func NewArea

func NewArea(x0, y0, z0, x1, y1, z1 int) Area

NewArea is shorthand for Area{Pos(x0, y0, z0), Pos(x1, y1, z0)}. The returned Area has minimum and maximum coordinates swapped if necessary so that it is well-formed.

func (Area) Dx

func (a Area) Dx() int

Dx returns the Area's width.

func (Area) Dy

func (a Area) Dy() int

Dy returns the Area's height.

func (Area) Dz

func (a Area) Dz() int

Dz returns the Area's length.

func (Area) Range

func (a Area) Range(f func(x, y, z int))

Range iterates over all points where Min.X <= X <= Max.X, Min.Y <= Y <= Max.Y, and Min.Z <= Z <= Max.Z and calls f for every X, Y and Z.

func (Area) String

func (a Area) String() string

String returns a string representation of the Area like "(1,2,3)-(4,5,6)".

type Ball

type Ball struct {
	R int
}

Ball represents the space bounded by a sphere. It is a spherical object with a specific radius.

func (Ball) Dim

func (b Ball) Dim() [3]int

Dim returns the width, height and length of the ball.

func (Ball) Inside

func (b Ball) Inside(cx, cy, cz, x, y, z int) bool

Inside checks if a specific point is within the ball at the centre x, y and z passed.

type Cube

type Cube struct {
	R int
}

Cube represents a cubical object, which has sides of equal length and width.

func (Cube) Dim

func (c Cube) Dim() [3]int

Dim returns the width, height and length of the cube.

func (Cube) Inside

func (c Cube) Inside(cx, cy, cz, x, y, z int) bool

Inside checks if a specific point is within the cube with the centre coordinates passed.

Jump to

Keyboard shortcuts

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