Thinking about doing a LDCad 1.7 version


RE: Thinking about doing a LDCad 1.7 version
I realized if you assume all selection points are on a plane, you can drop the setX/setY lines and calculate the plane normal instead of using a static x vector

Code:
function onRun() local sel=ldc.selection() if sel:getRefCount()<3 then return end local a=sel:getRef(1):getPos() local b=sel:getRef(2):getPos() local c=sel:getRef(3):getPos() local ba=a-b local bc=c-b local n=bc:getCross(ba) n:normalize() local bb1=n:getSignedAngle(ba, bc) local bb2=math.deg(math.acos(bc:getLength()/ba:getLength())) local angle=-(bb1-bb2) ldc.setClipboardText(angle) ldc.dialog.runMessage(angle) end

neg y makes it somewhat confusing but i think this should work in any orientation, not tested though.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Thinking about doing a LDCad 1.7 version - by Roland Melkert - 2020-05-05, 22:07

Forum Jump:


Users browsing this thread: 1 Guest(s)