geom

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_ssl_gc_geometry_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Rectangle added in v0.2.0

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

func NewRectangleFromCenter added in v0.2.0

func NewRectangleFromCenter(center *Vector2, xExtent, yExtent float64) (r *Rectangle)

NewRectangleFromCenter creates a new rectangle from a center and the x- and y-extent

func NewRectangleFromPoints added in v0.2.0

func NewRectangleFromPoints(p1, p2 *Vector2) (r *Rectangle)

NewRectangleFromPoints creates a new rectangle from two points

func (*Rectangle) IsPointInside added in v0.2.0

func (r *Rectangle) IsPointInside(p *Vector2) bool

IsPointInside returns true if the given point is inside the rectangle

func (*Rectangle) MaxX added in v0.2.0

func (r *Rectangle) MaxX() float64

MaxX returns the largest x value

func (*Rectangle) MaxY added in v0.2.0

func (r *Rectangle) MaxY() float64

MaxX returns the largest y value

func (*Rectangle) MinX added in v0.2.0

func (r *Rectangle) MinX() float64

MaxX returns the smallest x value

func (*Rectangle) MinY added in v0.2.0

func (r *Rectangle) MinY() float64

MaxX returns the smallest y value

func (*Rectangle) WithMargin added in v0.2.0

func (r *Rectangle) WithMargin(margin float64) *Rectangle

WithMargin creates a new rectangle with the added/subtracted margin

type Vector2

type Vector2 struct {
	X *float32 `protobuf:"fixed32,1,req,name=x" json:"x,omitempty"`
	Y *float32 `protobuf:"fixed32,2,req,name=y" json:"y,omitempty"`
	// contains filtered or unexported fields
}

A vector with two dimensions

func NewVector2

func NewVector2(x, y float64) *Vector2

NewVector2 creates a new Vector2 from float64 values

func NewVector2Float32

func NewVector2Float32(x, y float32) *Vector2

NewVector2Float32 creates a new Vector2 from float32 values

func (*Vector2) Descriptor deprecated

func (*Vector2) Descriptor() ([]byte, []int)

Deprecated: Use Vector2.ProtoReflect.Descriptor instead.

func (*Vector2) DistanceTo

func (m *Vector2) DistanceTo(o *Vector2) float64

DistanceTo returns the distance between this vector and the given one

func (*Vector2) GetX

func (x *Vector2) GetX() float32

func (*Vector2) GetY

func (x *Vector2) GetY() float32

func (*Vector2) Length

func (m *Vector2) Length() float64

Length returns the length of this vector

func (*Vector2) ProtoMessage

func (*Vector2) ProtoMessage()

func (*Vector2) ProtoReflect

func (x *Vector2) ProtoReflect() protoreflect.Message

func (*Vector2) Reset

func (x *Vector2) Reset()

func (*Vector2) String

func (x *Vector2) String() string

func (*Vector2) StringPretty

func (m *Vector2) StringPretty() string

StringPretty converts the vector into a pretty printed string

func (*Vector2) Sub

func (m *Vector2) Sub(o *Vector2) *Vector2

Sub subtracts the given vector from this one

func (*Vector2) X64

func (m *Vector2) X64() float64

X64 returns the x value as float64

func (*Vector2) Y64

func (m *Vector2) Y64() float64

Y64 returns the y value as float64

type Vector3

type Vector3 struct {
	X *float32 `protobuf:"fixed32,1,req,name=x" json:"x,omitempty"`
	Y *float32 `protobuf:"fixed32,2,req,name=y" json:"y,omitempty"`
	Z *float32 `protobuf:"fixed32,3,req,name=z" json:"z,omitempty"`
	// contains filtered or unexported fields
}

A vector with three dimensions

func (*Vector3) Descriptor deprecated

func (*Vector3) Descriptor() ([]byte, []int)

Deprecated: Use Vector3.ProtoReflect.Descriptor instead.

func (*Vector3) GetX

func (x *Vector3) GetX() float32

func (*Vector3) GetY

func (x *Vector3) GetY() float32

func (*Vector3) GetZ

func (x *Vector3) GetZ() float32

func (*Vector3) ProtoMessage

func (*Vector3) ProtoMessage()

func (*Vector3) ProtoReflect

func (x *Vector3) ProtoReflect() protoreflect.Message

func (*Vector3) Reset

func (x *Vector3) Reset()

func (*Vector3) String

func (x *Vector3) String() string

func (*Vector3) ToVector2

func (m *Vector3) ToVector2() *Vector2

ToVector2 converts this vector into a new 2d vector, dropping the z part

Jump to

Keyboard shortcuts

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