xy

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 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 Position
}

func NewLine

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

func (*Line) Contains

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

func (*Line) Intersect

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

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

func (*Line) IntersectSegment

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

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

func (*Line) String

func (l1 *Line) String() string

type Position

type Position struct {
	X, Y int
}

func (Position) Above

func (p Position) Above(q Position) bool

func (Position) Below

func (p Position) Below(q Position) bool

func (Position) Distance

func (p Position) Distance(q Position) float64

func (Position) Equals

func (p Position) Equals(q Position) bool

func (Position) LeftOf

func (p Position) LeftOf(q Position) bool

func (Position) RightOf

func (p Position) RightOf(q Position) bool

func (Position) String

func (p Position) String() string

func (Position) XY

func (p Position) XY() (int, int)

func (Position) XYfloat64

func (p Position) XYfloat64() (float64, float64)

type Rect

type Rect struct {
	TopLeft     Position
	BottomRight Position
}

Jump to

Keyboard shortcuts

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