Cross multiplication in VEX problem for tangents?(SOLVED)

   356   3   1
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
Hi friends
my issue today is what should be a simple cross-multiplication, is bouncing the results around making it hard to work out the issue. the sphere should be touching the sweep inside radius at all times all that is needed is the tangent length as the angles can be worked out easy as one is always 90deg and we have one distance from the radius. The maths I am trying to replicate is the law of Sines.



//get tangent length with known radius and angle
float ang = chf('angle');
float radius = chf('radius');

float half_ang = ang/2; // split the angle in half

float angA = half_ang;
float angB = 90.0; // tangent is always 90deg
float angC = 180.0 - angA - angB;

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

float tan_len = lenB; // = cos(half_input);

f@ang_mid = angC;
f@lenA = lenA ;
f@lenB = lenB ;
f@lenC = lenC ;

f@len_tan = tan_len;
f@pscale = tan_len;
Edited by Getyamamout - Aug. 16, 2025 10:48:44
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline


I am cutting the corner out oriental on a curve and copying lines to it and getting a intersection analysis to give the center of the arc but now I want to have a fixed radius I need a distance for the cut to happen. The only distance known is the radius wanted and the angle the curve has. the other angles can be worked out as one will always be 90 for the tangent and the angles must add up to 180deg

The images show a reference sphere that is set to the min radius wanted. this should be touching the side of the geo at all times
the radius is set to the radius of the sphere plus half the width of the sweep. the ball should move vertically when the angle changes and the geo should wrap around it. but I get random sizing and this is causing the ref sphere to drift.

If anyone can see an issue with my maths, or has another solution, for the same intended result, I would most appreciate it.
Edited by Getyamamout - Aug. 15, 2025 17:38:34

Attachments:
help.png (798.6 KB)
help1.png (749.0 KB)
help2.png (647.0 KB)

User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
Just figured out what was wrong with the results giving random numbers when trying to work out the 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.

//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

f@ta = tan(angB);
f@tb = atan(angB);
f@tc = tanh(angB);
f@td = sin(angB);
f@te = sin(angB);
f@tf = cos(angB);

// 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(angB); //  .......tan(52)= 1.2739941632; // 3.5 * 1.2739941632;//
float lenC = lenA * sin(angC); // long edge

float tan_len = 0;

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

f@angA = angA;
f@angB = angB;
f@angC = angC;

f@lenA = lenA ;
f@lenB = lenB ;
f@lenC = lenC ;

f@len_tan =  tan_len;  // 3.5 * 1.2739941632 = 4.479795713
f@pscale =  tan_len; // 4.479795713;//
User Avatar
Member
76 posts
Joined: Dec. 2020
Offline
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; 
  • Quick Links