Michael said:
Many thanks. I should be able to use quite a bit. Now I don't seem to have a camera up? I've those
values:
view_x float 660+ no OGLcoords The location of the camera, X coordinate (OpenGL)
view_y float 660+ no OGLcoords The location of the camera, Y coordinate (OpenGL)
view_z float 660+ no OGLcoords The location of the camera, Z coordinate (OpenGL)
view_elevation_m_msl float 660-840 no metersMSL The elevation of the camera
view_elevation_agl float 800-840 no ??? The elevation of the camera
view_pitch float 660+ no degrees The camera's pitch
view_roll float 660+ no degrees The camera's roll
view_heading float 660+ no degrees the camera's heading, CW frmo true north
Could I calculate the side with those?
Thanks
Michael
Well that complicates matters.
First you have would have to learn how to rotate a point around an arbitrary vector, and that isn't
an easy task I'm afraid.
This may help
void rotate(double point[3],double axis[3],double ang){
//point,axis,angle
double tx[3][3],ty[3][3],tz[3][3],ty1[3][3],tx1[3][3],temp[3];
clArr(tx);clArr(ty);clArr(tz);clArr(ty1);clArr(tx1);
double sum=0;
double v=powl((powl(axis[1],2)+powl(axis[2],2)),.5);
double l=powl(powl(axis[0],2)+powl(axis[1],2)+powl(axis[2],2),.5);
int i=0,j=0;
if(!ang)
return;
if(v){
//matrix for rotation around x axis
tx[0][0]=1;tx[1][1]=axis[2]/v;tx[2][1]=-axis[1]/v;tx[1][2]=axis[1]/v;tx[2][2]=axis[2]/v;
//and inverse
tx1[0][0]=1;tx1[1][1]=axis[2]/v;tx1[2][1]=axis[1]/v;tx1[1][2]=-axis[1]/v;tx1[2][2]=axis[2]/v;
}
//matrix for rotation around y axis
ty[1][1]=1; ty[0][0]=v/l; ty[2][0]=-axis[0]/l; ty[0][2]=axis[0]/l; ty[2][2]=v/l;
//and inverse
ty1[1][1]=1; ty1[0][0]=v/l; ty1[2][0]=axis[0]/l; ty1[0][2]=-axis[0]/l; ty1[2][2]=v/l;
//matrix for rotation around z axis
tz[2][2]=1; tz[0][0]=cosl(ang); tz[1][0]=-sinl(ang); tz[0][1]=sinl(ang); tz[1][1]=cosl(ang);
//multiply the point by the x matrix
if(v){
for(i=0;i<3;++i){
for(j=0;j<3;++j)
sum+=point[j]*tx[j]
;
temp=sum;
sum=0;
}
set(point,temp);
}
//multiply the point by the y matrix
sum = 0;
for(i=0;i<3;++i){
for(j=0;j<3;++j)
sum+=point[j]*ty[j];
temp = sum;
sum = 0;
}
set(point,temp);
//multiply the point by the z matrix
sum = 0;
for(i=0;i<3;++i){
for(j=0;j<3;++j)
sum+=point[j]*tz[j];
temp = sum;
sum = 0;
}
set(point,temp);
//multiply the point by the inverse y matrix
sum = 0;
for(i=0;i<3;++i){
for(j=0;j<3;++j)
sum+=point[j]*ty1[j];
temp = sum;
sum = 0;
}
set(point,temp);
//multiply the point by the inverse x matrix
if(v){
sum = 0;
for(i=0;i<3;++i){
for(j=0;j<3;++j)
sum+=point[j]*tx1[j];
temp = sum;
sum = 0;
}
set(point,temp);
}
}
I'm afraid that some lines of that code are going to be wrapped on to the next line/s, so you'll
have to splice it together.
From memory of DirectX...
pitch = rotation around the x axis
roll = rotation around the z axis
heading = rotation around the y axis.
I thought that OpenGL would give you more than that though.
I have no idea what view_elevation is as I thought that view_y would be the camera's elevation.
You should be asking these questions in an OpenGL forum.
This seems to be opening up a Pandora's box for you.
Regards
Ron Francis
www.RonaldFrancis.com