blueprintspatial

package
v0.0.2-early-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AAB

type AAB struct {
	Width  float64
	Height float64
}

AAB represents an axis-aligned bounding box

type Circle

type Circle struct {
	Radius float64
}

Circle represents a circular shape with radius

type Direction

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

func NewDirectionLeft

func NewDirectionLeft() Direction

func NewDirectionRight

func NewDirectionRight() Direction

func (*Direction) AsFloat

func (d *Direction) AsFloat() float64

func (*Direction) IsLeft

func (d *Direction) IsLeft() bool

func (*Direction) IsRight

func (d *Direction) IsRight() bool

func (*Direction) SetLeft

func (d *Direction) SetLeft()

func (*Direction) SetRight

func (d *Direction) SetRight()

type Polygon

type Polygon struct {
	LocalVertices []vector.Two
	WorldVertices []vector.Two
}

Polygon represents a shape defined by vertices in both local and world space

type Position

type Position struct{ vector.Two }

Position represents a 2D point in space

func NewPosition

func NewPosition(x, y float64) Position

NewPosition creates a new Position at the specified coordinates

type PreviousPosition

type PreviousPosition struct{ vector.Two }

PreviousPosition stores the previous position for continuous collision detection

type Rotation

type Rotation float64

Rotation represents an angle in radians

func (Rotation) AsFloat64

func (r Rotation) AsFloat64() float64

AsFloat64 returns the rotation value as a float64

func (*Rotation) Set

func (r *Rotation) Set(val float64)

type Scale

type Scale struct{ vector.Two }

Scale represents scaling factors for x and y dimensions

func NewScale

func NewScale(x, y float64) Scale

NewScale creates a new Scale with the specified x and y scaling factors

type Shape

type Shape struct {
	LocalAAB AAB
	WorldAAB AAB
	Polygon  Polygon
	Skin     Skin
}

Shape represents a geometric shape with local and world bounds, polygon definition, and skin

func NewDoubleRamp

func NewDoubleRamp(width, height float64, topWidthRatio float64) Shape

NewDoubleRamp creates a two-sided ramp (trapezoid with slopes on both sides) width: total width of the ramp height: height of the ramp topWidthRatio: width of the flat section on top (as a ratio of total width, 0-1) Note: In this engine, lower Y values are higher in the world (y=0 is top of screen)

func NewPolygon

func NewPolygon(localVertices []vector.Two) Shape

NewPolygon creates a new shape from a set of local vertices

func NewRectangle

func NewRectangle(width, height float64) Shape

NewRectangle creates a rectangular shape with specified width and height

func NewSingleRamp

func NewSingleRamp(width, height float64, leftToRight bool) Shape

NewSingleRamp creates a triangular ramp shape with specified dimensions When leftToRight is true, the ramp ascends from left to right

func NewTrapezoidPlatform

func NewTrapezoidPlatform(width, height float64, slopeRatio float64) Shape

NewTrapezoidPlatform creates a trapezoid shape with a flat top of the specified width, angled sides, and a narrower bottom. The slopeRatio controls how much narrower the bottom is This is useful for creating one-way platforms with more gradual angled sides

func NewTriangularPlatform

func NewTriangularPlatform(width, height float64) Shape

NewTriangularPlatform creates a triangular shape with a flat top of the specified width and angled sides meeting at a point at the specified height below the top This is useful for one-way platforms where you want to prevent side collisions

type Skin

type Skin struct {
	AAB    AAB
	Circle Circle
}

Skin contains collision detection primitives for a shape

func CalcSkin

func CalcSkin(p Polygon, aab AAB, scale vector.TwoReader) Skin

CalcSkin calculates collision primitives for a polygon

Jump to

Keyboard shortcuts

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