golyat

package module
v0.0.0-...-7753fd9 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 1 Imported by: 0

README

golyat

Test Coverage Go Report Card GoDoc

import "git.fractalqb.de/fractalqb/golyat"


Go Lyaout, or simply golyat, helps to layout shapes that have bounding boxes in rows or columns just as you find it in most vector drawing programs. However golyat does only the computations and no drawing at all. Use it e.g. with https://github.com/llgcode/draw2d to make something useful from it.

Documentation

Index

Constants

View Source
const (
	XAxis = axisX(false)
	YAxis = axisY(true)
)

Variables

This section is empty.

Functions

func Align

func Align(on Axis, frac, target Scalar, shapes ...Shape)

func Spread

func Spread(on Axis, frac, start, stop Scalar, shapes ...Shape)

If only one shape that one's frac is moved to frac between start and stop

Types

type Axis

type Axis interface {
	Min(bb BBox) Scalar
	Max(bb BBox) Scalar
	Move(s Shape, d Scalar)
	Cross() Axis
}

type BBox

type BBox interface {
	Xmin() Scalar
	Xmax() Scalar
	Ymin() Scalar
	Ymax() Scalar
}

type Border

type Border struct {
	Content         Shape
	Padding, Margin Rect
}

func (*Border) BBox

func (br *Border) BBox() BBox

func (*Border) Move

func (br *Border) Move(dx, dy Scalar)

type Container

type Container struct {
	Rect
	Content []Shape
}

func (*Container) Add

func (c *Container) Add(s Shape)

func (*Container) AddAll

func (c *Container) AddAll(ses ...Shape)

func (*Container) Move

func (c *Container) Move(dx, dy Scalar)

type Rect

type Rect struct {
	// contains filtered or unexported fields
}

func NewRect

func NewRect(xMin, xMax, yMin, yMax Scalar) *Rect

func (*Rect) BBox

func (r *Rect) BBox() BBox

func (*Rect) Move

func (r *Rect) Move(dx, dy Scalar)

func (*Rect) SetXmax

func (r *Rect) SetXmax(x Scalar)

func (*Rect) SetXmin

func (r *Rect) SetXmin(x Scalar)

func (*Rect) SetYmax

func (r *Rect) SetYmax(y Scalar)

func (*Rect) SetYmin

func (r *Rect) SetYmin(y Scalar)

func (Rect) Xmax

func (r Rect) Xmax() Scalar

func (Rect) Xmin

func (r Rect) Xmin() Scalar

func (Rect) Ymax

func (r Rect) Ymax() Scalar

func (Rect) Ymin

func (r Rect) Ymin() Scalar

type Scalar

type Scalar = float64

func Extent

func Extent(bb BBox, axis Axis) Scalar

func ExtentOf

func ExtentOf(s Shape, axis Axis) Scalar

func ForceOf

func ForceOf(s1, s2 Shape, axis Axis) Scalar

ForceOf computes the distance the two shapes would have to be moved apart alog the axis to avoid an overlap. The calculation takes into account possible margins that may be created by Borders.

func Frac

func Frac(bb BBox, f float64, axis Axis) Scalar

func FracOf

func FracOf(s Shape, f float64, axis Axis) Scalar

func Gap

func Gap(b1, b2 BBox, axis Axis) Scalar

Gap computes the width of the gap along axis between the bounding boxes b1 and b2.

func GapOf

func GapOf(s1, s2 Shape, axis Axis) Scalar

GapOf computes the gap along the axis between the bounding boxes of the two shapes s1 and s2.

func Height

func Height(bb BBox) Scalar

func MaxOf

func MaxOf(s Shape, axis Axis) Scalar

func MinOf

func MinOf(s Shape, axis Axis) Scalar

func Width

func Width(bb BBox) Scalar

type Shape

type Shape interface {
	BBox() BBox
	Move(dx, dy Scalar)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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