mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49: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.
|
||||
// face = The face, given as a list of indices into the vertex array `points`.
|
||||
function triangulate_face(points, face) =
|
||||
let(count=len(face))
|
||||
(3==count)?
|
||||
[face]
|
||||
:
|
||||
let(
|
||||
face = deduplicate(face),
|
||||
count = len(face)
|
||||
)
|
||||
(count < 3)? [] :
|
||||
(count == 3)? [face] :
|
||||
let(
|
||||
facenorm=face_normal(points, face),
|
||||
cv=find_convex_vertex(points, face, facenorm),
|
||||
|
@ -167,8 +169,7 @@ function triangulate_face(points, face) =
|
|||
flatten([
|
||||
triangulate_face(points, select(face, cv, diagonal_point)),
|
||||
triangulate_face(points, select(face, diagonal_point, cv))
|
||||
])
|
||||
;
|
||||
]);
|
||||
|
||||
|
||||
// Function: triangulate_faces()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,220];
|
||||
BOSL_VERSION = [2,0,221];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue