rect: s.mcquay.me/dm/rect Index | Files

package rect

import "s.mcquay.me/dm/rect"

Package rect implements rectangles and can determine when rectanges intersect, are contained, and when rectangles lie adjacent

Index

Package Files

doc.go line.go point.go rectangle.go triangle.go

func Adjacency Uses

func Adjacency(r1, r2 Rectangle) bool

Adjacency detects whether two rectangles, r1, and r2, are adjacent. Adjacency is defined as the sharing of a side

func Containment Uses

func Containment(r1, r2 Rectangle) bool

Containment returns whether r2 is contained inside of r1

func Intersection Uses

func Intersection(r1, r2 Rectangle) []Point

Intersection determine whether two rectangles, r1 and r2, have one or more intersecting lines and produce a result, []Point, identifying the points of intersection

type Point Uses

type Point struct {
    X, Y float64
}

Point is a struct defining a coordinates position on a 2D plane

type Rectangle Uses

type Rectangle struct {
    P1, P2, P3, P4 Point
}

Rectangle struct defines a plane figure with four straight sides and four right angles, which contains 4 vertixes points, P1 through P4

func (Rectangle) IsRect Uses

func (r Rectangle) IsRect() bool

IsRect determins if the rectangle provided really is a rectangle, which by definition means a plane figure with four straight sides and four right angles.

Package rect imports 3 packages (graph). Updated 2017-06-28. Refresh now. Tools for package owners.