# The glu-tessellate Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

# The glu-tessellate Reference Manual

This is the glu-tessellate Reference Manual, version 0.1.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:53:20 2018 GMT+0.

Next: , Previous: , Up: Top   [Contents][Index]

# glu-tessellate

This is a triangulation library that wraps around GLU's tessellation routines to make turning vectors of point data into triangles stupid easy.

Yes, it supports concave polygons, and yes it supports holes. It also allows you to specify which winding rule you use to triangulate.

It also returns every triangle it produces in counter-clockwise order. You can change this to clockwise by passing `:cw t`.

## Usage

The library has one public function (don't you love simplicity?) which takes a vector points (a point being an '(x y) list) into a list of triangles:

``````;; returns two triangles making up this square
(glu-tessellate:tessellate #( (0 0) (0 10) (10 10) (10 0) ))  ->
(((10.0d0 10.0d0) (0.0d0 10.0d0) (0.0d0 0.0d0))
((10.0d0 0.0d0) (10.0d0 10.0d0) (0.0d0 0.0d0)))
``````

It also supports polygons with holes. Holes are specified as a list of point vectors:

``````;; a square with a hole returns quite a few more triangles
(glu-tessellate:tessellate #( (0 0) (0 10) (10 10) (10 0) ) :holes '( #((3 3) (3 7) (7 7) (7 3)) )) ->
(((10.0d0 10.0d0) (0.0d0 10.0d0) (3.0d0 7.0d0))
((0.0d0 0.0d0) (3.0d0 7.0d0) (0.0d0 10.0d0))
((3.0d0 7.0d0) (0.0d0 0.0d0) (3.0d0 3.0d0))
((10.0d0 0.0d0) (3.0d0 3.0d0) (0.0d0 0.0d0))
((3.0d0 3.0d0) (10.0d0 0.0d0) (7.0d0 3.0d0))
((10.0d0 10.0d0) (7.0d0 3.0d0) (10.0d0 0.0d0))
((7.0d0 3.0d0) (10.0d0 10.0d0) (7.0d0 7.0d0))
((3.0d0 7.0d0) (7.0d0 7.0d0) (10.0d0 10.0d0)))
``````

### Arguments

The one function this library uses takes the following keyword arguments:

``````:holes           ; a list of point vectors describing the holes in the polygon
:winding-rule    ; a keyword describing the winding rule: (:odd :nonzero :positive :negative :abs-geq-two)
:cw              ; if T, produced triangles will be in CW order instead of CCW
``````

## Limitations

GLU tessellation normally allows you to store arbitrary data with each point and also merge this point data when new points are created. This library doesn't currently allow this, and is only used for triangulation of points. If you need to attach colors to your triangles, it must be done so outside of the library...unless, of course, you wish to add arbitrary data support and issue a pull request ;).

The only other limitation I can think of is that it relies on GLU being on the system. Show me a system without GLU and I'll show you a computer from an alternate universe where Microsoft finally did away with all competition and DirectX rules o'er the land with an iron fist.

Next: , Previous: , Up: Top   [Contents][Index]

## 2 Systems

The main system appears first, followed by any subsystem dependency.

Previous: , Up: Systems   [Contents][Index]

### 2.1 glu-tessellate

Author

Andrew Lyon <orthecreedence@gmail.com>

MIT

Description

A simple triangulation engine that wraps around GLU’s tessellation system.

Version

0.1.0

Dependency

cffi

Source

glu-tessellate.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

## 3 Files

Files are sorted by type and then listed depth-first from the systems components trees.

Previous: , Up: Files   [Contents][Index]

### 3.1 Lisp

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.1 glu-tessellate.asd

Location

glu-tessellate.asd

Systems

glu-tessellate (system)

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.2 glu-tessellate/package.lisp

Parent

glu-tessellate (system)

Location

package.lisp

Packages

Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.3 glu-tessellate/tessellate.lisp

Dependency

package.lisp (file)

Parent

glu-tessellate (system)

Location

tessellate.lisp

Exported Definitions

tessellate (function)

Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

## 4 Packages

Packages are listed by definition order.

Previous: , Up: Packages   [Contents][Index]

### 4.1 glu-tessellate

Source

package.lisp (file)

Nickname

tess

Use List
• cffi
• common-lisp
Exported Definitions

tessellate (function)

Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

## 5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.

Next: , Previous: , Up: Definitions   [Contents][Index]

### 5.1 Exported definitions

Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.1 Functions

Function: tessellate POINTS &key HOLES WINDING-RULE CW

Tessellate a polygon into triangles.

Package
Source

tessellate.lisp (file)

Previous: , Up: Definitions   [Contents][Index]

### 5.2 Internal definitions

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.1 Constants

Constant: +begin+
Package
Source

tessellate.lisp (file)

Constant: +ccw+
Package
Source

tessellate.lisp (file)

Constant: +cw+
Package
Source

tessellate.lisp (file)

Constant: +edge-flag+
Package
Source

tessellate.lisp (file)

Constant: +end+
Package
Source

tessellate.lisp (file)

Constant: +exterior+
Package
Source

tessellate.lisp (file)

Constant: +interior+
Package
Source

tessellate.lisp (file)

Constant: +line-loop+
Package
Source

tessellate.lisp (file)

Constant: +line-strip+
Package
Source

tessellate.lisp (file)

Constant: +lines+
Package
Source

tessellate.lisp (file)

Constant: +points+
Package
Source

tessellate.lisp (file)

Constant: +polygon+
Package
Source

tessellate.lisp (file)

Package
Source

tessellate.lisp (file)

Package
Source

tessellate.lisp (file)

Constant: +tess-begin+
Package
Source

tessellate.lisp (file)

Constant: +tess-begin-data+
Package
Source

tessellate.lisp (file)

Constant: +tess-boundary-only+
Package
Source

tessellate.lisp (file)

Constant: +tess-combine+
Package
Source

tessellate.lisp (file)

Constant: +tess-combine-data+
Package
Source

tessellate.lisp (file)

Constant: +tess-coord-too-large+
Package
Source

tessellate.lisp (file)

Constant: +tess-edge-flag+
Package
Source

tessellate.lisp (file)

Constant: +tess-edge-flag-data+
Package
Source

tessellate.lisp (file)

Constant: +tess-end+
Package
Source

tessellate.lisp (file)

Constant: +tess-end-data+
Package
Source

tessellate.lisp (file)

Constant: +tess-error+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-1+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-2+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-3+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-4+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-5+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-6+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-7+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-8+
Package
Source

tessellate.lisp (file)

Constant: +tess-error-data+
Package
Source

tessellate.lisp (file)

Constant: +tess-max-coord+
Package
Source

tessellate.lisp (file)

Constant: +tess-missing-begin-contour+
Package
Source

tessellate.lisp (file)

Constant: +tess-missing-begin-polygon+
Package
Source

tessellate.lisp (file)

Constant: +tess-missing-end-contour+
Package
Source

tessellate.lisp (file)

Constant: +tess-missing-end-polygon+
Package
Source

tessellate.lisp (file)

Constant: +tess-need-combine-callback+
Package
Source

tessellate.lisp (file)

Constant: +tess-tolerance+
Package
Source

tessellate.lisp (file)

Constant: +tess-vertex+
Package
Source

tessellate.lisp (file)

Constant: +tess-vertex-data+
Package
Source

tessellate.lisp (file)

Constant: +tess-winding-abs-geq-two+
Package
Source

tessellate.lisp (file)

Constant: +tess-winding-negative+
Package
Source

tessellate.lisp (file)

Constant: +tess-winding-nonzero+
Package
Source

tessellate.lisp (file)

Constant: +tess-winding-odd+
Package
Source

tessellate.lisp (file)

Constant: +tess-winding-positive+
Package
Source

tessellate.lisp (file)

Constant: +tess-winding-rule+
Package
Source

tessellate.lisp (file)

Constant: +triangle-fan+
Package
Source

tessellate.lisp (file)

Constant: +triangle-strip+
Package
Source

tessellate.lisp (file)

Constant: +triangles+
Package
Source

tessellate.lisp (file)

Constant: +unknown+
Package
Source

tessellate.lisp (file)

Constant: +vertex+
Package
Source

tessellate.lisp (file)

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.2 Special variables

Special Variable: *created-points*
Package
Source

tessellate.lisp (file)

Special Variable: *cur-triangle*
Package
Source

tessellate.lisp (file)

Special Variable: *cur-triangle-wind*
Package
Source

tessellate.lisp (file)

Special Variable: *cur-type*
Package
Source

tessellate.lisp (file)

Special Variable: *polygons*
Package
Source

tessellate.lisp (file)

Special Variable: *triangles*
Package
Source

tessellate.lisp (file)

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.3 Macros

Macro: def-c-callback NAME &rest ARGS
Package
Source

tessellate.lisp (file)

Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.4 Functions

Function: begin-polygon TESS
Package
Source

tessellate.lisp (file)

Function: delete-tess TESS
Package
Source

tessellate.lisp (file)

Function: do-tess-begin TYPE

Called when a tessellation shape begins. Stores the shape type for later reference.

Package
Source

tessellate.lisp (file)

Function: do-tess-combine COORDS VERTEX-DATA WEIGHTS DATA-OUT

Called when tessellation must create a new point. Ideally this is where user data would be merged into a new point, but since we don’t support user data, there’s nothing to do but create the point and return =].

Package
Source

tessellate.lisp (file)

Function: do-tess-end ()

Called with tessellation finishes with a shape. Saves all relevant data and sets up for another shape to come its way.

Package
Source

tessellate.lisp (file)

Function: do-tess-error ERR

Error!!!!

Package
Source

tessellate.lisp (file)

Function: do-tess-vertex VERTEX

Called when tessellation sends us a vertex. Uses the current shape type to figure out how the vertex will be processed/stored.

Package
Source

tessellate.lisp (file)

Function: end-polygon TESS
Package
Source

tessellate.lisp (file)

Function: error-string CODE
Package
Source

tessellate.lisp (file)

Function: get-tess-property TESS WHICH DATA
Package
Source

tessellate.lisp (file)

Function: get-winding-rule WIND-KEYWORD

Get the global winding rule for the keyword passed in.

Package
Source

tessellate.lisp (file)

Function: new-tess ()
Package
Source

tessellate.lisp (file)

Function: next-contour TESS TYPE
Package
Source

tessellate.lisp (file)

Function: polygon-clockwise-p POLYGON-POINTS

Determine if the points of a polygon are in clockwise order.

Package
Source

tessellate.lisp (file)

Function: tess-begin-contour TESS
Package
Source

tessellate.lisp (file)

Function: tess-begin-polygon TESS DATA
Package
Source

tessellate.lisp (file)

Function: tess-callback TESS WHICH CALLBACKFUNC
Package
Source

tessellate.lisp (file)

Function: tess-end-contour TESS
Package
Source

tessellate.lisp (file)

Function: tess-end-polygon TESS
Package
Source

tessellate.lisp (file)

Function: tess-normal TESS VALUEX VALUEY VALUEZ
Package
Source

tessellate.lisp (file)

Function: tess-property TESS WHICH VALUE
Package
Source

tessellate.lisp (file)

Function: tess-vertex TESS LOCATION DATA
Package
Source

tessellate.lisp (file)

Previous: , Up: Top   [Contents][Index]

## Appendix A Indexes

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.1 Concepts

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.2 Functions

Next: , Previous: , Up: Indexes   [Contents][Index]