intgeom

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2018 License: Apache-2.0 Imports: 2 Imported by: 12

Documentation

Overview

Package intgeom stores primitives for integer geometry

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance added in v1.5.0

func Distance(x1, y1, x2, y2 int) float64

Distance is the euclidean distance function from two implicit int pairs

Types

type Point

type Point struct {
	X, Y int
}

Point is a basic integer pair

func NewPoint

func NewPoint(x, y int) Point

NewPoint returns an (X,Y) point structure

func (Point) Add added in v1.1.0

func (p Point) Add(p2 Point) Point

Add sums the location of a second point onto the Point

func (Point) Distance

func (p Point) Distance(p2 Point) float64

Distance is the euclidean distance function

func (Point) GreaterOf added in v1.4.0

func (p Point) GreaterOf(ps ...Point) Point

GreaterOf returns a point of the highest X and Y component in the inputs.

func (Point) LesserOf added in v1.4.0

func (p Point) LesserOf(ps ...Point) Point

LesserOf returns a point of the lowest X and Y component in the inputs.

func (Point) PointsBetween added in v1.4.0

func (p Point) PointsBetween(p2 Point) []Point

PointsBetween returns a line of points connecting p and p2

type Rect

type Rect struct {
	Min Point
	Max Point
}

Rect is a basic integer pair with width / height

func NewRect

func NewRect(x, y, x2, y2 int) Rect

NewRect returns an (X,Y):(X2,Y2) rectangle

func NewRectWH

func NewRectWH(x, y, w, h int) Rect

NewRectWH returns an (X,Y):(X+W,Y+H) rectangle

func ShuffleRects

func ShuffleRects(rs []Rect) []Rect

ShuffleRects is a utility function to randomize the order of a rectangle set

Jump to

Keyboard shortcuts

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