Skip to main content

Tranform3D help not affine transformation

1 reply [Last post]
atulsaroha
Offline
Joined: 2010-08-06
Points: 0

Hi, I am trying to transform my available 3D points in coordinate system of screen in java3d using below code.
I want the the all my points in screen fiting so that the original scale ratio among X,Y,Z remains preserved , so i used common scale and transformation to bring the points distribute around center.
When tried it using below code it gave me error sometimes but work sometimes

I also want to fetch out the current transformation of the points after jooming and rotation, i.e. this changed transformation value. How to know current affine transformation?

-------------------------
TransformGroup objTrans= new TransformGroup();
infiniteBounds = new BoundingSphere(new Point3d(), Double.MAX_VALUE);
objTrans.setBounds(infiniteBounds);
objTrans.setCapability(Group.ALLOW_CHILDREN_WRITE);
float scale=Math.max(Xmax-Xmin, Math.max(Ymax-Ymin, Zmax-Zmin));
//Transformation toward Origin and scaled in between (-1,-1,-1) to (1,1,1)
Transform3D trans1=new Transform3D();

trans1.set((1.8f/scale),new Vector3f((-(1.8f*Xmin)/scale)-.9f,(-(1.8f*Ymin)/scale)-.9f,(-(1.8f*Zmin)/scale)-.9f));
//trans1.set((1.8f/scale),new Vector3f((-(Ymax+Ymin)/2)*(1.8f/scale),(-(Zmax+Zmin)/2)*(1.8f/scale),(-(Xmax+Xmin)/2)*(1.8f/scale)));

objTrans.addChild(shape);
objTrans.setTransform(trans1);

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
atulsaroha
Offline
Joined: 2010-08-06
Points: 0

Display problem about non afine transform is solved i have bug in my program.
But still need to know about current transform to get the point from screen mapped back to original system as I have to identify trimmed points from displayed sceen as zoom and rotation may be done before on those points.
So, i need to current transformation.

atulsaroha wrote:

Hi, I am trying to transform my available 3D points in coordinate system of screen in java3d using below code.
I want the the all my points in screen fiting so that the original scale ratio among X,Y,Z remains preserved , so i used common scale and transformation to bring the points distribute around center.
When tried it using below code it gave me error sometimes but work sometimes

I also want to fetch out the current transformation of the points after jooming and rotation, i.e. this changed transformation value. How to know current affine transformation?

-------------------------
TransformGroup objTrans= new TransformGroup();
infiniteBounds = new BoundingSphere(new Point3d(), Double.MAX_VALUE);
objTrans.setBounds(infiniteBounds);
objTrans.setCapability(Group.ALLOW_CHILDREN_WRITE);
float scale=Math.max(Xmax-Xmin, Math.max(Ymax-Ymin, Zmax-Zmin));
//Transformation toward Origin and scaled in between (-1,-1,-1) to (1,1,1)
Transform3D trans1=new Transform3D();

trans1.set((1.8f/scale),new Vector3f((-(1.8f*Xmin)/scale)-.9f,(-(1.8f*Ymin)/scale)-.9f,(-(1.8f*Zmin)/scale)-.9f));
//trans1.set((1.8f/scale),new Vector3f((-(Ymax+Ymin)/2)*(1.8f/scale),(-(Zmax+Zmin)/2)*(1.8f/scale),(-(Xmax+Xmin)/2)*(1.8f/scale)));

objTrans.addChild(shape);
objTrans.setTransform(trans1);