mathutil

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenDigitsStr added in v1.3.7

func GenDigitsStr(n int) string

func Limit added in v1.3.7

func Limit[T constraints.Ordered](v, min, max T) T

func LimitFloat64

func LimitFloat64(v float64, min, max float64) float64

TODO: remove

func LimitInt

func LimitInt(v int, min, max int) int

TODO: remove

func Max added in v1.3.0

func Max[T constraints.Ordered](s ...T) T

func Min added in v1.3.0

func Min[T constraints.Ordered](s ...T) T

func RoundFloat64 added in v1.3.3

func RoundFloat64(val float64, precision uint) float64

Types

type Intf

type Intf int64

Integer based float. Based on fixed.Int52_12.

func Intf1

func Intf1(x int) Intf

func Intf2

func Intf2(x fixed.Int26_6) Intf

func (Intf) Ceil

func (x Intf) Ceil() int

func (Intf) Ceil2 added in v1.3.7

func (x Intf) Ceil2() Intf

func (Intf) Floor

func (x Intf) Floor() int

func (Intf) Floor2 added in v1.3.7

func (x Intf) Floor2() Intf

func (Intf) Mul

func (x Intf) Mul(y Intf) Intf

func (Intf) String

func (x Intf) String() string

type PointIntf

type PointIntf struct {
	X, Y Intf
}

func PIntf1

func PIntf1(x, y int) PointIntf

func PIntf2

func PIntf2(p image.Point) PointIntf

func (PointIntf) Add

func (p PointIntf) Add(q PointIntf) PointIntf

func (PointIntf) In

func (p PointIntf) In(r RectangleIntf) bool

func (PointIntf) Sub

func (p PointIntf) Sub(q PointIntf) PointIntf

func (PointIntf) ToPointCeil

func (p PointIntf) ToPointCeil() image.Point

func (PointIntf) ToPointFloor

func (p PointIntf) ToPointFloor() image.Point

type RectangleIntf

type RectangleIntf struct {
	Min, Max PointIntf
}

func RIntf

func RIntf(r image.Rectangle) RectangleIntf

func (RectangleIntf) Add

func (RectangleIntf) Dx added in v1.3.7

func (r RectangleIntf) Dx() Intf

func (RectangleIntf) Dy added in v1.3.7

func (r RectangleIntf) Dy() Intf

func (RectangleIntf) Empty

func (r RectangleIntf) Empty() bool

func (RectangleIntf) Intersect

func (r RectangleIntf) Intersect(s RectangleIntf) RectangleIntf

func (RectangleIntf) Size added in v1.3.7

func (r RectangleIntf) Size() PointIntf

func (RectangleIntf) Sub

func (RectangleIntf) ToRectCeilFloor added in v1.3.7

func (r RectangleIntf) ToRectCeilFloor() image.Rectangle

contracts

func (RectangleIntf) ToRectFloorCeil

func (r RectangleIntf) ToRectFloorCeil() image.Rectangle

expands

Jump to

Keyboard shortcuts

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