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.
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);