Whoa, thanks for pointing me to that book. Just ordered it :) sounds
like exactly what i need.
- A
Charles Parcell wrote:
This is why Danny is "The Math Man"!
BTW, love your book Danny. Can't wait for the next. :)
http://www.amazon.com/Mathematics-Physics-Programmers-Game-Development/dp/1584503300/sr=1-1/qid=1158676544/ref=pd_bbs_1/104-0626050-4073525?ie=UTF8&s=books
Charles P.
On 9/18/06, Andreas R <[EMAIL PROTECTED]> wrote:
Danny Kodicek wrote:
>> I can email an image to anyone that wants it, or you can draw it like
>> this...
>>
>> I think this is what you want...
>> Draw a point and a line vertically upwards of length R.
>> Draw a large letter V (inverted cone) upwards from the point.
>> Draw an arc, radius R to cut the V.
>> Where the arc cuts the vertical draw a circle, radius r, to meet the
edges
>> of V.
>> The edges of V are tangents.
>> Draw radii to these tangents, making 90 degree angles with them.
>> Mark r and R on the diagram.
>> Now r/R = sin(A), where A is half the angle at the bottom of the V.
>>
>> Let's say there are n of these small circles, so that
>> n*2*A = 360 (degrees)
>> or
>> n*2*A = 2*pi (radians)
>>
>> You can decide n and find A and then find r/R (the angles are usually
in
>> radians).
>> You can then decide R and find r (or other way around).
>>
>> Each time through the loop for <=n the new angle measured from
>> the vertical
>> in a clockwise direction is n*2*A.
>> The place to draw each circle is x=Rsin(n*2*A) and y=Rcos(n*2*A)
>>
>
> I enjoyed this one, so I came back to it and wrote a complete
solution.
Put
> a symbol in the library with id 'circle', then run this script:
>
> function getRingRadius(tArray:Array):Number {
> var tMaxError = 0.1
> var tMax = 1024
> var tMin = 0
> do {
> var tCheck = (tMax + tMin) / 2
> var tSum = 0
> for (var i = 0; i<tArray.length; i++) {
> tSum += Math.atan2(tArray[i],tCheck)
> }
> if (tSum>Math.PI) {
> tMin = tCheck
> } else {
> tMax = tCheck
> }
> } while (Math.abs(tSum - Math.PI)>tMaxError)
> return tCheck
> }
> var tRadii = new Array()
> for (var i=0; i<10 ; i++) {
> tRadii.push(Math.random()*20+1)
> }
> var tRingRadius = getRingRadius(tRadii)
> var tSquaredRadius = tRingRadius * tRingRadius
> var tAngle = 0
> for (var i=0; i<10 ; i++) {
> tCircle = this.attachMovie("circle", "circle"+i,
> this.getNextHighestDepth())
> tCircle._width = tCircle._height = tRadii[i]*2
> tThisAngle = Math.atan2(tRadii[i], tRingRadius)
> tAngle += tThisAngle
> tDistance = Math.sqrt(tRadii[i]*tRadii[i] + tSquaredRadius)
> tCircle._x = 200 + tDistance * Math.cos(tAngle)
> tCircle._y = 200 + tDistance * Math.sin(tAngle)
> tAngle += tThisAngle
> }
>
> NB: my previous script had my max and min mixed up so it didn't work.
This
> one is correct.
>
> Danny
>
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
You guys are gods :)
Thanks so much! My problem was solved completely by slight modifications
to Danny's script. What i'd do without this list i don't know.
- Andreas
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com