Discover Packages
github.com/df-mc/we
geo
package
Version:
v0.0.0-...-6250647
Opens a new window with list of versions in this module.
Published: Nov 20, 2022
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
Documentation
¶
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(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.
Dx returns the Area's width.
Dy returns the Area's height.
Dz returns the Area's length.
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.
String returns a string representation of the Area like "(1,2,3)-(4,5,6)".
type Ball struct {
R int
}
Ball represents the space bounded by a sphere. It is a spherical object with a specific radius.
Dim returns the width, height and length of the ball.
Inside checks if a specific point is within the ball at the centre x, y and z passed.
type Cube struct {
R int
}
Cube represents a cubical object, which has sides of equal length and width.
Dim returns the width, height and length of the cube.
Inside checks if a specific point is within the cube with the centre coordinates passed.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.