Rotating faces in Editable Poly
Posted: 11 May 2008 06:23 PM
Occupation: student of architecture
Member
Avatar
Rank
Location: Manhattan, Kansas
Total Posts:  4
Joined  2008-05-11

Is there any simple way? Rotate doesn’t work or I don’t know how to make it work.

Please help, it’s several days now I’m trying to do this. It’s the only thing I need to finish the surface developing script, my due is close.

Thanks

 
 
 

Posted: 11 May 2008 07:39 PM   [ # 1 ]
Occupation: Technical Director VFX, Frantic Films
Administrator
Avatar
RankRankRankRank
Location: Winnipeg, Manitoba
Total Posts:  143
Joined  2006-08-24
Stanley M - 11 May 2008 06:23 PM

Is there any simple way? Rotate doesn’t work or I don’t know how to make it work.

Please help, it’s several days now I’m trying to do this. It’s the only thing I need to finish the surface developing script, my due is close.

Thanks

Get the face, get the vertices used by face, transform them by whatever transformation matrix you want.
Rotations at Sub-Object level are actually translations of vertices. Same applies to edges.

Borislav “Bobo” Petrov

 
 
 

Posted: 11 May 2008 08:39 PM   [ # 2 ]
Occupation: student of architecture
Member
Avatar
Rank
Location: Manhattan, Kansas
Total Posts:  4
Joined  2008-05-11

OK ... transformation matrix ... that sounds like a fun smile

I tried to use Editable Mesh instead, rotate works there but getting of neighbor faces from edge works weird.
Couldn’t you throw in some sample piece of code showing how to rotate bitarray of vertices?

Anyway, thanks for fast reaction, it will help me.

 
 
 

Posted: 11 May 2008 10:27 PM   [ # 3 ]
Occupation: student of architecture
Member
Avatar
Rank
Location: Manhattan, Kansas
Total Posts:  4
Joined  2008-05-11

OK, I found out what transform matrices are, and how I can transform objects with them, but transforming vertices…

 
 
 

Posted: 11 May 2008 11:07 PM   [ # 4 ]
Occupation: Technical Director VFX, Frantic Films
Administrator
Avatar
RankRankRankRank
Location: Winnipeg, Manitoba
Total Posts:  143
Joined  2006-08-24
Stanley M - 11 May 2008 10:27 PM

OK, I found out what transform matrices are, and how I can transform objects with them, but transforming vertices…

Here is an example:

fn rotateSelectedPolyFaces theObj theAngle thePivot: =
(
    
local theSel polyOp.getFaceSelection theObj --# get the selected faces
    
local theVerts polyOp.getVertsUsingFace theObj theSel --# convert to vertex selection
    
local theMatrix theAngle as matrix3 --# convert the quaternion to a matrix
    
local thePivotMatrix = if thePivot == unsupplied then 
        matrix3 1  
--# if no pivot node is provided, use identity matrix - this will result in rotation about world origin
    
else 
        
thePivot.transform --# otherwise use the transformation matrix of the supplied node
    
--# calculate the transformation matrix - get the vertex out of world space into the space of the pivot node,
    
--# multiply by the rotation matrix and convert back to world space
    
local theTM =  inverse thePivotMatrix theMatrix *  thePivotMatrix 
    
for v in theVerts do  --# for every vertex, get the position, transform by the matrix and set back as new position
        
polyOp.setVert theObj v ((polyOp.getVert theObj v)* theTM)
    
redrawViews() --# force a viewport update
)

--
# Create a Sphere, collapse to EPoly, select some faces. 
--# Also create a Point helper as Reference coordinate system
--# EXAMPLES:
rotateSelectedPolyFaces $Sphere01 (quat 30 [0,0,-1])  --# rotate about world origin's Z
rotateSelectedPolyFaces $Sphere01 (quat 30 [1,0,0]thePivot:$Sphere01 --# rotate about local origin's X
rotateSelectedPolyFaces $Sphere01 (quat 30 [0,1,0]thePivot:$Point01 --# rotate about Point01's Y

Everything you see and do in Max ends up using transformation matrices one way or another. All the object and sub-object rotations, scaling, translations, viewport and camera projections, rendering, shading etc. use them. They are like The Force, binding the 3D world together… Learn to use them.

Borislav “Bobo” Petrov

 
 
 

Posted: 11 May 2008 11:17 PM   [ # 5 ]
Occupation: student of architecture
Member
Avatar
Rank
Location: Manhattan, Kansas
Total Posts:  4
Joined  2008-05-11

By the Force ... I can see it now. Oh how only could I live without them?!

Thank you oh mighty Bobo smile

 
 
 

   
 
 

Forum theme Quick Jump
RSS 2.0 RSS 2.0 Atom Feed Atom Feed