 A Flash Developer Resource Site

1. ## Trigonometry help

Help! I've never learn trigonometry! I have two circles and need to make tangent lines conecting both.
This is probably a basiq question but I just cant find how!  Reply With Quote

2. ## Conveyor Belt Trigonometry

http://spacegrape.com/flashkit/conveyor.html

// I only got one 'side' of the conveyor belt so far and it is flawed somehow
// a large wheel close to a small one and it gets funky
// interesting problem

//a,b center of the first circle
//c,d center of the second circle
//x1,y1 'top' tangent point on the first circle
//x2,y2 'top' tangent point on the second circle
//g angle between segment ab_cd and ab_x1y1
//g is also the angle between ab_cd and cd_x2y2
//h is not shown in the diagram, it is the angle between ab_cd and horizon
//dist=distance between the two centers

dist = Math.sqrt((c*c-a*a)+(d*d-b*b));
g = Math.acos((r1-r2)/dist);
h = Math.atan((b-d)/(c-a));

// 'top' of belt
x1 =Number(a)+Number(Math.round(1000*r1*Math.cos(g-h))/1000);
y1 =Number(b)+Number(Math.round(1000*r1*Math.sin(g-h))/1000);
x2 = Number(c)+Number(Math.round(1000*r2*Math.cos(g-h))/1000);
y2 = Number(d)+Number(Math.round(1000*r2*Math.sin(g-h))/1000);  Reply With Quote

3. Ah, this is some tasty math. I will do a quick review of my discreet and then post back with some formulas  Reply With Quote

4. you will need an if statement something like this

the code you currently have will fit here
}

I will explain my math if you need help but it is pretty complicated so I will save you the confusion for now

note:you must reverse circle 1 and 2 for the second if statement
dist=Math.sqrt((circle1._x-circle2._x)*(circle1._x-circle2._x)+(circle1._y-circle2.y)*(circle1._y-circle2._y))
}

now the offsetangle is the angle, in radians, you must add to the top and subtract from the bottom of both circles in order to get the correct tangent.
Although, I could be wrong, you might have to subtract from the top and add to the bottom.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap 