Color vs. Number

Computers store data in two basic ways: in colors and in numbers. Ultimately, computers reduce everything to ones and zeros, so you could say that, in the end, computer operating systems simply crunch numbers. However, at a higher level, what that data represents becomes important because the data relates to what you can do with it in a program.

When data fundamentally represents numbers, a program can easily apply math to manipulate the data set. All computer-aided design (CAD) programs are vector based, meaning they fundamentally manipulate numbers behind the scenes.

The term vector literally refers to a mathematical object that is defined at a point in space (implying a coordinate system), with a given magnitude (shown by the length of a line segment) and direction (indicated by an arrowhead at the end of the line). You might have dim memories of vectors from those math classes you once took in school. So what does this have to do with CAD anyway?

In a way, vectors have everything to do with CAD, because CAD is based on points, lines, angles, coordinate systems, and so on. The word vector was sort of chosen as a mascot for this type of euclidean geometry/Cartesian coordinate type of linear mathematical system. Let's take a quick look at how this works in AutoCAD.

1. Launch your CAD program. This book will use AutoCAD 2005, but many of the concepts are similar in other CAD programs.

2. Open SimpleDrawing.dwg from the CD. Figure 1.1 shows the CAD drawing.

3. Click one of the lines. The line highlights and three blue grips appear, indicating this entity is selected. You can select an entity like this because CAD is object based: AutoCAD actually "thinks" and stores information on a per-object basis.

4. Click the Properties button on the main toolbar or type Properties on the Command line, and then press Return or Enter to open the Properties palette (see Figure 1.2). (You may have to hover your mouse over the vertical palette title bar to get it to fly out if it is set to Auto-hide on your system.) Under the Geometry heading in the Properties palette, notice numeric values in the Start X, Y, and Z and End X, Y, and Z fields. These numbers are the coordinates of the selected line's start and end points.

This line is represented by start and end points because AutoCAD uses a three-dimensional coordinate system to locate entities in space—an important feature of the program. AutoCAD doesn't "understand" anything about the space surrounding the objects. Instead, it only "knows" about the entities that are stored in its database; the spatial relationship you see between the objects is controlled by their numerical coordinate system.

5. Zoom in closer toward the center of the drawing; you can click the Zoom Realtime tool and click and drag up to do this. Observe how the line work does not get any thicker as you zoom in; the coordinates of this line do not change either. When you zoom in AutoCAD, you are using math to manipulate the display of the coordinate system. You could zoom in forever and still never get to an "end."

6. You can close your CAD program now, and there is no need to save the example drawing.

Figure 1.2

Clicking the Properties button opens the Properties palette.


"3 ^ ^ 1


□ ByLaycr





uneiype scate


Plot style



■ ByLaycr




If Geometry


2ff-8 15/16"

Start r

23-8 lEf!6"

Start Z



I4'-2 5/8'

End V

IS-] 13/16"

End Z





-1OT-6 7/0'

Delta 2



i6'-4 n/16"



NOTE AutoCAD objects are independent of resolution.

On the other hand, data that represents color is more difficult to manipulate using math. In point of fact, colors are ultimately represented by numbers on a computer. However, the way color data is stored and manipulated is far less efficient than the way numerical data is stored and manipulated with math. Let's take a look at Photoshop to see how it fundamentally handles data.

1. Launch Photoshop.

2. Choose File > New to open the New dialog box (see Figure 1.3). Click the Width and Height drop-down lists and change the measurement to pixels. Type 600 in the Width text box, and type 450 in the Height text box. Set the Resolution to 72 pixels/inch, and choose White from the Background Contents drop-down list. Click OK to create a new image document with these settings.

Figure 1.3

Creating a new Photoshop document

Name: | Untitled-1

« l

Preset: | Custom H


wtith: 1600 | pixels zl

Save Preset.-, j

l-teqht: |450 | pitted jJ

Delete R'eset.. |

Resolution: 172 | pixels/Inch

image Size: 791 .OK

Cdcr Mode: | RGB Color J 18 bit zl

Background Contents: | White »|

v, Advanced

The process of creating a new document shows how Photoshop works; it stores data as pixels ("picture elements" that are tiny squares of color). You have to choose exactly how many pixels you want to work with right from the beginning. The resolution is the pixel density, or how many pixels appear per unit length.

3. Click and hold the Rectangle icon in the toolbox to display the hidden tools. Select the Line tool.

4. The Options bar is at the top of the interface (see Figure 1.4) and displays context-sensitive information for many of the tools in the toolbox.

Click the third button from the left, Fill pixels, to directly create pixels using the tools shown on the right. (The Line tool is selected.)

Figure 1.4

The Options bar when the Line tool is selected

Ll LH -J i kj 'li O X - Weight: 11 p.: Modfi Hrv-nb Z] 1XA |' r Ar,li-ui j^:d

5. Before you draw a line, you need to select the relevant options on the Options bar:

♦ Set the width to one pixel by typing 1 px in the Width text box if it is not already set to 1 pixel.

♦ Make sure the blending mode is set to Normal.

♦ Finally, make sure the Anti-aliased check box is unchecked.

6. Draw a line by dragging and releasing the mouse in the left side of the document window.

7. Hold down the Shift key and draw more lines. Notice that while Shift is held, you can only draw lines that are horizontal, vertical, or on a 45-degree angle.

8. Toggle the Anti-aliased check box on and draw a few more random lines on the right side of the document. Use Shift to draw horizontal, vertical, and 45-degree lines also. Figure 1.5 shows aliased lines on the left side and anti-aliased lines on the right.

Figure 1.5

Aliased and anti-aliased lines

Aliased lines

Aliased lines

9. Press Z or click the Zoom tool in the toolbox, and then zoom in to the left side of the document where you drew aliased lines, to 600% magnification. (The zoom amount is shown in the title bar of the document window, as shown in Figure 1.6.)

At this magnification, you can see that the lines are made of square pixels. Unlike AutoCAD, in Photoshop the closer you zoom in, the larger the line work becomes because the pixels get bigger. These "lines" are merely black pixels in a matrix of white pixels that form the overall image. Photoshop doesn't record these black lines as entities, but alters the appropriate pixel colors already stored in memory.

Also, notice how the horizontal and vertical lines look smooth: the pixels are in a regular grid that aligns with this horizontal/vertical orientation.

Figure 1.6

The relationship of pixels to grid

Smooth horizontal and vertical lines

Smooth horizontal and vertical lines

Jagged oblique line Perfect stairstep 45-degree lines

NOTE The relationship that pixels have with their implied grid determines how jagged they appear.

The 45-degree line also has a clean look because it is made of a perfect stairstep of pixels. Only the oblique line seems jagged because it must be represented on this grid of pixels.

10. Hold down the spacebar and drag the mouse to the left in the document window to pan over to the anti-aliased area of the image (see Figure 1.7).

The horizontal and vertical lines are perfectly represented because they align with the grid of pixels. The 45-degree and oblique lines get an anti-aliasing treatment that blends the adjacent pixel colors to make the edge seem softer. Notice how the 45-degree anti-aliasing is symmetrical and that the oblique blending is a bit more complex.

11. Double click the Zoom tool in the toolbox to return to 100% magnification. Save this file as Linework.psd. This file is also provided on the CD for your convenience.

Let's compare a few items in Figures 1.6 and 1.7. First, the aliased oblique line in Figure 1.6 is unacceptable because it is clearly jagged. Oblique lines therefore benefit from anti-aliasing. The horizontal and vertical lines appear the same whether they are anti-aliased or not because they align with the grid of pixels in the image. Finally, the lines that are at a 45-degree angle actually look better in Figure 1.6 because they appear thinner than the anti-aliased lines in Figure 1.7.

Figure 1.7

Anti-aliased pixels

Smooth horizontal and vertical lines

Anti-aliased 45-degree lines

Smooth horizontal and vertical lines

Anti-aliased 45-degree lines

Anti-aliased oblique line
0 0

Post a comment