function causing 3d position havoc.
im working on the "marine biology casestudy" thing in class, and im using vc++ for the compiler. I have one function that is meessing up my position of seacrabs on the bottom. It takes 2 heigth and a position betheen them and uses (pos(tan((a-b)/1)))+a or (pos(tan((b-a)/1)))+b whather a is > b. But when i pass it these floats
a = 3
b = 1.7787
pos = 0.9
it returns 4.24809
it should return 1.79788
this is the code that i am using. i have the c2 there for debugging.
float findtrianglespot(float a,float b,float pos)
{
float e;
//ofstream c2("debug2.txt");
//c2 << a << char(10)< b)
{
e = tan((a-b)/1.0);
//c2 << (pos * e) + b;
return( ((pos * e) + b) );
}
else if (a < b)
{
e = tan((b-a)/1.0);
//c2 << (pos * e) + a;
return( ((pos * e) + a) );
}
else
{
return(a);
}
//c2.close();
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement