Documentation ¶
Index ¶
- Constants
- type Line2
- type Rect
- type Rectf
- type Recti
- type Vec2
- func (v Vec2[T]) Add(other Vec2[T]) Vec2[T]
- func (v Vec2[T]) Angle() float64
- func (v Vec2[T]) Complex128() complex128
- func (v Vec2[T]) Complex64() complex64
- func (v Vec2[T]) Eq(other Vec2[T]) bool
- func (v Vec2[T]) Length() float64
- func (v Vec2[T]) LengthSq() T
- func (v Vec2[T]) Polar() (r, theta float64)
- func (v Vec2[T]) XY() (x, y T)
- type Vec2f
- type Vec2i
Examples ¶
Constants ¶
View Source
const (
Tau = math.Pi * 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rect ¶
type Rect[T intfloat] struct {
X0, Y0, X1, Y1 T
}
Example ¶
package main import ( "fmt" "github.com/eihigh/geom" ) func main() { r1 := geom.Recti{10, 10, 20, 20} r2 := geom.XYWHToRect(10, 10, 10, 10) r3 := geom.PosSizeToRect(geom.Vec2i{10, 10}, geom.Vec2i{10, 10}) fmt.Println(r1.Eq(r2)) fmt.Println(r1.Eq(r3)) }
Output: true true
func MinMaxToRect ¶
func PosSizeToRect ¶
func XYWHToRect ¶
func XYWHToRect[T intfloat](x, y, w, h T) Rect[T]
type Vec2 ¶
type Vec2[T intfloat] struct {
X, Y T
}
func (Vec2[T]) Complex128 ¶
func (v Vec2[T]) Complex128() complex128
Click to show internal directories.
Click to hide internal directories.