geom

package
v0.0.0-...-0f6939a Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(a, b Point2f) float64

Types

type Bounds

type Bounds struct {
	Min, Max Point
}

func MakeBounds

func MakeBounds(x1, y1, x2, y2 float64) Bounds

func (Bounds) Add

func (b Bounds) Add(p Point) Bounds

func (Bounds) Center

func (b Bounds) Center() Point

func (Bounds) Dx

func (b Bounds) Dx() float64

func (Bounds) Dy

func (b Bounds) Dy() float64

func (Bounds) Size

func (b Bounds) Size() Point

func (Bounds) Sub

func (b Bounds) Sub(p Point) Bounds

type Frame

type Frame struct {
	Left   float64
	Right  float64
	Top    float64
	Bottom float64
}

Indent Thickness Indents Border, Frame

func MakeFrame1

func MakeFrame1(width float64) Frame

func MakeFrame2

func MakeFrame2(leftRight, topBottom float64) Frame

func MakeFrame4

func MakeFrame4(left, right, top, bottom float64) Frame

func MakeFrameUniform

func MakeFrameUniform(width float64) Frame

Uniform

func (Frame) Add

func (a Frame) Add(b Frame) Frame

func (Frame) DivScalar

func (a Frame) DivScalar(scalar float64) Frame

func (Frame) MulScalar

func (a Frame) MulScalar(scalar float64) Frame

func (Frame) Sub

func (a Frame) Sub(b Frame) Frame

type Point

type Point struct {
	X, Y float64
}

func MakePoint

func MakePoint(x, y float64) Point

func (Point) Add

func (a Point) Add(b Point) Point

func (Point) DivScalar

func (a Point) DivScalar(scalar float64) Point

func (Point) MulScalar

func (a Point) MulScalar(scalar float64) Point

func (Point) Sub

func (a Point) Sub(b Point) Point

type Point2f

type Point2f struct {
	X float64
	Y float64
}

func PolarToCartesian

func PolarToCartesian(p Polar) Point2f

func Pt2f

func Pt2f(x, y float64) Point2f

func PtLerp

func PtLerp(p0, p1 Point2f, t float64) Point2f

Point2f lerp

func (Point2f) Add

func (a Point2f) Add(b Point2f) Point2f

func (Point2f) DivScalar

func (a Point2f) DivScalar(scalar float64) Point2f

func (Point2f) Invert

func (a Point2f) Invert() Point2f

func (Point2f) InvertAxisX

func (a Point2f) InvertAxisX() Point2f

func (Point2f) InvertAxisY

func (a Point2f) InvertAxisY() Point2f

func (Point2f) MulScalar

func (a Point2f) MulScalar(scalar float64) Point2f

func (Point2f) Sub

func (a Point2f) Sub(b Point2f) Point2f

func (Point2f) ToPolar

func (a Point2f) ToPolar() Polar

type Polar

type Polar struct {
	Rho float64
	Phi float64
}

func CartesianToPolar

func CartesianToPolar(a Point2f) Polar

func ShPolar

func ShPolar(r, φ float64) Polar

Pt is shorthand for Point{X, Y}. Pr is shorthand for Polar{Rho, Phi}. Pr, MakePolar, ShPolar ShPolar is shorthand for Polar{Rho, Phi}.

func (Polar) ToCartesian

func (p Polar) ToCartesian() Point2f

type Rectangle2f

type Rectangle2f struct {
	Min Point2f
	Max Point2f
}

func PointToRect2f

func PointToRect2f(p Point2f) Rectangle2f

func (Rectangle2f) Add

func (r Rectangle2f) Add(p Point2f) Rectangle2f

func (Rectangle2f) Center

func (r Rectangle2f) Center() Point2f

func (Rectangle2f) Dx

func (r Rectangle2f) Dx() float64

func (Rectangle2f) Dy

func (r Rectangle2f) Dy() float64

func (Rectangle2f) Grow

func (r Rectangle2f) Grow(f Frame) Rectangle2f

func (Rectangle2f) Shrink

func (r Rectangle2f) Shrink(f Frame) Rectangle2f

func (Rectangle2f) Size

func (r Rectangle2f) Size() Point2f

Jump to

Keyboard shortcuts

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