xy

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package xy provides xy Position

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	Start, End Point
}

func NewLine

func NewLine(x1, y1, x2, y2 int) *Line

func (*Line) Contains

func (l *Line) Contains(p Point) bool

func (*Line) Intersect

func (l1 *Line) Intersect(l2 *Line) (Point, error)

Intersect returns the Point if two lines intersect. https://en.wikipedia.org/wiki/Line-line_intersection

func (*Line) IntersectSegment

func (l1 *Line) IntersectSegment(l2 *Line) (Point, error)

IntersectSegment returns Point where lines intersect. http://geomalgorithms.com/a05-_intersect-1.html#intersect2D_2Segments()

func (*Line) String

func (l1 *Line) String() string

type Point added in v0.20.0

type Point struct {
	X, Y int
}

func (Point) Above added in v0.20.0

func (p Point) Above(q Point) bool

func (Point) Below added in v0.20.0

func (p Point) Below(q Point) bool

func (Point) Distance added in v0.20.0

func (p Point) Distance(q Point) float64

func (Point) Equals added in v0.20.0

func (p Point) Equals(q Point) bool

func (Point) LeftOf added in v0.20.0

func (p Point) LeftOf(q Point) bool

func (Point) RightOf added in v0.20.0

func (p Point) RightOf(q Point) bool

func (Point) String added in v0.20.0

func (p Point) String() string

func (Point) XY added in v0.20.0

func (p Point) XY() (int, int)

func (Point) XYfloat64 added in v0.20.0

func (p Point) XYfloat64() (float64, float64)

type Rect

type Rect struct {
	TopLeft     Point
	BottomRight Point
}

Jump to

Keyboard shortcuts

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