mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 03:09:45 +00:00
Deduplicate face vertices before triangulation.
This commit is contained in:
parent
07d47f4ffc
commit
b0ebc77aba
2 changed files with 40 additions and 39 deletions
|
@ -129,10 +129,12 @@ function is_only_noncolinear_vertex(points, facelist, vertex) =
|
||||||
// points = Array of vertices for the polyhedron.
|
// points = Array of vertices for the polyhedron.
|
||||||
// face = The face, given as a list of indices into the vertex array `points`.
|
// face = The face, given as a list of indices into the vertex array `points`.
|
||||||
function triangulate_face(points, face) =
|
function triangulate_face(points, face) =
|
||||||
let(count=len(face))
|
let(
|
||||||
(3==count)?
|
face = deduplicate(face),
|
||||||
[face]
|
count = len(face)
|
||||||
:
|
)
|
||||||
|
(count < 3)? [] :
|
||||||
|
(count == 3)? [face] :
|
||||||
let(
|
let(
|
||||||
facenorm=face_normal(points, face),
|
facenorm=face_normal(points, face),
|
||||||
cv=find_convex_vertex(points, face, facenorm),
|
cv=find_convex_vertex(points, face, facenorm),
|
||||||
|
@ -167,8 +169,7 @@ function triangulate_face(points, face) =
|
||||||
flatten([
|
flatten([
|
||||||
triangulate_face(points, select(face, cv, diagonal_point)),
|
triangulate_face(points, select(face, cv, diagonal_point)),
|
||||||
triangulate_face(points, select(face, diagonal_point, cv))
|
triangulate_face(points, select(face, diagonal_point, cv))
|
||||||
])
|
]);
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
// Function: triangulate_faces()
|
// Function: triangulate_faces()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,220];
|
BOSL_VERSION = [2,0,221];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue