This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > January 2005 > help finding fundamental 3d maths





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author help finding fundamental 3d maths
simon

2005-01-07, 11:16 pm

does anyone know how to compute the vrmlmatrix, from the components of
a transform?

and

ideally how the compute the 2d coord in the viewing plane, from a point
in 3d?

ProgHettoLab

2005-01-08, 12:15 pm

simon ha scritto:
> does anyone know how to compute the vrmlmatrix, from the components of
> a transform?
>
> and
>
> ideally how the compute the 2d coord in the viewing plane, from a point
> in 3d?
>


I would to know how to use vrmlmatrix too.

pMB

--
Pierluigi Maria Bovi Architetto
Yahoo! Messenger [proghettolab]
ICQ [272553328]

ProgHettoLab - Laboratorio per la Progettazione Integrata
Via Barletta 11, Foggia (Italy)
www.proghettolab.it
simon

2005-01-08, 12:15 pm

i wanted to know how to calculate it, for use outside vrml.

but as an explanation of what it does, how about this;

Script {
url "vrmlscript:
function initialize(){
m=new VrmlMatrix();
// setTransform (translation, rotation, scale, scaleOrientation,
center)
m.setTransform(new SFVec3f(0,0,1), new SFRotation(0,0,1,0),new
SFVec3f(1,1,1),new SFRotation(0,0,1,0),new SFVec3f(0,0,0) );
print ('matrix (only +1 in z-axis):');
print (m);


v=new SFVec3f(10,10,10);
print ('start point='+v);
print ('point transformed once='+m.multVecMatrix (v));
print ('point same transform twice='+m.multVecMatrix
(m.multVecMatrix(v)));
m2=m.multLeft(m);
print ('point transformed once with combined
matrix='+m2.multVecMatrix (v));

// example : combine two rotations

r1=new SFRotation(0,0,1,Math.PI/2);
m1=new VrmlMatrix();
m1.setTransform(new SFVec3f(0,0,0), r1);

r2=new SFRotation(0,1,0,Math.PI/2);
m2=new VrmlMatrix();
m2.setTransform(new SFVec3f(0,0,0), r2);

t=new SFVec3f();
rt=new SFRotation();
s=new SFVec3f();

m1.multLeft(m2).getTransform(t,rt,s);
print('example:');
print ('rotation:'+r1+' followed by roation '+r2+' is the same as
rotation '+rt );

m1.multRight(m2).getTransform(t,rt,s);
print ('rotation:'+r2+' followed by roation '+r1+' is the same as
rotation '+rt );

}
"
}

simon

2005-01-08, 12:15 pm

notes from various browsers,

cortona, blaxxun, flux all seem correct,

Note:
the same rotation can be encoded in four ways, opposite direction of
vector and/or anti/clockwise for angle, in this case all browsers
picked positive rotation angle, but only cortona picked the smallest
angle, not sure if this is always the case, but shouldn't actually
matter.

actual outputs:
from cortona:

matrix (only +1 in z-axis):
1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
0, 0, 1, 1

start point=10 10 10
point transformed once=10 10 11
point same transform twice=10 10 12
point transformed once with combined matrix=10 10 12
example:
rotation:0 0 1 1.5708 followed by roation 0 1 0 1.5708 is the same as
rotation -0.57735 0.57735 0.57735 2.0944
rotation:0 1 0 1.5708 followed by roation 0 0 1 1.5708 is the same as
rotation 0.57735 0.57735 0.57735 2.0944

from Blaxxun;

matrix (only +1 in z-axis):
1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1
start point=10 10 10
point transformed once=10 10 11
point same transform twice=10 10 12
point transformed once with combined matrix=10 10 12
example:
rotation:0 0 1 1.5708 followed by roation 0 1 0 1.5708 is the same as
rotation 0.57735 -0.57735 -0.57735 4.18879
rotation:0 1 0 1.5708 followed by roation 0 0 1 1.5708 is the same as
rotation 0.57735 0.57735 0.57735 2.0944


from flux:( code needed changes, print > Browser.print and needed
toStrinf().)

Done
matrix (only +1 in z-axis):
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1
start point=10.000000,10.000000,10.000000
point transformed once=10.000000,10.000000,11.000000
point same transform twice=10.000000,10.000000,12.000000
point transformed once with combined
matrix=10.000000,10.000000,12.000000
example:
rotation:0.000000,0.000000,1.000000,1.570796 followed by roation
0.000000,1.000000,0.000000,1.570796 is the same as rotation
0.577350,-0.577350,-0.577350,4.188790
rotation:0.000000,1.000000,0.000000,1.570796 followed by roation
0.000000,0.000000,1.000000,1.570796 is the same as rotation
0.577350,0.577350,0.577350,2.094395

Muaddib

2005-01-10, 4:16 am

There is no simple answer to this question, for you must understand some
linear algebra. A good starting point is to learn about the transform
node itself, and for this, we look at the annotated vrml reference:
http://www.caip.rutgers.edu/vrlab/v...otated/BOOK.HTM
Look up the node - Transform - and see the explanation therein. You
will find:

P' = T × C × R × SR × S × -SR × -C × P
Transform {
center C
rotation R
scale S
scaleOrientation SR
translation T
children [...]
}

Each of the fields corresponds to a four by four matrix. The negative
ones are their inverses. An x,y,z coordinate is represented as the
vector (x,y,z,1). Here are some keywords for searching:
matrix multiplication, linear algebra
center/translation - affine transformation
rotation/scale orientation - rigid motions


Josip Almasi

2005-01-10, 7:21 pm

simon wrote:

> i wanted to know how to calculate it, for use outside vrml.


Martin Baker has excellent 3d math site:
http://www.martinb.com/

Regards...
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews