geometry

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AngleDirections = struct {
	angleDirections
	Err    error
	Values []AngleDirection
}{

	Err: fmt.Errorf("invalid AngleDirection"),
	// contains filtered or unexported fields
}
View Source
var AngleTypes = struct {
	angleTypes
	Err    error
	Values []AngleType
}{

	Err: fmt.Errorf("invalid AngleType"),
	// contains filtered or unexported fields
}

Functions

func DegreeToRadian

func DegreeToRadian[T types.Numbers](angle T) T

func RadianToDegree

func RadianToDegree[T types.Numbers](angle T) T

Types

type Angle

type Angle[T types.Numbers] struct {
	Magnitude T
	Type      AngleType
	Direction AngleDirection
}

func (Angle[T]) ToDegree

func (t Angle[T]) ToDegree() Angle[T]

func (Angle[T]) ToRadian

func (t Angle[T]) ToRadian() Angle[T]

type AngleDirection

type AngleDirection string

func (AngleDirection) MarshalJSON

func (t AngleDirection) MarshalJSON() ([]byte, error)

func (AngleDirection) MarshalYAML

func (t AngleDirection) MarshalYAML() (interface{}, error)

func (*AngleDirection) Scan

func (t *AngleDirection) Scan(value interface{}) error

func (AngleDirection) String

func (t AngleDirection) String() string

func (*AngleDirection) UnmarshalJSON

func (t *AngleDirection) UnmarshalJSON(data []byte) error

func (*AngleDirection) UnmarshalYAML

func (t *AngleDirection) UnmarshalYAML(unmarshal func(interface{}) error) error

func (AngleDirection) Value

func (t AngleDirection) Value() (driver.Value, error)

type AngleType

type AngleType string

func (AngleType) MarshalJSON

func (t AngleType) MarshalJSON() ([]byte, error)

func (AngleType) MarshalYAML

func (t AngleType) MarshalYAML() (interface{}, error)

func (*AngleType) Scan

func (t *AngleType) Scan(value interface{}) error

func (AngleType) String

func (t AngleType) String() string

func (*AngleType) UnmarshalJSON

func (t *AngleType) UnmarshalJSON(data []byte) error

func (*AngleType) UnmarshalYAML

func (t *AngleType) UnmarshalYAML(unmarshal func(interface{}) error) error

func (AngleType) Value

func (t AngleType) Value() (driver.Value, error)

type CartesianCoordinate

type CartesianCoordinate[T types.Numbers] struct {
	X T
	Y T
}

func PolarToCartesian

func PolarToCartesian[T types.Numbers](coordinate PolarCoordinate[T]) CartesianCoordinate[T]

type Circle

type Circle[T types.Numbers] struct {
	Center CartesianCoordinate[T]
	Radius T
}

func NewCircle

func NewCircle[T types.Numbers](center CartesianCoordinate[T], radius T) Circle[T]

func NewCircleXY

func NewCircleXY[T types.Numbers](x, y, radius T) Circle[T]

func (Circle[T]) PointOnCircumference

func (t Circle[T]) PointOnCircumference(angle Angle[T]) CartesianCoordinate[T]

type Dimension2d

type Dimension2d[T types.Numbers] struct {
	Height T
	Width  T
}

func NewDimension2d

func NewDimension2d[T types.Numbers](height, width T) Dimension2d[T]

type LineSegment

type LineSegment[T types.Numbers] struct {
	Start CartesianCoordinate[T]
	End   CartesianCoordinate[T]
}

func NewLineSegmentCoords

func NewLineSegmentCoords[T types.Numbers](start, end CartesianCoordinate[T]) LineSegment[T]

func NewLineSegmentXY

func NewLineSegmentXY[T types.Numbers](x1, y1, x2, y2 T) LineSegment[T]

func (LineSegment[T]) Length

func (t LineSegment[T]) Length() T

func (LineSegment[T]) Midpoint

func (t LineSegment[T]) Midpoint() CartesianCoordinate[T]

func (LineSegment[T]) PointAtPercent

func (t LineSegment[T]) PointAtPercent(percentage T) CartesianCoordinate[T]

func (LineSegment[T]) Slope

func (t LineSegment[T]) Slope() T

func (LineSegment[T]) SlopeIntercept

func (t LineSegment[T]) SlopeIntercept() SlopeInterceptLine[T]

func (LineSegment[T]) Standard

func (t LineSegment[T]) Standard() StandardLine[T]

type PolarCoordinate

type PolarCoordinate[T types.Numbers] struct {
	Radius T
	Angle  Angle[T]
}

func CartesianToPolar

func CartesianToPolar[T types.Numbers](coordinate CartesianCoordinate[T]) PolarCoordinate[T]

type Rectangle

type Rectangle[T types.Numbers] struct {
	TopLeft    CartesianCoordinate[T]
	Dimensions Dimension2d[T]
}

func NewRectangle

func NewRectangle[T types.Numbers](topLeft CartesianCoordinate[T], dimensions Dimension2d[T]) Rectangle[T]

func NewRectangleXYHW

func NewRectangleXYHW[T types.Numbers](x, y, height, width T) Rectangle[T]

func (Rectangle[T]) Area

func (t Rectangle[T]) Area() T

func (Rectangle[T]) BottomLeft

func (t Rectangle[T]) BottomLeft() CartesianCoordinate[T]

func (Rectangle[T]) BottomMidpoint

func (t Rectangle[T]) BottomMidpoint() CartesianCoordinate[T]

func (Rectangle[T]) BottomRight

func (t Rectangle[T]) BottomRight() CartesianCoordinate[T]

func (Rectangle[T]) Center

func (t Rectangle[T]) Center() CartesianCoordinate[T]

func (Rectangle[T]) LeftMidpoint

func (t Rectangle[T]) LeftMidpoint() CartesianCoordinate[T]

func (Rectangle[T]) Perimeter

func (t Rectangle[T]) Perimeter() T

func (Rectangle[T]) PointOnPeremiter

func (t Rectangle[T]) PointOnPeremiter(angle Angle[T]) CartesianCoordinate[T]

func (Rectangle[T]) RightMidpoint

func (t Rectangle[T]) RightMidpoint() CartesianCoordinate[T]

func (Rectangle[T]) TopMidpoint

func (t Rectangle[T]) TopMidpoint() CartesianCoordinate[T]

func (Rectangle[T]) TopRight

func (t Rectangle[T]) TopRight() CartesianCoordinate[T]

type SlopeInterceptLine

type SlopeInterceptLine[T types.Numbers] struct {
	M T
	B T
}

func (SlopeInterceptLine[T]) Segment

func (t SlopeInterceptLine[T]) Segment(x1, x2 T) LineSegment[T]

func (SlopeInterceptLine[T]) Y

func (t SlopeInterceptLine[T]) Y(x T) T

type StandardLine

type StandardLine[T types.Numbers] struct {
	A T
	B T
	C T
}

Jump to

Keyboard shortcuts

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