rect2

package
v0.0.0-...-cfa0ac2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Float32

type Float32 = Rectangle[float32]

func NewFloat32

func NewFloat32[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Float32

type Float64

type Float64 = Rectangle[float64]

func NewFloat64

func NewFloat64[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Float64

type Int

type Int = Rectangle[int]

func NewInt

func NewInt[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Int

type Int16

type Int16 = Rectangle[int16]

func NewInt16

func NewInt16[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Int16

type Int32

type Int32 = Rectangle[int32]

func NewInt32

func NewInt32[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Int32

type Int64

type Int64 = Rectangle[int64]

func NewInt64

func NewInt64[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Int64

type Int8

type Int8 = Rectangle[int8]

func NewInt8

func NewInt8[PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Int8

type Rectangle

type Rectangle[T rm.SignedNumber] struct {
	Position vector2.Vector[T]
	Size     vector2.Vector[T]
}

func New

func New[T rm.SignedNumber](position vector2.Vector[T], size vector2.Vector[T]) Rectangle[T]

func NewSize

func NewSize[T rm.SignedNumber](size vector2.Vector[T]) Rectangle[T]

func NewT

func NewT[T rm.SignedNumber, PT, ST rm.SignedNumber](position vector2.Vector[PT], size vector2.Vector[ST]) Rectangle[T]

func NewXYWH

func NewXYWH[T rm.SignedNumber](x, y, w, h T) Rectangle[T]

func One

func One[T rm.SignedNumber]() Rectangle[T]

func Zero

func Zero[T rm.SignedNumber]() Rectangle[T]

func (Rectangle[T]) A

func (r Rectangle[T]) A() vector2.Vector[T]

func (Rectangle[T]) Add

func (r Rectangle[T]) Add(xy vector2.Vector[T], wh vector2.Vector[T]) Rectangle[T]

func (Rectangle[T]) AddHeight

func (r Rectangle[T]) AddHeight(dH T) Rectangle[T]

func (Rectangle[T]) AddPosition

func (r Rectangle[T]) AddPosition(dXY vector2.Vector[T]) Rectangle[T]

func (Rectangle[T]) AddPositionXY

func (r Rectangle[T]) AddPositionXY(x, y T) Rectangle[T]

func (Rectangle[T]) AddSize

func (r Rectangle[T]) AddSize(dWH vector2.Vector[T]) Rectangle[T]

func (Rectangle[T]) AddSizeXY

func (r Rectangle[T]) AddSizeXY(width, height T) Rectangle[T]

func (Rectangle[T]) AddWidth

func (r Rectangle[T]) AddWidth(dW T) Rectangle[T]

func (Rectangle[T]) AddX

func (r Rectangle[T]) AddX(dX T) Rectangle[T]

func (Rectangle[T]) AddXYWH

func (r Rectangle[T]) AddXYWH(x, y, w, h T) Rectangle[T]

func (Rectangle[T]) AddY

func (r Rectangle[T]) AddY(dY T) Rectangle[T]

func (Rectangle[T]) B

func (r Rectangle[T]) B() vector2.Vector[T]

func (Rectangle[T]) Ceil

func (v Rectangle[T]) Ceil() Rectangle[T]

Ceil applies the ceil math operation to each component of the rectangle

func (Rectangle[T]) CeilToInt

func (v Rectangle[T]) CeilToInt() Rectangle[int]

CeilToInt applies the ceil math operation to each component of the rectangle, and then casts it to a int

func (Rectangle[T]) Center

func (r Rectangle[T]) Center() vector2.Vector[T]

func (Rectangle[T]) Contains

func (r Rectangle[T]) Contains(v vector2.Vector[T]) bool

func (Rectangle[T]) EachUnitCell

func (r Rectangle[T]) EachUnitCell() iter.Seq[vector2.Vector[T]]

func (Rectangle[T]) Floor

func (v Rectangle[T]) Floor() Rectangle[T]

Floor applies the floor math operation to each component of the rectangle

func (Rectangle[T]) FloorToInt

func (v Rectangle[T]) FloorToInt() Rectangle[int]

FloorToInt applies the floor math operation to each component of the rectangle, and then casts it to a int

func (Rectangle[T]) Grow

func (r Rectangle[T]) Grow(v T) Rectangle[T]

func (Rectangle[T]) GrowXYWH

func (r Rectangle[T]) GrowXYWH(left, top, right, bottom T) Rectangle[T]

func (Rectangle[T]) Height

func (r Rectangle[T]) Height() T

Y returns the y of the wh component

func (Rectangle[T]) HorizontalLine

func (r Rectangle[T]) HorizontalLine(y T) (vector2.Vector[T], vector2.Vector[T])

func (Rectangle[T]) Inverse

func (r Rectangle[T]) Inverse(v vector2.Float64) vector2.Float64

func (Rectangle[T]) InverseF

func (r Rectangle[T]) InverseF(v vector2.Float32) vector2.Float32

func (Rectangle[T]) InverseLerp

func (r Rectangle[T]) InverseLerp(v vector2.Float64) vector2.Float64

InverseLerp calculates the inverse lerp of a point within the rectangle, returning a normalized vector2.Vector[T].

func (Rectangle[T]) InverseLerpF

func (r Rectangle[T]) InverseLerpF(v vector2.Float32) vector2.Float32

InverseLerpF calculates the inverse lerp of a point within the rectangle, returning a normalized vector2.Float32.

func (Rectangle[T]) IsZero

func (v Rectangle[T]) IsZero() bool

func (Rectangle[T]) Lerp

func (r Rectangle[T]) Lerp(t vector2.Float64) vector2.Vector[T]

func (Rectangle[T]) LerpF

func (r Rectangle[T]) LerpF(t vector2.Float32) vector2.Vector[T]

func (Rectangle[T]) LerpXYF

func (r Rectangle[T]) LerpXYF(x, y float32) vector2.Vector[T]

func (Rectangle[T]) Pivot

func (r Rectangle[T]) Pivot(anchor vector2.Vector[T], xy vector2.Vector[T]) Rectangle[T]

func (Rectangle[T]) ResetPosition

func (r Rectangle[T]) ResetPosition() Rectangle[T]

ResetPosition zero the xy component of the rectangle

func (Rectangle[T]) Round

func (v Rectangle[T]) Round() Rectangle[T]

Round takes each component of the rectangle and rounds it to the nearest whole number

func (Rectangle[T]) RoundToInt

func (v Rectangle[T]) RoundToInt() Rectangle[int]

RoundToInt takes each component of the rectangle and rounds it to the nearest whole number, and then casts it to a int

func (Rectangle[T]) Scale

func (r Rectangle[T]) Scale(f float64) Rectangle[T]

func (Rectangle[T]) ScaleByVector

func (r Rectangle[T]) ScaleByVector(f vector2.Float64) Rectangle[T]

func (Rectangle[T]) ScaleByVectorF

func (r Rectangle[T]) ScaleByVectorF(f vector2.Float32) Rectangle[T]

func (Rectangle[T]) ScaleByXY

func (r Rectangle[T]) ScaleByXY(x, y float64) Rectangle[T]

func (Rectangle[T]) ScaleByXYF

func (r Rectangle[T]) ScaleByXYF(x, y float32) Rectangle[T]

func (Rectangle[T]) ScaleF

func (r Rectangle[T]) ScaleF(f float32) Rectangle[T]

func (Rectangle[T]) SetA

func (r Rectangle[T]) SetA(a vector2.Vector[T]) Rectangle[T]

func (Rectangle[T]) SetB

func (r Rectangle[T]) SetB(b vector2.Vector[T]) Rectangle[T]

func (Rectangle[T]) SetHeight

func (r Rectangle[T]) SetHeight(newH T) Rectangle[T]

SetHeight changes the y of the wh component of the rectangle

func (Rectangle[T]) SetPosition

func (r Rectangle[T]) SetPosition(newXY vector2.Vector[T]) Rectangle[T]

SetPosition changes the xy component of the rectangle

func (Rectangle[T]) SetPositionXY

func (r Rectangle[T]) SetPositionXY(x, y T) Rectangle[T]

SetPosition changes the xy component of the rectangle

func (Rectangle[T]) SetSize

func (r Rectangle[T]) SetSize(newWH vector2.Vector[T]) Rectangle[T]

SetSize changes the wh component of the rectangle

func (Rectangle[T]) SetSizeXY

func (r Rectangle[T]) SetSizeXY(width, height T) Rectangle[T]

SetSizeXY changes the wh component of the rectangle

func (Rectangle[T]) SetWidth

func (r Rectangle[T]) SetWidth(newW T) Rectangle[T]

SetWidth changes the x of the wh component of the rectangle

func (Rectangle[T]) SetX

func (r Rectangle[T]) SetX(newX T) Rectangle[T]

SetX changes the x of the xy component of the rectangle

func (Rectangle[T]) SetY

func (r Rectangle[T]) SetY(newY T) Rectangle[T]

SetY changes the y of the xy component of the rectangle

func (Rectangle[T]) ShrinkXYWH

func (r Rectangle[T]) ShrinkXYWH(left, top, right, bottom T) Rectangle[T]

func (Rectangle[T]) String

func (r Rectangle[T]) String() string

func (Rectangle[T]) ToFloat32

func (v Rectangle[T]) ToFloat32() Rectangle[float32]

func (Rectangle[T]) ToFloat64

func (v Rectangle[T]) ToFloat64() Rectangle[float64]

func (Rectangle[T]) ToInt

func (v Rectangle[T]) ToInt() Rectangle[int]

func (Rectangle[T]) ToInt32

func (v Rectangle[T]) ToInt32() Rectangle[int32]

func (Rectangle[T]) ToInt64

func (v Rectangle[T]) ToInt64() Rectangle[int64]

func (Rectangle[T]) VerticalLine

func (r Rectangle[T]) VerticalLine(x T) (vector2.Vector[T], vector2.Vector[T])

func (Rectangle[T]) Width

func (r Rectangle[T]) Width() T

Width returns the x of the wh component

func (Rectangle[T]) X

func (r Rectangle[T]) X() T

X returns the x of the xy component

func (Rectangle[T]) Y

func (r Rectangle[T]) Y() T

Y returns the y of the xy component

func (Rectangle[T]) Zoom

func (r Rectangle[T]) Zoom(f float64) Rectangle[T]

func (Rectangle[T]) ZoomByVector

func (r Rectangle[T]) ZoomByVector(f vector2.Float64) Rectangle[T]

func (Rectangle[T]) ZoomByVectorF

func (r Rectangle[T]) ZoomByVectorF(f vector2.Float32) Rectangle[T]

func (Rectangle[T]) ZoomByXY

func (r Rectangle[T]) ZoomByXY(x, y float64) Rectangle[T]

func (Rectangle[T]) ZoomByXYF

func (r Rectangle[T]) ZoomByXYF(x, y float32) Rectangle[T]

func (Rectangle[T]) ZoomF

func (r Rectangle[T]) ZoomF(f float32) Rectangle[T]

Jump to

Keyboard shortcuts

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