• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Gripes & Grumbles v
« Previous 1 … 4 5 6 7 8 Next »
wings_body and weld function ...

 
  • 0 Vote(s) - 0 Average
wings_body and weld function ...

ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#5
11-05-2014, 07:43 PM
I rewrote this function in wings_body to be more than 10% faster. Maybe 15% faster.
This is my rewrite. I didn't know module sofs ... but when I got familiar with it ... I decided
it was at very least overkill. It's cool ... but overkill and slower ... and for me ... hard to read.

I think the issue is simple ... someone was trying to handle a case with multiple coincident faces to
be potentially welded. AKAIK ... and can see ... that's not reasonable possibility. The coinicident faces to weld should ultimately be in tuples like [{Fa,Fb}] but right now are in list like [[Fa,Fb]]

Code:
weld_1(Tol, #we{id=Id,fs=Fs0}=We0, {Sel,Status0}) ->
    Fs = qualified_fs(gb_trees:keys(Fs0), Tol, We0, []),
    %% Don't use sofs module ... that's WAY OVERKILL and slower.
    %% Not to mention ... harder to read
    MyAcc = fun({Center,F}, Acc) ->
        case gb_trees:is_defined(Center,Acc) of
            true ->
                Val = gb_trees:get(Center,Acc),
                gb_trees:enter(Center, lists:append(Val,[F]), Acc);
            false -> gb_trees:enter(Center,[F],Acc)
        end
    end,
    Tree = lists:foldl(MyAcc, gb_trees:empty(), Fs),
    Part = gb_trees:values(Tree),
    case weld_part(Part, Tol, We0, Status0) of
    {We0,Status} ->
        {We0,{[{Id,gb_sets:singleton(0)}],Status}}; % Nothing to weld or done
    {We,Status} ->
        {We,{[{Id,weld_selection(lists:append(Part), We0, We)}|Sel],Status}}
    end.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Messages In This Thread
wings_body and weld function ... - by ggaliens - 11-02-2014, 05:00 PM
RE: wings_body and weld function ... - by micheus - 11-02-2014, 06:15 PM
RE: wings_body and weld function ... - by ggaliens - 11-02-2014, 08:58 PM
RE: wings_body and weld function ... - by ggaliens - 11-05-2014, 03:49 PM
RE: wings_body and weld function ... - by ggaliens - 11-05-2014, 07:43 PM
RE: wings_body and weld function ... - by ggaliens - 11-06-2014, 04:15 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode