Thanks for your response, Alessandro.
I am actually mirroring a coordinate system change transform. Here is one
of the transforms I am trying to mirror.
0.997564, -0.069755, -0.000462, -0.000000,
0.067070, 0.957300, 0.281208, -0.006913,
-0.019174, -0.280554, 0.959647, -0.04314,
0.000000, 0.000000, 0.000000, 1.000000
And I multiplied this transform by the following (a scale of -1.0 applied
to the x coordinates):
-1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
I'm not applying this transform to a shape, though...it is a bit more
complex. To summarize, I need to mirror a coordinate system change
(similar to one shown above), and use this transform in a series of
transforms that are multiplied together. The product of this series of
transforms is then used to transform a shape. Any ideas on how to mirror
the transform without screwing up the normals?
Thanks for your help,
Nick
Maybe this is a bug.
How do you do this mirroring ??
transform3D.setScale(-1) ? ( I guess the Java3D develop. team never
imagined a negative scaling hehehehe )
If so, may you can try another way as reverting X axis of the shapes, as
below :
private void mirrorShapeXAxis(Shape3D sh)
{
Appearance app = sh.getAppearance();
if (app != null)
{
PolygonAttributes polyA = new PolygonAttributes();
polyA.setCullFace(polyA.CULL_FRONT);
app.setPolygonAttributes(polyA);
}
GeometryInfo gi = new GeometryInfo((GeometryArray)sh.getGeometry());
Point3f[] coords = gi.getCoordinates();
// mirror in X axis
for(int i=0; i<coords.length;i++)
{
coords[i].x = - coords[i].x;
}
gi.setCoordinates(coords);
// it reverse the normals - not mirror like
//NormalGenerator ng = new NormalGenerator();
//ng.generateNormals(gi);
//gi.recomputeIndices();
sh.setGeometry(gi.getGeometryArray());
}
Please report if it works or not.
Alessandro
----- Original Message -----
From: "Nick Stark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 09, 2003 10:09 AM
Subject: [JAVA3D] Inverted Normals Question
> Hi -
>
> I have a set of objects, all of whose normals are initially correct (all
> lighting looks as it should).
>
> However, I apply a mirror transform to some of the objects, and when
> viewing the new objects, it appears that the normals have been inverted
on
> the geometry. The lights still look correct for the objects that were
not
> mirrored, but the objects that are mirrored have dark faces and bright
> backsides. The objects have not moved to such a position where this
should
> be the case, though. Is there some issue with the 3D API or is this a
> problem that any of you have encountered before?
>
> Thanks for any help.
>
> Nick
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA3D-INTEREST". For general help, send email
to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".