using trigonometric functions to adjust values to be from -1 to 1












3












$begingroup$


I have some code which is projecting 3D points onto a 2D surface based on the user's viewpoint. The top graph shows the actual points that I get from my code. The y values seem to be correct, but the x values are off. The blue x values in the top graph should be more like the bottom graph (stretching from 1 to -1).



I need to somehow take the blue x and orange y values from the top graph and get the desired x values that you see in the bottom graph. I don't know much about curve fitting. Does anyone know any combination of trigonometric functions that I can apply to the top values to get the desired x values in the bottom graph?



graph.



EDIT:
To get the x and y values requires a full page of code which takes x y z of a point, x y z of the camera, azimuth pitch roll of the camera and somehow churns out an x,y coordinate which is appropriate for displaying the point on the screen. I was hoping that just knowing the values of X and Y relative to each other would be enough to allow us to unsqueeze the x line.



If it helps, I've uploaded a CSV file containing the points used to make this graph at: http://g42.org/temp/projectionXY.csv



Those points represent calculations starting at -45 degrees horizontal and -45 degrees vertical and then progressing along the horizontal by 5 degree increments until it reaches +45. It then increments the vertical by 5 degrees and starts again.



In other words, the camera is pointed down 45 degrees and left 45 degrees and then is moved along a horizontal path until it reaches right 45 degrees and then goes up 5 degrees and repeats.



For what it's worth, here's the actual code.



double ax = obj.p().x();
double ay = obj.p().y();
double az = obj.p().z();
double cx = northPole.x();
double cy = northPole.y();
double cz = northPole.z();

double pi180 = Math.PI / 180;

{
// Adjust ax, ay, az to bring the point into the frame of reference of the fixed camera
double ax2, ay2, az2;

// Rotate the point clockwise around the z-axis by its longitude
ax2 = ax * Math.cos(cam.lon()*pi180) + ay * Math.sin(cam.lon()*pi180);
ay2 = -ax * Math.sin(cam.lon()*pi180) + ay * Math.cos(cam.lon()*pi180);
ax = ax2;
ay = ay2;

// Rotate around y-axis by minus (90 - latitude)
ax2 = ax * Math.cos((90-cam.lat())*pi180) - az * Math.sin((90-cam.lat())*pi180);
az2 = ax * Math.sin((90-cam.lat())*pi180) + az * Math.cos((90-cam.lat())*pi180);
ax = ax2;
az = az2;
}

double cosOx = Math.cos(pitch*pi180);
double sinOx = Math.sin(pitch*pi180);
double cosOy = Math.cos(roll*pi180);
double sinOy = Math.sin(roll*pi180);
double cosOz = Math.cos(azimuth*pi180);
double sinOz = Math.sin(azimuth*pi180);

double p1 = sinOz * ay + cosOz * ax;
double p2 = cosOz * ay - sinOz * ax;

double dz = cosOx * (cosOy * az + sinOy * p1) - sinOx * p2;
double dx = ( cosOy * p1) - sinOy * az;
double dy = sinOx * (cosOy * az + sinOy * p1) + cosOx * p2;

double bx = -dx/dz;
double by = dy/dz;


In the above code, bx is the "x" on the graph image. by is the "y" on the graph image. The dz value is only used to determine if the value is in front of or behind the viewer. If it's positive then it's in front. Other than that I don't use its value for anything.



EDIT 2:
I figured out the solution empirically. Since dy was being calculated correctly I just played around with manipulations that were similar to dy until I got a result for dx which looked correct. The end result is that the source code above would have the following two lines change:



double dx = sinOx * (-sinOy * az + cosOy * p1) + sinOx * p2;
double bx = -dx/dz - 1.086087667;


Ideally I'd like to understand why this works, but honestly I'm just thrilled that I've finally got the projection code working like it's supposed to.



If anyone has an alternate way of expressing the above change which doesn't require the ugly -1.086087667 there, I'd love to see it.










share|cite|improve this question











$endgroup$



migrated from stats.stackexchange.com Aug 1 '11 at 6:39


This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.


















  • $begingroup$
    Something like $frac2{pi}arctan(cot,pi x)$?
    $endgroup$
    – J. M. is not a mathematician
    Aug 1 '11 at 6:47










  • $begingroup$
    What is this y function? It seems like it's somehow related (maybe even inverse proportional) to the deviation of the segments of x values from the desired. That is, it seems that as y approaches $pm$1 the x curve behaves as needed, but as it approaches 0 the x curve "compresses" (evenly from both sides). Gauging it with my eyes means you'd probably want something similar to f(t)=x(t)*c*(1-|y(t)|) for some constant c, but I can't really say for sure without knowing what y actually means...
    $endgroup$
    – user864940
    Aug 1 '11 at 6:59










  • $begingroup$
    Seeing the functions that produce this would probably not help much, but I've added some information to the original post at the end.
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:07












  • $begingroup$
    J.M., that doesn't seem to do it. It makes things look all weird. Now that I've included a link to the csv in the message above feel free to try it out. (Thanks to both of you for helping me by the way! The math for this is pretty difficult to get correct. I've spent a lot of time tweaking this.)
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:29






  • 1




    $begingroup$
    Now, what do you mean by the pitch, the roll, and the azimuth? I got used to the idea of an "airplane cockpit view" when the azimuth would be the direction of the meridian to which the plane body projects, the pitch would be the angle at which the body of the plane is tilted towards or away from the ground and the roll would be the angle of rotation of the wings from the "horizontal" position. However, with this interpretation, dz cannot depend on the roll and your dz does, so you mean something else. Can you explain what exactly?
    $endgroup$
    – fedja
    Aug 5 '11 at 0:39
















3












$begingroup$


I have some code which is projecting 3D points onto a 2D surface based on the user's viewpoint. The top graph shows the actual points that I get from my code. The y values seem to be correct, but the x values are off. The blue x values in the top graph should be more like the bottom graph (stretching from 1 to -1).



I need to somehow take the blue x and orange y values from the top graph and get the desired x values that you see in the bottom graph. I don't know much about curve fitting. Does anyone know any combination of trigonometric functions that I can apply to the top values to get the desired x values in the bottom graph?



graph.



EDIT:
To get the x and y values requires a full page of code which takes x y z of a point, x y z of the camera, azimuth pitch roll of the camera and somehow churns out an x,y coordinate which is appropriate for displaying the point on the screen. I was hoping that just knowing the values of X and Y relative to each other would be enough to allow us to unsqueeze the x line.



If it helps, I've uploaded a CSV file containing the points used to make this graph at: http://g42.org/temp/projectionXY.csv



Those points represent calculations starting at -45 degrees horizontal and -45 degrees vertical and then progressing along the horizontal by 5 degree increments until it reaches +45. It then increments the vertical by 5 degrees and starts again.



In other words, the camera is pointed down 45 degrees and left 45 degrees and then is moved along a horizontal path until it reaches right 45 degrees and then goes up 5 degrees and repeats.



For what it's worth, here's the actual code.



double ax = obj.p().x();
double ay = obj.p().y();
double az = obj.p().z();
double cx = northPole.x();
double cy = northPole.y();
double cz = northPole.z();

double pi180 = Math.PI / 180;

{
// Adjust ax, ay, az to bring the point into the frame of reference of the fixed camera
double ax2, ay2, az2;

// Rotate the point clockwise around the z-axis by its longitude
ax2 = ax * Math.cos(cam.lon()*pi180) + ay * Math.sin(cam.lon()*pi180);
ay2 = -ax * Math.sin(cam.lon()*pi180) + ay * Math.cos(cam.lon()*pi180);
ax = ax2;
ay = ay2;

// Rotate around y-axis by minus (90 - latitude)
ax2 = ax * Math.cos((90-cam.lat())*pi180) - az * Math.sin((90-cam.lat())*pi180);
az2 = ax * Math.sin((90-cam.lat())*pi180) + az * Math.cos((90-cam.lat())*pi180);
ax = ax2;
az = az2;
}

double cosOx = Math.cos(pitch*pi180);
double sinOx = Math.sin(pitch*pi180);
double cosOy = Math.cos(roll*pi180);
double sinOy = Math.sin(roll*pi180);
double cosOz = Math.cos(azimuth*pi180);
double sinOz = Math.sin(azimuth*pi180);

double p1 = sinOz * ay + cosOz * ax;
double p2 = cosOz * ay - sinOz * ax;

double dz = cosOx * (cosOy * az + sinOy * p1) - sinOx * p2;
double dx = ( cosOy * p1) - sinOy * az;
double dy = sinOx * (cosOy * az + sinOy * p1) + cosOx * p2;

double bx = -dx/dz;
double by = dy/dz;


In the above code, bx is the "x" on the graph image. by is the "y" on the graph image. The dz value is only used to determine if the value is in front of or behind the viewer. If it's positive then it's in front. Other than that I don't use its value for anything.



EDIT 2:
I figured out the solution empirically. Since dy was being calculated correctly I just played around with manipulations that were similar to dy until I got a result for dx which looked correct. The end result is that the source code above would have the following two lines change:



double dx = sinOx * (-sinOy * az + cosOy * p1) + sinOx * p2;
double bx = -dx/dz - 1.086087667;


Ideally I'd like to understand why this works, but honestly I'm just thrilled that I've finally got the projection code working like it's supposed to.



If anyone has an alternate way of expressing the above change which doesn't require the ugly -1.086087667 there, I'd love to see it.










share|cite|improve this question











$endgroup$



migrated from stats.stackexchange.com Aug 1 '11 at 6:39


This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.


















  • $begingroup$
    Something like $frac2{pi}arctan(cot,pi x)$?
    $endgroup$
    – J. M. is not a mathematician
    Aug 1 '11 at 6:47










  • $begingroup$
    What is this y function? It seems like it's somehow related (maybe even inverse proportional) to the deviation of the segments of x values from the desired. That is, it seems that as y approaches $pm$1 the x curve behaves as needed, but as it approaches 0 the x curve "compresses" (evenly from both sides). Gauging it with my eyes means you'd probably want something similar to f(t)=x(t)*c*(1-|y(t)|) for some constant c, but I can't really say for sure without knowing what y actually means...
    $endgroup$
    – user864940
    Aug 1 '11 at 6:59










  • $begingroup$
    Seeing the functions that produce this would probably not help much, but I've added some information to the original post at the end.
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:07












  • $begingroup$
    J.M., that doesn't seem to do it. It makes things look all weird. Now that I've included a link to the csv in the message above feel free to try it out. (Thanks to both of you for helping me by the way! The math for this is pretty difficult to get correct. I've spent a lot of time tweaking this.)
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:29






  • 1




    $begingroup$
    Now, what do you mean by the pitch, the roll, and the azimuth? I got used to the idea of an "airplane cockpit view" when the azimuth would be the direction of the meridian to which the plane body projects, the pitch would be the angle at which the body of the plane is tilted towards or away from the ground and the roll would be the angle of rotation of the wings from the "horizontal" position. However, with this interpretation, dz cannot depend on the roll and your dz does, so you mean something else. Can you explain what exactly?
    $endgroup$
    – fedja
    Aug 5 '11 at 0:39














3












3








3


0



$begingroup$


I have some code which is projecting 3D points onto a 2D surface based on the user's viewpoint. The top graph shows the actual points that I get from my code. The y values seem to be correct, but the x values are off. The blue x values in the top graph should be more like the bottom graph (stretching from 1 to -1).



I need to somehow take the blue x and orange y values from the top graph and get the desired x values that you see in the bottom graph. I don't know much about curve fitting. Does anyone know any combination of trigonometric functions that I can apply to the top values to get the desired x values in the bottom graph?



graph.



EDIT:
To get the x and y values requires a full page of code which takes x y z of a point, x y z of the camera, azimuth pitch roll of the camera and somehow churns out an x,y coordinate which is appropriate for displaying the point on the screen. I was hoping that just knowing the values of X and Y relative to each other would be enough to allow us to unsqueeze the x line.



If it helps, I've uploaded a CSV file containing the points used to make this graph at: http://g42.org/temp/projectionXY.csv



Those points represent calculations starting at -45 degrees horizontal and -45 degrees vertical and then progressing along the horizontal by 5 degree increments until it reaches +45. It then increments the vertical by 5 degrees and starts again.



In other words, the camera is pointed down 45 degrees and left 45 degrees and then is moved along a horizontal path until it reaches right 45 degrees and then goes up 5 degrees and repeats.



For what it's worth, here's the actual code.



double ax = obj.p().x();
double ay = obj.p().y();
double az = obj.p().z();
double cx = northPole.x();
double cy = northPole.y();
double cz = northPole.z();

double pi180 = Math.PI / 180;

{
// Adjust ax, ay, az to bring the point into the frame of reference of the fixed camera
double ax2, ay2, az2;

// Rotate the point clockwise around the z-axis by its longitude
ax2 = ax * Math.cos(cam.lon()*pi180) + ay * Math.sin(cam.lon()*pi180);
ay2 = -ax * Math.sin(cam.lon()*pi180) + ay * Math.cos(cam.lon()*pi180);
ax = ax2;
ay = ay2;

// Rotate around y-axis by minus (90 - latitude)
ax2 = ax * Math.cos((90-cam.lat())*pi180) - az * Math.sin((90-cam.lat())*pi180);
az2 = ax * Math.sin((90-cam.lat())*pi180) + az * Math.cos((90-cam.lat())*pi180);
ax = ax2;
az = az2;
}

double cosOx = Math.cos(pitch*pi180);
double sinOx = Math.sin(pitch*pi180);
double cosOy = Math.cos(roll*pi180);
double sinOy = Math.sin(roll*pi180);
double cosOz = Math.cos(azimuth*pi180);
double sinOz = Math.sin(azimuth*pi180);

double p1 = sinOz * ay + cosOz * ax;
double p2 = cosOz * ay - sinOz * ax;

double dz = cosOx * (cosOy * az + sinOy * p1) - sinOx * p2;
double dx = ( cosOy * p1) - sinOy * az;
double dy = sinOx * (cosOy * az + sinOy * p1) + cosOx * p2;

double bx = -dx/dz;
double by = dy/dz;


In the above code, bx is the "x" on the graph image. by is the "y" on the graph image. The dz value is only used to determine if the value is in front of or behind the viewer. If it's positive then it's in front. Other than that I don't use its value for anything.



EDIT 2:
I figured out the solution empirically. Since dy was being calculated correctly I just played around with manipulations that were similar to dy until I got a result for dx which looked correct. The end result is that the source code above would have the following two lines change:



double dx = sinOx * (-sinOy * az + cosOy * p1) + sinOx * p2;
double bx = -dx/dz - 1.086087667;


Ideally I'd like to understand why this works, but honestly I'm just thrilled that I've finally got the projection code working like it's supposed to.



If anyone has an alternate way of expressing the above change which doesn't require the ugly -1.086087667 there, I'd love to see it.










share|cite|improve this question











$endgroup$




I have some code which is projecting 3D points onto a 2D surface based on the user's viewpoint. The top graph shows the actual points that I get from my code. The y values seem to be correct, but the x values are off. The blue x values in the top graph should be more like the bottom graph (stretching from 1 to -1).



I need to somehow take the blue x and orange y values from the top graph and get the desired x values that you see in the bottom graph. I don't know much about curve fitting. Does anyone know any combination of trigonometric functions that I can apply to the top values to get the desired x values in the bottom graph?



graph.



EDIT:
To get the x and y values requires a full page of code which takes x y z of a point, x y z of the camera, azimuth pitch roll of the camera and somehow churns out an x,y coordinate which is appropriate for displaying the point on the screen. I was hoping that just knowing the values of X and Y relative to each other would be enough to allow us to unsqueeze the x line.



If it helps, I've uploaded a CSV file containing the points used to make this graph at: http://g42.org/temp/projectionXY.csv



Those points represent calculations starting at -45 degrees horizontal and -45 degrees vertical and then progressing along the horizontal by 5 degree increments until it reaches +45. It then increments the vertical by 5 degrees and starts again.



In other words, the camera is pointed down 45 degrees and left 45 degrees and then is moved along a horizontal path until it reaches right 45 degrees and then goes up 5 degrees and repeats.



For what it's worth, here's the actual code.



double ax = obj.p().x();
double ay = obj.p().y();
double az = obj.p().z();
double cx = northPole.x();
double cy = northPole.y();
double cz = northPole.z();

double pi180 = Math.PI / 180;

{
// Adjust ax, ay, az to bring the point into the frame of reference of the fixed camera
double ax2, ay2, az2;

// Rotate the point clockwise around the z-axis by its longitude
ax2 = ax * Math.cos(cam.lon()*pi180) + ay * Math.sin(cam.lon()*pi180);
ay2 = -ax * Math.sin(cam.lon()*pi180) + ay * Math.cos(cam.lon()*pi180);
ax = ax2;
ay = ay2;

// Rotate around y-axis by minus (90 - latitude)
ax2 = ax * Math.cos((90-cam.lat())*pi180) - az * Math.sin((90-cam.lat())*pi180);
az2 = ax * Math.sin((90-cam.lat())*pi180) + az * Math.cos((90-cam.lat())*pi180);
ax = ax2;
az = az2;
}

double cosOx = Math.cos(pitch*pi180);
double sinOx = Math.sin(pitch*pi180);
double cosOy = Math.cos(roll*pi180);
double sinOy = Math.sin(roll*pi180);
double cosOz = Math.cos(azimuth*pi180);
double sinOz = Math.sin(azimuth*pi180);

double p1 = sinOz * ay + cosOz * ax;
double p2 = cosOz * ay - sinOz * ax;

double dz = cosOx * (cosOy * az + sinOy * p1) - sinOx * p2;
double dx = ( cosOy * p1) - sinOy * az;
double dy = sinOx * (cosOy * az + sinOy * p1) + cosOx * p2;

double bx = -dx/dz;
double by = dy/dz;


In the above code, bx is the "x" on the graph image. by is the "y" on the graph image. The dz value is only used to determine if the value is in front of or behind the viewer. If it's positive then it's in front. Other than that I don't use its value for anything.



EDIT 2:
I figured out the solution empirically. Since dy was being calculated correctly I just played around with manipulations that were similar to dy until I got a result for dx which looked correct. The end result is that the source code above would have the following two lines change:



double dx = sinOx * (-sinOy * az + cosOy * p1) + sinOx * p2;
double bx = -dx/dz - 1.086087667;


Ideally I'd like to understand why this works, but honestly I'm just thrilled that I've finally got the projection code working like it's supposed to.



If anyone has an alternate way of expressing the above change which doesn't require the ugly -1.086087667 there, I'd love to see it.







trigonometry






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 26 '18 at 9:31









Glorfindel

3,42981830




3,42981830










asked Aug 1 '11 at 4:53









HappyEngineerHappyEngineer

80311




80311




migrated from stats.stackexchange.com Aug 1 '11 at 6:39


This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.









migrated from stats.stackexchange.com Aug 1 '11 at 6:39


This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.














  • $begingroup$
    Something like $frac2{pi}arctan(cot,pi x)$?
    $endgroup$
    – J. M. is not a mathematician
    Aug 1 '11 at 6:47










  • $begingroup$
    What is this y function? It seems like it's somehow related (maybe even inverse proportional) to the deviation of the segments of x values from the desired. That is, it seems that as y approaches $pm$1 the x curve behaves as needed, but as it approaches 0 the x curve "compresses" (evenly from both sides). Gauging it with my eyes means you'd probably want something similar to f(t)=x(t)*c*(1-|y(t)|) for some constant c, but I can't really say for sure without knowing what y actually means...
    $endgroup$
    – user864940
    Aug 1 '11 at 6:59










  • $begingroup$
    Seeing the functions that produce this would probably not help much, but I've added some information to the original post at the end.
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:07












  • $begingroup$
    J.M., that doesn't seem to do it. It makes things look all weird. Now that I've included a link to the csv in the message above feel free to try it out. (Thanks to both of you for helping me by the way! The math for this is pretty difficult to get correct. I've spent a lot of time tweaking this.)
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:29






  • 1




    $begingroup$
    Now, what do you mean by the pitch, the roll, and the azimuth? I got used to the idea of an "airplane cockpit view" when the azimuth would be the direction of the meridian to which the plane body projects, the pitch would be the angle at which the body of the plane is tilted towards or away from the ground and the roll would be the angle of rotation of the wings from the "horizontal" position. However, with this interpretation, dz cannot depend on the roll and your dz does, so you mean something else. Can you explain what exactly?
    $endgroup$
    – fedja
    Aug 5 '11 at 0:39


















  • $begingroup$
    Something like $frac2{pi}arctan(cot,pi x)$?
    $endgroup$
    – J. M. is not a mathematician
    Aug 1 '11 at 6:47










  • $begingroup$
    What is this y function? It seems like it's somehow related (maybe even inverse proportional) to the deviation of the segments of x values from the desired. That is, it seems that as y approaches $pm$1 the x curve behaves as needed, but as it approaches 0 the x curve "compresses" (evenly from both sides). Gauging it with my eyes means you'd probably want something similar to f(t)=x(t)*c*(1-|y(t)|) for some constant c, but I can't really say for sure without knowing what y actually means...
    $endgroup$
    – user864940
    Aug 1 '11 at 6:59










  • $begingroup$
    Seeing the functions that produce this would probably not help much, but I've added some information to the original post at the end.
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:07












  • $begingroup$
    J.M., that doesn't seem to do it. It makes things look all weird. Now that I've included a link to the csv in the message above feel free to try it out. (Thanks to both of you for helping me by the way! The math for this is pretty difficult to get correct. I've spent a lot of time tweaking this.)
    $endgroup$
    – HappyEngineer
    Aug 2 '11 at 0:29






  • 1




    $begingroup$
    Now, what do you mean by the pitch, the roll, and the azimuth? I got used to the idea of an "airplane cockpit view" when the azimuth would be the direction of the meridian to which the plane body projects, the pitch would be the angle at which the body of the plane is tilted towards or away from the ground and the roll would be the angle of rotation of the wings from the "horizontal" position. However, with this interpretation, dz cannot depend on the roll and your dz does, so you mean something else. Can you explain what exactly?
    $endgroup$
    – fedja
    Aug 5 '11 at 0:39
















$begingroup$
Something like $frac2{pi}arctan(cot,pi x)$?
$endgroup$
– J. M. is not a mathematician
Aug 1 '11 at 6:47




$begingroup$
Something like $frac2{pi}arctan(cot,pi x)$?
$endgroup$
– J. M. is not a mathematician
Aug 1 '11 at 6:47












$begingroup$
What is this y function? It seems like it's somehow related (maybe even inverse proportional) to the deviation of the segments of x values from the desired. That is, it seems that as y approaches $pm$1 the x curve behaves as needed, but as it approaches 0 the x curve "compresses" (evenly from both sides). Gauging it with my eyes means you'd probably want something similar to f(t)=x(t)*c*(1-|y(t)|) for some constant c, but I can't really say for sure without knowing what y actually means...
$endgroup$
– user864940
Aug 1 '11 at 6:59




$begingroup$
What is this y function? It seems like it's somehow related (maybe even inverse proportional) to the deviation of the segments of x values from the desired. That is, it seems that as y approaches $pm$1 the x curve behaves as needed, but as it approaches 0 the x curve "compresses" (evenly from both sides). Gauging it with my eyes means you'd probably want something similar to f(t)=x(t)*c*(1-|y(t)|) for some constant c, but I can't really say for sure without knowing what y actually means...
$endgroup$
– user864940
Aug 1 '11 at 6:59












$begingroup$
Seeing the functions that produce this would probably not help much, but I've added some information to the original post at the end.
$endgroup$
– HappyEngineer
Aug 2 '11 at 0:07






$begingroup$
Seeing the functions that produce this would probably not help much, but I've added some information to the original post at the end.
$endgroup$
– HappyEngineer
Aug 2 '11 at 0:07














$begingroup$
J.M., that doesn't seem to do it. It makes things look all weird. Now that I've included a link to the csv in the message above feel free to try it out. (Thanks to both of you for helping me by the way! The math for this is pretty difficult to get correct. I've spent a lot of time tweaking this.)
$endgroup$
– HappyEngineer
Aug 2 '11 at 0:29




$begingroup$
J.M., that doesn't seem to do it. It makes things look all weird. Now that I've included a link to the csv in the message above feel free to try it out. (Thanks to both of you for helping me by the way! The math for this is pretty difficult to get correct. I've spent a lot of time tweaking this.)
$endgroup$
– HappyEngineer
Aug 2 '11 at 0:29




1




1




$begingroup$
Now, what do you mean by the pitch, the roll, and the azimuth? I got used to the idea of an "airplane cockpit view" when the azimuth would be the direction of the meridian to which the plane body projects, the pitch would be the angle at which the body of the plane is tilted towards or away from the ground and the roll would be the angle of rotation of the wings from the "horizontal" position. However, with this interpretation, dz cannot depend on the roll and your dz does, so you mean something else. Can you explain what exactly?
$endgroup$
– fedja
Aug 5 '11 at 0:39




$begingroup$
Now, what do you mean by the pitch, the roll, and the azimuth? I got used to the idea of an "airplane cockpit view" when the azimuth would be the direction of the meridian to which the plane body projects, the pitch would be the angle at which the body of the plane is tilted towards or away from the ground and the roll would be the angle of rotation of the wings from the "horizontal" position. However, with this interpretation, dz cannot depend on the roll and your dz does, so you mean something else. Can you explain what exactly?
$endgroup$
– fedja
Aug 5 '11 at 0:39










1 Answer
1






active

oldest

votes


















0












$begingroup$

As I mentioned in the last edit of the text of the question I've worked out something that seems to work. I worked with a mathematician to get the original code, but that was months ago and I don't know how to contact him again, so I'll just make do with my results.



The important thing is that when I play the game the plotted objects float around on screen in a way that seems natural. If it's incorrect then it's below the threshold that I can sense it while playing.






share|cite|improve this answer









$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f54879%2fusing-trigonometric-functions-to-adjust-values-to-be-from-1-to-1%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    As I mentioned in the last edit of the text of the question I've worked out something that seems to work. I worked with a mathematician to get the original code, but that was months ago and I don't know how to contact him again, so I'll just make do with my results.



    The important thing is that when I play the game the plotted objects float around on screen in a way that seems natural. If it's incorrect then it's below the threshold that I can sense it while playing.






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      As I mentioned in the last edit of the text of the question I've worked out something that seems to work. I worked with a mathematician to get the original code, but that was months ago and I don't know how to contact him again, so I'll just make do with my results.



      The important thing is that when I play the game the plotted objects float around on screen in a way that seems natural. If it's incorrect then it's below the threshold that I can sense it while playing.






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        As I mentioned in the last edit of the text of the question I've worked out something that seems to work. I worked with a mathematician to get the original code, but that was months ago and I don't know how to contact him again, so I'll just make do with my results.



        The important thing is that when I play the game the plotted objects float around on screen in a way that seems natural. If it's incorrect then it's below the threshold that I can sense it while playing.






        share|cite|improve this answer









        $endgroup$



        As I mentioned in the last edit of the text of the question I've worked out something that seems to work. I worked with a mathematician to get the original code, but that was months ago and I don't know how to contact him again, so I'll just make do with my results.



        The important thing is that when I play the game the plotted objects float around on screen in a way that seems natural. If it's incorrect then it's below the threshold that I can sense it while playing.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Aug 20 '11 at 19:41









        HappyEngineerHappyEngineer

        80311




        80311






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f54879%2fusing-trigonometric-functions-to-adjust-values-to-be-from-1-to-1%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix