Search - User list
Full Version: Houdini Bad Math Issue wrong tan results?(SOLVED)
Root » Technical Discussion » Houdini Bad Math Issue wrong tan results?(SOLVED)
Getyamamout
Hi friends
Just figured out what was wrong with a bit of VEX the results were giving random numbers when trying to work out a triangle.

the math to work out the triangle edge needed was Length_A * tan(Angle_B) = Length_B

the correct figures are

Length_A =3.5
Angle_B = 52

3.5 * tan(52) = 4.479795713
3.5 * 1.2739941632 = 4.479795713
Length_B = 4.479795713

calculator tan(52) = 1.279941632
////////////////////////////

Houdini tan(Angle_B) = -6.05327

so I manually typed the figures in
Houdini tan(52) = -6.05327

so I manually typed the figures in
Houdini 3.5 * 1.2739941632 = 4.5898 still a tenth off the needed result

Really do NOT know where to go from here if the math is so far off??? or am I really Thick ??? you can tell me it's ok.
BabaJ
float Length_A = 3.5;
float Angle_B  = 52;
float Length_B = tan(radians(Angle_B)) * Length_A;
Getyamamout
Read the F in Instructions!!! is the lessen here just didn't think about the tangent being in radians all good and working now.. Just need to scream it out to yourself sometimes until you go mad enough to work it out on your own...
So the answer is YES I am THICK AF...
//get tangent length with known radius and angle
float ang = 180 - chf('angle');
float rad = chf('radius');

float half_ang = (float)ang*0.5; // split the angle in half

float angA = (float)half_ang;// this is the angle atached to the curve halfed to aim at the center of the radius
float angC = (float)90.0; // tangent is always 90deg
float angB = (float)180.0 - (float)angC - (float)angA;// missing angle is center of radius

// lengths below are opposite to the angles above of the same ABC charaacter
// lenA/sin(angA) = lenB/sin(angB) = lenC/sin(angC) so need to cross multiply

float lenA = rad; // this is the opposite edge
float lenB = lenA * tan(radians(angB)); // needed edge length
//float lenC = lenA * sin(angC); // long edge

float tan_len = 0;

if (angA >= 45){
tan_len = -lenB;
}
else {
tan_len = lenB;
}

f@pscale = tan_len;

Thanks for the Quick reply Babaj but worked it out anyway and yep RADIANS was the answer
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB