point

package
v0.0.0-...-9c133fc Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Circle

type Circle struct {
	Point
	R float64
}

func NewCircle

func NewCircle(x, y, r float64) *Circle

func PtCircle

func PtCircle(p Point, r float64) *Circle

type Filter

type Filter func(pt Point) bool

type Line

type Line struct {
	A, B Point
}

type Lines

type Lines []Line

func (*Lines) Add

func (ls *Lines) Add(l ...Line)

type Point

type Point complex128

func Pt

func Pt(x, y float64) Point

func Pt0

func Pt0() Point

func Pt2

func Pt2(a *api.Point2D) Point

func Pt3

func Pt3(a *api.Point) Point

func PtI

func PtI(a *api.PointI) Point

func (Point) Add

func (a Point) Add(x, y float64) Point

func (Point) CellCenter

func (a Point) CellCenter() Point

func (Point) Closest

func (a Point) Closest(ps []Point) *Point

User should check that he receives not nil

func (Point) Compas

func (a Point) Compas() Side

func (Point) Dir

func (a Point) Dir(ptr Pointer) Point

Direction on grid

func (Point) Dist

func (a Point) Dist(ptr Pointer) float64

func (Point) Dist2

func (a Point) Dist2(ptr Pointer) float64

func (Point) Floor

func (a Point) Floor() Point

func (Point) IsCloserThan

func (a Point) IsCloserThan(dist float64, ptr Pointer) bool

func (Point) IsFurtherThan

func (a Point) IsFurtherThan(dist float64, ptr Pointer) bool

func (Point) Len

func (a Point) Len() float64

func (Point) Manhattan

func (a Point) Manhattan(ptr Pointer) float64

func (Point) Mul

func (a Point) Mul(x float64) Point

func (Point) Neighbours4

func (a Point) Neighbours4(offset float64) Points

func (Point) Neighbours8

func (a Point) Neighbours8(offset float64) Points

func (Point) NeighboursDiagonal4

func (a Point) NeighboursDiagonal4(offset float64) Points

func (Point) Norm

func (a Point) Norm() Point

func (Point) Point

func (a Point) Point() Point

func (Point) Rotate

func (a Point) Rotate(rad float64) Point

func (*Point) SetX

func (a *Point) SetX(x float64)

func (*Point) SetY

func (a *Point) SetY(y float64)

func (Point) String

func (a Point) String() string

func (Point) To2D

func (a Point) To2D() *api.Point2D

func (Point) To3D

func (a Point) To3D() *api.Point

func (Point) Towards

func (a Point) Towards(ptr Pointer, offset float64) Point

func (Point) X

func (a Point) X() float64

func (Point) Y

func (a Point) Y() float64

type Pointer

type Pointer interface {
	Point() Point
}

type Points

type Points []Point

func Intersect

func Intersect(a *Circle, b *Circle) (ps Points)

Find the intersection of the two circles, the number of intersections may have 0, 1, 2

func (*Points) Add

func (ps *Points) Add(p ...Point)

func (Points) Center

func (ps Points) Center() Point

func (Points) CloserThan

func (ps Points) CloserThan(dist float64, ptr Pointer) Points

func (Points) ClosestTo

func (ps Points) ClosestTo(ptr Pointer) Point

func (Points) Empty

func (ps Points) Empty() bool

func (Points) Exists

func (ps Points) Exists() bool

func (Points) Filter

func (ps Points) Filter(filters ...Filter) Points

func (Points) FirstFurtherThan

func (ps Points) FirstFurtherThan(dist float64, from Pointer) Point

func (Points) FurthestTo

func (ps Points) FurthestTo(ptr Pointer) Point

func (Points) Has

func (ps Points) Has(p Point) bool

func (Points) Intersect

func (ps Points) Intersect(ps2 Points) Points

func (Points) Len

func (ps Points) Len() int

func (Points) OrderByDistanceTo

func (ps Points) OrderByDistanceTo(ptr Pointer, desc bool)

func (Points) Rect

func (ps Points) Rect() Points

Coordinates of rectangle that fits all points

func (*Points) Remove

func (ps *Points) Remove(point Point)

type Side

type Side int

Vector directions

const (
	E Side = iota
	NE
	N
	NW
	W
	SW
	S
	SE
)

func (Side) IsDiagonal

func (s Side) IsDiagonal() bool

func (Side) IsHorizontal

func (s Side) IsHorizontal() bool

func (Side) IsOrthogonal

func (s Side) IsOrthogonal() bool

func (Side) IsVertical

func (s Side) IsVertical() bool

Jump to

Keyboard shortcuts

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