dagaz

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MERGE_EPSILON = (float32)(0.6)

Variables

This section is empty.

Functions

func EqualWithEpsilon

func EqualWithEpsilon(a float32, b float32, epsilon float64) bool

func InRangeWithEpsilon

func InRangeWithEpsilon(value float32, min float32, max float32, epsilon float32) bool

func IntersectQuad

func IntersectQuad(r Ray, q Quad) (bool, float32)

func Swap

func Swap(a *float32, b *float32)

Types

type Module

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

func (*Module) HandleDagazGetDebugInfo

func (m *Module) HandleDagazGetDebugInfo(ctx context.Context, respond hwebsocket.ResponseSender, msg hwebsocket.Msg) error

func (*Module) HandleDagazGetGroundPlane

func (m *Module) HandleDagazGetGroundPlane(ctx context.Context, respond hwebsocket.ResponseSender, msg hwebsocket.Msg) error

func (*Module) HandleDagazGetRegion

func (m *Module) HandleDagazGetRegion(ctx context.Context, respond hwebsocket.ResponseSender, msg hwebsocket.Msg) error

func (*Module) HandleDagazQuadSample

func (m *Module) HandleDagazQuadSample(ctx context.Context, msg hwebsocket.Msg) error

func (*Module) HandleDisconnect

func (m *Module) HandleDisconnect()

func (*Module) HandleMsg

func (m *Module) HandleMsg(ctx context.Context, respond hwebsocket.ResponseSender, msg hwebsocket.Msg) error

func (*Module) Init

func (m *Module) Init(s *models.Session, p *models.Participant)

func (*Module) Name

func (m *Module) Name() string

type Quad

type Quad struct {
	Center  Vector3f
	Extents Vector3f // Half-Extents!

	// implicit
	Normal Vector3f

	MergeCount uint32
}

func NewQuadFromProtobuf

func NewQuadFromProtobuf(protoQuad *dagazpb.Quad) Quad

func (*Quad) ToProtobuf

func (q *Quad) ToProtobuf() *dagazpb.Quad

type Ray

type Ray struct {
	From Vector3f
	To   Vector3f
}

func NewRayFromProtobuf

func NewRayFromProtobuf(protoRay *dagazpb.Ray) Ray

type RegularGrid

type RegularGrid struct {
	Resolution uint
	PlaneCount uint32
	MergeCount uint32
	Min        Vector3f
	Max        Vector3f
	Grid       [][][]*Quad
}

func NewRegularGrid

func NewRegularGrid(numCols uint, numRows uint, resolution uint) *RegularGrid

func (*RegularGrid) ExpandToFitPoint

func (grid *RegularGrid) ExpandToFitPoint(p *Vector3f)

NOTE(jhenriques): the cells limits are in the range [0..1[ meaning, for a resolution of 1, the "unit 1" is in "cell index" 1

func (*RegularGrid) GetDebugInfo

func (grid *RegularGrid) GetDebugInfo() SpatialDebugInfo

func (*RegularGrid) GetRegion

func (grid *RegularGrid) GetRegion(min Vector3f, max Vector3f) []*Quad

func (*RegularGrid) InsertQuad

func (grid *RegularGrid) InsertQuad(q Quad)

func (*RegularGrid) IntersectQuad

func (grid *RegularGrid) IntersectQuad(r Ray) (*Quad, float32)

This is a very specialized quad intersection method to work with our 2D uniformely sessiond grid.

type SpatialDebugInfo

type SpatialDebugInfo struct {
	Resolution  uint32
	Row_count   uint32
	Col_count   uint32
	Plane_count uint32
	Merge_count uint32
	Min_point   Vector3f
	Max_point   Vector3f
	Occupancy   []uint32
}

type SpatialPartition

type SpatialPartition interface {
	InsertQuad(q Quad)
	IntersectQuad(r Ray) (*Quad, float32)
	GetRegion(min Vector3f, max Vector3f) []*Quad

	// debug stuff:
	GetDebugInfo() SpatialDebugInfo
}

type State

type State struct {
	SpatialPartition SpatialPartition
}

type Vector3f

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

func Add

func Add(a Vector3f, b Vector3f) Vector3f

func Cross

func Cross(a Vector3f, b Vector3f) Vector3f

func Mul

func Mul(a Vector3f, s float32) Vector3f

func NewVector3f

func NewVector3f(x, y, z float32) Vector3f

func NewVector3fFromProtobuf

func NewVector3fFromProtobuf(point *dagazpb.Point) Vector3f

func Normalized

func Normalized(a Vector3f) Vector3f

func Sub

func Sub(a Vector3f, b Vector3f) Vector3f

func (*Vector3f) Add

func (v1 *Vector3f) Add(v2 Vector3f)

func (*Vector3f) Dot

func (a *Vector3f) Dot(b Vector3f) float32

func (*Vector3f) Equal

func (v1 *Vector3f) Equal(v2 Vector3f) bool

func (Vector3f) EqualWithEpsilon

func (v1 Vector3f) EqualWithEpsilon(v2 Vector3f, epsilon float64) bool

func (*Vector3f) GreaterOrEqualThan

func (v1 *Vector3f) GreaterOrEqualThan(v2 Vector3f) bool

func (*Vector3f) GreaterThan

func (v1 *Vector3f) GreaterThan(v2 Vector3f) bool

func (*Vector3f) Length

func (a *Vector3f) Length() float64

func (*Vector3f) LesserOrEqualThan

func (v1 *Vector3f) LesserOrEqualThan(v2 Vector3f) bool

func (*Vector3f) LesserThan

func (v1 *Vector3f) LesserThan(v2 Vector3f) bool

func (*Vector3f) NormalizeInPlace

func (a *Vector3f) NormalizeInPlace()

func (*Vector3f) ToProtobuf

func (v *Vector3f) ToProtobuf() *dagazpb.Point

Jump to

Keyboard shortcuts

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