indieFan
07-06-2004, 18:22
Hi Everyone,
I'm currently working on coding a program for a CNC using variables. I've run into a significant stumbling block regarding the math, however.
I am taking two ellipses that have every point the same distance apart. I then have a known starting angle; and, because the ellipses are to be symmetric about the x-axis, the finishing angle. Once the program reaches the finishing angle on the outer ellipse, it is to move inward at the same y position to the inner ellipse. (Essentially, it is cutting out the letter C.)
Here are the questions:
1. How does one tell when one is on the inner ellipse?
2. Is it possible to calculate the new x length given only the y dimension?
3. Is it possible to calculate the new angle given only the y dimension?
My test numbers (in inches) have been:
Major (y) axis: 6; Minor (x) axis: 4; start angle: 15; distance between ellipses: 0.5
If it still isn't clear, please let me know.
Any help would be appreciated,
indieFan
P.S.- I may have figured it out:
Knowing that the y-distance from the x axis is -0.5275 at the end, and that the total y length from center to end of the axis is 2.5, then the new angle can be calculated using asin(-0.5275/2.5)=theta. Theta is equal to -12.18 degrees. Given theta and the y length, the x distance can now be calculated since the distance from the center to the x-axis is known.
The new problem is how to calculate an asin when there is no function available in the programming language. :-(
P.P.S.- I think I finally understand the arcsin(x)=arctan(x/sqrt(1-x^2)) equation which is easy to program.
I'm currently working on coding a program for a CNC using variables. I've run into a significant stumbling block regarding the math, however.
I am taking two ellipses that have every point the same distance apart. I then have a known starting angle; and, because the ellipses are to be symmetric about the x-axis, the finishing angle. Once the program reaches the finishing angle on the outer ellipse, it is to move inward at the same y position to the inner ellipse. (Essentially, it is cutting out the letter C.)
Here are the questions:
1. How does one tell when one is on the inner ellipse?
2. Is it possible to calculate the new x length given only the y dimension?
3. Is it possible to calculate the new angle given only the y dimension?
My test numbers (in inches) have been:
Major (y) axis: 6; Minor (x) axis: 4; start angle: 15; distance between ellipses: 0.5
If it still isn't clear, please let me know.
Any help would be appreciated,
indieFan
P.S.- I may have figured it out:
Knowing that the y-distance from the x axis is -0.5275 at the end, and that the total y length from center to end of the axis is 2.5, then the new angle can be calculated using asin(-0.5275/2.5)=theta. Theta is equal to -12.18 degrees. Given theta and the y length, the x distance can now be calculated since the distance from the center to the x-axis is known.
The new problem is how to calculate an asin when there is no function available in the programming language. :-(
P.P.S.- I think I finally understand the arcsin(x)=arctan(x/sqrt(1-x^2)) equation which is easy to program.