• 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 Interface & Usage v
« Previous 1 … 12 13 14 15 16 … 32 Next »
Unify edge length

 
  • 0 Vote(s) - 0 Average
Unify edge length

ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#8
09-22-2015, 02:36 AM (This post was last modified: 09-22-2015, 03:34 AM by ggaliens.)
Why don't we define a reasonable solution for esha ?

I propose a command "size absolute" or maybe "absolute size" to go next to "Absolute Command" (which I don't understand very well). Absolute size should resize edges, faces and bodies about their centers to a fixed number or units (length, area, or volume). A generic solution that is missing I'm pretty sure.


Code:
command({edge,{manifoldlab,absolute_size}}, #st{sel=SelAny}=St) ->
    case SelAny of
        [ ] ->   wings_u:error_msg("This is best applied to edge rings.");
        _ -> ok
    end,
    Qs = [{text, 1.0, [{key,absolute_size},{width,10}]}],
    wings_dialog:dialog("Absolute Size ...", Qs,
        fun(Res) ->
            {absolute_size,Sz}  = lists:keyfind(absolute_size,1,Res),
            wings_sel:fold(
                fun(Es, #we{id=ID}=We, Acc) ->
                    MyEdge = fun(Ei, #we{es=Etab, vp=VPos}=We2) ->
                        #edge{vs=VS,ve=VE} = array:get(Ei, Etab),
                        Pt1 = wings_vertex:pos(VS, We2),
                        Pt2 = wings_vertex:pos(VE, We2),
                        MidPt = e3d_vec:average([Pt1,Pt2]),
                        Dir = e3d_vec:norm(e3d_vec:sub(Pt1,MidPt)),
                        Pt1b = e3d_vec:add(MidPt, e3d_vec:mul(Dir,Sz)),
                        Pt2b = e3d_vec:add(MidPt, e3d_vec:mul(Dir,-Sz)),
                        VPos2 = array:set(VE, Pt2b, array:set(VS,Pt1b,VPos)),
                        We2#we{vp=VPos2}
                    end,
                    WeNew = gb_sets:fold(MyEdge, We, Es),
                    wings_shape:replace(ID, WeNew, Acc)
                end, St, St)
        end);

« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)



Messages In This Thread
Unify edge length - by esha - 09-19-2015, 01:18 PM
RE: Unify edge length - by ggaliens - 09-19-2015, 02:02 PM
RE: Unify edge length - by esha - 09-19-2015, 02:19 PM
RE: Unify edge length - by ggaliens - 09-19-2015, 03:24 PM
RE: Unify edge length - by esha - 09-19-2015, 04:28 PM
RE: Unify edge length - by micheus - 09-19-2015, 06:03 PM
RE: Unify edge length - by micheus - 09-20-2015, 04:59 AM
RE: Unify edge length - by ggaliens - 09-22-2015, 02:36 AM
RE: Unify edge length - by micheus - 09-22-2015, 11:46 AM
RE: Unify edge length - by beng27 - 03-31-2016, 04:05 PM
RE: Unify edge length - by ggaliens - 03-31-2016, 05:18 PM
RE: Unify edge length - by micheus - 03-31-2016, 05:53 PM
RE: Unify edge length - by beng27 - 04-02-2016, 10:31 AM
RE: Unify edge length - by ggaliens - 04-02-2016, 03:25 PM
RE: Unify edge length - by beng27 - 04-22-2016, 05:41 PM
RE: Unify edge length - by ggaliens - 04-22-2016, 07:54 PM

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

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode