5 CNC Mathematics
5 CNC Mathematics
N20G96S800M3
N30G50S4000
N40T0100M8
NS0G00X3 .35Z1 .25T0101
N60G01X3 .25F.002
N70G04X0.5
N80X3 .35F.05
N90G00X5 .0Z0T0101
01111 ~
N10G20G99G40 _ . -. ~
N20G96S800M3 _ __. _
N30G50S4000 1,:"'•• ~
N40T0100M8 ' -
NS0G00X3.35Z1 .25T0101 ..-:~ -~ -
N60G01X3.25F.002 ~ - .. --
N70G04X0.5 ··
N80X3 .35F.05 ~ ---,- ••
Objectives
Information in this chapter will enable you to:
• Identify various geometric shapes.
• Apply various geometric principles to solve problems.
• Solve right triangle unknowns.
• Apply trigonometric principles to determine coordinate values.
Technical Terms
acute angle function right triangle
adjacent angles hypotenuse scalene triangle
angle isosceles triangle secant
arc obtuse angle segment
bisect parallel sine
chord parallelogram square
circle perpendicular straight angle
circumference polygons supplementary angles
complementary angles proposition tangent
congruent Pythagorean theorem transversal
cosecant quadrilateral triangle
cosine radius trigonometric
cotangent rectangle functions
diagonal reflex angle trigonometry
diameter right angle vertex
equilateral triangle
Geometric Terms
The following is a list of geometric terms and their definitions. These
terms will be used throughout this chapter and the remainder of this
textbook. Study them before continuing.
53
54 CNC Machining
Angles
An angle (L) is the figure formed by the meeting of two lines at the
same point or origin called the vertex. See Figure 3-1. Angles are measured
in degrees ( minutes('), and seconds ("). A degree is equal to 1/360 of a
0
),
circle, a minute is equal to 1/60 of 1°, and a second is equal to 1/60 of 1'.
There are many types of angles, Figure 3-2. An acute angle is greater
than 0° and less than 90°. An obtuse angle is greater than 90° and less
than mo 0 • A right angle is exactly 90°. A straight angle is exactly mo 0 , or a
straight line. A reflex angle is greater than 180° and less than 360°.
An angle can also be described by its relationship to another angle.
See Figure 3-3. Adjacent angles are two angles that use a common side.
Complementary angles are two angles that equal 90°. Supplementary
angles are two angles that equal 180°, or a straight line.
Polygons
Polygons are figures with many sides that are formed by line segments.
Polygons are named according to the number of sides and angles they have.
For example, a decagon is a polygon with ten sides; deca comes from the
Latin word for ten.
Triangles
A triangle is a three-sided polygon. There are a number of types of
triangles, Figure 3-4. A right triangle has a 90° (right) angle. An isosceles
triangle has two equal sides and two equal angles. An equilateral triangle
has three equal sides; all angles are equal (60°). A scalene triangle has
three unequal sides and unequal angles.
Verte~
~ 30°
G
Chapter 3 CNC Math 55
T E
R---------------- 0
Straight Reflex
Figure 3-2. Various types of angles.
55°
Adjacent Complementary
\
100°
80°
Supplementary
Figure 3-3. Describing an angle in relationship to another angle.
56 CNC M achining
Right Isosceles
Equilateral Scalene
Figure 3-4. Examples of various types of triangles. The sum of the angles in a triangle always equals
180°.
Quadrilaterals
A quadrilateral is a polygon with four sides, Figure 3-5. A line drawn
from one angle (intersecting corner) of a quadrilateral to the opposite angle
is called a diagonal.
Square
A square has four equal sides and four right (90°) angles. The opposite
sides of a square are parallel to each other. The diagonals of a square bisect
the four angles and each other. The diagonals are equal and perpendicular
to each other. The diagonals form congruent angles (equal in size and
shape) .
Rectangle
A rectangle is a quadrilateral with equal opposite sides and four right
angles. The opposite sides are parallel to each other. The diagonals are
equal, bisect each other, and create two pairs of congruent triangles.
Chapter 3 CNC Math 57
" / ' /
/ '' /
/
"" /
/
'' /
/
""'-/ / ''
' X
/
/
/
/'-
/
""
/
/
''
/
/
/
/
''
/ " /
''
/
" /
/
'
" /
'
Square Rectang le
Parallelogram
Figure 3-5. The three types of quad rilaterals . Quadrilaterals have fou r interior angles that total 360°.
Parallelogram
A parallelogram is a quadrilateral with equal opposite sides and equal
opposite angles. The diagonals bisect each other and create two pairs of
congruent triangles.
Circles
A circle is a set of points, located on a plane, that are equidistant from a
common central point (center point). See Figure 3-6. There are a number of
terms that are used to describe various aspects of a circle, Figure 3-7.
The diameter is the segment that connects two points on a circle
and intersects through the center of the circle. The size of a circle is its
diameter.
The radius is a segment that joins the circle center to a point on the
circle circumference. Radius has half the value of diameter.
Figure 3-6. Al l points defini ng a circle are equidistant from the center point.
58 CNC Machining
R
Chord Arc Tangent
Figure 3-7. Illustrations of various terms relating to a circle.
Propositions
A proposition is a statement to be proved, explained, or discussed.
Following are a number of geometric propositions.
• Opposite angles are equal. When two lines intersect, they form equal
angles. Thus, in Figure 3-8, Angle 1 equals Angle 3, and Angle 2
equals Angle 4.
• Two angles are equal if they have parallel corresponding sides.
Thus, in Figure 3-9, Angle 1 equals Angle 2.
• A line perpendicular to one of two parallel lines is perpendicular to
the other line. Thus, in Figure 3-10, Lines R and S are perpendicular
to Line T.
Figure 3-8. Two intersecting lines form four angles with the opposite angles being
equal.
2 4
3
Chapter 3 CNC Math 59
Figure 3-9. Two angles with corresponding parallel sides are Figure 3-10. A transversal line
equal. perpendicular to one parallel line is
perpendicular to the other parallel
line. Lines R and S are parallel.
Figure 3-11. Two parallel lines intersected by a third line form Figure 3-12. Angles 1, 2, and 3
alternate angles that are equal to each other. Interior Angles 4 form a triangle totaling 180°.
and 5 are equal along with 3 and 6. Exterior Angles 1 and 8 are
equal along with 2 and 7.
60 CNC Machining
Figure 3-13. Angle 4, an exterior angle, Figure 3-14. Angle 1 is equal to Angle 2 because their
equals the sum of Angles 1 and 2, which are corresponding sides are perpendicular to each other.
nonadjacent interior angles.
Figure 3-15. Line TW, developed from the Figure 3-16. Lines MN and ML are tangent to the
tangency point to the circle's center, is circle and share an endpoint and are, therefore, equal
perpendicular to tangent Line UV. in length .
Chapter 3 CNC Math 61
Trigonometry
Trigonometry is the area of mathematics that deals with the relationship
between the sides and angles of a triangle. Triangles are measured to find
the length of a side (leg) or to find the number of degrees in an angle. In
CNC machining, trigonometry is used to determine tool location relative
to part geometry.
Trigonometry deals with the solution of triangles, primarily the right
triangle. See Figure 3-17. A right triangle has one angle that is 90° (Angle c),
and the sum of all angles equals 180°. Angles a and b are acute angles,
which means they each are less than 90°. Angles a and b are complementary
angles, which means they total 90° when added.
The three sides of a triangle are called the hypotenuse, side opposite,
and side adjacent. Side C is called the hypotenuse, because it is opposite the
right angle. It always is the longest side.
Sides A and B are either opposite to or adjacent to either of the acute
angles. It depends on which acute angle is being considered. Side A is the
side opposite Angle a, but is the side adjacent to Angle b. Side B is the side
opposite Angle b, but is the side adjacent to Angle a. For example, when
referring to Angle b, Side A is adjacent and Side B is opposite. Or, when
referring to Angle a, Side B is adjacent and Side A is opposite.
As stated earlier in this chapter, angles are usually measured in degrees,
minutes, and seconds, Figure 3-18. There are 360° in a circle, 60' in a degree,
and 60" in a minute. As an example, 31 degrees, 16 minutes, and 42 seconds
is written as 31°16'42". Angles can also be given in decimal degrees, such as
34.1618 (34°9'42").
B
Right
angle
C
55°14'11"
40°02'26'
~ 1 5°11 '45"
Figure 3-18. Illustrations of various angles containing degrees, minutes, and seconds.
62 CNC Machining
Since 11" is smaller than 45': 60" must be borrowed from 14'. When
15°11'45" is subtracted from 55°13'71': the final answer is 40°2'26".
Using Trigonometry
Trigonometry is the most valuable mathematical tool used by a
programmer for calculating cutter or tool nose locations. Trigonometric
functions are absolute values derived from the relationships existing
between angles and sides of a right triangle. A function is a magnitude
(size or dimension) that depends upon another magnitude. For example, a
circle's circumference is a function of its radius, since the circle size depends
on the extent of its radius value.
In the triangle shown in Figure 3-19, A/Bis the ratio of two sides and
therefore a function of Angle d . As Angle d increases to the dashed line,
the function will change from A/ B to E/ B. This shows that the ratio of two
sides of a triangle depends on the size of the angles of the triangle.
Chapter 3 CNC Math 63
Trigonometric Functions
Since there are three sides (legs) to a triangle, there exist six different
ratios of sides. These ratios are the six trigonometric functions of sine,
cosine, tangent, cotangent, secant, and cosecant. Each ratio is named from
its relationship to one of the acute angle in a right triangle. The right angle is
never used in calculating functions. A function is obtained by dividing the
length of one side by the length of one of the other sides. These functions can
be found in math texts and many references, such as Machinery's Handbook.
Special books also exist that give primarily trigonometric tables and values.
In addition, many calculators can compute trigonometric values. Figure 3-20
is a partial table of trigonometric functions covering 33°. To find the cosine
of 33°58: read down the minute column to 58 minutes, then read across
the row. Under the column labeled cosine, you find value 0.82936, which is
cosine 33°58'.
64 CNC Machining
Figure 3-20. Partial table showing values of the six trigonometric functions sine, cosine, tangent,
cotangent, secant, and cosecant as they relate to 33° and various minutes.
Chapter 3 CNC Math 65
A
66 CNC Machining
The six functions given are related to Angle a, but also can be applied
to Angle bas well. Therefore, Sin b = B/C, Cos b = A/C, etc., shows that
any function of Angle a is equal to the cofunction of Angle b. From that
relationship, the following are derived:
• sin a = A/C = cos b
• cos a = B/ C = sin b
• tan a = A/B = cot b
• cot a = B/ A = tan b
• sec a = C/B = csc b
• csc a = C/A = sec b
With Angle a and Angle b being complementary, the function of any
angle is equal to the cofunction of its complementary angle. Therefore, sin
70° = cos 20°, and tan 60° = cot 30°.
I
I
I
\T Sin
I
---- -- - ~ "'I
::::J
I I
I
I
r-Tan
Figure 3-22. Programmers will sometimes use the Figure 3-23. Programmers may use the radius
radius value as the hypotenuse when determining value as a leg to solve the other missing values of
location values. the right triangle.
Chapter 3 CNC Math 67
are a number of applications where a programmer will use the radius and
triangle to determine distances. In Figure 3-24, the radius and triangle are
applied to determine a bolt circle, tool path, and intersection. In Figure 3-25,
the radius and triangle are applied to determine a cutter path.
y
Position 1 Position 2
R = 1.5" R = 1.5"
Angle from the Angle from the
horizontal axis =30° horizontal axis =60°
Y =sin 30 (1.5") Y =sin 60 (1.5")
Y =0.5 (1.5") Y =0.866 (1.5")
Y =0.75" Y = 1.299"
X =cos 30 (1.5") X =cos 60 (1.5")
X =0.866 (1.5") X =0.5 (1.5")
X = 1.299" X =0.75"
Figure 3-24. Using a radius value and the construction of a right triangle to determine hole locations.
Note: Angle values are used to solve remaining leg values.
--1 ~R
Toolpath direction
Cutter
Angle on workpiece is 45°
Cutter radius is 0.25"
Figure 3-27. Illustration showing the triangle that must be solved to calculate the position of a cutter
when cutting an acute angle on a workpiece.
Chapter 3 CNC Math 69
Figure 3-28. The triangle that must be solved to calculate the position of the end mill when cutting an
obtuse angle on a workpiece.
Pythagorean Theorem
The Pythagorean theorem states a special relationship that exists
among the three sides of a right triangle. It states that the length of the
hypotenuse squared equals the sum of the squares of the other two side lengths. So,
if the lengths of any two sides of a right triangle are given, the length of the
third side can be calculated by using the Pythagorean theorem:
A2 + B2 = c 2
In Figure 3-29, Side C is equal to 5 and Side B is equal to 3. The value for
A (the third side of the triangle) can be determined by using the formula
C 2 = A 2 + B2. To solve for A, substitute the known values into the formula to
get 52 = A 2 + 32, then square the values to get 25 = A 2 + 9. Next, isolate the
unknown variable by subtracting 9 from both sides of the equation to get
16 = A 2 • Finally, take the square root of both sides of the equation, to get 4 = A
So, the length of Side A is 4.
To cut a 90° rounded corner on a workpiece, we can use the Pythagorean
theorem to plot the toolpath of the cutter. See Figure 3-30. The radius on
the workpiece is 1". The cutter diameter is 0.25" (0.125" radius).
To cut partial arcs, we can use a combination of trigonometric
functions and the Pythagorean theorem to plot the positions of the cutter.
See Figure 3-31.
70 CNC Machining
Pythagorean theorem: c 2 = A2 + s 2
52 = A2 + 32
25 = A2 + 9
25-9 = A2
-!16 =iA.2
4=A
Figure 3-29. Cutter locations when cutting a 90° radius corner on a workpiece.
Cutter
position 3 The distance from the
center of the workpiece
radius to the center of
the cutter at Position 1
is 1.25" (workpiece
radius+ cutter radius).
Therefore, the formula
to find the X dimension
cutter for each change in Y is
position 1 X 2 + Y2 = 1. 25 2 .
x 2 + v 2 = 1.252
x 2 = 1.252 - v 2
X = ✓ 1.25 2 - Y 2
If the cutter travels
in the Y direction
0.5'', the X position
can be calculated by
substituting 0.5'' for Y.
X = ✓ 1.25 2 - 0.5 2
X = ✓1.3125
Toolpath direction
X = 1.146
Figure 3-30. This illustration shows how to use the Pythagorean theorem to calculate the cutter position
as it creates a corner radius.
Cutter
position 1
Center of 1.00"
workpiece
radius
Figure 3-31. The Pythagorean theorem and trigonometric functions can be used together to plot the
toolpath of a cutter.
sina=-1-
2.25"
a = sin-1 (.4444)
a= 26°
Now we can calculate distance X for each degree that angle a increases
until it reaches 62° (26° + 36°).
sin 27 = ~
2.25
sin 27 (2.25) = Y
1.021 =Y
sin 28 (2.25) = Y
1.056 =Y