geom

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 1 Imported by: 0

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

func (p Point) DistSq(other Point) int

func (Point) Sub

func (p Point) Sub(other Point) Point

func (Point) ToNorm

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

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

type Polygon

type Polygon struct {
	Points []Point
}

Polygon represents a n-gon with integer coordinates.

func (Polygon) ToNorm

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

func (Polygon) Triangulate

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