mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-01 06:10:28 +02:00
Deduplicate face vertices before triangulation.
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user