sgmmath

package
v0.0.0-...-ae9a0ba Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundingRect

type BoundingRect struct {
	Min Point
	Max Point
}

func NewBoundingRect

func NewBoundingRect() BoundingRect

func NewPointBoundingRect

func NewPointBoundingRect(point Point) BoundingRect

func (*BoundingRect) Add

func (rect *BoundingRect) Add(point Point)

func (*BoundingRect) Center

func (rect *BoundingRect) Center() Point

func (*BoundingRect) Contains

func (rect *BoundingRect) Contains(other BoundingRect) bool

func (*BoundingRect) Expand

func (rect *BoundingRect) Expand(padding float64)

func (*BoundingRect) Includes

func (rect *BoundingRect) Includes(point Point) bool

func (*BoundingRect) IsZero

func (rect *BoundingRect) IsZero() bool

func (*BoundingRect) Size

func (rect *BoundingRect) Size() (float64, float64)

type Point

type Point struct {
	X, Y float64
}

func MeanPoint

func MeanPoint(p1 Point, points ...Point) Point

func (Point) Add

func (p Point) Add(diff Point) Point

func (Point) Distance

func (p Point) Distance(other Point) float64

func (Point) Point

func (p Point) Point() Point

type Pointable

type Pointable interface {
	Point() Point
}

type PolarVector

type PolarVector struct {
	Begin  Point
	Angle  float64
	Length float64
}

func (PolarVector) AngleDiff

func (pv PolarVector) AngleDiff(pv2 PolarVector) float64

func (PolarVector) Direction

func (pv PolarVector) Direction() SectorDirection

func (PolarVector) PointAtLength

func (pv PolarVector) PointAtLength(l float64) Point

func (PolarVector) PointAtOffset

func (pv PolarVector) PointAtOffset(offset float64) Point

func (PolarVector) Sector

func (pv PolarVector) Sector(sectorCount int) int

func (PolarVector) ToVector

func (pv PolarVector) ToVector() Vector

type SectorDirection

type SectorDirection int
const (
	DirectionTop SectorDirection = iota
	DirectionBottom
	DirectionLeft
	DirectionRight

	DirectionMax
)

type Vector

type Vector struct {
	Begin, End Point
}

func NewVector

func NewVector(begin, end Pointable) Vector

func (Vector) Size

func (v Vector) Size() (float64, float64)

func (Vector) ToPolar

func (v Vector) ToPolar() PolarVector

Jump to

Keyboard shortcuts

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