geom

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 1 Imported by: 6

Documentation

Overview

Package geom contains structs for representing a Point and a Triangle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	X int
	Y int
}

Point represents a 2D point with integer coordinates.

func (Point) DistSq added in v1.1.9

func (p Point) DistSq(other Point) int

func (Point) Sub added in v1.1.9

func (p Point) Sub(other Point) Point

func (Point) ToNorm added in v1.1.7

func (p Point) ToNorm(w, h int) normgeom.NormPoint

ToNorm returns the normalized equivalent of a Point given a width and height.

type Polygon added in v1.1.7

type Polygon struct {
	Points []Point
}

Polygon represents a n-gon with integer coordinates.

func (Polygon) ToNorm added in v1.1.7

func (p Polygon) ToNorm(w, h int) normgeom.NormPolygon

func (Polygon) Triangulate added in v1.1.7

func (p Polygon) Triangulate(triangle func(Triangle))

type Triangle

type Triangle struct {
	Points [3]Point
}

Triangle represents a triangle with integer coordinates.

func NewTriangle

func NewTriangle(x0, y0, x1, y1, x2, y2 int) Triangle

NewTriangle returns a new Triangle with specified vertex coordinates.

func (Triangle) ToNorm

func (t Triangle) ToNorm(w, h int) normgeom.NormTriangle

ToNorm returns the normalized equivalent of a Triangle given a width and height.

Jump to

Keyboard shortcuts

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