Changing Coordinates During Runtime
idbruce
Posts: 6,197
Hello Everyone
I have a new challenge that I am attempting to conquer. I want the Propeller chip to figure run time coordinates. Here are the circumstances before any changes:
This is what I want to accomplish:
After a new coordinate location has been established, it can then be changed to a Polar Coordinate with the following formulas:
Okay, those are my thoughts. So now, firstly, is my line of thinking correct? And secondly, what do I actually need to do, to be able to perform these mathematical operations on a Propeller chip? Do I need floating point support.... ETC... An example would be helpful.
Bruce
I have a new challenge that I am attempting to conquer. I want the Propeller chip to figure run time coordinates. Here are the circumstances before any changes:
- Cartesian Coordinate System
- All coordinates are in Quadrant I
- Fixed point of origin (0, 0)
- A imaginary perimeter surrounds all points.
This is what I want to accomplish:
- I want to move the point of origin to the center of the perimeter. So instead of just using Quadrant I, all four Quadrants will now be utilized.
- After a coordinate has been relocated, I want to then convert the Cartesian Coordinate to a Polar Coordinate.
- NewXValue = OldXValue - (PerimeterWidth/2)
- NewYValue = OldYValue - (PerimeterHeight/2)
- NewCoordinate = (NewXValue, NewYValue)
After a new coordinate location has been established, it can then be changed to a Polar Coordinate with the following formulas:
- r = √ ( x2 + y2 ) *Use the Pythagorean Theorem to find the hypotenuse.
- θ = tan-1 ( y / x ) *Use the Tangent Function to find the angle.
Okay, those are my thoughts. So now, firstly, is my line of thinking correct? And secondly, what do I actually need to do, to be able to perform these mathematical operations on a Propeller chip? Do I need floating point support.... ETC... An example would be helpful.
Bruce
Comments
http://forums.parallax.com/showthread.php?123209-Tired-of-no-SIN-COS-TAN-ARCSIN-ARCCOS-ARCTAN-ARCTAN2-support-in-SPIN-Try-the-S
See http://forums.parallax.com/showthread.php?127241
Bean
Very very cool, and just exactly what I need How about the part of changing the origin point in respect to a given coordinate. Did that part of my proposal make sense, and will it work the way I want it to?
Bruce
Bean
Thank you very much for your input, it was most helpful. I initially thought this was going to be a tad troublesome, but as it turns out, ultimately pain free WOW!!!!!!! UNBELIEVABLE!!!!!!!!
Bruce