Documentation ¶
Overview ¶
Package xmath provides math-related utilities.
Index ¶
- Constants
- func AbsFloat32(x float32) float32
- func AbsInt(x int) int
- func CeilFloat32(x float32) float32
- func FloorFloat32(x float32) float32
- func MaxFloat32(a, b float32) float32
- func MaxInt(a, b int) int
- func MinFloat32(a, b float32) float32
- func MinInt(a, b int) int
- func Round(x float64) float64
- func RoundFloat32(x float32) float32
- type BitSet
- func (b *BitSet) Clear(index int)
- func (b *BitSet) ClearRange(start, end int)
- func (b *BitSet) Clone() *BitSet
- func (b *BitSet) Copy(other *BitSet)
- func (b *BitSet) Count() int
- func (b *BitSet) Data() []uint64
- func (b *BitSet) EnsureCapacity(words int)
- func (b *BitSet) Equal(other *BitSet) bool
- func (b *BitSet) FirstSet() int
- func (b *BitSet) Flip(index int)
- func (b *BitSet) FlipRange(start, end int)
- func (b *BitSet) LastSet() int
- func (b *BitSet) Load(data []uint64)
- func (b *BitSet) NextClear(start int) int
- func (b *BitSet) NextSet(start int) int
- func (b *BitSet) PreviousClear(start int) int
- func (b *BitSet) PreviousSet(start int) int
- func (b *BitSet) Reset()
- func (b *BitSet) Set(index int)
- func (b *BitSet) SetRange(start, end int)
- func (b *BitSet) State(index int) bool
- func (b *BitSet) Trim()
- type Matrix2D
Constants ¶
const ( // DegreesToRadians converts a value in degrees to radians when multiplied // with the value. DegreesToRadians = math.Pi / 180 // RadiansToDegrees converts a value in radians to degrees when multiplied // with the value. RadiansToDegrees = 180 / math.Pi )
Variables ¶
This section is empty.
Functions ¶
func CeilFloat32 ¶
CeilFloat32 returns the smallest integer value greater than or equal to x.
func FloorFloat32 ¶
FloorFloat32 returns the greatest integer value less than or equal to x.
func MaxFloat32 ¶
MaxFloat32 returns the larger of a or b. Note that there is no special handling for Inf, NaN, or +0 vs -0. If you want/need that, up-cast to float64 and use math.Max().
func MinFloat32 ¶
MinFloat32 returns the smaller of a or b. Note that there is no special handling for Inf, NaN, or +0 vs -0. If you want/need that, up-cast to float64 and use math.Min().
Types ¶
type BitSet ¶
type BitSet struct {
// contains filtered or unexported fields
}
BitSet contains a set of bits.
func (*BitSet) ClearRange ¶
ClearRange clears the bits from 'start' to 'end', inclusive.
func (*BitSet) EnsureCapacity ¶
EnsureCapacity ensures that the BitSet has enough underlying storage to accommodate setting a bit as high as index position 'words' x 64 - 1 without needing to allocate more storage.
func (*BitSet) FirstSet ¶
FirstSet returns the first set bit. If no bits are set, then -1 is returned.
func (*BitSet) NextSet ¶
NextSet returns the next set bit starting from 'start'. If no bits are set at or beyond 'start', then -1 is returned.
func (*BitSet) PreviousClear ¶
PreviousClear returns the previous clear bit starting from 'start'. If no bits are clear at or before 'start', then -1 is returned.
func (*BitSet) PreviousSet ¶
PreviousSet returns the previous set bit starting from 'start'. If no bits are set at or before 'start', then -1 is returned.
type Matrix2D ¶
type Matrix2D struct {
XX, YX, XY, YY, X0, Y0 float64
}
Matrix2D provides a 2D matrix.
func NewIdentityMatrix2D ¶
func NewIdentityMatrix2D() *Matrix2D
NewIdentityMatrix2D creates a new identity transformation 2D matrix.
func NewMatrix2D ¶
NewMatrix2D creates a new 2D matrix.
func NewRotationMatrix2D ¶
NewRotationMatrix2D creates a new 2D matrix that rotates by 'radians'. Positive values are clockwise.
func NewScaleMatrix2D ¶
NewScaleMatrix2D creates a new 2D matrix that scales by 'sx' and 'sy'.
func NewTranslationMatrix2D ¶
NewTranslationMatrix2D creates a new 2D matrix that translates by 'tx' and 'ty'.
func (*Matrix2D) TransformDistance ¶
TransformDistance returns the result of transforming the distance vector (size.Width and size.Height) by this matrix. This is similar to TransformPoint(), except that the translation components of the transformation are ignored.
func (*Matrix2D) TransformPoint ¶
TransformPoint returns the result of transforming the point by this matrix.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fixed provides fixed-point values that can be added, subtracted, multiplied and divided.
|
Package fixed provides fixed-point values that can be added, subtracted, multiplied and divided. |
Package geom provides geometry primitives.
|
Package geom provides geometry primitives. |
Package rand provides a Randomizer based upon the crypto/rand package.
|
Package rand provides a Randomizer based upon the crypto/rand package. |