Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Share Thread:
Reddit Facebook Twitter
wings_body and weld function ...
11-05-2014, 03:49 PM (This post was last modified: 11-05-2014 04:20 PM by ggaliens.)
Post: #4
RE: wings_body and weld function ...
Maybe we can LURK around the problem a bit and find it ...

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.
Reply


Messages In This Thread
RE: wings_body and weld function ... - ggaliens - 11-05-2014 03:49 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)