LDCad Advanced rotation techniques


RE: Advanced rotation techniques
#4
(2022-07-23, 1:25)N. W. Perry Wrote: Indeed, it would be really slick if we could directly access the mesh points!

But assuming I know a couple of the points, is there a way to find the vector between them through the GUI? I guess via selection info (taking angle values from each of the orthogonal views)?

The attached script levels (3 items of) the selection.

core of the script:
Code:
for i=1,3 do
  ref[i]=sel:getRef(i)
    pos[i]=ref[i]:getPos()
  end
 
  local xx=(pos[2]-pos[1]):getNormalized()
  local zzTmp=(pos[3]-pos[1]):getNormalized()
  local yy=xx:getCross(zzTmp)
  local zz=xx:getCross(yy)
 
  local ori=ldc.matrix()
  ori:setOriCols(xx, yy, zz)

The script takes 3 items from the selection and use them to get a plane normal.
Then it uses one of the 2 triangle vectors as the x-axis to build an orientation matrix.

You'll have to rotate it around Y afterwards to get it on its final place.

The really cool thing would be to analyze the mesh (possible in 1.7 Alpha 2a) to get those 3 points automatically.


Attached Files
.zip   levelItems.zip (Size: 862 bytes / Downloads: 2)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Advanced rotation techniques - by N. W. Perry - 2022-07-22, 13:40
RE: Advanced rotation techniques - by Roland Melkert - 2022-07-23, 19:20

Forum Jump:


Users browsing this thread: 1 Guest(s)