Handbook
Glossary
triangulate-face ( face -- triangles )
Vocabulary
euler
.
b-rep
.
triangulation
Inputs
face
an
object
Outputs
triangles
an
object
Definition
USING:
accessors
alien.c-types
alien.data
alien.handles
destructors
euler.b-rep.triangulation.private
game.models.half-edge
grouping
kernel
libc
opengl.glu
sequences
;
IN:
euler.b-rep.triangulation
::
triangulate-face
( face -- triangles )
[
face
dup
base-face>>
eq?
[
triangulated-face-must-be-base
]
unless
gluNewTess
&gluDeleteTess
:>
tess
V{
}
clone
:>
vertices vertices
<alien-handle-ptr>
&release-alien-handle-ptr
:>
vertices-h tess
GLU_TESS_BEGIN_DATA
tess-begin
gluTessCallback
tess
GLU_TESS_END_DATA
tess-end
gluTessCallback
tess
GLU_TESS_VERTEX_DATA
tess-vertex
gluTessCallback
tess
GLU_TESS_EDGE_FLAG_DATA
tess-edge-flag
gluTessCallback
tess vertices-h
gluTessBeginPolygon
4
double
malloc-array
&free
:>
vertex-buf face
[|
ring |
tess
gluTessBeginContour
ring
edge>>
[
tess
swap
vertex>>
[
position>>
double
>c-array
]
[
<alien-handle-ptr>
&release-alien-handle-ptr
]
bi
gluTessVertex
]
each-face-edge
tess
gluTessEndContour
ring
next-ring>>
dup
]
loop
drop
tess
gluTessEndPolygon
vertices
{
}
like
3
<groups>
]
with-destructors
;