Skip to content
Revar Desmera edited this page Mar 31, 2019 · 6 revisions

Library File triangulation.scad

Functions to triangulate polyhedron faces. To use, add the following lines to the beginning of your file:

use <BOSL/triangulation.scad>

Table of Contents

  1. Functions

1. Functions

face_normal()

Description: Given an array of vertices (points), and a list of indexes into the vertex array (face), returns the normal vector of the face.

Argument What it does
points Array of vertices for the polyhedron.
face The face, given as a list of indices into the vertex array points.

find_convex_vertex()

Description: Returns the index of a convex point on the given face.

Argument What it does
points Array of vertices for the polyhedron.
face The face, given as a list of indices into the vertex array points.
facenorm The normal vector of the face.

point_in_ear()

Description: Determine if a point is in a clipable convex ear.

Argument What it does
points Array of vertices for the polyhedron.
face The face, given as a list of indices into the vertex array points.

normalize_vertex_perimeter()

Description: Removes the last item in an array if it is the same as the first item.

Argument What it does
v The array to normalize.

is_only_noncolinear_vertex()

Description: Given a face in a polyhedron, and a vertex in that face, returns true if that vertex is the only non-colinear vertex in the face.

Argument What it does
points Array of vertices for the polyhedron.
facelist The face, given as a list of indices into the vertex array points.
vertex The index into facelist, of the vertex to test.

triangulate_face()

Description: Given a face in a polyhedron, subdivides the face into triangular faces. Returns an array of faces, where each face is a list of three vertex indices.

Argument What it does
points Array of vertices for the polyhedron.
face The face, given as a list of indices into the vertex array points.

triangulate_faces()

Description: Subdivides all faces for the given polyhedron that have more than three vertices. Returns an array of faces where each face is a list of three vertex array indices.

Argument What it does
points Array of vertices for the polyhedron.
faces Array of faces for the polyhedron. Each face is a list of 3 or more indices into the points array.