Skip to content Skip to navigation Skip to collection information

OpenStax-CNX

You are here: Home » Content » A First Course in Electrical and Computer Engineering » Vector Graphics: Introduction

Navigation

Table of Contents

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Endorsed by Endorsed (What does "Endorsed by" mean?)

This content has been endorsed by the organizations listed. Click each link for a list of all content endorsed by the organization.
  • IEEE-SPS

    This collection is included inLens: IEEE Signal Processing Society Lens
    By: IEEE Signal Processing Society

    Click the "IEEE-SPS" link to see all content they endorse.

  • College Open Textbooks display tagshide tags

    This collection is included inLens: Community College Open Textbook Collaborative
    By: CC Open Textbook Collaborative

    Comments:

    "Reviewer's Comments: 'I recommend this book as a "required primary textbook." This text attempts to lower the barriers for students that take courses such as Principles of Electrical Engineering, […]"

    Click the "College Open Textbooks" link to see all content they endorse.

    Click the tag icon tag icon to display tags associated with this content.

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Bookshare

    This collection is included inLens: Bookshare's Lens
    By: Bookshare - A Benetech Initiative

    Comments:

    "Accessible versions of this collection are available at Bookshare. DAISY and BRF provided."

    Click the "Bookshare" link to see all content affiliated with them.

  • NSF Partnership display tagshide tags

    This collection is included inLens: NSF Partnership in Signal Processing
    By: Sidney Burrus

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • Featured Content display tagshide tags

    This collection is included inLens: Connexions Featured Content
    By: Connexions

    Comments:

    "A First Course in Electrical and Computer Engineering provides readers with a comprehensive, introductory look at the world of electrical engineering. It was originally written by Louis Scharf […]"

    Click the "Featured Content" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • UniqU content

    This collection is included inLens: UniqU's lens
    By: UniqU, LLC

    Click the "UniqU content" link to see all content selected in this lens.

  • Evowl

    This collection is included inLens: Rice LMS's Lens
    By: Rice LMS

    Comments:

    "Language: en"

    Click the "Evowl" link to see all content selected in this lens.

  • Lens for Engineering

    This module and collection are included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Vector Graphics: Introduction

Module by: Louis Scharf. E-mail the author

Note:

This module is part of the collection, A First Course in Electrical and Computer Engineering. The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

Acknowledgements

Fundamentals of Interactive Computer Graphics by J. D. Foley and A. Van Dam, ©1982 Addison-Wesley Publishing Company, Inc., Reading, Massachusetts, was used extensively as a reference book during development of this chapter. Star locations were obtained from the share- ware program “Deep Space” by David Chandler, who obtained them from the “Skymap” database of the National Space Science Data Center.

Notes to Teachers and Students:

In this chapter we introduce matrix data structures that may be used to represent two- and three-dimensional images. The demonstration program shows students how to create a function file for creating images from these data structures. We then show how to use matrix transformations for translating, scaling, and rotating images. Projections are used to project three-dimensional images onto two-dimensional planes placed at arbitrary locations. It is precisely such projections that we use to get perspective drawings on a two-dimensional surface of three-dimensional objects. The numerical experiment encourages students to manipulate a star field and view it from several points in space.

Once again we consider certain problems essential to the chapter development. For this chapter be sure not to miss the following exercises: Exercise 2 in "Two-Dimensional Image Transformations", Exercise 1 in "Homogeneous Coordinates", Exercise 2 in "Homogeneous Coordinates", Exercise 5 in "Three-Dimensional Homogeneous Coordinates", and Exercise 2 in "Projections".

Introduction

Pictures play a vital role in human communication, in robotic manufacturing, and in digital imaging. In a typical application of digital imaging, a CCD camera records a digital picture frame that is read into the memory of a digital computer. The digital computer then manipulates this frame (or array) of data in order to crop, enlarge or reduce, enhance or smooth, translateor rotate the original picture. These procedures are called digital picture processing or computer graphics. When a sequence of picture frames is processed and displayed at video frame rates (30 frames per second), then we have an animated picture.

In this chapter we use the linear algebra we developed in The chapter on Linear Algebra to develop a rudimentary set of tools for doing computer graphics on line drawings. We begin with an example: the rotation of a single point in the (x,y)(x,y) plane.

Example 1

Point P P has coordinates (3,1)(3,1) in the (x,y)(x,y) plane as shown in Figure 1. Find the coordinates of the point P ' P', which is rotated π6π6 radians from P P.

Figure 1: Rotating a Single Point in the (x,y)(x,y) Plane
Figure one is a two-dimensional cartesian graph with two line segments, P, and P' drawn out into the first quadrant. The horizontal axis is labeled x and the vertical axis is labeled y. Line segment P reaches point (3, 1). The angle from the x-axis to line segment P is labeled θ. Line segment P' reaches point (x', y'), which is a higher y-value than P and a lower x-value than P. The angle between P and P' is measured as π/6. Both lines are labeled as length r.

To solve this problem, we can begin by converting the point P P from rectangular coordinates to polar coordinates. We have

r = x 2 + y 2 = 10 θ = tan - 1 ( y x ) 0 . 3217 r a d i a n . r = x 2 + y 2 = 10 θ = tan - 1 ( y x ) 0 . 3217 r a d i a n .
(1)

The rotated point P ' P' has the same radius r r, and its angle is θ+π6θ+π6. We now convert back to rectangular coordinates to find x ' x' and y ' y' for point P ' P':

x ' = r c o s ( θ + π 6 ) 10 cos ( 0 . 8453 ) 2 . 10 y ' = r s i n ( θ + π 6 ) 10 sin ( 0 . 8453 ) 2 . 37 . x ' = r c o s ( θ + π 6 ) 10 cos ( 0 . 8453 ) 2 . 10 y ' = r s i n ( θ + π 6 ) 10 sin ( 0 . 8453 ) 2 . 37 .
(2)

So the rotated point P ' P' has coordinates (2.10, 2.37).

Now imagine trying to rotate the graphical image of some complex object like an airplane. You could try to rotate all 10,000 (or so) points in the same way as the single point was just rotated. However, a much easier way to rotate all the points together is provided by linear algebra. In fact, with a single linear algebraic operation we can rotate and scale an entire object and project it from three dimensions to two for display on a flat screen or sheet of paper.

In this chapter we study vector graphics, a linear algebraic method of storing and manipulating computer images. Vector graphics is especially suited to moving, rotating, and scaling (enlarging and reducing) images and objects within images. Cropping is often necessary too, although it is a little more difficult with vector graphics. Vector graphics also allows us to store objects in three dimensions and then view the objects from various locations in space by using projections.

In vector graphics, pictures are drawn from straight lines.1 A curve can be approximated as closely as desired by a series of short, straight lines. Clearly some pictures are better suited to representation by straight lines than are others. For example, we can achieve a fairly good representation of a building or an airplane in vector graphics, while a photograph of a forest would be extremely difficult to convert to straight lines. Many computer- aided design (CAD) programs use vector graphics to manipulate mechanical drawings.

When the time comes to actually display a vector graphics image, it may be necessary to alter the representation to match the display device. Personal computer display screens are divided into thousands of tiny rectangles called picture elements, or pixels. Each pixel is either off (black) or on (perhaps with variable intensity and/or color). With a CRT display, the electron beam scans the rows of pixels in a raster pattern. To draw a line on a pixel display device, we must first convert the line into a list of pixels to be illuminated. Dot matrix and laser printers are also pixel display devices, while pen plotters and a few specialized CRT devices can display vector graphics directly. We will let MATLAB do the conversion to pixels and automatically handle cropping when necessary.

We begin our study of vector graphics by representing each point in an image by a vector. These vectors are arranged side-by-side into a matrix G G containing all the points in the image. Other matrices will be used as operators to perform the desired transformations on the image points. For example, we will find a matrix R R, which functions as a rotation: the matrix product RGRG represents a rotated version of the original image G G.

Footnotes

  1. It is possible to extend these techniques to deal with some types of curves, but we will consider only straight lines for the sake of simplicity.

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks