Graphics Programs Reference
In-Depth Information
171
172
173
174
175
176
177
178
179
180
181
182
183
// draw the shape
lineStyle(2, 0x0000ff, 100);
beginFill(0x00aaff,75);
moveTo(xs[0], ys[0]);
for (i=1; i<numPts; i++)
{
lineTo(xs[i], ys[i]);
}
lineTo(xs[0], ys[0]);
endFill();
}
}
Step 2: Dealing with more complicated shapes
The program we have works well with simple planar objects. Suppose we have a more
complicated object like a logo or letterform with a hole in it, such as the left side of
Figure 9.7. There are several ways in which the object could be modeled or constructed.
An engineering technique is finite element modeling, where the object is subdivided
into smaller, simpler elements such as triangles. There are many advantages to this
approach, particularly for very complex objects. Since we are dealing with planar
objects and have a desire to keep the amount of data input relatively small, we will use
an alternative approach as shown in the right side of Figure 9.7.
Figure 9.7 Constructing a shape with a hole
 
Search WWH ::




Custom Search