box

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

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

Go to latest
Published: Aug 31, 2022 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box [2]d2.Pt

Box is a rectangle that lies orthoganal to the plane. The first point should be the min point and the second should be the max.

func New

func New(pts ...d2.Pt) *Box

New Box containing all the points passed in.

func (*Box) Area

func (b *Box) Area() float64

Area of the box fulling shape.Area.

func (*Box) BoundingBox

func (b *Box) BoundingBox() (min, max d2.Pt)

BoundingBox fulfils shape.BoundingBoxer and shape.Shape.

func (*Box) Centroid

func (b *Box) Centroid() d2.Pt

Centroid returns the center of the box, fulfilling shape.Centroid

func (*Box) Contains

func (b *Box) Contains(p d2.Pt) bool

Contains returns true of the box contains the point. Fulfills shape.Container and shape.Shape.

func (*Box) ConvexHull

func (b *Box) ConvexHull() []d2.Pt

ConvexHull fulfills shape.ConvexHuller. Returns the 4 corners of the box.

func (*Box) LineIntersections

func (b *Box) LineIntersections(l line.Line, buf []float64) []float64

LineIntersections returning the sides of the box that are intersected. Fulfills line.Intersector and shape.Shape.

func (*Box) Perimeter

func (b *Box) Perimeter() float64

Perimeter of the box. Fulfills shape.Perimeter.

func (*Box) Side

func (b *Box) Side(n int) line.Line

Side returns one of the sides proceeding counter clockwise.

func (*Box) Sides

func (b *Box) Sides() *[4]line.Line

Sides returns an array of the 4 sides in counter clockwise order.

func (*Box) SignedArea

func (b *Box) SignedArea() float64

SignedArea of the box fulling shape.Area. If the box is well formed the area should always be positive.

func (*Box) V

func (b *Box) V() d2.V

V is the vector from the min point to the max point

func (*Box) Vertex

func (b *Box) Vertex(n int) d2.Pt

Vertex returns one of the 4 verticies of the box proceeding counter clockwise.

Jump to

Keyboard shortcuts

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