grid

package
v0.0.0-...-0235693 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Set   rune = '#'
	Unset rune = '.'
)

Variables

This section is empty.

Functions

func EpsEqual

func EpsEqual(f1, f2 float64) bool

func SortPoints

func SortPoints(pts []Point)

Types

type BinaryGrid

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

func ParseBinaryGrid

func ParseBinaryGrid(s string) (*BinaryGrid, error)

func (*BinaryGrid) IsSet

func (g *BinaryGrid) IsSet(col, row int) bool

func (*BinaryGrid) NumCols

func (g *BinaryGrid) NumCols() int

func (*BinaryGrid) NumRows

func (g *BinaryGrid) NumRows() int

func (*BinaryGrid) SetPoints

func (g *BinaryGrid) SetPoints() []Point

type BinaryGridRow

type BinaryGridRow []bool

type Point

type Point struct {
	X, Y int
}

func Pt

func Pt(x, y int) Point

func (Point) Add

func (p Point) Add(q Point) Point

func (Point) Between

func (p Point) Between(p1, p2 Point) bool

func (Point) DistTo

func (p Point) DistTo(q Point) float64

func (Point) InnerProduct

func (p Point) InnerProduct(q Point) float64

func (Point) IsMultipleOf

func (p Point) IsMultipleOf(q Point) bool

func (Point) IsZero

func (p Point) IsZero() bool

func (Point) LeftAngleTo

func (p Point) LeftAngleTo(q Point) float64

func (Point) ManhattenDistTo

func (p Point) ManhattenDistTo(q Point) int

func (Point) ManhattenNorm

func (p Point) ManhattenNorm() int

func (Point) Norm

func (p Point) Norm() float64

func (Point) RightAngleTo

func (p Point) RightAngleTo(q Point) float64

func (Point) RightAngleToXAxis

func (p Point) RightAngleToXAxis() float64

func (Point) String

func (p Point) String() string

func (Point) Sub

func (p Point) Sub(q Point) Point

type Point3D

type Point3D struct {
	X, Y, Z int
}

func P3D

func P3D(x, y, z int) Point3D

func (Point3D) Add

func (p Point3D) Add(q Point3D) Point3D

func (Point3D) String

func (p Point3D) String() string

func (Point3D) Sub

func (p Point3D) Sub(q Point3D) Point3D

Jump to

Keyboard shortcuts

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