Hello all,
I have spent some time (actually quite some time) with
com.sun.j3d.loaders.vrml97.impl.Extrusion.
The original version created strange results. These were mainly caused by
setting up the SCP's incorrectly. In short I have made the following
corrections:
z[i].cross(u,v); // was previously: z[i].cross(v,u);
x[i].cross(y[i],z[i]); // was previously: x[i].cross(z[i],y[i])
The original SCP was not right handed. The new one is. It seems also that
there is an error in the VRML specification regarding the calculation of Z
in
(http://www.vrml.org/Specifications/VRML97/part1/nodesRef.html#Extrusion). I
think this was noticed also by Rick Goldberg as seen in the original
comments.
I have also made some improvements:
if spine is collinear a real SCP is calculated. Previously it was constant
added createCorrectionRotations -method that calculates per spine rotations
that are needed to prevent the extusion from twisting around the spine when
the z coordinates of SCP's vary. I'm not sure, if this is in the spirit of
VRML, but I think it is easier to create smooth extrusions this way. You can
compare results given by the original Extrusion, CosmoPlayer, and this
Extrusion with the attached pipe2.wrl file.
Attached is also the new version of Extrusion.
Pasi
P.S. In a previous mail I was wondering if it should also be possible to
programmatically populate a VRML-Java3D scene and output VRML from it. By
definition the overridden toStringBody() methods of BaseNode should do this,
but they seem not implemented. Are there any plans to do this?
Extrusion.java
pipe2.wrl