Hi Ralf

I have tried that, the problem is the x and y don't meet up with the new width and height when rounded.

Since the component is now at an angle the slope distance is not calculated for a round relative to the new x and y. So when you round the width it will then move since the original calc was exactly calculated from a decimal x or y.

In a different light imagine the component is upside down at a 45 degree angle. if you size the component up and to the left, and round the width it might push it one pixel or less greater than what the move x, y was calculated for and I am going for perfection which this doesn't yield.

...

Peace, Mike

On 9/19/06, Ralf Bokelberg <[EMAIL PROTECTED]> wrote:

Since there is no general way to void decimals in between of a calculation like yours, i'd suggest to round at the end.
Cheers,
Ralf.



On 9/19/06, Michael Schmalle <[EMAIL PROTECTED]> wrote:
Hi,

I'm doing some serious trig with rotation and sizing. I have a problem I have been trying to figure out, this question is aimed more at Adobe engineers. ;-)

Say I take the rotation angle of a component, I have rounded this the nearest whole number before any trig calcs.

1. get rotation ie 30
2. get mouse x, y which in the beginning is like 40,45
3. calc a dsitance from mouse to client -> mx, mx -> cx, cy this number is not rounded using Point.distance()
4. use atan2() to get mouse client angle, now we are in crazy decimals
5. calc theta, crazy decimals
6. calc radians, crazy decimals
7. calc sine of distance from mouse to client ,crazy decimals
8. calc another y change using cosine, more crazy decimals
9. calc a slopedistance, even more decimals
10. Then subtract slopdistance from current client width, which in the begining was a whole number, now it is DECIMAL!

Now, I have a new calculated x and y with width and height that are all in decimals. THis is giving me movement fragments that I cannot get rid of.

The question is where and when should I floor(), round() or ciel()? I see you used Number(newX.toFixed(1)) in your rotation calcs but this dosn't do anything for me here.

I keep getting numbers like 23.0000000000034 .

Help!  :)

Peace, Mike
--
What goes up, does come down.



--
Ralf Bokelberg <[EMAIL PROTECTED] >
Flex & Flash Consultant based in Cologne/Germany




--
What goes up, does come down. __._,_.___


SPONSORED LINKS
Software development tool Application development software Development software
Development outsourcing software Embedded software development

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to