shape

package
v0.0.0-...-20810c9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InfiniteBounds Bounds2 = Bounds2{
		Min: Point2{X: -math.MaxFloat32, Y: -math.MaxFloat32},
		Max: Point2{X: math.MaxFloat32, Y: math.MaxFloat32},
	}
	InfiniteCircle Circle2 = Circle2{Radius: math.MaxFloat32}
)

Functions

This section is empty.

Types

type Bounds2

type Bounds2 struct {
	Min, Max Point2
}

func (Bounds2) Area

func (s Bounds2) Area() float32

func (Bounds2) Bounds

func (s Bounds2) Bounds() Bounds2

func (Bounds2) Center

func (s Bounds2) Center() Point2

func (Bounds2) Circle

func (s Bounds2) Circle() Circle2

func (Bounds2) Closest

func (s Bounds2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Bounds2) Empty

func (s Bounds2) Empty() bool

func (Bounds2) Intersection

func (s Bounds2) Intersection(b Bounds2) Bounds2

func (Bounds2) Intersects

func (s Bounds2) Intersects(b Bounds2) bool

func (Bounds2) PolygonPoints

func (s Bounds2) PolygonPoints(target []Point2) int

func (Bounds2) PolygonSize

func (s Bounds2) PolygonSize() int

func (Bounds2) Union

func (s Bounds2) Union(b Bounds2) Bounds2

type Circle2

type Circle2 struct {
	Center Point2
	Radius float32
}

func (Circle2) Bounds

func (s Circle2) Bounds() Bounds2

func (Circle2) Circle

func (s Circle2) Circle() Circle2

func (Circle2) Closest

func (s Circle2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Circle2) PolygonPoints

func (s Circle2) PolygonPoints(target []Point2) int

func (Circle2) PolygonSize

func (s Circle2) PolygonSize() int

type Ellipse2

type Ellipse2 struct {
	Center        Point2
	Width, Height float32
}

func (Ellipse2) Bounds

func (s Ellipse2) Bounds() Bounds2

func (Ellipse2) Circle

func (s Ellipse2) Circle() Circle2

func (Ellipse2) Closest

func (s Ellipse2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Ellipse2) PolygonPoints

func (s Ellipse2) PolygonPoints(target []Point2) int

func (Ellipse2) PolygonSize

func (s Ellipse2) PolygonSize() int

type HasShape2

type HasShape2 interface {
	GetShape() Shape2
}

type Inverted2

type Inverted2 struct {
	Shape Shape2
}

func (Inverted2) Bounds

func (s Inverted2) Bounds() Bounds2

func (Inverted2) Circle

func (s Inverted2) Circle() Circle2

func (Inverted2) Closest

func (s Inverted2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Inverted2) PolygonPoints

func (s Inverted2) PolygonPoints(target []Point2) int

func (Inverted2) PolygonSize

func (s Inverted2) PolygonSize() int

type Line2

type Line2 struct {
	Start, End Point2
}

func (Line2) Bounds

func (s Line2) Bounds() Bounds2

func (Line2) Circle

func (s Line2) Circle() Circle2

func (Line2) Closest

func (s Line2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Line2) PolygonPoints

func (s Line2) PolygonPoints(target []Point2) int

func (Line2) PolygonSize

func (s Line2) PolygonSize() int

type Padded2

type Padded2 struct {
	Shape   Shape2
	Padding float32
	Rounded bool
}

func (Padded2) Bounds

func (s Padded2) Bounds() Bounds2

func (Padded2) Circle

func (s Padded2) Circle() Circle2

func (Padded2) Closest

func (s Padded2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Padded2) PolygonPoints

func (s Padded2) PolygonPoints(target []Point2) int

func (Padded2) PolygonSize

func (s Padded2) PolygonSize() int

type Plane2

type Plane2 struct {
	A, B, C float32
}

func Plane2Line

func Plane2Line(start, end Point2) Plane2

func Plane2PointNormal

func Plane2PointNormal(point, normal Point2) Plane2

func (Plane2) Bounds

func (s Plane2) Bounds() Bounds2

func (Plane2) Circle

func (s Plane2) Circle() Circle2

func (Plane2) Closest

func (s Plane2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Plane2) Distance

func (s Plane2) Distance(p Point2) float32

func (Plane2) Normal

func (s Plane2) Normal() Point2

func (Plane2) Origin

func (s Plane2) Origin() Point2

func (Plane2) PolygonPoints

func (s Plane2) PolygonPoints(target []Point2) int

func (Plane2) PolygonSize

func (s Plane2) PolygonSize() int

type Point2

type Point2 struct {
	X, Y float32
}

func (Point2) Add

func (s Point2) Add(p Point2) Point2

func (Point2) Bounds

func (s Point2) Bounds() Bounds2

func (Point2) Circle

func (s Point2) Circle() Circle2

func (Point2) Closest

func (s Point2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Point2) Dot

func (s Point2) Dot(p Point2) float32

func (Point2) Length

func (s Point2) Length() float32

func (Point2) LengthSq

func (s Point2) LengthSq() float32

func (Point2) Lerp

func (s Point2) Lerp(e Point2, d float32) Point2

func (Point2) Max

func (s Point2) Max(p Point2) Point2

func (Point2) Min

func (s Point2) Min(p Point2) Point2

func (Point2) Move

func (s Point2) Move(dx, dy float32) Point2

func (Point2) Neg

func (s Point2) Neg() Point2

func (Point2) NormalTo

func (s Point2) NormalTo(p Point2) (Point2, float32)

func (Point2) PolygonPoints

func (s Point2) PolygonPoints(target []Point2) int

func (Point2) PolygonSize

func (s Point2) PolygonSize() int

func (Point2) Scale

func (s Point2) Scale(scale float32) Point2

func (Point2) Sub

func (s Point2) Sub(p Point2) Point2

func (Point2) Tangent

func (s Point2) Tangent() Point2

type Polygon2

type Polygon2 struct {
	Points []Point2
}

func (Polygon2) Bounds

func (s Polygon2) Bounds() Bounds2

func (Polygon2) Circle

func (s Polygon2) Circle() Circle2

func (Polygon2) Closest

func (s Polygon2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Polygon2) Inside

func (s Polygon2) Inside(p Point2) bool

func (Polygon2) PolygonPoints

func (s Polygon2) PolygonPoints(target []Point2) int

func (Polygon2) PolygonSize

func (s Polygon2) PolygonSize() int

type Segment2

type Segment2 struct {
	Start, End Point2
}

func (Segment2) Bounds

func (s Segment2) Bounds() Bounds2

func (Segment2) Circle

func (s Segment2) Circle() Circle2

func (Segment2) Closest

func (s Segment2) Closest(p Point2, distance *float32, normal *Point2) Point2

func (Segment2) PolygonPoints

func (s Segment2) PolygonPoints(target []Point2) int

func (Segment2) PolygonSize

func (s Segment2) PolygonSize() int

type Shape2

type Shape2 interface {
	Closest(p Point2, distance *float32, normal *Point2) Point2
	// Translate(t Point2) Shape2
	Bounds() Bounds2
	Circle() Circle2
	// Bounding(p Point2) Shape2
	PolygonPoints(target []Point2) int
	PolygonSize() int
}

type Transform2

type Transform2 struct {
	// contains filtered or unexported fields
}

func Identity

func Identity() Transform2

func (*Transform2) Determinant

func (t *Transform2) Determinant() float32

func (*Transform2) GetDegrees

func (t *Transform2) GetDegrees() float32

func (*Transform2) GetInvert

func (t *Transform2) GetInvert() Transform2

func (*Transform2) GetRadians

func (t *Transform2) GetRadians() float32

func (*Transform2) GetScale

func (t *Transform2) GetScale() (x, y float32)

func (*Transform2) GetTranslate

func (t *Transform2) GetTranslate() (float32, float32)

func (Transform2) HasAffect

func (t Transform2) HasAffect() bool

func (*Transform2) Identity

func (t *Transform2) Identity()

func (*Transform2) Invert

func (t *Transform2) Invert()

func (Transform2) IsEffectivelyIdentity

func (t Transform2) IsEffectivelyIdentity() bool

func (Transform2) IsIdentity

func (t Transform2) IsIdentity() bool

func (Transform2) IsZero

func (t Transform2) IsZero() bool

func (*Transform2) Multiply

func (t *Transform2) Multiply(b Transform2)

func (*Transform2) PreScale

func (t *Transform2) PreScale(sx, sy float32)

func (*Transform2) PreTranslate

func (t *Transform2) PreTranslate(tx, ty float32)

func (*Transform2) Rotate

func (t *Transform2) Rotate(radians float32)

func (*Transform2) RotateDegrees

func (t *Transform2) RotateDegrees(degrees float32)

func (*Transform2) Scale

func (t *Transform2) Scale(sx, sy float32)

func (*Transform2) Set

func (t *Transform2) Set(sx, ry, rx, sy, tx, ty float32)

func (*Transform2) SetRotate

func (t *Transform2) SetRotate(radians float32)

func (*Transform2) SetRotateAround

func (t *Transform2) SetRotateAround(radians, anchorX, anchorY float32)

func (*Transform2) SetRotateDegrees

func (t *Transform2) SetRotateDegrees(degrees float32)

func (*Transform2) SetRotateDegreesAround

func (t *Transform2) SetRotateDegreesAround(radians, anchorX, anchorY float32)

func (*Transform2) SetRotateDegreesScaleAround

func (t *Transform2) SetRotateDegreesScaleAround(degrees, scaleX, scaleY, anchorX, anchorY float32)

func (*Transform2) SetRotateScaleAround

func (t *Transform2) SetRotateScaleAround(radians, scaleX, scaleY, anchorX, anchorY float32)

func (*Transform2) SetScale

func (t *Transform2) SetScale(sx, sy float32)

func (*Transform2) SetScaleAround

func (t *Transform2) SetScaleAround(sx, sy, anchorX, anchorY float32)

func (*Transform2) SetShear

func (t *Transform2) SetShear(sx, sy float32)

func (*Transform2) SetShearAround

func (t *Transform2) SetShearAround(sx, sy, anchorX, anchorY float32)

func (*Transform2) SetTranslate

func (t *Transform2) SetTranslate(tx, ty float32)

func (*Transform2) Shear

func (t *Transform2) Shear(sx, sy float32)

func (*Transform2) Transform

func (t *Transform2) Transform(x, y float32) (float32, float32)

func (*Transform2) TransformPoint

func (t *Transform2) TransformPoint(c Point2) Point2

func (*Transform2) TransformVector

func (t *Transform2) TransformVector(vx, vy float32) (float32, float32)

func (*Transform2) TransformVectorPoint

func (t *Transform2) TransformVectorPoint(v Point2) Point2

func (*Transform2) Translate

func (t *Transform2) Translate(tx, ty float32)

Jump to

Keyboard shortcuts

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