boxmodel

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoxModel

type BoxModel interface {
	// Inside returns the number of boxes inside the shape.
	Inside() int
	// InsideCursor returns a cursor that will iterate over all the boxes
	// inside the shape.
	InsideCursor() (Iterator, box.Box, bool)

	// Perimeter returns the number of boxes that contain the perimeter.
	Perimeter() int
	// PerimeterCursor returns a cursor that will iterate over all the boxes
	// on the perimeter of the shape.
	PerimeterCursor() (Iterator, box.Box, bool)

	// Outside returns the number of boxes outside the shape.
	Outside() int
	// OutsideCursor returns a cursor that will iterate over all the boxes
	// inside the shape.
	OutsideCursor() (Iterator, box.Box, bool)

	// Area is an approximation of the area of the shape. It is the sum of all
	// the boxes inside the shape and half the area of the boxes on the
	// perimeter.
	Area() float64

	// SignedArea is the same as Area.
	SignedArea() float64

	ConvexHull() []d2.Pt

	// Centroid is the center of mass of the shape.
	Centroid() d2.Pt
	// contains filtered or unexported methods
}

BoxModel represents a shape that has been encoded as a set of boxes.

func New

func New(s shape.Shape, depth int) BoxModel

New BoxModel representing the shape.

type Compressor

type Compressor interface {
	Add(name string, model BoxModel) (BoxModel, error)
	Get(name string) BoxModel
	All() map[string]BoxModel
	Stats() (int, int)
	// contains filtered or unexported methods
}

Compressor compacts the quad-trees and reuses segments between models.

func NewCompressor

func NewCompressor() Compressor

NewCompressor initilizes a Compressor

type Iterator

type Iterator interface {
	Next() (b box.Box, done bool)
}

Iterator iterates over a collection of boxes

Jump to

Keyboard shortcuts

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