graphics2D

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseGeometryClass

type BaseGeometryClass struct {
	Box      *BoundingBox
	Geometry []Point
}

func (*BaseGeometryClass) Area

func (bg *BaseGeometryClass) Area() (area float64)

func (*BaseGeometryClass) Centroid

func (bg *BaseGeometryClass) Centroid() (ct *Point)

func (*BaseGeometryClass) GetBoundingBox

func (bg *BaseGeometryClass) GetBoundingBox() (bb *BoundingBox)

func (*BaseGeometryClass) GetGeometry

func (bg *BaseGeometryClass) GetGeometry() (geom []Point)

func (*BaseGeometryClass) InverseTransformLambertAzimuthal

func (bg *BaseGeometryClass) InverseTransformLambertAzimuthal(radius float64, center *Point)

func (*BaseGeometryClass) SetGeometry

func (bg *BaseGeometryClass) SetGeometry(geom []Point)

func (*BaseGeometryClass) TransformLambertAzimuthal

func (bg *BaseGeometryClass) TransformLambertAzimuthal(radius float64, center *Point)

type BoundingBox

type BoundingBox struct {
	XMin [2]float32
	XMax [2]float32
}

func BoundingBoxFromGoogleMapsZoom

func BoundingBoxFromGoogleMapsZoom(vCenter Point, canvasWidth int, zoomLevel float64) (viewBox *BoundingBox)

func NewBoundingBox

func NewBoundingBox(Geometry []Point) (Box *BoundingBox)

func (*BoundingBox) Centroid

func (bb *BoundingBox) Centroid() (centroid *Point)

func (*BoundingBox) Divide

func (bb *BoundingBox) Divide(denom *BoundingBox) (scaleX []float64)

func (*BoundingBox) Grow

func (bb *BoundingBox) Grow(newBB *BoundingBox)

func (*BoundingBox) MoveToOrigin

func (bb *BoundingBox) MoveToOrigin() (bbOut *BoundingBox)

func (*BoundingBox) Outline

func (bb *BoundingBox) Outline() (pLine *PolyLine)

func (*BoundingBox) PointInside

func (bb *BoundingBox) PointInside(point *Point) (within bool)

func (*BoundingBox) Scale

func (bb *BoundingBox) Scale(scale float32) (bbOut *BoundingBox)

func (*BoundingBox) ScaleX

func (bb *BoundingBox) ScaleX(scale float32) (bbOut *BoundingBox)

func (*BoundingBox) ScaleY

func (bb *BoundingBox) ScaleY(scale float32) (bbOut *BoundingBox)

func (*BoundingBox) Translate

func (bb *BoundingBox) Translate(panX [2]float32) (bbOut *BoundingBox)

type GeometryInterface

type GeometryInterface interface {
	GetGeometry() []Point
	SetGeometry([]Point) // Allows for external transformations
	GetBoundingBox() *BoundingBox
	Area() float64
	Centroid() *Point
}

type Line

type Line struct {
	Box *BoundingBox
	// contains filtered or unexported fields
}

func NewLine

func NewLine(pt1, pt2 Point) (line *Line)

func (*Line) Area

func (ln *Line) Area() (area float64)

func (*Line) Centroid

func (ln *Line) Centroid() (centroid *Point)

func (*Line) GetBoundingBox

func (ln *Line) GetBoundingBox() (box *BoundingBox)

func (*Line) GetGeometry

func (ln *Line) GetGeometry() (geom []Point)

func (*Line) SetGeometry

func (ln *Line) SetGeometry(geom []Point)

type Point

type Point struct {
	X [2]float32
}

func LineLineIntersection

func LineLineIntersection(line1, line2 *Line) *Point

func NewPoint

func NewPoint(x, y float32) *Point

func (*Point) Area

func (pt *Point) Area() (area float64)

func (*Point) Centroid

func (pt *Point) Centroid() (centroid *Point)

func (*Point) Equal

func (pt *Point) Equal(rhs Point) bool

func (*Point) GetBoundingBox

func (pt *Point) GetBoundingBox() (box *BoundingBox)

func (*Point) GetGeometry

func (pt *Point) GetGeometry() (geom []Point)

func (*Point) Minus

func (pt *Point) Minus(rhs *Point) (res *Point)

func (*Point) Plus

func (pt *Point) Plus(rhs *Point) (res *Point)

func (*Point) Scale

func (pt *Point) Scale(scale Point)

func (*Point) SetGeometry

func (pt *Point) SetGeometry(geom []Point)

type PolyLine

type PolyLine struct {
	BaseGeometryClass
}

func NewPolyLine

func NewPolyLine(geom []Point) (pl *PolyLine)

type Polygon

type Polygon struct {
	BaseGeometryClass
}

func NewNgon

func NewNgon(centroid Point, radius float64, n int) (poly *Polygon)

func NewNgonGivenArea

func NewNgonGivenArea(centroid Point, area float64, n int) (poly *Polygon)

func NewPolygon

func NewPolygon(geom []Point) (poly *Polygon)

func (*Polygon) Area

func (pg *Polygon) Area() (area float64)

func (*Polygon) Centroid

func (pg *Polygon) Centroid() (centroid *Point)

func (*Polygon) PointInside

func (pg *Polygon) PointInside(point Point) (inside bool)

type QuadMesh

type QuadMesh struct {
	BaseGeometryClass
	Dimensions [2]int
	Attributes [][]float32
}

type TriMesh

type TriMesh struct {
	BaseGeometryClass
	Triangles  []Triangle
	Attributes [][]float32
}

func (*TriMesh) AddQuadMesh

func (tm *TriMesh) AddQuadMesh(mesh *QuadMesh) error

func (*TriMesh) Area

func (tm *TriMesh) Area() (area float64)

func (*TriMesh) Centroid

func (tm *TriMesh) Centroid() (centroid *Point)

type Triangle

type Triangle struct {
	Nodes [3]int32
}

Jump to

Keyboard shortcuts

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