affine

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Center

type Center []d2.Pt

Center of a set of points.

func (Center) Centroid

func (c Center) Centroid() d2.Pt

Centroid of the point set.

type Weighted

type Weighted struct {
	Pts     []d2.Pt
	Weights []float64
	Sum     float64
}

Weighted finds the center of a set of weighted points.

func NewWeighted

func NewWeighted(capacity int) *Weighted

NewWeighted pre-allocates the capacity for the calculation.

func (*Weighted) Add

func (w *Weighted) Add(pts ...d2.Pt)

Add points to the weighted set, each with a weight of 1.

func (*Weighted) Centroid

func (w *Weighted) Centroid() d2.Pt

Centroid finds the center of the weighted points.

func (*Weighted) Weight

func (w *Weighted) Weight(pt d2.Pt, weight float64)

Weight adds a point with a weight

Jump to

Keyboard shortcuts

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