poly2tri

package module
v0.0.0-...-f6ef213 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

Poly2Tri is a port of Poly2Tri to Go.

It is purely experimental.

License

Copyright 2019 Glenn Lewis. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Overview

Package poly2tri is a port of Poly2Tri to Go.

Index

Constants

View Source
const (
	// PiOver2 is Pi/2.
	PiOver2 = math.Pi / 2
	// Pi3Over4 is 3Pi/4.
	Pi3Over4 = 3 * math.Pi / 4
	// Epsilon is a small number.
	Epsilon = 1e-12
)
View Source
const (
	// CW is clockwise.
	CW = iota
	// CCW is counter-clockwise.
	CCW
	// COLLINEAR is collinear.
	COLLINEAR
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancingFront

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

AdvancingFront represents an advancing front.

type Basin

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

Basin represents a basin.

func (*Basin) Clear

func (b *Basin) Clear()

Clear clears the basin.

type Edge

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

Edge represents an edge.

type EdgeEvent

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

EdgeEvent represents an edge event.

type Node

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

Node is an advancing front node.

type Point

type Point struct {
	X, Y float64
	// contains filtered or unexported fields
}

Point represents a point.

func NewPoint

func NewPoint(x, y float64) *Point

NewPoint returns a new point.

type PointArray

type PointArray []*Point

PointArray attaches the methods of Interface to []*Point, sorting in increasing order.

func (PointArray) Len

func (p PointArray) Len() int

func (PointArray) Less

func (p PointArray) Less(i, j int) bool

func (PointArray) Sort

func (p PointArray) Sort()

Sort is a convenience method.

func (PointArray) Swap

func (p PointArray) Swap(i, j int)

type SweepContext

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

SweepContext represents a sweep context.

func New

func New(polyline PointArray) *SweepContext

New initializes the polyline.

func (*SweepContext) AddHole

func (s *SweepContext) AddHole(polyline PointArray)

AddHole adds a hole.

func (*SweepContext) AddPoint

func (s *SweepContext) AddPoint(p *Point)

AddPoint adds a point.

func (*SweepContext) Mesh

func (s *SweepContext) Mesh() TriArray

Mesh returns the entire triangle mesh for debugging purposes.

func (*SweepContext) RemoveFromMap

func (s *SweepContext) RemoveFromMap(t *Triangle)

RemoveFromMap removes a triangle from the map.

func (*SweepContext) RemoveNode

func (s *SweepContext) RemoveNode(node *Node)

RemoveNode removes a node.

func (*SweepContext) Triangulate

func (s *SweepContext) Triangulate() TriArray

Triangulate returns the contstrained triangles.

type TriArray

type TriArray []*Triangle

TriArray represents a triangle array.

type Triangle

type Triangle struct {
	// Triangle Point
	Point [3]*Point
	// contains filtered or unexported fields
}

Triangle represents a triangle.

Jump to

Keyboard shortcuts

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