Hi,
I'm trying to build a 3D Bar Graph viewer that would be updated (say
once a second) and then the previous bars should move down the z axis.
I have a thread that reads data from a file, builds the bar graph
segments,
displays it properly (at 0,0, 0,0, 0,0) with:
for(int i = 0; i < pBands.length; ++i)
{
float width = pBands[i] / 200.0f;
Segment segment = new Segment(width, 0.01f);
// Create a transform group node to scale and position the object.
Transform3D tform = new Transform3D();
tform.set(new Vector3d(x, y, 0.0));
TransformGroup objTrans = new TransformGroup(tform);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.addChild(segment.getChild());
previousGraphs.add(objTrans);
transGroup.addChild(objTrans);
y += 0.01f;
}
The Transform3D tform is used to position the Segment.
transGroup is added to a BranchGroup which is then added to the root
BranchGroup.
This is all going on in a thread, so the view may have already been set.
Before this I go through previousGraphs Vector and try to move each
TransformGroup along the z-axis.
Transform3D transform_along_z = new Transform3D();
transform_along_z.set(new Vector3d(1.0, 1.0, 1.1));
// Use transform_along_z to 'age' the previous graphs by
// moving them down the z axis.
int n = 0;
for(Enumeration e = previousGraphs.elements(); e.hasMoreElements(); )
{
TransformGroup objTrans = (TransformGroup)e.nextElement();
Transform3D t0 = new Transform3D();
objTrans.getTransform(t0);
System.out.println("updating previous graphs " + n++ + "
transform was: \n" + t0);
t0.mul(transform_along_z);
System.out.println("new transform is:\n" + t0);
objTrans.setTransform(t0);
}
I've also tried a number of different matricies and Vector3d.
The only segments that show up are the ones at zero on the z.
Segment contains a QuadArray. But I'm only using one plane.
getChild returns a Shape3D.
Why are the other z segments not showing up?
thanks,
Don Hermes
[EMAIL PROTECTED]
===========================================================================
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".