utils

package
v0.0.0-...-2a6a35c Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Rand = rand.New(rand.NewSource(time.Now().UnixMilli()))

Functions

This section is empty.

Types

type Point

type Point struct {
	X, Y float64
}

func RoundToPoint

func RoundToPoint(rad, length float64) Point

func (Point) Add

func (p Point) Add(p2 Point) Point

func (Point) Diff

func (p Point) Diff(p2 Point) (float64, float64)

func (Point) String

func (p Point) String() string

String returns a string representation of p like "(3,4)".

func (Point) Sub

func (p Point) Sub(p2 Point) Point

type Rectangle

type Rectangle struct {
	Min, Max Point
}

func Rect

func Rect(x, y, w, h float64) Rectangle

Rect build a utils.Rectangle

func (Rectangle) Dx

func (r Rectangle) Dx() float64

Dx returns r's width.

func (Rectangle) Dy

func (r Rectangle) Dy() float64

Dy returns r's height.

func (Rectangle) Size

func (r Rectangle) Size() Point

Size returns r's width and height.

func (Rectangle) String

func (r Rectangle) String() string

String returns a string representation of r like "(3,4)-(6,5)".

Jump to

Keyboard shortcuts

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