HTML and CSS Reference

In-Depth Information

Figure 7-9. The values of the
lineCap
and
lineJoin
properties

TRIGONOMETRY

An area of mathematics that is worth getting your head around when dealing with al-

gorithmically created drawings is trigonometry. Trigonometry is concerned with the

study of the angles and sides of triangles, which is critical for drawing specific points

around a circle. Since the canvas uses a Cartesian coordinate space made up of rows

and columns (the x and y coordinates), finding the x, y coordinates of a point a certain

distance away from another point, when the line of sight between them is slanted, is

not as straightforward as it would be if they were in a horizontal or vertical line from

each other, but finding the point really isn't that much more difficult. All you need is

the angle formed inside a triangle drawn between the two. Once you have that, the

formulas in
Figure 7-10
are all you need.

Search WWH ::

Custom Search