Issue mirror transformation


#1

I never really had any issue mirror rotation until I stumbled onto this:
how to “mirror” those 2 points:


point transform:(matrix3 [-0.0744505,0.102782,-0.991914] [0.900617,-0.420165,-0.111136] [-0.42819,-0.901608,-0.061286] [-41.0417,2.50814,301.575]) name:"LeftPoint"
point transform:(matrix3 [0.110613,0.061457,-0.991962] [0.958345,0.257846,0.122839] [0.263323,-0.964229,-0.030376] [41.0417,2.50804,301.575])name:"Rightoint"

What I’m actually looking for is to mirror the local X axix rotation value

so let’s say that point001 is rotated 15 degree on the x axis I need to have the opposite roll value on the other side. :banghead:

I need to keep the overall same direction (don’t flip axis) SHould I just mirror the whole thing and fix the axis back as to how I want them ?


#2

quick and dirty method

tm = $.transform;
     tm[1] *= -1;
     $.transform = tm;
sorry just read the final part of your post :) but to actually "mirror" you need to flip an axis otherwise your just rotating 180 degrees around the z axis which is not the same ?
$.transform = ((eulerangles 0 0 180)  as matrix3) * $.transform 

or

$.transform = prerotateZ  $.transform 180;

which is the same thing and the same as rotating 180 degrees about the local z axis in the viewport and very similar to the axis flip above but with the additional flipping of the y axis.


#3

thanks, but those solution doesn’t give me the desired result

I managed to get the desired “mirror” effect using this function


fn MirrorRollAxis Source Target = (
	
	pointParent 			= point name:"Point_Parent"
	pointSource 			= point name:"Point_Source"
	pointSource.parent 		= pointParent
	pointSource.transform 	= Source.transform
	pointParent.transform  	= prescale pointParent.transform [-1,1,1]
	pointSource.transform  	= prescale pointSource.transform [1,-1,1]

	target.transform = pointSource.transform
	delete pointParent;delete pointSource
)

But I dont like having to create node just to get the desired result :confused:


#4

post the scene and say what objects you want to mirror

(please give a file with max version <= 2012)


#5

the situation might vary. it depends on:# are mirroring objects children of the same parent

are they originally flipped against each other

can they be translated (rotated, scale)

etc.

the math is simple… you have to multiply transform one with mirror matrix.
for x axis in absolute coordinate system it’s:


 
 x_mirror_tm = matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0]
 
 delete objects
 p1 = point name:"R point" pos:[10,0,10] rotation:(eulerangles 45 60 70) axistripod:on box:on cross:off wirecolor:green
 p2 = point name:"L point" axistripod:on box:on cross:off wirecolor:yellow
 	
 p2.transform = p1.transform*x_mirror_tm
 

#6

in your case the method should be modified a little:


x_mirror_tm = matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0]

 delete objects
 
 p3 = point transform:(matrix3 [-0.0744505,0.102782,-0.991914] [0.900617,-0.420165,-0.111136] [-0.42819,-0.901608,-0.061286] [-41.0417,2.50814,30.575]) name:"LeftPoint" wirecolor:red
 p4 = point transform:(matrix3 [0.110613,0.061457,-0.991962] [0.958345,0.257846,0.122839] [0.263323,-0.964229,-0.030376] [41.0417,2.50804,30.575]) name:"Rightoint" wirecolor:blue
 
 p5 = copy p3 transform:(p3.transform*x_mirror_tm) wirecolor:orange
 p5.transform = prescale p5.transform [1,-1,1]
 resetscale p5
 

#7

or …

x_mirror_tm = matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0]

delete objects

p3 = point transform:(matrix3 [-0.0744505,0.102782,-0.991914] [0.900617,-0.420165,-0.111136] [-0.42819,-0.901608,-0.061286] [-41.0417,2.50814,30.575]) name:"LeftPoint" wirecolor:red
--p4 = point transform:(matrix3 [0.110613,0.061457,-0.991962] [0.958345,0.257846,0.122839] [0.263323,-0.964229,-0.030376] [41.0417,2.50804,30.575]) name:"Rightoint" wirecolor:blue

p5 = copy p3 transform:((prescale p3.transform [1,-1,1])*x_mirror_tm) wirecolor:orange

#8

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.