PDA

View Full Version : Mirror vertices from one side to the other


pigbelly
02-11-2005, 08:31 AM
Hi I want to mirror my vertices from +X to -X.

I only want to model one side of the face and then copy that information over to the other side. I have tried to negativley duplicate it and all that but it doesent work well with blendshapes, I guess the vertexID gets messed up?

I can get the world posistion using : pointPosition

But I cant figure out(have no brain) how to get that information over to the negative side to the correct vertex....

Is there away or is there perhaps a smarter solution out there??

Cheers
/Tommie

seven6ty
02-11-2005, 09:56 AM
I've been meaning to get around to working this out myself too.

Here's a bit of code I clipped from one of my old commands that I thought might be related...
// Procedure flipVert is designed to change the value of one vertex location in X, Y, or Z space
// from positive to negative, or from negative to positive. This will later be used to compare
// with other vertex locations on the target side of the object, to determine which corresponding
// vertex has the closest location.
proc float[] flipVert(float $targetVertName[], string $axis)
{
float $flippedVert[3] = $targetVertName;
switch($axis)
{
case "YZ":
$flippedVert[0] = $flippedVert[0] * -1;
break;
case "XZ":
$flippedVert[1] = $flippedVert[0] * -1;
break;
case "XY":
$flippedVert[2] = $flippedVert[0] * -1;
break;
}
return($flippedVert);
}

But basically, you'd have to break each vert in the geometry into either a positive or negative group, based upon it's X, Y, or Z position (using whichever axis you wish to mirror over,) and use this to query and store the position of each vert in both positive and negative groups... then switch these values across the axis to be flipped.

...This is just what I've been thinking in my head. I have another script for splitting the verts into pos and neg groups as well, I do believe...

pigbelly
02-11-2005, 10:18 AM
ok..

but how dose maya know which vertex to move?

and how do i assign
loat $targetVertName[], string $axis


I'm really a beginner in Mel....so dont be suprised by the stupid Q's

Cheers

/Tommie

CGTalk Moderation
02-11-2006, 11:00 AM
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.