shapes

package
v0.0.0-...-0bea188 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bounds

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

Bounds represents the top left and bottom right coordinates of a shape

func NewBounds

func NewBounds(min, max Point2) Bounds

NewBounds returns a new Bound instance

func (Bounds) GetMax

func (b Bounds) GetMax() Point2

GetMax returns the bottom right point of a shape

func (Bounds) GetMin

func (b Bounds) GetMin() Point2

GetMin returns the top left point of a shape

type Circle

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

Circle represents a circle, used only to generate a regular polygon, so no much to see here :)

func NewCircle

func NewCircle(radius, x, y float64) *Circle

NewCircle returns a new Circle instance

func (*Circle) CalcArea

func (c *Circle) CalcArea() float64

CalcArea returns the circle's area

func (*Circle) CalcCircumference

func (c *Circle) CalcCircumference() float64

CalcCircumference returns the circle's circumference

func (*Circle) GetPosition

func (c *Circle) GetPosition() Point2

GetPosition returns the position of circle's center

func (*Circle) GetRadius

func (c *Circle) GetRadius() float64

GetRadius returns the circle's radius

type IrRegPolygon

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

IrRegPolygon represents an irregular polygon

func NewIrRegPolygon

func NewIrRegPolygon(numSides int, vertices ...Point2) *IrRegPolygon

NewIrRegPolygon returns a new IrRegPolygon instance

func (*IrRegPolygon) GetNumSides

func (p *IrRegPolygon) GetNumSides() int

GetNumSides returns number of sides the polygon has

func (*IrRegPolygon) GetVertices

func (p *IrRegPolygon) GetVertices() []Point2

GetVertices returns a slice of utils.Point2 that represents the vertices of the polygon

func (*IrRegPolygon) SetVertices

func (p *IrRegPolygon) SetVertices(v []Point2)

SetVertices it's written on the box :)

type Point2

type Point2 struct {
	X, Y float64
}

Point2 represents a point on a 2d plane

type Polygon

type Polygon interface {
	// GetNumSides returns number of sides the polygon has
	GetNumSides() int
	// GetVertices returns a slice of utils.Point2 that represents the vertices of the polygon
	GetVertices() []Point2
	// SetVertices it's written on the box :)
	SetVertices(v []Point2)
}

Polygon well it's a polygon big news :]

type RegPolygon

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

RegPolygon represents a regular polygon

func NewPolygon

func NewPolygon(numSides int, sideLength float64, vertices ...Point2) *RegPolygon

NewPolygon returns a new Polygon instance

func (*RegPolygon) GetInnerSideAngle

func (p *RegPolygon) GetInnerSideAngle() float64

GetInnerSideAngle returns the angle between sides in radians

func (*RegPolygon) GetNumSides

func (p *RegPolygon) GetNumSides() int

GetNumSides returns number of sides the polygon has

func (*RegPolygon) GetSideLength

func (p *RegPolygon) GetSideLength() float64

GetSideLength return polygon's side length

func (*RegPolygon) GetVertices

func (p *RegPolygon) GetVertices() []Point2

GetVertices returns a slice of utils.Point2 that represents the vertices of the polygon

func (*RegPolygon) SetVertices

func (p *RegPolygon) SetVertices(v []Point2)

SetVertices it's written on the box :)

Jump to

Keyboard shortcuts

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