poly

package
v1.17.13 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package poly cuts the polygons of a model file into triangles (a fan when the polygon is convex, ear clipping when it is not); the loaders of OBJ and PLY share it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Triangulator

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

Triangulator cuts polygons into triangles. It keeps its work arrays between polygons.

func (*Triangulator) Cut

func (tr *Triangulator) Cut(pos []float64, corners []int32, out []int32) []int32

Cut appends the triangles of the polygon to out, as numbers of its corners: a triangle is three consecutive numbers, in the winding of the polygon. pos are the positions of all the vertices of the file, three numbers each, and corners the vertices of the polygon in them. A convex polygon is cut as a fan from its first corner; a concave one by ear clipping on the plane that is the most face-on to the polygon. A polygon with no area is cut as a fan too, and the triangles that have none are the business of the renderer.

Jump to

Keyboard shortcuts

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