Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Directions2D = [4]Point2D[int]{
{0, -1},
{1, 0},
{0, 1},
{-1, 0},
}
Directions2D is an array of points corresponding to the difference to move in a certain direction in 2D. The order of the points is clockwise starting from up, i.e., UP, RIGHT, DOWN, LEFT.
var Directions3D = [6]Point3D[int]{
{0, -1, 0},
{1, 0, 0},
{0, 1, 0},
{-1, 0, 0},
{0, 0, 1},
{0, 0, -1},
}
Directions3D is an array of points corresponding to the difference to move in a certain direction in 3D. The order of the points is clockwise starting from up, and then front and back (z-axis), i.e., UP, RIGHT, DOWN, LEFT, FRONT, BACK.
Functions ¶
This section is empty.
Types ¶
type BoundingBox2D ¶
BoundingBox2D contains information about coordinates of a rectangular border. This could represent the minimum and maximum value of X and Y coorindates in the coordinate system or minimum and maximum rows and columns for a matrix.
func NewBoundingBox2D ¶
func NewBoundingBox2D(minx, maxx, miny, maxy int) *BoundingBox2D
NewBoundingBox2D creates a new two dimensional bounding box.
func (*BoundingBox2D) Area ¶
func (b *BoundingBox2D) Area() int
Area returns the area of the bounding box.
func (*BoundingBox2D) Contains ¶
func (b *BoundingBox2D) Contains(x, y int) bool
Contains is used to check whether the point formed by given x and y values is within the bounds of the box.
func (*BoundingBox2D) Intersection ¶
func (b *BoundingBox2D) Intersection(other *BoundingBox2D) *BoundingBox2D
Intersection returns the bounding box formed by the intersection of bbox2d with other, nil if they do not intersect.
type BoundingBox3D ¶
BoundingBox3D is similar to BoundingBox2D, except this represents a three dimensional cuboid.
func NewBoundingBox3D ¶
func NewBoundingBox3D(minx, maxx, miny, maxy, minz, maxz int) *BoundingBox3D
NewBoundingBox3D creates a new three dimensional bounding box.
func (*BoundingBox3D) Contains ¶
func (b *BoundingBox3D) Contains(x, y, z int) bool
Contains is used to check whether the point formed by given x, y and z values is within the bounds of the box.
func (*BoundingBox3D) Intersection ¶
func (b *BoundingBox3D) Intersection(other *BoundingBox3D) *BoundingBox3D
Intersection returns the bounding box formed by the intersection of bbox3d with other, nil if they do not intersect.
func (*BoundingBox3D) Volume ¶
func (b *BoundingBox3D) Volume() int
Volume returns the volume of the bounding box.
type Point2D ¶
type Point2D[T constraints.Signed] struct { X, Y T }
Point2D represents a 2 dimensional point in the coordinate system.
func (Point2D[T]) ManhattanDistance ¶
ManhattanDistance returns the manhattan distance between p and other.
type Point3D ¶
type Point3D[T constraints.Signed] struct { X, Y, Z T }
Point3D represents a 3 dimensional point in the coordinate system.
func (Point3D[T]) ManhattanDistance ¶
ManhattanDistance returns the manhattan distance between p and other.