Maybe we can LURK around the problem a bit and find it ...
Why would wings_face:fold be used here in wings_body ?
It almost seems like the could have simplified a bunch my calling wings_face:center(F, We) ... I doubt it would be that much slower.
Also ... the name is a MISNOMER here because there is nothing qualified about the faces. I happen to think there should be meaning in words here. It really should be called granularized_fs ... instead. But that's a bit of an aside.
Probably the face fold is just fine ... but so is this one ... and in a single trial ... it came out faster (don't know why).
Why would wings_face:fold be used here in wings_body ?
Code:
qualified_fs([F|Fs], Tol, We, Acc) ->
Vs = wings_face:fold(
fun(V, _, _, Acc0) ->
[V|Acc0]
end, [], F, We),
{X,Y,Z} = wings_vertex:center(Vs, We),
Center = {granularize(X, Tol),granularize(Y, Tol),granularize(Z, Tol)},
qualified_fs(Fs, Tol, We, [{{length(Vs),Center},F}|Acc]);
qualified_fs([], _, _, Acc) -> Acc.
It almost seems like the could have simplified a bunch my calling wings_face:center(F, We) ... I doubt it would be that much slower.
Also ... the name is a MISNOMER here because there is nothing qualified about the faces. I happen to think there should be meaning in words here. It really should be called granularized_fs ... instead. But that's a bit of an aside.
Probably the face fold is just fine ... but so is this one ... and in a single trial ... it came out faster (don't know why).
Code:
qualified_fs([F|Fs], Tol, We, Acc) ->
Vs = wings_face:vertices_ccw(F,We),
{X,Y,Z} = wings_vertex:center(Vs, We),
Center = {granularize(X, Tol),granularize(Y, Tol),granularize(Z, Tol)},
qualified_fs(Fs, Tol, We, [{{length(Vs),Center},F}|Acc]);
qualified_fs([], _, _, Acc) -> Acc.