Tessellation via GLU
paths->triangles
paths->edges
7.7

Tessellation via GLU

The glu-tessellate module uses the platform’s GLU library to convert a set of closed paths to either a set of triangles for the bounded shape’s interior or a set of line segments for the bounded shape’s edges.

procedure

(paths->triangles closed-paths 
  #:fill-style fill-style 
  [#:expected-scale expected-scale]) 
  
(listof (vector/c (cons/c flonum? flonum?)
                  (cons/c flonum? flonum?)
                  (cons/c flonum? flonum?)))
  closed-paths : (listof (listof vector?))
  fill-style : (or/c 'odd-even 'winding)
  expected-scale : real? = 1.0
Produces a set of triangles given a set of closed paths. The triangles cover the space bounded by the combined paths using the specified fill-style.

Each closed path must start with a vector of two numbers, which represents the path’s starting and ending point. Subsequent elements are vectors of either two or six numbers, where a vector of six numbers represents a Bezier curve from the preceding point to the point specified by the last two elements of the vector, where the first four elements of the vector represent control points. (This format is consistent with the result of get-datum in dc-path%.)

The resulting triangles are each represented by a vector of three points, where a point is represented by a pair of numbers.

Paths can include Bezier curves, which must be approximated by lines. The expected-scale argument adjusts the approximation based on how much the resulting triangles are expected to be scaled relative to a rendering unit.

procedure

(paths->edges closed-paths 
  #:fill-style fill-style 
  [#:expected-scale expected-scale]) 
  
(listof (vector/c (cons/c flonum? flonum?)
                  (cons/c flonum? flonum?)))
  closed-paths : (listof (listof vector?))
  fill-style : (or/c 'odd-even 'winding)
  expected-scale : real? = 1.0
Like paths->triangles, but produces a set of line sequences for the edge of the area bounded by the combined paths. For each edge, the bounded area is to the left of the edge moveing from the starting point to the ending point.