Here is a formula I am using to determine reduction of a rectangle to ensure it is completely unclipped by a rounded corner outer rectangle.

Code:

`CR=.357: S=128: D = CR * S`

ADJ = S - (D - SQR(D * D / 2))

S for this example, is the short side of the rectangle and is known

D is a diameter of the corner circles in the screenshot below and is calculated

ADJ is the deflateD value for the outer rectangle.

So using the formula above, ADJ = 114.616, the adjusted/deflated rectangle. However, I am having trouble trying to reverse my own formula, solving for S when ADJ is known. Any kind math-wizards out there care to share?

Note: Standard ellipse formulas do not apply. The shape of the rectangle after corners are applied are only guaranteed to be an ellipse (oval or circle) in just one case: when CR = 1.0

Edited. Maybe the equation can't be inverted & so be it.

I have an incremental number, which itself is incremented, as follows...

Code:

`Damper = 0`

Running = 0

Ticks = 0

Do

Damper + = -0.1

Running += Damper

Tick += 1

Loop

At some point in the future I might be notified that Running must equal 0 again when Ticks=12845 and I'll need to put the gears into reverse. (Exact 0 is not necessary).

Is there a simple Math function that could calculate this rather than messing about with another internal loop?

Thanks. ]]>