Sie sind auf Seite 1von 260

,

DAVID F. ROGERS
J. ALAN ADAMS

MATHEMATICAL
ELEMENTS FOR

- ...

..... ,...

W'

J(

, ..

..

'

THIS 8001( BFLONGS I 0

MIKE HAYDEN
~~n1YATICAL

ElBNrs
FOR

CO'RJTER G\1\PH l cs

MATHEMATICAL ELEMENTS
FOR
COMPUTER GRAPHICS
DAVID F. mRS

.Aerospace Engineering oepar tt1ent


United States Naval h:al:lemy

J.

PIWf>

Engineering oepart:ment
United States Naval Academy

l~cal

ftf.Mw-HILL BooK Ca1>ANY


St. Louis san Francisoo Auckland
DUsseldorf Johannesburg Kua la Llr'r(:lUr I..ooda'l

New York
t~oo

M:lnt:real

S3o Paulo

New

Delhi

Panazra

Paris

Singapore Sydney Tokyo Toronto

Copyright@l976 by ~w-Hill ' Inc. All rights


reserved. Printed in the united States of Merica.
The prtXJian ~ of this publicatioo may be reproduced.
No other part of this publication may be reproduced ,
stored in a retrieval system, or transmitted , in any
form or by any rre.ans, electraric, ~ .
~t:ocnpy.ing , recording, or ot:heiwise, without the
prior written permission of the publisher.

3 4 5 6 7 8 9 0

FGRFGR

7 9

Fairfield Graphics was printer and bi nder .


Ll.brary of Qn]ress catalogirq m Publicat.ioo Data
~.

Oa\nd F
1937r.\"lt:hesratica.l elencnts for o:xt~ter graphics .

Incl1rles blbliographical references and index.


t. Cl.:rput.er graphics. I. Admns, Janes Alan 1936-, jowt autl-or.
II. Tt tle
;)85.R6
001.6'443
75-29930
ISBN o-o7-o53527-2

CONTENTS

XIII

PIUAC
QW'lER 1

nmax.x:TIOO

ro Cll<lPl1l'ER GRAPHIC

1-2

Overview of catp.lter Gra[il:ics


Iepresent.i.ng Pictures to be Presented

1-3

Preparing Pictures for Presentation

1-4

Presenting Previously Prepared Pictures

1-5

lnteract.in<J with the Picture

1-6

Descript.ioo of scrne Typical Graphics Dcvi oes

ll

1-7

Classificatioo of Graphics Devices

16

References

23

1-1

OW'TR 2 romrs
2-l
2-2
2-3
2-4
2-5
2-6
2- 7
2-8

liND LINES

Introcb::tioo
Representation of Points

Transformat:.ioos and t-'.atrices


Tranformation of Points

24
24
24
25
25

Parallel Lines

27
28
29

Intersect.ing Lines

30

Transformation of Straight Lines

t-tidr:oint Transformation

2-9

~t.Jtlcn

11

2-10

ReflectJ.on
scaling

31

2-11

32

2-12 canbined Operations

33

2-13 TransformatScn of a Unit Square


214 Arbitrary 2 X 2 ~tati.on Mat rix

34

2-15 '1\.Q-Dlr.W'm.Si.ooa.l 'J.'ranS1at.ioos and Hcnogeneous Ox>rd.inates

36
41

2-16

Points at Infinity

2-17

'1\.o-DllT'enSl.OOal Jbtation about

35

an Arbitrary Axis

44

References

CW\PJER 3

43

'ruREE-DINENSICN\L 'I'Rl\NSFOR>'.ATlQ.:S 1\ND PRml:TICN;

46

3-1

Introduction

46

3-2

'lbme-Dinensional Scaling

3-3

'nlrec-Dirrensional Shearing

3-4

'furee-DiJrensional IOtations

47
49
49

3-5

Reflection in 'I'hree Dimensions

51

3-6

Translation in Three Dilrensions

54

3-7

Three-D~ional

3-8

Elerrcnts for the General JOtation

3-9

Affire and Perspective

lbtations about

an Arbitrary Axis

54

r-~trix

55

Gect~etry

59

3-10 Axooc:rretric Projections

60

3-11

Perspective TranSfonMt.ions

3-12

Techniques for Generating Perspective Views

3-13

Pomts at Infinity

66
73
77

3-14

Reoa\stn.ction of 'Ihree-Dirrensional Information

3-15

Stereograriric Projection
References

QW1fER t

78
84
87
89

PLANE aJRVES

89
90

4-l

Introduction

4-2

Nonpara.rrctric

4-3

Param:>t.ric CUr\tes

4-4
4- S
4-6

Nonpa.ram:?tric

Parar-etric Representation of Conic Sections

102

4-7

103

4-8

Pa.razmt.ric Reprcsentatioo of a Circle


Para~TW!tric ~presentation of an Ellipse

4-9

Pararrctr ic Rcprescnt.:ltion of a Parabola

curves
~resentation

92

of Conic Sections

Nonparanetric Circular Arcs

4-10 Paranetric RaprcSUltation of a Hyperbola

94
98

104
106
108

<nm:NI'S VII

4-ll A Prooodure for the Use of Conic secti.als


4-U Circular Axe Inte.q:olation

5-.l
5-2
5-3
5-4
5-5
5-6
5-7
5-8

ll3

us

References

OW'TER 5

ill

Bourdary COnditions

116
ll6
116
119
123
124

Paratolic Blending

133

Bezier CUrves
a-spline CUrves

139

SPACE a.JRVES

Int.rodu:tion

o.uves

Representation of Space

CUbic Splines
N<mralized Paraneters

144
155

References

ffiAPTER 6

S'llRFACE IESCFUPI'IClil 1\ND GENERATIClil

6-12 Generalized Q)ons Surfaces


6-13 COOC1usions
References

.157
157
158
162
164
165
166
168
170
175
176
180
181
185
186

APffNDIX A CCI.fiVI'ER GRAPHICS

188

6-1
6- 2
6-3
6-4
6-5
6-6
6-7
6-8
6-9
6-10

Int.rodllct ioo
Spherical surfaces
PlanE: 'Jurfaoes
CUrved SUrface Ieprescntation

Bilinear Surface
IDfted or Ruled Surfaces
Linear COons surfaces

Bicubic Surface Patch


'Ibe F-Patch
Bezier Surfaces

6-ll &-spline SUrfaces

A-1
A-2
A-3

SOFniARE

Carp.Iter GraJirics Primitives

Catplter Graphics Elarents

canonical Space

IWENDIX B

NM'RIX <PERATI(N)

B-1

Te.oninology

B-2

Mdi tion and Subtraction

B-3
B-4

Multiplicatioo
~t

of a Square Matrix

.189
191
194
196
196
197
197
198

a-s
C-1

Im-erse ot a

Square t-1iltrix

199
200
200
201
202
202
203
204
204

C-2

A"' Al.godtm for '1\.o-Oim.msi.onal Translations


A '1\.o-Dirrensl.CnAl. Sealing Algorittm

C- 3

h '1\.o-OiJrensl.onal Peflection Algorithm

C-4

A General. '1\.o-Di.m:nsl.ooa.l lbtation Alqorit:ml

c-s

A 'Ihree-Dilrensional Scaling Algoritml

C-6

A.'1 Algoritl'm for 'lbree-O.urensional lbtaticn About the x- Axis

C-7

r.n

C-8

An Algorittm for 'Ihree-D.inensional

C-9

An Algorittm for 'Ihree-DJ.SrenSional Reflectioos

206

C-10

An Algorithm for 'llu:ee-Dilrensional Translation

207

e-ll

An Algorithm for 'lhree-Di.nensional ~taticn

Al.CJ.Xl.tml for 'Ihree-Dirrensioocll lbtaticn About the y-Axis


~taticn

About the z-Axis

about 'Any Arbitrary Axis in Spoce

205

C-13

h Dirrctric Projective Algorithm

207
208
209

C-14

An Isaret.ric Projective Algoritl'm

210

c-12 An Axooaretric Projective Algoritlm

c -15 An Algorittm for Perspective Transfonnaticns


C-16 'lbroe-Dimmsialal
C-17

en Algoritbns

A Stereo Algorithm

C-18 An Algorithm for a Nonparametric Circle


C-19

An Algont:ml for a Paran-etnc Circle

c-20

rar~ic

Ellipse Al.gon.tm&

c - 21 An Algorittm for a Paranetric Parabola


C-22

Algorithms for Pa.ra.rrot.nc HypeJ::bolas

c-23

An Algorittm for a Circle through Three Points

c-24

An Algoritl'm for Generating CUbic Splines

C-25

An Algorithm for Paralx>lic Blending

c-26 A Bczier CUrve Algorithm

c - 27 A a-spline CUrve Algorithm


C-28 1\n Algorithm for a Bilinear Surface Patch
C- 29

An Algorittm for a Linear Coons Surface

C-30 An Algoritml for a Bicubic Surface Patch


C-31

INIIX

lktLer SUrface Generatioo Algorittm

210

211
213

214
215

216

217
217
218
220
223
225
226
228
228

229
230
232

FOREWORD

Since its inception rore than a decade ago, the field of carput.er

gr~

has

captured thl! iiragi.naticn and technical interest of rapidly increasing nuttlers of

individuals fran nany disciplines.

A high percentage of the g:ro.fing rc:&Ilks of

cx:xtpUter graphics professionals has given primary attentioo to catputer-oriented

problems

1.n

progianming, S'Jstem design , hardware, etc.

'lh.is was pointed out by

Dr. Ivan Sutherland in his introduction to Mr . Prince' s book , "Interactive

Grafhlcs for Ccrp..lt.er- Aided Design," in 1971 and it is still true t.oday.

believe that an inadequate balance of attentioo has been given to applicatiooorientcd problem; .

There has been a dearth of producticn of useful information

t:Mt bears directly oo the develO(Jtent and iltplerrentatioo of truly productive


applications.

Understanding the practical aspects of carputer grat:*\ics with

regard to both the nature and use of applications r epresents an essentja] and
ultiJMte requitetettt in the devel o p tent of practical catputer graphic syst.enS .
~.athenatical

tcdurlques , especially principles of geanet.ry and transfozntttioos,

are indiCJenOus to nost

gra{ilic appl.icatioos .

Yet, l arge ni.Bbcrs of

graphic prograrmcrs and analysts struggle over or gloss over the basic
as the catplex problems of the mat:.hem:ltical eleuents .
operational potential of catputer graphics is often

as~

rurthemore, the full

~izcd

whenever the

rMt:he'natic.u relationships , constraints, and options are inadequately expl oited.


By the.u: authorship of this text, D:rs . Jt>gcrs and 1\dams have rea:xpuzed the

valuable relevance of their back9XOU'ld to these przlctical consl.derntioos.

'lbUr text is oaJCi~, is ~ive, and is written in a style unusually

oonducive to ease of rcacUng,

, iUlCl use.

I t exmplifi.es the

rare

type of '-Ork that rrost practit.iooers stould wish to place in a prominent locatioo

within their library since it should prove to be an invaluable ready rcfarcnce

for rrost disciplines. It is also well suited as the b<lsis for a oourse in a
cx:rtputer science educatioo curriculum.
I c:n1gratul.ate tho

autn:>rs in producing an excellent and needed text,

"Mat:hernat ical Elecrents for Cotp..lter Graphics."

s.

H. "Olas" 0\ascn

Locl<heed Georgia Calpmy, Inc.

PREFACE

A new and .rapidly expanding fjeld called "CXJlPUter gra~" is errerging.

'Ihis field cxxrbines roth the old and the new:

the age old art of graptucal

cx:mtU'licatioo and the re11 technology of catpUters. AlJrost everyone can expect
to be affected by this rapidly expanding techoology. A new era in the usc of
CXITpUter graphics,

not just by the large mrpanies and agencies \\ho ml'.lde rra.ny

of the initial advances in software and hardware, but by the general user, is
beginning.

Lc.w-cost graphics terminals, ~ sharing, plus advances in mini-

and miCJ:O<XXIPUters have made this possible.

'lbday, <XIlputer graphics is

practical , reliable, CXlSt effective , and readily availAble.


The purpose of

this lxlok is to present an introdtx:ti.on to the rro.thanatical

theory underlying cx:.op.rtcr graphics techniques in a unified manner.

Al.trough

new ways of pt:eSentlng material are given, no actual ''new" mathematical TMterial

is presented .

All the material in this boolc exists scattered throughout the

technical literature.

111 CTM

'Ibis lxx>k atterrpts to bring it all together in one place

notatJoo.

In selecting material, ~ dlose tecmiques \Jtich

were fund.alrentally nath-

ematical in nature rather than t.rose \olhi.dl <Nere rrore procedural in nature. For
this reason the reader will find rrore extensive discussions of rotatioo, translatioo, perspective , and curve and surface descriptloo than of clippi.ng or
hidden line and surfaro rerroval..

First-year college rratheratics is a sufficient

prerequisite for the major part of the text.

After a discuss:i.on of c:urront cxnpoter graphics tochnol.ogy in Olapter 1,


t.~

manipulatIon of graphical elEments represented in matrix form using haro-

CJI=OOOUS a:xn:'din.ate5 is described .

A discussion of existing techniques for


reptesent.iN} p:>mts, lines, curves, and surfN"PS within a digital CXITpUter, as

'Mll.l as c:utpUter sofO.'are procedures for rmnipulatinq and displaying mcputer


output in graphical form,

is then presented in the following 0\aptc.rs.

!'lathematical tcchniques for pt:oducing ~ ard perspe:ct.:ive views

are given , along with generalized tec::hn.iques for rotation, translation, and

scall.ng of qearotric figures.

aro

CUrve definition procedures for both explicit

palCiretric representations are presented for both

and three-

ditrcnsiooal. curves. C\.U:\Ie definition techniques include the use of conic


sec:t.ials, ci.rcul.Ar arc interpolation, C\bic spl..ines , parabolic bl ending , Bezier

curves and curves based en a-splines. An int.roduct.i.a'\

to the mathematics of

surface description is inc:ltxied.

catplter algorlthns for uost of the fundarlental e.l.arents in an interactive


graphics package are given in an appendix as BASIC* l..anguaqe subprograms .

ever, these algorithns deliberately stop


actually display tre results.

srort

of the coding necessary to

U'\fortunate.ly there are no standard l.anqua<Je

carmands or subroutines available for graphic display.

discussioo of

grapuc

HeM-

Although sate prel.imi.nary

primitives and graphic elem:mts is given in .Appendix A,

each user will in general find it r..eoessary to work within the oonfines of the

cx:nputer system and gra{il.ics devices available to him or her.

'1h:l furx1aJmnt.al ideas in this book have been used as the foln}ation for an
introductory oourse in

c:utp.~ter

<Jraphics given to sb.rlents

or sclcntific fields at the undergraduate l evel.

It

J.S

nann<:r at both I.D1iversit..ies and schools of technol ogy.

~mjoring

in technical

suitabl e for use in this

It is also suiUible as

a supplene1taxy text in rro:re advanced c:utputer programning courses or es a


SH{l>letre:1taxy text in

sore

advanced mathesratics

courses.

Further, it can

profitably used by ind.iviCbals engaged in professiooal programning.

be

Finally,

tho docurcnted c::onputer ptograms srould be of use to m1puter users interested


in

developing mcputer gra(Xlics capability.

The authors gratefully aclo'lc:Mledge the enoourageucnt and support of the

Urited States Naval Academy.

'llle acadatu.c envi..roon:ent provided by the aaninis-

Lratial, the f<-~t."Ulty, and espcc:ially the midshipnen was conducive to the
de~lop<r.nt

of the rmterial in this J:xxX.

*Msrc i.s a regiStered trade

nurk of

nu:U.OUt.h COllege

PREFACE YN

No book is ever written without the assistance of a great


Here

\ole

\lo10Uld like to acknowledge a few of them.

~mny

people.

First, Steve COOns \lh::l reviewed

the entire m:umscript and made rrany valuable suggestioos, Rich .Reisenfeld \lh::l

reviewed the material on B-spli.ne curves and surfaces, Professor Pierre Be2ier
\lh::l reviewed the 11\llterial on Bezier curves and surfaces and Ivan Sutherland ....no

ional recont.roction techniques discussed

provided the iupetus for the


in Olapter 3.

Special

aclcncwled~t

CAD Group at ambridge University.

is due past and present rrebers of the

Spec:Hically, \oOrlc Cklne with Jti>in Forrest,

Olarles Lang, and Tcny Nutlx:Jume provided greater insight into the subject of

CCJ1l",rt:er graphics .

Finally, to I.Duie Knapp who provided an original FORmAN

program for B-spline curves .


'!he authors would also l..iJ<e to aclo':Mled<;Je the assJstanoe of many individuals

at the Evans and Sutherland CQipUt.e.r Coqx:>ration.


a uthored the ~t fran ....ru.c:h many of the

Specifically, Jim can an who

deAs on representing , preparing1

presenting and interacting with pictures is based.

Special thanks are also due

Lee Bil101o1 "*'o prepared all of the line drawings.

t-t.ach of the art ...orlc: for Chapter l has been provided t.hrough the good

offices of :ui.ous c:otputer graphics equiprent nanufacturers .

Specific acknor.ol-

led<Jrent is tmde as follows :


Fig. 1-3

Evans and SUtherland Caq;luter Corporatim

Fig. 1-S

Adage Inc.

Fig. 1-7

.Adage Inc.

Fig. 1-8

Vector General, Inc.

Fig. 1-11 Xynetics 1 Inc.


Fig. 1-12 CALO:l-1P, California eoopurer Prochx:ts, Inc.
Fig. 1-15 Gould , Inc.
Fig. 1-16 Tektronix, Inc .
Fig. 1-17 Evans and Sutherland catFuter Cox:pxaUon
Fig . 1-18 CAiaM.', california c:atputer Prodttts, Inc .

David F. JO]erS
.1. Alan Adams

CHAPTER l
INTRODUCTION TO
COMPUTER GRAPHIC
TECHNOLOGY

Since o::rrputer grafhi c:s is a relatively new technology, 1.t is neoassa.ry

to clarify the current ternu.rology.

rather l OOEiely in this field .

A nmber of t.e.rTTs and defl.nitioos are used

In particular, carpucer aided design (CJ\D) ,

interactive graphics (IG) , m1puter graflh.ics (ex;) ,

aro

conputer aided manufac-

turing (01'.) are frequently used interch~ly or in such a rrlU'lner that

considerable confusion exists as to the precise rrean.ir].


is the nost general.

Of these tcrrrs CAD


CAD rra.y be defined as any use of the caTpUtor to aid in

tr.e design of an individual part, a S\.i::)system, or a total system. 'Ihe use


CJocs not have to involve gra._oh.ic:s .

'1he design process rroy be at tr.e systen

cxmoept lcw.l or at tho detal.l part design level.

It nay also involve an in-

terface with CA.'i.


~ ai<X-d manufacturing

is the use of n CX>IIPJter to &d in the

manufacture or production of a part exclusive of the design pnx:::ess .

A direct

interfaoo between the results of a CAD application and the neoessacy part
pr~xi'lmling

using su:h l anguages as APT (Autooatic Progt'W11l..>d Tools) and lNIAPI'

(United' s APT) , t.ht" direction of a IMChine tool using a haroNircd or softwired

(miniconputer) controller to

roae eata

-f'ro a OUI'd"lCd pa._?Cr tap: and CJC!llerate

the necessary ~ to oonLrol a l"aChi.r.e tool, or the direct control of a

oochine tool USirJ a minicarprt:.er nay be involved.


Cbrputc.r graphics is the use of a caputer to define , st:.aro, nunipulatc,

i:."ltcrrogate, ar.a PLesent pictorial output.

ation.

'lhls is essentially a passive oper-

a:rputer prepares and presents stored infonration to an observer

Th'

in the fo:::r.. or pictures .


bo.inj presented.

'lhe

'lhe cbsetver has no direct conLrol over the picture

application~

be as sirrple as the presentation of the

qrll{:h of a silrple C1lnCtion us~ a hicjl-speed line printer or a


te.let.~

t.emi.nal to as mplex as the simulation of the autaMtic reentry and

landU'lq of a space capsule.

Interacti"\:! qrapucs also uses the <X1TpUt:er to prepare and present pictor-

ial rote..-ial.

llc:Uevar, in interactive grapti.cs the observer can influence the

picture as it is being presented; i.e., t:ht:! observer interacts with t:hc picture
m real t:.in!.

To see the inportance of the Yea!

restriction, consider the

onal picture a:xtposed of 1000 lines

pJ"Cblcm of rotating a cotplex

at a reason.tlble rotation rate, say, 15/second.

As we shall see subsequently ,

the 1000 lines of the picture are JTOSt oonveniently represented by a 1000 x 4
nutrix of hooogeneous OX>rdinates of the end points of the lines ,
n::~St

tion is

a 4 x

aro

the rota-

oonveniently acca,plisbed by nultiply:ing this 1000 x 4 matrix by

tran.sfornation rratrix.

Accntplish.ing the required natrix nW.tiplication

roquin.... 16 , 000 aultiplicatialS , 12,000 additions , and 1000 divisions .

I f this

m'ltrix rrultipUcation is acx:n1plished in soft..lare, the tirrc is significant.

To

soc t.ltis, consider that a typical miniconputer using a haxd.-ta.re floating-p::lint


pt~~sor

requires 6 microseconds to nultiply 0.'0 nurbers , 4 microseconds to

add O..'O fl\rlbers , and 8 rnicrosecorxls to divide t\\'0 nurbers.

'Ihus the matrix

nultlpl.ication requucs 0 .15 seconds.


Sin~

mtputer cti.splays that al lo;, dynamic notion require that the picture

be redram (refreshed) at least 30

each second in order to awid flicker,

i c 1s cbvious that: the picture canmL change snoothly.

Even if it is assured

that the picture is recalculated {\4?d!lted) only 15 times eadl seoond, i.e.,
ever)'

Hare.

tlcqrec , it is still not [X.>SSible to aco:JJtplish a sncoth rotation in soft'Ihus this is

to l.ntcractivcly

T"DN

no lollC}er interactive graphics .

To regain the ability

present the picture several th.i.ngs can be oone. Cl ever pro-

rJrarwli..ng can n:duc:c the t.irre to accntplish the required matrix multiplication .
lfodever, 0 pOlnt will be reached wnere this is no longer possible .

plexlty o! t:hA.; picture

m'ly not

I~

accept.ab lP .

be reduced.

'llla <Xlllr

In this case, the resulting picture

Finally, the matrix multiplication can be acxntpli.shcd

by using a Spcclal-pl.ll"pC)Se digital hare);.;are rrut.riJ< nultipller.

r-osL prouU:sing CIR'road\.

'Ihi.s is the

It can easily handle the prcblcm outlined l!b:>ve.

lnt:h this tcrmioology in mind the renainder of this chapter will give an
OVCIViL~

of cx:rput.er gratillcs

displhJS

~va.i 1<-bl,..

W<lre

~h....

am

discuss and c lassify the types of gr~ic

nt:Cl!SSary ronsiderations for devel~t of a soft-

S'fllt..an for the f~tal drcr,...l.T\g, device-control, and dato-handl:ing

aspects of c:atputer grapucs is given in J\ppe1rli.x B.

1-1

~GRAPHI CS

CNERVIEW

!J:

catputer

gr~ics

as defined

abo~

can be a very

o:xt~lex

arvi ell verse Sl.b-

I t cncx:~~paSses fields of study as diverse as electronic and rroch.lnical.


desi gn of the corqx>nents used in catpUter gr<qitics systans .md the oonoepts of
ject.

display lists and tree structures for preparing and presenting pictures to an

ooserve.r using a c:atputer gra[:irics system.

1\

di..scu<;sion of these aspects of

interactive c:atputer g:rar.hlcs is given in the bock by


1-l ) .

Ne~

and Sproul (ICf.

llcre ~ will atteupt to present only those aspects of the subject of

interest fran a user' s point of view .

From this point of via", CXlClputer

graphics can be divided into the fol lowing areas:


Representing pictures to be presented

Prepari.nq pictures for presentation


Pl:escnting previously prepared pictures

Interacting wi.th the picture


Here the word "picture" is used in its broadest sense to rrcan arrt collection
of lines , points, text, etc., to 1><:! displayed an a graJ=hics device.

A picture

TMY be as s.inple as a single line or curve , or it may be a fully sca.lcd and


anrotatcd ~ or a c:atplex representation of an aircraft , shl:_:~, or autacbile.

1-2

la>REsa-rr1 ~ P1<:n~s

To BE PREsENTED

F'\lndaJrentally the pictures represented in cnTpUt:er cp:aphics can be considered as a collection of lines , points, and textual material.

1\

line can be

represented by the ooordinatcs of i ts end points c, , y 1 ,z1 > and

(~,y ,z 2 ),

point by a s.i.ngle-ooordi.nat:e triplet (xl'y , z ) , and textual material by col1 1


l.ect.ions of lines or points .
'Llle representation of textual material i s by far the rrost c:atplcx, involving in many cases cw:ved lines or dot matrices .

IICMever, unless Ule user is

concerned with pattern ['C(X)(Jnition, the design of graphic tmrd.,'are, or unusual


character sets , he or she need not be concerned with these details, sinoe alIro6t all grapuc &vices have built-in ..harc},:are" of software c:ha.r.!K:ter gen-

erators.

'Ihe representation of curved lines is usually l!o:::ouplishcd by approxi-

rating them by short straight-line segrrcnt.s .

plished using hard.-lare curve <]CJlerator:s .

1-3

PREPARING

PtcrtR:s FOR PRESENTATION

Iio..Jever, this is sarctiJros acxntr

P1ctll.rCS

ult.i.r.ately oonsl.St of points.

are qererally stored

The ooordinatcs o! these poirlts

a h.le (anay) prior to beJ.ng used to present the plc-

1n

'nlis file (array) is called a data base.

t:ure.

Very mtplex pictures require

very m::plex data bases wtudl require a oocrplex Pn'XJrM\ to access them.

'l1lese

<n1plex CaUl b-'lSCS ruy inwlvc rinq st.ruccu:res, tree st:nx:turcs, etc., and the
~tsclf !"~

contain powts, slbst.ructures, and olher ronqraphic data.


T"e des i<Jl" of ~ data bases and the program; which at:..'mss them is an ongoing
top1.c of .research, a topic which is clearly beyond the ~of t!lis text.
fb:ever, JT1AnY mputer graphics applications inwlve much sinpler p1ctures for
data bast.

which the user can reddil} invent sinple data base structures \\lhich can be
a~sed.

easily

'ttlcre are

Pomts are the b:s.sic building bloa'<.s of a graphic data base.

th.."""O basic rroth:xls or instructions for

trea~

a point as a graphic <_7El00etric

nove the be5n, pen, cursor, plottinc] head (hereafter CAl led the cursor)

entit'l:

to t:he point, dra.<.> a line to that point, or draw a dot at thal point.

m::ntally t:he.rt=- are

c..'O

wtJYS to specify the position of a p:>int.:

relative (incraent.al) ooordi.nates .

F\lnda-

absolute or

In relative or incranental ooordinates the

position of a point is defined by giving the displaoerne.nt of the p:>int with


respect

to the pre\"ious point.

The specif1.cation of the position of a p:>int in either absolute or relative


'lhis can lead to difficulties 1.f a mrputer

ooord.inates requires a niJ!I't.)er.

Generally a fUll 0011puter lf.'Ord 1.s used

"''it.'l a l.irnlted lf.'Ord lengt.."'l is used.

to specify o cxx:mii.natc position.

ifl.ed by a full cr:r.puter word


\<o'Ord .

l.S

'lhe largest. integer rnmber that can be spec2n-l - 1, where n is lhe nutber of bits in the

For thl. 16-bit minia:rtp.lter frequmtly used to

displays, t.his

1S

32767.

5\.{l{X)rt

CQlPUter graphic

For many awlications this is ac::oE4"'table .

~var,

diffl.culties arc cnoount:ered ~.~.ne.n larger integer ru::bers than can be specified

are required.

At.

first

'-'C

might expect to 0\."ercare this difficult:r by using

relat.ivc ooord.i.Mtes to specify a nurrber sud'l as 60 , 000, i.e . , using an absolute

ooor:dinatc spcciflcation to position the cursor to (30000 , 30000) and then a


relative cxxm:Unat.e specification of (30000, 30000) to position the beam to the
final desired point of (60000, 60000) .

1-t::Jwever, this will rot \o.'Ork , since an

at!:.crtpt to aOC\I':Ul..ate relative position specifications beyond the nuxi1Tun rcp-

re:scnta>lc

val~ wi 11

result in the

ard erroneous nagnitu1c.

y1eld the

fhen::n:na

Thew~
hcrog~us

generatia~

of a mlt'ber of ~ite sign

For cathode ray t\De (CRI') displays tins w11l generally

cal.l.OO wraparound.

out of this

di~ is to

use hooge.~l:S ooordinates.

'1hQ

o:x>xdinatcs introduces sare a&ii tional cuplc.xit}, ~ loss

speed, and ~I'! loss in resolution.

tb~'ever, ~

~ighed by the advallt~ of bci.'19 able

use of
lil

dlsadvant.aqes are far out-

to represent .l.ar9c wteger nwbcrs \d.th

a cucputer of limited wonl size.

for this reason

.:lS

\o.<ell as others presented

l ater, hom::lgene.ous coordinate representat:.i.oos are generally used in t:his bock .


In harogcncous roord.inates an n di.rrensional space is rcpre.;cnt:ed by n + 1

dim.:msions , i.e . , throo-d.inensional data where the position of a JX)int is given

by the triplet (x, y , z) is represented by four ax:n:dinat.es (hx,hy ,hz,h) ,


h is an

ami tra.ry

n\Jlber.

l f each of the coordinate positions represented in


l ess than 32767 , then h "-ould be n-ade
represented directly .

I(,

o:JUa1

c1

16-bit

were

c:arpu~r

to 1 and the CXX)rtti.nate positions

hcJ..rever, one of the Eucledean or ordinary CXX)rdi.nates

is larger than 32767, say , )( ::: 60000 , then the


bea::tres apparent.

~re

poNer

or

haxogunuous cxxmlinat:es

In this case '''e can let h = 1/2, and the CXX)rdinatcs of the

point are then def ined as ( 30000 , l/2y , l/2z 1 1/2) , all acceptabl a nUtbers for
a 16-bit CXIIlpllter .

Ho..-evet"1 sooe resolution is lost sinro x .. 60000 and x

59999 are both represented by the sama hooogeneous CXX)rdinate.

In fact resolu-

tion is l ost in all the ooordinat2s evan i f only one of them exceeds the 11\lX.i.nun expressable mmbor of a particular <Xluputer.

1~

PRESEw.!~ f>REv iOUSLY PREPARED PICTURES


~lith

these CXJJtnents about data bases in mind it is

ne<X!SSa.ty

to note that

the data base usad to prepare the picture for presentation is alnost never the
sarre as the display file used to present Ute picture .

The data base represents

the total p1.ctura wile the display file represents only sare portion, vie.,r, or

s<X!re of the picture.

The display file is created by transforming the data

The picture contained in the data base may be J:eSizcd, rotated, trans-

base.

lated, or part of it rorroved or vie..JOO fran a particular point to obtain

essary perspective before being displayed.

f"any

nec-

of these operations can be

aca:xrplished by using siJtpl c linear transformations which involve matrix trultip~cab,ons .

views.

As

1\rrong these are rotation , translation , scaling, and perspective

we shall sec later, hart:>gen(t>us ooordinatcs arc very oonveniont for

acxortplishing these transformations .


As will be shown in det.ril in

to perform

arrr

0\apt:ers 2 arrl 3 , a 4 x 4 matrix can be used

of these individlal transfonrutions on points represented as a

matrix in harogcneous ooordinatcs.

\\hen a sequence of transformations is

dcs.i.:oc<l, each individual transfornation can be sequentially applied t.o the

points to ochieve the desired result.

If , ho.-Jever, the nurber of points is

slbstantial, this is i.neH icient and t.irc consU'lli.ng.

1\n alternate and rrore

desirable ret.OOd is to rrultiply the iOOividual rotrices reprcsantinq each


~

transfo11Mtion t:o<)et:har and then to finally rrul.tiply the matrix of

points by the resulting 4 x 4 transforl!ation matrix.

'Dri.s matrix operation is

It results in significant t.irre savings when performing

called cx:ncatenatioo.

C:OifX'UOO matrix operat.i.ons oo sets of data points.

Although in many grilliUcs applications t.'lle cotpletc data b.lse is displayed,


frcqoontly only portions of the data base are to be displayed.

'lhi.s process of

d.ispl.ayllJ ally part of the cotplete-picture data base lS called W1IlCic7wing .


\\indo.;ing is not easy, particularly i f the picture data base has been transform-

Pertonnance of the winda.dng q:leration

ed as discussed above.

lJ'l

so.ft..rare gen-

erallY is sufflcicntly t.ine CXlOSuni.ng that dynamic real- t.irre intoracti\'C qtafhj.cs

is not possible.

.Again, sq:::histicat.ed graphics devices perform tlu.s funct.Loo

In ge.ncra.l there are two cypes of w~ - cllppinq <md scissoring . CUpping i.m.olves deteonininq whid\ lines or FOt"tions of lines in the
picture lie outs1de the wi.nda-1. 'lbose lines or portions of H.ne.s am then disin hardNare.

carded and not displayed; i.e. , they are not passed on to the displ ay devioo.
In the scissoring t.edlnique, the display device has a larger fhysical drl!Winq
space than is required . Only those lines or l.i.re segrrcnts within the specified

'".i.nclo..> are made


are dra-m.

visible

e1.e1

though l.i.rles or line segmmts outside the w~

Clipping aCOJJ<plished in hardYcU:e is generally rrore advantageous

than scissoring; e.q., clipping makes available a much larger drawirq area than

sd ssonnq . In scissoring, those lines or Se<JITClts of lines \'f'hich are not visible in the wi.ndc:7w are also drawn. 'lhis, o f oourse, requires ti.lre, since the
line gererator l't'llSt spend tiJm drawing the entire data base whether visible or
invisible rather than only part of t.'le data base as in the CAse for cliwing .
.In two dim::msions

a windcw is specified by values for the left, right, top ,

and bottx:lrrl ~ of a rectarqle.

Clipping is easiest i f the edges of the

rectangle are parallel to the ooordinate axes.

case, the rotation of the

w~

base 1..n the Of+OSite direction.

Fig. 1-1.

ll, ho..lever, this is rot the


can be o:npensated for by rotating the data

'l'No-dirrensional ciiwirq is represented in

r..i.ms are reta.i.ood, deleted, or partially deleted , depond1ng on

whether they are mtpletely within or without:. the windo.q or partially within

or without the w.incX:w.

In three dinensions a wi.ndow consists of a frustum of

vision, as stn.m in Fig . 1-2.

.In Fig. 1-2 the near (hither) l::x::A..lOOary is at N,

the far (yon) boundary at F , and the sides at SL, SR, ST, and

sa.

JlS a final step in the picture presentatioo process it is ncoessacy to

a:>nwrt fran t:he ooordinat.es used in the picture data base called user coordin-

ates, to those used 1::1} the displey device, called display ooord.irotcs .

In par-

ticuLu-, it is necessary to a::>n\.'ert ooordinate data which pass the winc:bd.ng


procrss into display ooordi.nates such that the PJ.cture appears in socte specified

area on the displa-J, called a vi0-1p0rt .

'lbe viewport can be specified by giv-

ll3 its left, righl, top, an:l bottxxn edqes if


dirren~nooal

~l.onal 0 1:"

U t:hree-

by also specifyinq a near (hither) and far (yon) boundat:y.

tn the

ltnc p.utl.tll~ '~tlhtn \\tndo"'


DJrl from a b dtspla)'cd.
pa fl rront b- c not dt~played
c
l tnc cnllrcl)
\qlhlll

--

Wtndo ''
cn l trt l1nc
d ~P Ia ~ cd
!II

Lnc:

paru;~ ll y

"'1th1n
wwdow p~ll from b-e
d t\ph,,.d pall\ .t-h. c- d
no t dt:.pla ycd

I tnt entrtly
J OUISide O(
w 111dow no t
dt)p l aycd

~ di.Jrensional
windo.o~ing (clipping) .

Figure 1-1

-I

Figure 1-2
ional
frustun of vision w.indo.ol.

rcost general case oonversion to display exx>rdi.natcs within a specified t:h.medin'cnsional viewport~ a linear rrapping frau a si>Hu.d ed

[rustun

of

vision (wi.ndo.") to a six-sided vieNpOrt .


An additional requ.Ue1ent for II'OSt pictures is the presentation of alpha-

nlm'Cric or character data .

There are in general two rroth::x3s of generating

characters - software and hard"are. If dlaracters am qenc.rated .1.n software


using lines , they are treated in the smre manner as any other picture elCI'I\"'nt.
In fnct this is rocessa.xy if they are to be clipped and then transforncd along
with other picture e l aronts .

ha.rd,..rare character generator .

Ha.leve.r, many graphic devices hava sare k.ind of


'-ben har:d.>are character generators are used , the

actual characters are generated just prior to beirxj drawn.

they are treated as only character oodes .

Wltil this point

Hara,are character generation is less

flexible sinoe i t does not allow for clipping or infinite transfonration, e . q .,


only li.Jru.ted rotations an:l sizes are generally possible, but it yields signifi-

cant efficiencies.
\\hen a ha.z:d..rare character generator is used, the !'rogr& which drives the

qrapuc device nust first specify size , orientatioo, and the position
the character or text strlll9 is to begin.

,mcz-c

'nle character c.oOOs specifying these

c:ha.rnct.&istics ;u-e then OOdod to the display file.

{k.lon being

character generator intexpreb the text string , looks up in

p~sscd

the

th<.:

neces-

sary .Lines to c:lra\.. the c:haractcr, and draws the characters on the displ ay de-

vice.

1-5

lrCTERACTWG HrrH THE PICTURE


Inte.racti.ng with

t.l)c

picture requires sare type of interactive device to

CXllr.Uni.cate with the progra., while it is running.

In effect this

tix: program so that rc-1 or d.l.fferent infol:'T19tion can be provided.

devices have been used to accotplish this task .


pe.n.G,

N\.ITCrous

The sirrnJ.est is , of course ,

the al[:haru.vreric keyb:lard such as is foun:! on the tel etype .

devices incll.JOO ll.ght

inte~

flore sq::hlsticated

jat sticl-.s , track balls , a rrouse, ftlnction swi tchc:s ,

control dials, and ana.lo-1 tablets .

We shall

exanu.nc each of these devices

I.:. ric fly .

A sjpple alpham..tmric keyboard as sham in Fig . l-3 can be a useful int:er-

actiw device.
easily

Preci.sc al(ilabetic, ru.meri..cal, or ex>ntrol inforrration can be

~lied

to the proyram.

lbleVer, it is not capable of high rates of

interaction, e><pccially if the user is rot a cp:xl typist.


Perhaps the best kncMn interactive device l.S the lic;l\t pen.

'lhc light pen

a:>ntai.ns a light-scn:ntivc rh;>toelectric oell and associated ci.tcuitry .

\>,'hen

I-OSitioned over a l.i.nc sc:qm:nL or other ll.ghted area of a CRr and activated,
the posl. tion of

t:re pen is sensed

ard an inte~t is sent to the conputcr .

Gdl.eMatic of a typical light pen is sham in Fig. l-4 .

Figure 1-5 sharJs a licjlt

pen in usc for renu p1.c:::k.ing.

The

JCI'f

stick, rrousc, cllld track ball all operate on the

SCITe

principle.

By ITOIIirq a ex>ntrol, ~ional positiooal information is cx:rmunicatcd to

the catputer.

1\l..l thesr' deVl.oes are analog in

nature.

In particular, ro~t

of the a:>ntrol dlan<;Jcs tho setting of a sensitive potentiareter.

The result.i.ng

siCJOials are convortccl fran analog (voltages) to digital signals using an analog
to dig.1tal (A/D) oonverter.

These digital signD.ls arc then interpreted by the

cnputer as positiot"..a.l infoo:ation .

A joy stick is

stnm in Fig . 1-6. Jat

sti&s, rouses, t.rad: balls, azrl similar devices are useful for particular
appll c:at.:lons.

IJ&C..'VC.r, they sOOuld not be used to provide very pr ecise posi tioo-

al information.

Control dials

a.c;

sho.m 111 Fig. 1-7 are essentially sensitive rotating poten-

ti(');Cters clnd <lSSOCi..ltl'd circuitry such that the position of the dial can be
sc.::nsed using anal.oq to cliqlt.dl <X:lnvcrsion t.echrtiqoos .

useful !'or activating rota im, t.ranslnt.ion, or


soft..tarc

syst:.e~Tc.

7.0:11''

'l1ley are particular ly

fentures of ha.rc:Ware and

~hiiiiCI

hullnn
1 l1h cr npltc

hunulc
I

I
Ph ~>lrnuluplu: r

C/
.__., Pu l~c

Figure 1-3 Al{:tlanll!l'eric


keyboard.

luhe
~hnl'lll!1

c trcull 1 > -

Figure 1-4 Schc:rnatic


of a light pen.

Figure 1-5 Light pen in use for menu picking.

l et di~Piol)
cnnr 111llc 1

Figure 1-7 COntrol

Figure 1-6 Joy stick.

dja]s.

Function switches, sJu.m in Fig . 1-8, are either toggle or push-button


switches wtn>e fOSit.ion can be detennined by the

~cs

Li~ts

program.

1.ndicat.ing which S'"'itch or s.dtches are active are also usually provided .

The analog tablet is the ItDSt versatile and accurate devloe for cx::mrunlcat..irq {X)Sitional information to the mrputer.

Pxoperly used, the analog tablet

can perform all the functions of a light pen, joy stick , track ball,
tion swi t.dles , or control dials .

IrOUSC , func-

Asscx:iated with the tablet is a pen which can

be roved over the surface a.rd whose position can be sensed.

It is also possible

to sense whether or not tho pen is in close proximity to the tablet surface.

PosiLional Wornation with

acx~uracies of

leLs, and Uiblct.s with accuracies of


tablets arc sht::Ml in Fig. l-9.

:!:

:!:

0.01 inch are typical of many tab-

0 . 001 inch are available.

Typical analog

1'he position of the pen and its relative loca-

tion in t1'IL! picturo-di..splay area are tied to:)ether by rreans of cursor (a small
visibl e syrri:nl) whose tTOtion on the pictl.ln! display area is in concert with
that: of the pen m the tablet .

o"ur the 1 iqht prn.

'lhe analog tablet has two distinct advantages

IJanely, when the analog tablet is used to perfonn a

JX)inting function , the indication occurs in the data base and rot in the displ.dy file. 'n1us, the proqrdlmlin:] is sirrplified. Also, dr~ or sketching
cr r-ointlng

~ing

.m ru'lillog tablet wtri.dl is on a horizontal surface is rorc

natural than perfonn.lng the san-e oper-

ation with a light pen in a vertical


orientation.
An analog tablet

Cml

be irrplcrrentod

in hard..are by using a variety of clcc-

trocnagnet.ic princi?lcs.

~of

these

are discussed in Ref. 1-1 in nnrc dctai 1.


Except in unusual cnvl.roo!rents the user

need not be cau:rned with the precise

'' '
''
'

'. . '

.........~'
-
,.....

'l)erating principle.

1-

1l:SCR I PT I(XII

OF Sot"C

TypICAL

tAAPIfl CS lv1 CES


'ttlere are a large nll!bcr of different types of grCifhics devices available,
far too many to describe them all hru:e.

'Therefore only a limited m..rrber of de-

vices representative of those available


Figure 1- 8

E\Jncti.oo s.dtale:S .

will be c.cnsidered.

In particular,

three different t}?eS of CRT grapucs

devices - storage t\be, refresh, and raster scan; a pen and ink plotter; and
a dot oot.ri.x plotter - will be described .

.Additi.ona1 devices and rore detail-

ed descriptions are provided in Ref. 1-1.

'llle three types of CRI' (cathode

tube) devices are direct vie,., storage

tl.be displays, refresh displays, and raster scan displays .

'1\le direct vi&l

storage tube display, also CAlled a bistable storage tube cll.st>lay, can be
oonsidered as similar to an oscillosoope \17ith a very long persistence phospl':>r.
A storage tube display is shown in Fig. 1-9 . A line or character will remain
visible (up to an rour) until erased by the generation of a specific electrical
signaL 'llle erasing prooess mquires about 1/2 serond . Storage t\be displays
have several advantages and disadvantages.

Sam of the advantages are:

the

display is flicker free, resolution of the display is gocd (typically 1024 x

1024 acklre.ssable raster points in an approx.irnate 8 x 8 inch square), and oost


is

lao~.

FUrther, it is relatively easy arrl fast to obtain an acceptable hard

CXJPY of lhe picture , and conceptually they are sarewhat eas1.er to program and

rrore suited to tilre-shnring applicatialS than refresh or raster scan displays.


'ttle principill dis-'ldvantagc is that the screen cannot be selectively c.rascd;
i.e., in order to dlange atrf el..E!rent of a picture the entire picture rrust be
redrawn . Because of this the display of dynamic ITOtions is not possible. In

f'ig-..:.re l-9 Analog tablet.


acldi tion, this C1aracteristic results in t."le interaction between

the

di.spl~ bci.ng'

scr.cwhat:

s~-cr

t.~e

user ar.3

t.flan with a refresh display.

A refresh CRr ~cs display is based on a telev>_sion-like cathode ray


tltk.

Ho..oe\.oer, t.ie r.et.'10d of qenerati.ng the image is quite different.

'fule-

Vl.SlOn uses a raster scan tedmi~ (see below) to generate the reqw..red picture, ,,t\e.reas the traditional refres.'l CR!' gra!Xllcs display is of the call igraFhic
or li.nr-draw.i.n:] type.

A refresh CRr graphics display requires

addition to the cat:hodc ray bbc itself :


troller.

elerents in

a display buffer and a display a:m-

In order to understand the advantages and limitations of a refresh

display it is necessary to cxmceptually l..ll'lderst.md the puxpose of these devices.


s~ the:

verJ rapidly,
CQ'ISt.ruct.: t."'"

rate.

ptoS"t.hor used on the catl1ode rey tlbe of a refresh display fades


.e., has a short persistenc2, it u; neoessa.ry to repaint or re-

enUre picture

rnny

tires each sccx:nd .

nus is

called the refresh

A refresh ra~ t."lat is too ].o..,. \..:ill result i...r1 a ~"nrCCOO called flicker .

'Ihi.s is SL'!Ular to the effect "ttich results fran runni..ng a rrovie projector too

minittun rcfrcs.'l rate of 30 tires per SC<Dnd is roqui..red to achieve a


flicker-free displaJ. A ref,...,._s'l rate of 40 tires per SCCl::lOO is reccrrrnndcd.

slew.

'I!.e !unction of the display buffer is t:O store m

sequ"..l'lre

all of the inst.ruc-

tions neoc.ssacy to cirtlw the picture on the catliode ray t\be.

fu function of

the display controller is to access (cycle through) these instruct.ions at the

Imccdiately, a limitation of the refresh

refresh rate.

~lay

is obvious:

'lbe OOiplexity of the picture is l.i.mited by the size of the display buffer and

Ho..-ever, the short persistence of the

the speed of the chsplay oontroller.

ilnac]e CM be liSE"d to advantage to sho.-r dynanic rrotion.

In pcuticular, the pic-

ture can be \.{)dated every refresh or, say, every other refresh cycle if dolble

buffering is used.

fUrther , si..nm each elcrrcnt or instruction necessar; to

drcr,.. the mcplet.c picture exists in the display buffer, any individual ele!mnt

can be changed, deleted, or an adlitional e1crncnt Kklcd: i.e., a selective


erase feature can be iltplarented.

One additional disadvantage

or

a refresh CRI'

graphic device is the relative difficulty of abta.i.nirxj a hard oopy of the pic-

ture.

1\lthough refresh CRJ' graphic displnys are generally rrore e>epcnsive than

storage ttiJe displays , the above characteristics make them the Uisplay of choice
when dynamic rrotion in real t.irre or very rapid interaction with the display is

required.

A raster scan CRT grafh,ics display uses a starxlard television monitor for
In the raster scan display the picture is cnrposed of a

tile display c:or.sole.

series of dots.

These dots are traced out using a dual raster scan t:.cchniqoo,

i.e., as a series of horlwntal lines .


used to reduc:e flicker .

'l\o.1o rasters as sho.m in Fig. 1-10 are

'lhe basic electrical signal used to drive the display

cxnsole is an analog signal wl'Y:>se nodulation represents the intensity of the


individual dots which cntpot:;e the picture.

In using a raster scan display con-

sole it is first ~sary to convert the line and d\aracter infotmatlon to a

form <:x:ccpatible with the raster presentation.


wrsion.

'Ihis pn:leeSs is called scan

ccn-

once it is converted the infox:mation mJSt be stored such that it can

be ae:Ssed in a reasonable manner.

ques this is

~9

rrore feasible .

display, the odvantagcs and

With the advances in data storage tedmi-

In considering a raster scan CRT graphic

disadvanta~

are similar to those for line-drawing

displays , with sate additional cx:nsiilerations .

Narrely, they are generally sore-

what sl011er, the selective erase feature is rrore difficult to inpl.erent, and
they 11\:lY be directly

interfa~

Digital incre:rental pen

bed and drum.

plotter.

to cloGed-circuit television systans.

am ink plotters are of two general

Figure 1- ll sho..ls a flat-bed plotter and

F~g.

types - flat-

1-12 sho,..rs a drun

l'bst diun and flat-bed plotters qJe.rat.e in an incrorcntol rrode: i.e.,

the plotting tool, which need rot be a pen, noves across the plotting surface

in a senPs of small steps , typically 0.001 to 0 . 01 inch.


her of directions in which the tool can nove is limited,

directions stn.n in Fig. 1-13.


a series of small steps .

Frequently the run-

say, to the eight

'lhis results in a curved line appearing to be

In a nat-bed plotter the table

ll1

generally station-

ary aro

the ..ni. ting head rroves in o.u

di.rrtmsions over tho surface of the table .


A d..>"\r.\

f-t n t ra~ lff


'-t:conll ra ~ tt:r

technique to achicvo bo."CHl1.!:-cnsional notioo.

--

_.... _,_.

--- - --

ing tool.

-~

le.ngth.dsc notion is obtained by roll.i..nq

,;::;;JI-...c..-- -

the paf>"'r

-::-~

and forth

uroer

the rrork-

high-quality hard ~ o f qrat:hical output.

O::crpared to CRT

they are qw. tc

sl~ .

grapucs deVl.ces
COnsequently t.'"eey

are not generally used for .rea.l- tiJre


i.ntl!ractiw gratilics .

--

~~
...-.:.
~'
-----~-- L
_____.-'" - '\.
......
-~-<..:
--:11.:-..T>

-__
-

a particular aplllcat.ion, a flat-bed


plotter can be utilized as

oot

a coubination

digitizer and plotter and an interactive

Figure 1-10 Paster


scan technique.
':he elect.rost.1tic

no--ever, where

large dra.rings are noill\llly required for

-'
-- --- ----------'
----

__,-

~ck

Digital i.ncrem:mtal plotters can prov:ide

--

---------

. r=::

c:..

Here the marld.nq tool rroves bac:Y.

and forth across the paper while the

-__,....--:::
=

plotter uses a sarewh8t different

mtputer grllfhic system S'n::essfully


cb.-elopcd (see Pef . 1-2)

matrix printer/plotter operates by depositing part-

icles of a toner onto small electrostatically charged areas of a speoal paper.


F1gure 1-14 sho-"9 the qenernl

~which

lS esrployed .

In detail, a specially

coated paper which will hold an electrostatic charge is passed owr a writing
head -.,tu.ch oont:cu.ns n ro..- of SJMll

per inch

iU'1:'

ial paper.

typical.

~-riting

nibs or styb..

Fr'Oia 70 to 200 styli

The styli deposit an electrostatic charge onto the spec-

Since tho alectrostatic c:ha..rges a..re therrselves rot visible, the

charged P<l?"r is passed over a toner which is a liquid oontaining dark toner

particles.
~

'lhc particles are attracted to tr.e electrostatically dlarqed areas ,

then visible.

The paper is then dried and presented to tOO user.

Very

high speeds can tx> d:>tainOO, typically fran 500 to 1000 lines per minuto .
'lhe elccLrosl..c:iUc cbt rnatri.'< printer/plotter is a raster scan device; i.e. ,
1t. pres~ts

mformation one line at a t.irre.

Bec.!suse 1t is a raster scan devire

it. requires .:1 scl>stantial crount of mcputcr storage to construct a CXJCpletc


picturo. 'lhis p lu.,. the fact that the ~vice is useable for only pass1.ve gr~
ics

'll'T'

the principle disadvantages.

A further cti..ecedvantagoe

accuracy ar.d rcsolut ~ m, typically ~ 0 . 01 l.lldl.

1..9

relatively lew

'1l\c principal advanta<}es are

th.. very high speo..-.d wi th "''hich drawing!> can be prtdloed and an excellent reli-

ooility rcoord.

Figure 1-lS sho.ls an electrost..'ltic dot rrat.rix printer/plotter

Figure 1-ll flat-bed p1otter.

Figure 1- u

Drum plotter.


,
Pll pe 1

drne

I one r
upp iJCiltor

Rcill
e lee t rode

.._ ....

OJ

-I

Pa Jl e r
$Uppl)i

Fi'JUCe 1-13 Direc:t..i..ats


for incre<e.'ltal plotters.

Figum 1-14 Conceptl:.a1


description of electrostatic
dot rntrlx printer/plotter.

and typical output.

1-7

CLASS l FICATIOI~ ()- f1wt.i i CS lvlCES


'lhcre u.rc a n\.UTbcr of rrethods of cl assifying couputcr graphics devims.

Each rrethoJ yields


~via.:.s.

~It'"!

sate

insight into the sa1etirres confusi.ng array of possible

will dic;cuss several different

t~Ethods .

f'irst let's consider the difference beb.'een a passive and an active grafhics
d>vi~.

A IldSSive qr~cs devi~ s.inply draws pictures lrder O:XIpulcr control;

i.e., it

alla..~S

are

c1

the o:xputer to Cl001'1lln.icate graphically Wl.th the user .

t.elctypa , a high-speed 1..i.ne printer, and an clcctroGtatic

EXillTplcs

oot matrix

printer, pen and ink plotters, and stor~ tlbe cathcxie ray tlbe (CXJ') and refresh CRI' devices . Exar.'plcs of sate of these deVices curl the typical pictures
that th~ rniljht qenr;:rab: an. sho..-n in fig. 1- 10, 1-U, and 1- 15 t.h.ro\ql 1-20.
'!be

re~r

might wonder aboot ronsidcrinq thP tel etype and the high-speed line

printer as gr.J(..hics devices . l~ver. the'; have been used to drcr,... sirple
qrafhs or plots for a nurber of years .

Figure 1-15 E.l.ectrostatic dot trat:.rix


printer/plotter and typical ootput.

,p
-

rill

J.

I
~~iii:'!

..:
Ill'!
:;;;,

1.11
:00

Figure 1-16 Storage tube CRT gra(i\i cs device


am typi cal output.

Figure 1-17

~ CRI'

graphics device
and typical ootput.

=--"'\~

~r

-----

c: ..

~~-::

~r---

;:..a,;

....
-------

-.
--w
---

__

-
. c;,.r- ...__
4

......_...._........._
--~--..,.._.

--

--.- =-=-.:-:

-- -,...
...
- -- --

.:w-..--

- c::.c-

__
:--- - .t;
,__

....,..
a---......,...

. - __--..... _. -

.--.-...

C"'".._.....

--~-

..Cl.::. ---.5

----=.

;-_:.:

_....__,.,.
.......

::----...,._ - -:e.!:.

~:::."--

c:

--

- - --..
___
- _ . --.--- --- ----- .

..,.....

-~~-- -

~.

..........

c.::~ , z~:-

- ,.....::
--- .. --

.......-.-- - ,,..

--.:::s--- ..,.. ___

"

..;"' ,_ .. t -

---

-~-.:

":.~

....,_~

_._

~-~

'

-~-

~.,_

~ -'\.-

=~

''::"~-":""~.-L'-

..- ~
!WI---.:.

--... -

- --- . n:--.s:r
- ... .... . .

.... .,_

--

...,_._,_
- - -~

- e; ----

i:"

~-

_.,_

~.:a-

- --- --

---

:"' , i: =-s.

:J:ii----

- - ~--

~JI::: .... <IIt

-....,
-- -,.,..._,.,..
--- --- :.-.;

..__...,.._

:.

~--

...

---:
. - -

....

~_.,__

~~~--

----

f'=oii_,___

-.:
.,_.

......

..-...,;; --~

INrR:IXX:l'ICN TO C'Of-IPI.1I'ER GPJ\PI JICS 'l'mNXDGY

llo
............

... -

...

.. ..

..

..

.,

"' I

ol

....

... 0

..

..

..

'

Figure 1-19 High-speed printer


and typical graphic output .


....
.

.'
'

...
... .... -
"

..
..

.. ...

....

.. -1-PI' ........

....

..

..

it

... .........

..

t 'I
..........,,,

....

.. ..... .

..

. .. ..

...

---

.,

I
fI

(' )

21

'

Figure 1-20 Teletype


and typical grapuc output .

I f points are plotted close enough t:.ogether , they will awear to the eye to be
a solid line.

All the storage tli>e CRl' and rrost refresh CRI' gnph.ics devia:!S

are line-dra.ring devices.


refresh CRr grapucs

All the pen plotters are

devi~,

devices.

5atc

particularly raster scan (televl.Sion-lil'..e) devl.ces,

can be oonsidered as point-plotting gra(ilics devims .

'l'eletypes, hi<jl-sp:'ed

line printers, and electrostatic dot matrix printers are classed as point'lhe uti 1 i ty of a device can

pl otting devices .

f~y

of its resolution; e .g . 1 a teletype has a resolution of

aro :

be CX)OSl..deted in tet::ms

! 1/20

i..ndl horizontally

l/1 2 inch vertically, ~reas an electrostatic cbt matrix device

a resolution of

:!

may have

0. 01 inch.

Still another rret:hod of classifyin] graphics devices ~ dctenni.ning


whether a device can aooept true three--di.nensiooal data or whether threc-

d.Urensianal data nust first be converted to n.u-d:irrensicnal data by the appli-

cation of sare projective transformation and presented as C.u-dirrensional data.


In essence this rrethocl requires detex:mi..ning whether a gra._chics device has 0..'0

or three registers to hold ooordinate data.

In the case of a

al

device the third or z ooordinat.e is usually used to control the wtensity of

a CRl' beam.

'"tis feature is caned intensi ty m:xlulation or gray scaling.

is used to give the illusi on

or

It

depth to a picture.

Each of the classification rret:hods will f-requently plAce a particular

gra{ilics device in a di fferent categoxy.

HoNer1 each tmthod roes yield sorre

insight into the characteristics of the vari ous graphics devices .

Appendices A and C contain the architecture o f a software sche:fre based on


the concepts presented in this and in subsequent chapters.

description

or position

Of

vectors , lines , cu.rves , and surfaces

C'Olli'SC ,

aro

the

the transfor-

mation of these gearetric entit ies can be accarplished mathenaticaJ.ly independent of any display technique or display software.

'lhe remainder of this book

is conoerned with these mat:hefratical , devioe-i.ndependtmt techniqoos .

REFERENCES
1-1 Newman, ''~ t-1.. ,

am Sproull,

R. , Princi pl es o Interactive O:ltputer

Graphics , r-ldinm..-Hill Book Catpany 1 New 'tori<, 1973.


1-2 Bezier, P . E., "E:xarple of an Existing Systerrs in the t-bt.Or Industry:
'1he Uri.sur! Systan"

1971.

P:roc. lby . Soc. (I.orxbn) , \Ql A321, pp. 207-218 ,

CHAPTER 2

POINTS AND LINES

2-1

ltrrROIU:TION
~1e

p.lter

begln our study of t.l-te furxla.'ielltals of the matharatics underlying car-

grapti.cs by oonsidering the .representation and transformation of points

and llJleS .

Pol.Jlts am the lines wbidl join them

Me

used to represent oojects

or to display infot:rnation graphically on devices, such as discussed in Chapter


1.

'1he ability to transfonu these points and lines is basic to CXX1pUte.r gr a-

rtUcs.

\-,'hen visualizing an d:>ject

it II1!!IY be desirable to scale , rotate , t r ans-

late, distort, or develop a perspective view of the object . All of these transformations can be ac:carplished using the mathematical techniques discussed in
thi!i and the next dlapter.

'2-2

ltP~scrrrATJ CX~

OF Ponrrs

!\ point can be represented in two dirrensions by its coordinates.

These

bJO valu:s can be spoc.ified as the el.en:!nts of a o~tn.~, b.oo-c:ol~..~~m nllltri.x

(x y).

In tJ'\rnP dirrensions a one by three rclt.rix [x y z)

lS

used .

point can ~ x~resented by a two-row, onc-cohrn matrix

ly,

c1.

cl

ruions t:>r by

rotrlc.x:s like

[r]

r~J

in three di.Jrensions .

Alternate-

[ J in

bNC

ION rMtrices like (x,y] or oolurm

arc frequently called vectors .

A series of points, ~ of

f'OINI'S N:O LINES

25

\o.hlch is a position vector relative to a local ooordlnate systGn, may be


stored in a ttluputer as a matrix of ru.mbers .

'Ire position of these points can

be controlled by manipulating the rrotri.x \"trich defines the points.

Lines can

be dr.r..-n beo.oeen the points using afP:roprlate cxxtputer ha.rd../aro or software to

generate lines , curves , or pictures as output.

2-3

TRANSFf:4ATICl'lS f\.'40 1'\.\TRICES


'lhc c.lerrcnts that make tt> a matrix can represent various quanutics , such

as a mmber store, a nab.'Orl<, or the coefficients of a set of e:JUations .

'111e

rules of matrix algebra define allaVclble ooe:rations on these rntrioes (cf Appen-

dix B) .

t1an} physical prd.:)lerns lead to a rrotrix fonrulation .

m::ry be fonrulated as:

Nr = B.

Hero the prd>lGn

Given the matrices A and B flnd the solution matrix, i.e.,

In this case the solution is T ,. A- la, where A-1 is the inverse of the

square matrix A (see R:!f . 2-1)

a matrix is to treat the '1'-matrix itself as an operator.


Here rotrix trultiplication is ~ to perform a georetrical transformation on
l\n alternate usc of

a set of points represented by the position vectors contained in nutri.x 7\.

matrims

A and T

'nle

are assurrcd krn-'1"1 arrl it is required to det:.e.rrnine the elerents

of the matrix B.

Th.is interpretation of a mat.ri.x nultiplication as a

~trical

qJerator is the foundation of the ll'athernatical transforrrations useful in cx:mputer gra!itics.

2-4

TRANSFO~'ATI~ (J= PoiNTS


COnsider the results of the matrix nultlplicat.i.on of a nutrix {x y) con-

taining the ooordinates of a point P and a qeneral 2 x 2 transforttation matrix:

(x y]

[:

:]

[(ax + cy)

os

(bx + dy})

[x*

y*1

(2-l)

'lbis mathematical rotation mans that the initial CXX>rcli.nates x and y are trans-

fenc-ed to x* and y*, where x* .. (ax + cy) and y *

= (bx + dy)

We

are interested

in investigating the inplicat.J.ons of considering x* and y* as the tra.nsfornoo

CXX>rdinates .

\'le begin by investigating several Sfeeial

Consider the case where a

=d =1

arrl c = b = 0 .

~,ses.

'lhe t.ransformltion Nt.rix

then reduces to the identity matri.x and


(x

y)

l~ ~]

"'

[x

y]

= [x

y* )

and oo change in the ooordi.nates of the point I' occurs .


tJext

consider d : 1 , b

=c

= O, i.e.,

(2-2)

26 t-fi\l'HEW\.TIO\L EIDIM'S FOR CQ-!'Ul'ER GRAPHICS

(X

produo~

'!his

r :1q. 2-la.

[~ ~ J

y)

(ax

y*)

y) = (x

a scale change since x'" =- ax.

(2-3)

'Ihis transformation is sho.om in

llenoe this natrix nultiplication has the effect of stretching the


~on .

original ooordinatc in the

r-o,., consider

b c

=- o, i.e.,

f~ ~J

(x y]

= (ax

dy]

= [X*

y*]

(2-4)

'lllis yields o stret:dting in both the x- and y-ooordinates , as s ho.m in Fig.

If a ;. d, then the stret.chinqs are rot equal.

2-lb .

en.Uw~rent

If a = d > 1, then a pure

o r scal.i.nc:] of the c:oordinates of P occurs .. If 0 < a = d < 1, then

a m tprcssion o f the ooordi.nates of P will occur.


If a ar.\/or d are negative, then reflections occur.

b - c - 0, d .. 1 and a
(x

-1.

'Lhen

[-~ ~] =

y]

(-x

Y1 =

[x*

ard a reflection about the y-axis has occurred .

t.ion is sho..m in Fig. 2-lc .


about the x-axis occurs.
origin will occur.

To see this, consider

If b = c

If b = c =

o,

(2-5)

y*]

The effect of this transfonna-

0 , a::: 1, and d = -1, then a reflection


a = d < 0, then a reflect.l.on about the

'Ihis is slnm in Fig . 2- ld, with a = -1, d

= - 1.

Note that

reflection, stretching , and sc:al.ing of the ooordinates involve only the dia<JOM.l
tcnrG

o f the transfoDMtion rratrix .

No..' <::a)Sider the case where a


[x

[~ ~]

y)

= d = 1,

= [x

(bx

arxl c - 0 .

+ y) 1 =

[X*

'Ihus

(2- 6)

y*]

and lhe x-ooordi.nate of the point P is unchanged, while y* deperds linearly on

the origuvll coordinates.


Similarly \o.iten a -. d

= 1,

to the y-c:xxu:d.t.nate , as

This effect is c11 led shear and is stnm in F1g . 2-le.


b = o, the transformation prodtJCCS shear proportional

sho.rn in Fig. 2-lf .

Thus , we sec that the off-diagonal

tcnns produoo a shearing effect on the ooordinates of the point P.


Bofore m pletirq our discussion or the transfoll'Mtion of points, consider
the effect
lD

Of

the qcreral 2

2 transformation qiven by Eq . (2-1) when af{>lied

the oriqin, i.e.,

(x y)

:J
[: :]

= [(ax+ cy)

(bx + dy)]

[:
or for the o rigin,
[0

IIP['P '1\"e

OJ

= [0

0 ) = [X*

= (x*

y*)

(2-1)

y*}

see that thP o rigin is invariant uroer a general 2

2 transfonmtion.

'ltn s is a liJTU t.ation whidl will be overc:nre by thP. use of haogenrous coordinates .

POINt'S AND I..JNES 27

) .)

,.}

[~ ~]

p
I

>~

,, ,.
-.

I'

' ,.

,.

[~ ~]

T=

- --

T= r-10 -1OJ

~ ~

,,,.T=
" ,.

!-

I'

'~.

....

[~ ~]
h~

".

,
.
.T
[~ ~]

(\'\

I'

h\

',.

"' ".

~ "'

Figure 2-1

2-5

\. \

,,

I'

I.

\ , A

,,

~ [-~ ~]

TRANSFORI'V\TIOO

OF

Transfonnation of points .

STRAIGKT LINES

A straight line can be tlcfined by bov rosilion v.....ctors \olhi.d1 specify the
CXJOCcli.ndtes of its end (X>ints.
uq these b.."t> points can be
~

'nle position and orientation of the line joirr

c:::hatY.Jed

by operatul<} on t:hcsc two pJSition vectors .

actual q>eration of dro:JWing a line bet\-'{!(:11 two points will depend on the
Hen. we cx:m sider only the mdUtunalical operations on the

output ck.'Vi.ce used.

er:1 posi lioo vectors.


A straight l ine bebw'cen b>o points A and
drd;IJ'l in Fig. 2-2 .

(2

u in a

~ional

'lhc posit ion vectors of r.ou1ts 1\ and D

3) rest=eelively.

CJ.re

(0

plarE is

11

aro

No.I cons1der the trrlllStoDT\llion malrix


T =

[~ ~]

(2-7)

....tuch

.,.,'C

~.Sing

mJ.tri.x ITllltipliC<ltion on tllP position vectors for 1\ and B prodllCes Ule

~w

recognize fran our previous discussion llS producing a shearing effect.

Lransfomed vectors N cmd

AT~

to 11

CJl.Ven by

[~ ~]

(J

1) A*

(2-8)

8'!' :

(2

(2-9)

3)

'Ihus, the rcs\.O.ltinq el.e"ents in A a..-e x* = 3 ani y*


f'l&l [X>int

Similarly 1 B* is a

f'bre mtpaccl.y the line AB

specified by x* ... 11 and y 7.

rcprcse."'tcd by the 2 x 2 ~TUtrix L = (~

= 1.

latrix nul.tipllcation t.~cn yields

LT ""fo 1] '"1 2] = r3 1] .. L*
l2

3 l3 1

rror:t be

(2- 10)

u1 1

"''here the mtp:ments of L* represent the transfoll""Ed position 'v'ect:ors A" and

B*.

The transfot:r:\ltion of A to A* and B to B* i s sho.m in Fig . 2-2.

'Ihis shearing effect

tial axes are x,y and the transfonred axes axe x*, y *.

has increased the length of the line

2-6

am

'Ihe ini-

changed its or ientat ion .

MIIYOINT TAA~SF00"1f\TION
Figure 2-2 sho..'s that the 2 x 2 transfOllMtion rratrix tral'.sforms the

straight line y =
}' a

{3/4) X

+ 1, beO.-een points A and B, .into another straight l.ine

5/4, bet.-.-een A* and B* .

In act a 2 X 2 natrix transfOJl!'S atrj

straight line i."lto a secord straight line.

Points on the seo:m;i l..lne have a

one to one correstx>l"lder::oo with points en the first line.

this t.o be trua for the c!'ld p-rints of the line.

o:::nsider

B.

t.~

Letting A

\'ie have al..ready s.l\a..'n

To further ccnfinn this we

transfolT.Iation of the midpoint of the straight line beboleen A and

= [xl

Y1l, B = (x 2 y 2 ) 1 and T [:

{X)ints sir.ult:aneously

and transforr.U.ng both

gives

[:~ ~~1 r:

:J

r:~: :~

(2-11)

Hence, the transfomed end {X)ints are

A*

= (axl + en

B* {ax2 + c.y2

bxl + dyl)
bx2

= (xl

+ dy2) =

Y1*l

<x2*

Y2 * )

'Ire cidpoint of the initial line AS is

(2-U)

'Ihe t.rar.sfo rr:'dticn o f this midpoint is

] [: :]

axl + ax2 + c.yl + c.y2


2
bx1 + bx2 +

ay1 +

<TJ2

(2-13)

l<>INI'S lWD LINI:S 29

'lhl..s transfomation places the rnidpo111t of AS on the midpoint ot i\*B11 since

the

rniqx>~.nt

of A*B* is giwn by

ax1 + cyl

x =

+ ax2

cy2

bxl

+ dyl

+ dy2

t- bx2

r - ----...---2

=----..,.,----2
bx1 + bx2 + dyl + dy2
2

------=----...;;...

For the spec1.al case sho.m in Fi9 . 2-2, the


[1

(2-14)

axl + ax2 + en+ cy2

uli~t

of line 1\B is H1

'1hls transforms to

2] .

[1

2]

G~ J :

[7

\,hlch gives the mic\X>int on line A*B*.

(2-15)

4)

'lhis process can l::e

rep"'.lt.ed

for any

subset of the initial l i.ne, and it is clear that all points on the initial line
Lransform to points oo the second line .

Thus the transformalion providas a one

to one correspondence bet..;een points on the original line and points on the

transfor:rred line.

Fbr o:::rcputcr graphics applications, this nmns that any

straight line can be transfo.rtred to an.t


end points and then

2-7

redrawi.n9

nEM

position by s.inply transfonning its

the line betlo.-een the transfomed end points.

PARAU.L LiNES

a 2 x 2 rratrix is used to transfonn a pair of parallel lines, t.~


result is <1 seoond pair of parallel lines . To see this, oonsider a line beb."OOn
A = [xl y 1 ) and B .; lx2 yz} and a line parallel to AD beo.Aoon E and f' . To
shari that these l..incs and any transfomation of them are parallel, we exa:-.U.ne
\lhen

'1he slope of both AB and EF is

the slopes of AB, EF, A*B*, and E*F*.

Y2- Yl

(2-16)

mt X2 - Xl

Transfo.cning AB usi.ng a general 2 x 2 t.ransfonnation yields t.he end points


of A*B11 :

xl
[><2

Y1

Y2

[a b] =
c

rnx1 + cyl

bXJ. + d.Y11 = [><!

lax2 + cy2 bx2 + b.Y2

yt]
Yi

[A"]

(2-17)

B1t

'the slope of A*D* is then

(bx2 + dy2 ) - (bx1 + dy 1)


m.. = ........---..,..---,--.;.;_-~
~
(ax2 + cy2) - (axl + cy1)

:::0

b(x2 - x1) + d(y2 - Yl)


_...,..---:---:-----:aCx2 - xl) + c(y2 - Yl)

or

b+d
m 2-a+c

Y2- Yl
x2 - ><t
Y2- Yl
)(2 - )(1

b + dnl
~

a+ on

(2-18)

12

I(I

T== [ll -32]

10

T:

[~ ~]

l
( 1/2 J/] lA
l

6
) .\ .

4 ...

2
- 4-

0
0

ll

0',\

~ H13

IU

12

'"

2-2

Figure 2- 3 Transformation
of intersect.ing lines .

Figure
Transformation
of straight llne:s.

Since the slope~ is indc~t of x1 , x 2 , y 1 , and y , and since "1 a, b , c,


2
and d are the sarm for EF and AS, it follo.,'S that ~ for both EF* and A*B* are
equ.al.. 'll\us, parallel lines remain parallel after t.ransfonration . This ~
that parallelogra:rs t.ransfonn into other parallclogtans as a result of operation
by a 2 x 2 t...ransfonnctt..wn matrix. 'Ihese siltpl e results begin to sho.o.' the po..-er
of using r.atri.x rrul.tiplication to produce g:rlltiric:al effects.

2-8

INTERSECTING LINES
'1\-.lo dashed 111tersect.ing lines AS and EF are s.ha.m in Fig . 2-3.

'Ihe

~int

4/5 and y = 1/S. We no" rrult.iply the rratric:es oont.al.ning the end points of the two lines AS and EF by the transfonnation matrix

of intersection is at x

[:

~] .

'll\us ,

- 1
2

3
2

-2

-3

- 1

_!!
2

12

romrs

-1
-1]
[1
[ ~
3

2] -

1 -3

A'llD LINES

31

-2~ 1
3

This gives the solid lines A*B* and E*F* sho..m in Fig. 2-3.

'lhe transfamed

point of int:ersect.ion is

[~ ~)

[l

1)

'lhat is, the point of intersection of the initial pair of lines transfotli'G to
the point of intersection of the t.rclnSforned pair or lines .

Close examination

of the above transformation of intersecting straight lines will sha.l that it


has involved a rotation, a reflection, and a scali.nq of lhe original pair.

However, the total effect of a 2 x 2 matrix transformation l.S easier to see,


considering the effects of rotation, r eflection, and scaling separately . In
order to illustrate these .itdividual effects, we shall oonsider a sinple plane
figure - narrcly, a triangle.

2-9

fbTATION
Consider the pl ane triangle ABC s.ha.m in Fig. 2-4a .

'Ihis triangle is ro-

tated through 90 about the or igin in a counterclockwise sense by operating on

ead\ vertex with the trnnsforTMtion [ 0 1].


-1 0

If we use a 3 x 2 matrix conta:i.n-

ing the x- a00 y-coordinates Of the vertices 1 then

1 [01]'"'

4 1 -1 0
2 1

-1 4
-1 2

'Ih.is produces the triangle A*B*C*.


ed by using

r-1

(2-19)

13

A 180 rotation llbout lhc origin is abu.i n-

0] and a 270 rotation about the origin by using

0 -1
Note that neither scal.in;1

lo

-1].

nor reflecticn has occurred in these cxanples.

2-10 REFLECTION
~\!lereas

a pu.re

~onal

rotation in the xy-plane occurs about an

ax:is norm:ll. to the xy-p1ane, a reflection is a 180 rotation <~bout nn axis in


the xy-plane.

'IWo

reflections of the tri.anqle

reflection about lhc line y

=x

[EF

occurs by usinq [~

'lhe trans foetal, new vertices are qiven by

am shcMn in Fig. 2-<lli .

~]

(}'

!:>

s ,- ro

~6

J. .ref~on a::xr~ y =

oJ

....' e-

,(.

2-20)

6.

:..s cbt.a:. nee

fr.::clfl _,0, .
..
(;

a-'"C

s-h~.

by

~.q

sca 1 ~ r.g

a l- 1
7

.e

-~J

--

a.:.r d' sc.:.ss!.on of

-l

2]

~-...e r:...~.sfot~ar::oo cf

is cxr.trolled ~ t.'le. rogr.itu:ie of ~"'.e

cf t."le ratri.Y..

If the

t'iltr-Y.

-4

t;.O

r2 0 .:.S ..:sed as
.0

r=oi:ts, W': can see

te~

Zi!".

or.

mat

~..e: p~-.:tri ~.al

0""~-.ttor cr: the ..~_ioes

2j

o f a ~~"l'il~, a .. 2-t.i:'cs e.-: .arge: -er.t. occ;.n:s abo"~ the oric;.r. . If the r..ac;nitn1es nre ur~l, a d.lSt.OrtJ..on oo:.-.!..""5 . ~..t:S= eff~...s are sha--n i:-. fig . 2-'>.
Tria."]!~ 1-& if: t=c;J"Sfc:::;:-.-,d

at 2 Q'j ;
0 :2

~'l:.s a sCil.l.i.N; OCC\!I"S , a.'"ld <c...""ia~:;le

POD\'TS A"''D t..niES


Cf' is transforrrod by

33

{~ ~] which yields

a distortion chr to the unequal sc.osle


factors .
It is n::w clear how plane surfaces,
defined by ~oes joined by straight
lines, can be mmipulated in a variety
~
of ways . By performing a matrix operation on the position vectors which define
the \.~oes , the shape and position of
the surfa~ can be controlled. Ho...-e\...:rr,
a desired orientation my require no;re
than one transformation . Sinre mtri.x

.~
I

1\ t-

~
;'

(\

~ ~

nultiplication is noncntuutatiw, the


order of the transfoxrnations is inport-

'

ant when performing cntbined q:Jeratior.s .

'I

It

~~~

'"'

I)

- {

-'

">; "8
,_
~

--

\
\

,.

Figure 2-5 L'niform and


nonuniform scaling
or distortion.

In order to illustrate the effect

of ronc:amult.at.lve mat:rix nult.lplication,

consider the operations of rotation and reflection on the

(x y] .

If a 90 rotation is follo.,'ed

verti~

of a triangle

reflection about x- o, these two

consecutive t:ransforr.ations cfive


[x

0 1] "'

y] [

[-y

x)

-1 0
and then
(-y

en the other

X)

[-~ ~]

(- x

y)

hard, if refl ection is follor..ted by rotation, a different result

given by
y] [

(X

-~ ~1

[-x y]

and

[-x

y) [

0 11
-1 0

(-y

-xl

is d:>t:aizled .
So far we

ha\."C

concentrated on the behavior of points and lines to deter-

mine tho effect of sillple rratri.x transfonrations.


correctly considered to operate on

C:Vt.l'll

However, the rratri.x

point in tr.e plane.

lS

As has been shown,

the only poir.t that remains invariant in a 2 x 2 matrix transfonnatjon is the


origin.

All other points within the pl ane of the coordinate system are trans-

ferred.

pla~

transfoll'l\ltion nay be inte.rpreted as a stretching of the initial

and coordinate system into a new sh.apQ.

M:>re forna.lly, we say that the

transfonMHon causes n J'lk'!IPPi.nc; fran ore plane into a second plane.

Exanples

of this rnawin:J are sm.,., in the next section.

2-13

TRANS FO~\ATIOO

OF A ~IT

O::nsidcr a square-<Jrld
'lt~

SooAAE

~l:k

consisting of unit squares in the xy-plane.

four position vectors o f a unit square with one CX>J.'Tl& at the origin of the

coordi rote system arc


0 0,

o rigin of the coordinates - A

unit point on the x-ax:is - B

outer oorner -

unit point on the y-ax:is - D

'Ihis unit squru:e is shom in Fig. 2-6a.

:J

transformation [:

::

:
~e results

Application of a general 2 x 2 matrix

to the unit squaxe yields

~ ~ 1[:
~ ~J

:J- ~
la: c

(2-21)

:::

b : d:

First ootice fran


Eq. (2- 21) that the origin is not affected by the transformation, i.e., A A*
o f this transfonnation are sl'la.m in Fig. 2-6b.

= (0 OJ. fUrther, ootioe that the coordinates of B* are a;JUil.l to the first
row in the genera l transformation matrix, and the coordinates of D* are t:q1..li!l
to the scoond row in the general transfo.rmation matrix.

dinates of B* and D* (the transfomed unit points fl

'nlus , onoe the coor-

01 and [0 1) respectively)

are J<no.m, the gereral transfornation natrix is determined.

Since the sides

of the unit square are o riginally parallel and sinoe we have previous l y shotm
that parallel l ioos transfoDn into parallel lines, the transfor.med figure is

a parall elogram.
The effect of the t..enrs , a , b, c, and d in the 2 x 2 rrotrix can be identified Sep<mltely .

'1he t:.ez:ns b and c cause a

~ in they- and

,IP

shea.rin:J

(cf Sec. 2-4) of the initial

x-directions respectively, as can be seen in Fig. 2-6.

terms a asd d act as scal e f actors as noted earlier .

Thus, the general

2 x 2 rotrix produces a ooub ination of shearing and sca.lintJ.


It is a l so possibl e to easily det:errrU.nc the area o f the parallelogram
J\*ti C*O shown in F'i.g . 2-6 .

'Ibe area within the parallelogram can be calculated

POINI'S PND L.INES

35

..
l

tJ'

~-

-x

Before

After

Figure 2-6 General t.rar.sfomatian of unit square.

as follc:MS :

(a

t-

c) (b + d) -j{ab) - i(cb) -(b + b + d) -

~(c

+ a + c)

which yiel ds
(2-22)

It can be shown that the area of any t.ransfoJJTed


of the transformatioo natrix det:e.J:rninant

initial square

aro

parallelogram~

is a function

is related to the area of the

by the sinple relationship


(2-23)

In fact , since the area of a general figure is the

area of any transfomcd

figure~ is

SUTI

of urut squares, the

related to the area of the initial fi]llle

~by
(2-24)

'!his is a useful technique for

2-14

AAB ITRARV

2 X 2 l'bTATI~

de~

the areas of arl:atrary shapes.

r'ATRJX

'lhe general 2 x 2 rrat.rix which results in pure rotation of a figure about

~~ICAL IEJ.fm'S

36

FnR CCl.rorER GAAPHICS


the origm can be obtained by consider-

ing the rotation o f the unit square about

the Origl.n . 'lhis is sl'loNn in Fig. 2-7


for positive rotation in tl'.e c:ounter:clockwise direction . Figure 2-7 stXJWS that
p:>int B, [1 01 , is transfomed to the
po-1.1\t B*, with x* = (l)c:osa andy* =
{l)sme and that p:>int o, [0 ll, is

))

transfonred to D*, with x


and y* = (l)cose .

= -(l)sin6

Recalhng our previous

cbservatjoo that for an amitraxy 2

transfol:I'Mtion rratrix the cxordinates of


B* nust equal the first

ro-o in the trans-

fot:mation matrix and the coordinates of

..
_..,.

D* form the second

roN,

the general 2 x 2

rotation rratrix is

I
- - _.._______...0....__ ~B X
0

)...

(2-25)

c:os9 sinA]
[:-sin p cos 6

For the special case of 90, this reduces

to the result t!Sed earlier in Sec. 2- 9,


i.e.,

Figure 2-7 lbtat.J.on


of unit square.

[_~ ~]
In effect F.q . (2-25) is a mrbination of scaling and shearing ~ch leaves the

final dirrensions unc:h.anged.


pure rotation through an

2-15

'lherefore, this transforrrat.ion rr.atrix produces a

amitraey angle e.

Two-DJtelSI<lW... TRANSLATIOOS

AND

Up until the present t:.im! we have

~EOUS CooRDI NATES .


rot discussed the translation of points

and llnes or the figures or shapes resulting from COJtbinations of points and
li.Jl,e,s .

E\.rndM"entally this is because within the fran-e ,.ork of a general 2 x 2

l1\3t.rlx it is rot possible to introduce the constants of translation.

Foll.ow.l..ng

Fouest (Pcf. 2-2) we rote that this difficulty can be overc:x:JTC by introducing

a thlrd corponent to the p>int vectors {x y] and [x* y *), naking them
[X

1) and [x*

matrix, say,

Y"

1) .

'l'he transfonnat.ion I'T'atrix then becares a 3 x 2

'Ihis is necessary since the nurber of ooh.rms in the !X)int nntrix nust equal
the llUiber of

in the transformation matrix for the operation of matrix

ro.tS

I!Ul.tipllcat ion to be defined.


[x

1)

'Ihus,
0 ' = [x + n

y + n] "" (x y]

(2-26)

0 1

m nJ
where W"e note that the constants m, n cause a translation of x" and y relative
to x and y. tblever, a 3 x 2 rratrix is not square and thus does not have an
'Ihis difficulty can be

inverse (cf 1lppCNiix B) .

ovenx:t~1c

by utilizing a full

3 x 3 matrix, say,

0 0

0 1 0
m n
as the t.ransfonmtion matrix .

Notice that the third exxtp:)nent of the position

vectors i s not affected by the addition of the third col~..~~m to the transfo:tm:ttion matrix. Using this matrix in SJ. (2- 26) gives (x* y" 1] for the transfonred vector .

'lhe adCi +-..ion of the third elarent to the position vector a00 the third

co1mn to the transformation matrix a.l.l.oNs us to perfonn a trar.slation of the


position vector. Alternately W"e may consider the third elerre.nt as an addit.J..onal
coordinate of the positioo vector. For notatiooal pw:poses we assuro that when
the fX)Siti.on vector (x

11 is operated on by a general 3 x 3 natrix it beoorres

the p:>Sition vector [X Y H) .

y'* 1} .

that (X Y Hl [x

Previously the transforrratioo was perfo01ed suc::n


If we consider the t.ransfooration to be taking

pl ace in thrce-dimmsional space , this confines our trar.sfor.retions to the plane

H ,. l.

If, t-o,..ever,

W"e

assure that the third colum of the general 3 x 3 trans-

fomation matrix T is
rather than

r0
0

ll
matrix rrultiplication yields [x y

l )T = (X

H) , where H

1- 1.

'lhe general plane in 'Whidl the transforrred position vector rt::M lies is in
th;t:'e(~.immsional

what happens in

space .

However, at the present tiJre we are not interested in


. ional space.

Hence we d>tain x andy* by proj ect-

ing ftun the general plane back onto the plane B = 1, using a pencil o f rays

thrcu.Jh the origin. 'Ihis effect is shewn in Fig. 2-8. Csing si.rnilar trumgles
\o.'e see that H/X = 1/x* and H/Y ,.. 1/y* .
With three ca1pooents it follo.-."S that:
X y
(2-27)
(x*

"*]
= [:r
H -H 1]

\ree-Cli.rre''lSional vector representation of a two-di.Jrensiooal positioo

H,
sc nc rat
plan CHII

Figure 2-8 Geatetric representation of


hoiT'Ogeneous c::x:ord.ir.ates

vector, or in general the representation of an n-a:a,pJnent vector by an n + l


cx:arp:>nent vector, is called J:orogeneouc oool'dinat<? representation. In harogenoous a:xn:'Cti.nate representation the transfonration of n-diJrensional vectors is
pcrfonred in (n + l) diJrensiooal. space, and the transfot1ted n-dirrensior.al results
are cbta.ined by projection back into the particular n-dirrens.l..OnAl. spaoe of interest . 'lhus, m 0..0 dirren.sions the position vector !x y) is represented by
the three-cx:nTpOnent vector (hx hy h].

like an additional c::x:ordinate .

'1he extra ccttpJnent in the vector acts

'111e ordi.nacy or "physl.cal" cx:x:>rdi.nates are re-

lated to the hcrrogeneoos ooordinates by


X

and

y =

(2- 28)

'Ihere is no unique haroge.ne::>us c::x:otdinate representation of a point in


tw::>-dilrensl.Onal spaoe . For ex.anple, the lnrogeneous c::x:ordinates (12 8 4],
[6

2], and (3

1]

all represent the ordinary point [3

of calculation we dloose [x y

For ease

1) to represent a rontransfonred powt in bolO

dirensional houoycneous OXJrdinates .


r~

2] .

'then the transtormation*

y*J - rx yJ

*Note that here we have put the result of the tr&'\Sfotrnation oo the left-hand
side of the equation rather than on the right-hand side as was done previously:
i.e . , we write rratrix equations as B = AT rather than as 1'\ = B. Fl:an hereon
we w1.ll adopt this c:onwntion for ease in translat.i.ng results into cmputer
algori tlurB.

romrs

J\ND I....INES 39

in regular coordinates is given by

= [x

(X Y Hl

in hatogeneous coordinateS.
that X

= x*,

= y,

1]

carxying out the above two t.ra.n::>fotmaLions sllOoiS


'lhat is, since the addi banal conrdi.nate II is

and H .,. l.

unity, the transfonrod hatogeneous coordinates are the sasro as the transforrred
In general, H 1- 1, and the transferr-ed ortli.nary coordi-

ordinary coordinates.

nates are d>t.ainOO by noxnallzin<} the transfomed hatogeneous coordinatr$, e.g.,


x* ..

and

y* -

(2-29)

In a gearet.rical sense, all transfor:mations of x andy fall within the plane


H=l after normalization of the transfonred hatogeneous coordinat.cs.

'n\c advantage of i.nt.rcrlucirj honogeneous coordinates occurs in Ute qene.ral


3 x 3 trans formation rMtr.ix
a b

c d q
m n s
where space is new available to include other traJ"I.sfoxnations such as translation.

n-.e

scaling and shearing effects of the IMtri.x terns a, b, c , and d have bc-0

sho.m previously.

To sb:w the effect of the t:him colunn in the 3 x 3 transformatioo matrix,

consider the follOioling operation:


[X

Y H}

= [x

11

0 1

Here X x, Y y , and li px

= Lx

(px

+ qy + 1))

(2-34)

+ qy + l. 'Ihe coordinate H ~ch defines the

plane containing the t:ra.nsfonred [X>ints expressed in harogcncous coordinates


00;1

has the equation or a plane in thlre.<:Hii.tn:msional space.

'lhi.s transforma-

tion is sho.m in Fig. 2-9, where the line AB in the two-dimensional xy-plane
is projected to the line CD in the

ional plane pX + cfi - II + 1 = 0.

In Fig. 2-9 the values p "" q = 1 are used .

!l:onrallz.i.n<;J to obtain the two transfoll'OOd ordi.nacy coordinates,

t;le

,.'rite

X
X
x*-n=pX+qY+l
y

y* ; if

y
pY. + qY + l

Letting p q l.O and USl.f1 [X>ints A, [1


gives

3) and B, (4

1} sho.m in Fig. 2-9

'

.)

>"

2-

-'-7'~o- . -

'

. ..

II I

Figure 2-9

Transfoma+ion in harogeneoos coordinates .

for the transfoil'I'Ution and projection of A to C* , and

4
2
:x* l+- 4+l =J

1
y*=6

and

for the transfomation and projection of B to D* .


for C* and D* sN:Ml in Fig . 2- 9 are (1/5

3/ 5

'!be harogeneals coordinates

l) aJ".d [2/3

1/6

1) respectively .

'Jlle effece of rottralid.ng is to project the th.ree-di.Jrensional line

a two-cllirensional line C*D* in the plane H

= 1.0.

rn back onto

As shown in Fig . 2-9 , the

center of projection is the origin .


'Ihe C}eneral 3 x 3 t:ransforrration matri.'< far O.'()-(llirensiona.l honogeneous
mordinates

Cdl\

be subdivided into four parts:


ra b 1 p
d

I
1

-m ---n ' s
1

l..s we have seen a , b , c, and d produce scaling, shearing, and rotation; m and

n pttxluce translation; and p and q prcxluoo a projection .

'lb shcMr this , consider the transformation

elcrrcnt s , produces overall scaling .


(X

H) "" [x

'Ihe f ourth part,

1)

0
1

lo o

01 (x y
0
sJ

s]

(2-30)

POimS NID LINCS


Here , X

= x,

Y :: y , and H = s .

41

'1his gives
X

~-9
'lhe effective transformation is [x y
the p:liSition vector.

1]

y/s l}, a unifo tm scaling of

(x/s

If s < 1, then an enla..r:gen:mt occurs, and J.f s > 1, a re-

ductioo in scale occurs.

2-16

Po iNTS

AT

INFINllY

The use of harogeneous (X)Qrd.inates gives a oonvenient and efficient ..,ay

of rrapping a set of (X)ints fl:un one coordinate system into a oorresponding set
in an alternate exx>rdinat:e system.

usually the infinite ranqe o f one ooordinate

system will rrap into a finite range within the second coordinate system.

1\l.so,

lines which are parallel in one system will usually not be parallel in the ot:l1cr .

Hoo.oever, geatetrical prcperties such as p:>ints of intersection can be evaluated

in either (X)Qrdinate system as s.ho.m bela" .


'Ihe O..Q lines given by

x+y

2:x+3y=O

have a p:>int of intersection at x .. 3/5, y .,. 2/5 .


ed in terms of the horToge.neous ooordi.nates.

'!his solution can be cbtain-

By rewriting the equations as

x + y - 1 0; 2x - 3y = 0 it is possible to represent the bolo equations by the

matrix equation
[x

1)

[0

0)

1 -3

l-1

Ho..oever, for a matrix to have an inverse it must be square . '!1)e follc:Ming representation of the sane set of equations can be used to rreet this rcquirenent;
(X y 1) r 1
2 0 e [0 0 1]
(2-31)
1 -3 0

l-1

The inverse of this square matrix M is

t-fl

,,/~

j ol

55
LS
~tiplying

0
1

.J

both sides of Eq. (2-31) by

identity TMtrix yields

11C1 and

noting that

lrC1 = I,

the

[x

l
11 'S" (0

-1

ll

'nlus, x "" 3/5 and y = 2/5 es :req..:ired .


Conslrlc- tloiO parallel lines defined by

x+v=l
~

x+y=O
Proc::ee!ing as above leads to tt.e r.atrix EqUdtion
(x

1) ~ 1

01

(0

1)

1 1 0
..-1
fb.'C\.'C.r, C\te.:'l

an

lj

though a square matriX exists in this equation, it does not haw

since t..o ro..:s are identical .

~rse,

sible t..trich does have


(x

Another al t:.emate eguation is pos-

a., invertable mn:riY.. 'Ihis is


1] j l

11

[0

gLvcn by (cf

~.

2-3)
(2-32)

x)

1 1 oI
-1 0 o..
The :i.m:erse of the 3 x 3 rratrix in Ec;. (2- 32) is

r~-1

r~ ~ -~l
Ll

-1

!-hlt!.p1y.L'3 both sides of Eq. (2-32) by this inverse gives


lx

1] ~ (0

x)

ro

-1

o. .

l1
~

-x 0]

-11 - (x

resulting hatO<)el'leous CXlOrdinates [1 -1

x[l

-1

01

0) nust represent the "point of

intersectJ.on" for the n-o pa.rallellines , i.e., a point at infiruty.

tr.e t::...'O-d.urensicmal hatOgeneous vector (a b


on the line ey - bx = 0.

(2- 33)

In ge."leral,

0) represents the point at infinity

'Iho fuct that a vector with the harogeneous carponent 11 equal to zero OOe5

indeed represent a point at infinity can be illustrated by the limiting proc:ess


ConsJlder the line Y* = (J/4)x and tr.e point (X

Sh.'Cn be1cw.
calli r.<:J that

3] .

Re-

a unique represe.r.tation of a position vector docs not exist in

b:::m.::xJcneous cx:ordinates , tr.e point [4


co:>rd.i.nat.cs

Y) [4

in all

t.~e ways

31 can be represer.ted in hcr.cgeneocs

sl'lcwn in Table 2-l.

See ~f . 2-3 .

Note t:Mt

lll

Tal;le 2- 1 as tH>, the ratio of yi/x' ren:rlrs at 3/11 as is rEqUired by the gove...>ning cqt2tion.

F\lrther rote that

SIICO"!SSiW

paj rs Of [x

!all on the line y - (J/4)x, beoate closer to i.nfiru.cy.


as 11-.o , tl1e p:>int at inhnity (x* "r

11

= (m

(I)

y*), all o f .._'hid\

'ihus , in the linit

1) is g~ven by (X 1

H)

POINIS .aND LlNF..S

43

Table 2-l
Harogeneous Coordinates for the Point (4
H

x*

l/2
1/3
l/4

16

40

30

400

300

3)

l/10

1/100

[4

0) in hCiroqeneous ooordinates.

It follows that the position vector

(1

OJ represents a point at infinity on the x*-axis and [0

0) represents

a point at infinity on the y-axis. In this rranner horrogeneous ooordi..nAtes


give a convenient representation of points at infinity in addition to the capability for ~ali zed transformations .

2-17 T\'K>-DweNstONAL
Previously

<Ne

fbTATION

ABolJT AA ARBITRARY Axts

have considered rotations as

about the origin .

Han:>geneous cx::ordinates provide a JreChanism for aCCX)Itplish.ing rot:ations about

points other than the origin.

In general a rotation about an amitrary point

can be acc:atplished l:7j first translating the center of rotation

the origin,
performing the required rotation, and then translating the result back to the
to

'ltlus, rotation of the position vector (x y

original center of rotation.

1)

about the point m, n through an arbitrary angle can be ao::ntplished l:7j


(x

1]

0
""'1'1\

-n

rc:ose
-sine

sine
cos a

01

~J

r1

(X

'i

H)

(2-34)

By

canyinJ

out the n.-o interior rratrix products we can write

(X Y H) = [x y

For e:-carrple,

1) f cos6

sinO

0, (2- 35)

-sine

cosl3

+ n(si.ne)

-'"1ll (c:xl50 - 1)

-rn(sin8) - n(cose - 1>

the center of an cbject is at I 4

rotate t.'ic cbject 90 counterclocJG.tise about

3 ) and

lJ

it is desired to
~tion

its o.m omtral axis .

by the matrix

0 1 0
-1 0 0
0 0 1j
causes a rotatiGn about t:.hc origin, rot the ooject axis .
~~

procedure

l.S

As sho.om

above , the

to fust translate the OOJect so that the desired center

of rot.iltion is at the origin by using the t.rnnslntion n'iltrix

r1

-4 -3

then apply tr.e rotation mat.rix, and fil'lally translate the results of the rot.:r-

tian bac:X to t.'ic original center by rreans of the reverse translation rratrix.
'Ihc: entire q:Jera tic.n
[X

H]

[x

1)

L-4

-3

o1 rl 0 01
0 -1 0 0 0 1 0
0..,

1,;

l4 3

1J

(2- 36)

1J

can be cnbined into or.e rratrix cpo:>...ration by conc:atenat.J.ng the t.ransforrnatic.n


Ntrices, i.e. ,
y

[X

'11-.enl x

H] = [x y 1)

ol

-1

-1

(2- 37)

1J

X/II andy* = Y/H .

'lWcrdiirensional rotations about each cuds of an orthogonal nxis system are


represented in Fig. 2- 10.

A cntputer al90rithm for performing a t:wo-dirrensional

rotation about an arbitrary point is given in Appendix

c.

a.long with other

algori thn'6 for ~ic:nal translation, scal j ng 1 and reflection .

REFERENCES
2-1

f'ox1

L.

An Introduc:t:.ion to N\marical Li.near Algd>ra, OXford lhriversity

PresS 1 1.nndon 1 19 64

2- 2 Forrest, ;,.

P. .

"Co-ordinates, Transfoxmations , ard Visualization Techni-

que.," CAD Grol..p

~t N:>.

23, Cafl'brid:;e University, June 1969.

POINTS At;o (,fNE:S

2-3

Ahuja, D. C. , and Coons, s . A., "Gecm::ltry tor Const.ruction <lrd

45

Displa~, ..

IB15yst. J., vol. 7 , oos . 3and 4, pp.l88-205, 1968.

,.

,.

>"
}

\
\

CClS)' SlJl)

0 -silry oosy
\
\

.->"

'{.

""I
I

'

->

,.

oosa

0 -sl.nS

,..

"

sinS 0 cos

,.

-' -

\
\
\

..

.,.,.

OOSil

sim 0

.
-smn
coso 0
0

>"\

}'

\
\

\
\

...

,..J

..>..
...
...

'
c

Figure 2-10 ROtation .

CHAPTER 3
THREE DIMENSIONAL
TRANSFORl\fATIONS
AND PROJECTIONS

3-1 INTROOXT I00


The ability to represent or display a t:hree-d.ir'Cnsional object is fundalrent:a::l to the understanding of the shape of that ooject .
tO

Fu.rt:herlrore, the ability

rotate, translate, and project views of that object is also,

f~W to

the underst.an1.i.rJ of its shape.

nus

picking up a relat.h.-ely c:ancJlex unfamll.iar object.

oolds

1.n

mmy cases,

.1s easily c:lErnlstrated by

Imrediately one rotates it,

it at ann s length, stands back fran .it, etc ., in order to obtain an under-

starding of its sh8pe.

To

oo

this with a mcputer we rrust extend our previous

t:wo-d..ironsia-.al analyses to three dim.msions . Based on our previous experience


we imrali.atcly introduce N::rrogeneous exx>rd.i.nates. Hence a point in ~
diJrens1onal space (x y z) is represented by a four-dimensional pos1.tion vector

lx y z
to

1)

or

IX Y z H).

Again the transfonration f:n::n N::rrogcneoos coordinates

ordinary coordinates is given 17.1

[X Y Z H) (x y z l)T
X Y Z

lx 'Y* z ll Iii ii ill

(3-1 )

1ooo1'1ero T is sore t.rans!or.rut1oo catrix.


'I'hc c_,'Cnarali7.&l 4 x 4 transfoil"oaticn Ntrix for three--dirnlo_nsicnal haroc}etlDOUS

coordinates is

ab cp

(3-2)

defq

hi j r

tmns
The 4 x 4 t.ransfonnat.ion matrix in Eq. (3-2) can be partit.loned into four

sepsrate sectiCX'lS:
3

-------1 X 3 I 1 X1
'llle 3 x 3 ootrix produces a linear transfomation* in the tonn of scaling, shear-

The 1 x 3 row matrix produces translation, and the 3 x 1

ing, arrl rotation.

oolunn matrix prcxluces perspective transformation.

duces overall scaling.

ThL final single e 1mcnt pro-

'Ihc total transfonmtion obtained by op&Bt..i.ng on a posi-

tion vector with the 4 x 4 matrix arrl normali2ir3 the transfomed vector i.s
called a bilinear transfomation. nus gives a cutbinatioo of slwari71!,, weal

scaliff(l, l'Otal.i.on, rej'lection, translation, per'BiX"Ct.iVl, and WnY111 cwatitlfl.

3-2 Tffi.EE-D WENS IONAL

ScALI t-.6

The d.i.agooal terms o f the general 4 x 4 transfonrauon produce local ard

overall scaling .

Consider

(x y z 1]

wch

a
0
0
0

0
e
0
0

0 0 = [ax ey j z 1] : [x* y*
0 0
j 0
0 1

sln-ls the local scaling effect.

scaled as a unit. cube.

2*

1]

(3-3)

Figure 3-la shows a parallelepiped r e-

Overall scaling is obtained by using the fourth diagonal

elerent, i.e.,

(x y

11

1 0 0 0

= [x y

z s]

0 1 0 0
0 0 1 0
0 0 0 sj

= (x* y"*

z* 11 (~
l.! 11
s s s

linear trcmsformation is ale \<AU.ch transfonns an initial linear carhi.nation


of vectors into the sane l.inoar canbinatioo of transforrrud vectors.
A

1.

0 ll I

o1a

c.lOl

t
'
f9

S l I

20:1
,1 I l ).

o;oe

0 l DI

0 0 l 0

011

2001 OOC1
: ) 0 l

1'

fi 0 0 0

I 0 0 I I
1 o1 1 r
llClC
1 I 1 I I

A 0 0 0 1

8 00 1 :
c o ac J

,.

Figure '3-1

C . 1~

O.l
l

o.

I
I

-.n

-o.~

-c.n

--c.a~

o.~

0
1

l
:1'

O.f

I "'

c.

r. 1 0 II J
I 1 0 1 I

'

&.!.

0.15

l.~

I
l
l t
I t

0 l I II 1
J ' 1 l 1

0.1S

0.1~

0..

'~

1.1~

l,<l'j,

D 0 1 1 :

-c.,.

1.,
t' ,1!;

'lh1s effect is shct.m in Fig. 3-lb.

:Incidentally, the same effect can be obtained

by means of equal local scal.ings.


be

In thls case the transfornatHX1 matrix "'Qlld

!9

0 0 0

!s

!s

0 0

3-3

0 1

T~E-DIMENSI<JW. SlAAJNG
The off-d.iagcxlal terms in the upper let 3 x 3 CXli{XOt'lent mat.rix of the gen-

erAlized 4 x 4 transfonration matrix produce shear in three dimmsialS, e.g.,


(x y z 11

1 b c 0 = (x + yd + hz

bx + y + iz

ex + fy + z

1)

d 1 f 0
hi 1 0

0 0 0 1
A siJtt:>l e t:hJ::ee-dirner1Siooal. shear on a unit cube is stxlwn in Fig. 3-lc.

3-4

T~EE-DI~I<JW. RoTATIONS
In the previous sections we saw that a 3 x 3

cx:up:lC'lent

matrix produced a

lt:lwever, i f the deteminant (cf Appen:lix B)

CXlibinatioo o f Si2ling and shear.

of tbe 3 x 3 oc::mpcnent matrix is +1, then it produces a pure rotation about


the origin.

Before considering the general case of

about an arbitrary axis,

we

examine

ional rotation

several special cases.

x-ax.is, the x-d.irrensians oo not cl'la.NJe. 'lbls, the


transformation matrix will have zeros in the first row and first co1l.llm, except
for unity oo the main diagonal. The other tenn9 are determined by considering
In a rotation about the

the rotation of a unit cube in the same m:mner as discussed in Sec. 2-13.

leads to the t:ransfontatioo matrix for a rotatioo of angle

e about

the

'lhis

x-axis

given by
T=

1
0

cose sine

o -sine
0

cos6

(3-6)

0
0

Rotatia\ is assunel to be positive in a right-han:i sense as one looks fr:au the

origin outward a.1.oog the axis of rotation.

aro.xt the x- axis.

Figure 3-2a smws a -90 rotation

final result.

In order to sln.l this, o:ns:ider a rotatioo abot..lt the x-axis fol-

lowed ~ an equal rotatioo about the y-axis.

=~I

Using F.qs. (3-6) and (3-7) with

we have
T =

cos 0

0 cos6 sine o
o -sine cosS 0
0

cosa
. 2e
Sl.n

-sin~

sin

0
cos

-sin6

cos6sine
2
cos8sine -sine cos e
0

~J

cose

('3-9)

01

On the other hand, the reverse operation, i .e . , a rotatioo about the y-axis

e=

~1

0
sine
cos9

0
0

f01J.o..Jed by an equal rotation about the X-axi.S with

T = cos
0
sin

o -sin~ 0
1

0
0
cos 0

0
2

1
0

case

-sine

-oost sin6

case

sin

cose

sin&

2
sin6 -cos6sine cos e

yields
I

(3-10)

01
o

Caq:larison of the right-hand sides of Eqs. (3-9} and (3-10)

that they are

not the sc:ure. The fact that three-d.iJrensional rotations are oonoc:mrutative nust
be kept in mind when tJDre than one rotation is to be made.
'Ihe result of transformatioo. of the upper left object in Figure 3-3 consisting of

o-o 90 rotations using

.sho.m as the dashed figures .

the rratrix prcrluct given in Eqs. (3-9) is

hllen the opposite ordcu of rota.tioo. as specified

by Eq. (3-10) is perfumed , the solid figures shaHn in Fig. 3-3 graphlcal ly

dem:nstrate that different results are obtained by changing the order of rotation .
f'requently it is desirable to rotate an abJect about one of the cartesian

coordinate axes .
y-, and z-axes.

3-5

Algorithms given in Appendix C allow rotatioo. al:nlt the x-,

REfLECTIOO IN TtE DWENSIOOS


Sc:m:! orientatioo.s o (

a three diJren.s.i.oo.al object require reflections.

three ctitrensions the sizrplest reflectia\S occur through a plane.

In

For a rigid-

0 -1

..

../
0
0

0 -1

../

)
)

'

-r---71

//

/ I

f. ...... /

J--~--j

//
z
, I//'--..'(
/
~ .......
I / /
' ....V.,..
/

'

Figure 3-3

0 -1 0

/
/

-x;

------~

I
.,.-" I
} - - - ~ ~-- ..) ,~
/

J&.-.-~--1-

___ _v /

.,.

/;/'

0/
l .l "

0 -l
1 -1
0 -2
1 -2
0 -1

2 1 -1 1

2 0 -2 1
2 1 -2 1

1
1
1

0
0 1
0 0
0 0

0 0
0 0
-1 0
0 1

r1 0 1 1 A*
111 1 B*
l 0 2 l C*
1 1 2 1

D*

2 0 1 1 E*
2 1 1 1 F*
2 0 2 1 G*
2 1 2 1 I*

ensiooa.l ref1ectioo through the xy-plane.


Figure 3-4 'Ihl::ee-d.i.rr
body re.f1ectioo the determinant of the reflectioo transformatioo will be -1.0.
In a reflectioo through the xy-plane, only the z~.rdi.nate values of the

cbject ' s positioo vectors will be cl>.anqed.

sign.

In fact they will be reversed in

Thus, the transfonratioo ratrix for a reflectioo through the xy-plane is

1
0
0
0

0
1
0
0

0
0
-1
0

0
0
0
0

(3-11)

54

l'~CAL ~

FOR a:t-tPlTI'ER GRAPHICS

The reflection of a uru.t cube through t.~ xy-p1anc is shc:7..m in Figure 3-4 .

For

a reflection through the yz-plane,

-l 0 0 0

(3-12)

0 1 0 0

0 0 1 0

0 0 0 1
and for a roflcct.i<r. t:hroogh the xz-plane,

T= 1 0 0 0
0 -1 0

0 0 1

0
An

(3- 13)

0 1

alqoritln which INill perfom t:hree-ctirnensional reflecticns is given in

1\ppendix

c.

Reflections al;o.lt ot:OOr planes can

oo

obta.ined by a oanbination o f

rotation and reflection.

3-6

TRANSLATIOO IN TJ-REE DWENSICJIJS


Three-dimensional translation is obtained by writing

[X Y Z H) [x y z 1] r1 0 0 0
0 1 0 0

(3-14)

0 0 1 0
t mn 1

'

t'lhen expanded this yields


[X Y z H)

= I (x +

t)

(y

+ m) (z + n) 11

(3- 15)

It follo,.s that

x"' ~
x+ ~
H

(3- 16)

y* = 'i
= Y+m
H

z"' - !H = z + n
An a1gorithn for translations in three dimonsions appears in

3-7

l\ppe1ii.x

c.

T~-REE-D U-1ENSIOML RoTATIOOS ABOOT ~ AABITRARY Ax iS


The rrcthod of O.t>-dirnensional plane rotation D'to.lt an arbitrary axis was

discussed m

axis in

sec.

2-7.

The generalization of that probl em is rotation about any

t.hr~sional

space.

Again , the procedure is to translate tte ob-

ject and the desired axis of rotatioo so that the rotation is made about an axis
passing l.hrouqh the origin of the ooordinate system.
th~im:!ns1onal

The rrethcxl invol ves a

translat1oo, a rotatioo a'to.lt the origin, and a translation

bdck to ~ init.LAl positioo.

1f the axis about "'hlch rotation is desi.rEd

passes throu.g h the }X>int A It m n 1] , then the form of the transformat.ioo


rratrix is

(X Y Z H)

= (x

y z 1]

0 0

r1o o o

0 1 0 0

-11\ -n

-t

(3-17)

0 0 1 0
t mn 1

where the eleSJents in the 4x4 rotation matrix R are in geroral given by
2
n1 +
(R)

(1 -

n1 ~(1

n1 ~ (l

'1 2l008 D

oosO) n 3sJ..ne

- cos9) - n sJ.r,(, n-/ + (1-

n1 ~(l -

n/)~

~n 3 (1

008) -

~n3 (1-

0066) + "2s.J..nk n n (1- cosO) - "ls.inO n 1


2 3

(3-18)

C060) + n 1 sintJ 0

(1 - n

2
)0C1Sll
3

o
l

"2~1n

a derivation for dete.rming the elments of the rotat.l.oo matrix R

.1.S

given in tho

next section.
Fqu.ations '3-17) and (3-18) can be nserl as a basis for c::arputer software
algoritbns .

SUch an algorit:l'lm is particularly useful

for c::a1puter anirrations.

'Ibis transformat.ial , as well as others discussed in this dlapter, can also be

produced by use of hardware ~ts in a display device .


An algoritbn which will produce a

jooal rotation al:xJut an arl>i-

axis in space based oo Eq . ( l-17) ~ given J.n Appenchx C. The alqont.hns


for rotation about the in:lividual x-, y-, and z-axes previously discussed are
special cases of the present algorithn.
trary

3-8

Ei.&Etfl'S FOO n taERAL RoTATIOO f"AlRn<*


We begin by considering Fig . J-5, whid1 sho,.;s an arbitrary axis of rotation

(Q'l) transl ated so that it passes through the origin.

We then rotate a }X>int oo

tl1e translated cbject (5\d\ as }X>int P) about the axis by an angle

JTOve the }X>int fran P to P* .

oo.

Ps

u. This will

In Fig . 3-5, PQ = P*Q, and both of these lines arc

cx::nst..ruct.ed to be parpendic:ular to PQ. To determine the elerrents in the matrix R, we rrust relate the transformed coordinates of
P* to three variables: the coordinates of P, the rotatial angle () , and the
This dcridirect.ioo of the axis of rotatioo as specified by the unit. vector n.
perpendicular to

J.S

vatioo i.s given below.


~ dircctioo of the axis of

three directJ.oo cosines,

rotatioo is nost easily expressed in terms of

"1 = cosa , "'2 = cose and

=cosy.

*1hl.s scctioo rmy be Oll'li.tt.ed withoutloss of mntinuity.

The angles a, B,

':he d.irection cosines are tOO t..ltree

a..--d y are 1der.t;.fied 1.n Fig. 3-5 .

of 1:.~ ~t ~_or
wc':.Or

.. .. .. ,

..

For arry gc.r.eral "l!Ctor

0 = qlI

q2j +

c;.j. tlu.s

tr.it

ca.lc-..:l.at:.ed by n C/ C 1 where C is the absolute value of the vector


i3 .. 2 +
+ s 2 1 ard I 1 j, and k are u:ut veco-..ors l-"'1 the x-, y-,

sl

/q1

g1ven by
a.."ld

n.

~ts

%-di:'~..l.a'Ui

It folla..'S tr.at:

tesfE!Cti\lely.

0.1

"" n

COS'l

;'

ql

... q2

q3

q2

oos3 -

--:::::::::==::::::;==::=: = "2
/
2
0-1

0.2

.,. q3

q3

COS'(

':1le t:.it vector is

t""d':.r!.X

form t.l-Us

I ql2

+ q2

tr.e.'l given by
n ..

!.."'1

--;:::::;=====:;- n3

15

other results fra:1

q3

"2J.... + nl~
as n {"t "2 n3] .

"11

written

...,..

Z<

~....or

calc-J.lus1 tl'.e dot product. a."ld t."le cross

'

'

/
_ :;/

I
p"

-J

t)l'?-=:;:_-=
-:--- - 1

Figure 3- 5

, ..

.\

produ:::t, are needed to relate P* to P.

1h! vector dot prtxlu:::t is 91ven by

P . ~ .. IP nlcos~ IPI~

.P =

..

where is the angle bet....-een the tw:> vectors, as shcl.m in Fig. 3-5.

since

1 n 2 n 3 ), the dot product can also lx! expressed in matrix

[x y z) and n

(n

form as

=~

YJ7

[x y z}

'1.
"2
"3

vector cross product is give."\ by


.,.

.....

n x P det n

t"

+k

X y

!cn2z- n3y) + j(n)x- nlz)

In IMtrix form the

cross product is
+

-n3

-"2
'1.

"2

-"1

n x p = (x y z)

It 1s also true that


where

+ is again

...
1n

.....

x P

.. ,....
n

P sino) =

.~

P sin~

the angle between the b.'O vectors.

'lbe foll.o.oling three vector equalities are obtained fran Fig. 3-5:

0 + ci p

(3-19)
(3-20)
(3-21)

.......

4-

....

....

Fran Sl (3-21), oP = (P - Q} .

the ma.gnitldc of vector


+

OS IOPicos9.

Thus

QS,

which is in the direction of


+

CS

(P -

..

Since the magnitudes of QP and (F)* are equal,

Q)cose .

QP,

is given by

Using this result and

m 1bining

Sis. (3- 19) and (3-20) gives

P.

= Q+ <P - Q) cose

sP*

'l1le nagn i tude of SP111 is equal to


SP* -

'nle ch.rection of

s'P

is

parallel to the vector ~ x

P.

loP,sine

>=

IP - olsine
to the plane F'Ctl and is therefore

'Jbe unit vector m this direction is

.. ..

u= nxP

...
..
1n x PI

...nxP.

IP i sin~

- -

n x P

SP -

P)sW

rut

loP!

zo

IP - aro

-.

p - Q Sl.n J

Str.~

thus

en x P}s1.ne

~ ~

Eqt.:.11 t; cr. ( 3-21) can oow be written


......
.....
...
p Q + (P - Q)cos6 + (n x P)sine

Fl.9'..:.re 3-5

of rotation.
t:Sl.."lg

..

'lb! mag:nita'!e of Q

o..

p
As r~,

!1-.at the vector C

the e<;Uality

l..S

J.S

<P;;)n, r.q.

(3- 22)

....

t.lte proJection o f the voctor P on t.lv! axis

:z: ..

t' n = P cos; , a.'ld the direct..ion of

(3-22) beocJres

{Pn)n(l - cose) +

~tion

this

Peose

...

is n.

(n X P)sine

gives the transfor ned pomt 1.n terms of the iru.tial

we

point, the angle of rotatioo , a."ld the d.i..rectioo o f the axis o f rotation.
:.trite this result m rot.n.x form.
...

ro.~

l!smg the Ntrl.X ex-press~oo give."\ earlier for the dot pro:3uct (P n ) ard for
the cross product
x P), the equat.iC!'l for p beo::m...>S

~ (x y z) n
1 !~1 ~ n3J (l - COS7) (x y z ~ t lx y zl 0 n 3 -n 2 Sln (3- 23)

(n

-r.

2
. r.l
~

"2 -'1

em ~ writte."'l in a."'l equi\'81ent form usi.'\9 hatt:a;ie.neous coordil'...ates :

P '"' (X )'

l)

r n1

r1 n 2 nl':l 0 Cl -

r:l:-"2 ~

"J "2"3

n1

COS J

r 1 0 0 0 C08

0 10 0

n2"3 0
2
n3 0

+ " "

~ -n 2 0

SUl

()- 24)

-n3 0

0 0 1 0

u ~

LO 0 0 l J

1'11P. three t.erTT'S within the braces give- the required rotat.ioo rratrix (R] .

It 1s seen th.::lt to pro:lt.X:'C .a general rotat.lcra by use of F.q. (3-17) , the (x y z )


O'.:lOrdinates of t.'ll2 JX)int P, t!le directioo oosiJ'les of t.lx! u.xis of rotatioo

ln 1
As

n l, and the angle of rotat:a dbout the

a spcc1hc exa:rple consider rotat.J.oc al:ntt

an::l n

1.0.

ax1s

t.~

are neOOod to defl.ne (RJ.

z-<lX.ls.

'~hen

n = 0,
1

For this spt..>cial c1se t.~ rotaticra r .:ttrix R b..~

~ =

O,

THREE-OIMNSIQW.. "l'AANSFC>Rt-17\TIOOS AND PI'D.': 'cr'l'IQS

R=

r COSH

59

sine 0 0

cos., 0 0
-sm

1 0

0 l

'lhis rMtrix a<JrCCS with tlut given m Sec.

3-~

f or rotdtioo about the z-axis in

the xy- plane.

3-9 AFF1NE

PMJ PeRsPECT 1VE

GEa-t: 1RY

The idea of a vcct..or Lo describe a point. was .initially oonc:civcd frQI'" qoormtrical c:ooccpts.

Gearet.ric theorG'l\S have been developed for boili perspect.1.vc


'Ihe theorems of affine geaoot.ry arc identical to t.ta;c for

and affine g<X.metry.

Euclidean geonetry .

In affinQ gecmatcy parallelism is an .inp:>rtant. concept, and

the ratios beboleell parallel lines is an inte<]ral p.trt of the geatetry.

Euclidean

ga:t~Ctry

has been taught in

scrools

Si.nec:!

for many years , draw.Lng and sketch-

ing techniques based upon this gearetry have bec:are standard rrethods for graph.i-

cal ccmnunication .
1\n affine t.ransfor.rration is a canb.ination of linear transfornations folla..'ed

by translation .

For an affine transfonration, the last. oolum in the gcllcral

4 X 4 transformation IMtrl..X must be

ro .

OthenoJJ.SC 1 llS sh(l...n

in Sec. 3-11 belo.t,

1
the t.ransforrred torogcneous coordinate H is not unity and there is not a one to

one oo.rrespondence bet\.-een the affine transfol:'lfatioo and the 4 x 4 matrix opera-

tor.

Affi."'le t.ransfornations fonn a useful subset. of bilineAr transfornaLions,

si.rce the product of n.o affine transfo:rm3tions is also affine .

This alla..-s ooe

to perform a g<?.ncral orientation of a set of points relative to an arbitrary


coordinate systan while slill maintaining a value of unit.y for the hotoqeneous

coordl.nate H.
Alt:hot.Jgh perspective views are often used by artists and architocts because

they y1.eld rroro relaistic pictures, t.hey are seldan used in t..cchn1cal work becaU9C

of the difficulty of C'a'\Struction.

HoNcver, when hcrlogencous CXX>rdinates

are used to define an object ~'ithin a mrputer, c.1.the.r affJ..ne or perspective


t.ransfOJ:T"Ut.Lcns can be obtaint::rl with equal ecu;e . In perspective gearctry no bolO
lines arc parallel.

ln fact the perspecbve plane can be oonstdered "lS a hemi-

spher1cal surface and t:ha

pcrspcctt\"C

t:lon fran cne t hree BE

'"

\>J'Cl the elerrenls

1n

11

1'

tran.sfornatioo considered .:lS a transforrra-

r.,... ~

spa....tJ.

the lasl oolum of the general 4 x 4 transfotmltioo

11\;ltrix arc not zero, a perspective transfOLtMtion is fotned.

A perspective

trcmsfoCTitltiOO is frequently associated with a projoct.ioo ooto a plane, su::h as

z = c , fran a lcx:al center of proJectiOO. 'nle catb:ination of a perspective


1
transfotl'"\ltiOO with a projectiw transformatioo is called a perspective projectioo.
O.Q

A p:.rsp:cllve pxojectioo represents a transforrratioo fran three space to


I f the center of projection is located at infinity, then the perspec-

space.

tive proJectiOO

.LS

Ccllled

an axooc:rr-etric projection.

Ot:heiwisc, the form depends

upon the locatioo of the projectioo FOint.

3-10

AxoMMT'RIC PRoJECTIOOS
An axonanetric projectioo is produced by an affi!le transforrration which has

a zero value for its determinant.

'lhere are several different types of a>a::lOCI'OOt-

ric projections which find applicatioo

descriptiw gearotry o.nd engineering

I"Mt:.herratically form an axonaootric projection, the 4 x 4 transfo.rmatioo matrix is used to pxcdu::e an affine transforrratioo on a set of p:>ints .
'n1e p:>mts are then projected onto a plane frun a center of projection at infinity. 'l1le canton axonarotric projecticns are classified in Table 3-l.
draftl.ng.

..

l.l'\

To

'nsble 3-1

Ax.onc::r.etric Proj ecti<XlS


Pro)ec:tl.on

The transorrratioo matrix causes pure


rotatioo. 'Ihus, the coordl.nate axes

Trilrotric

remrln orthogonal

~'hen

projected

Oiztetric

Two

Isaretric

All three axes are equally foreshortened when projected

of the three axes are equally


foreshortened when projected

J\Xl:lnc::lrotric projectioos

shown in Fig. 3- 2 and 3-3.

An axonaret.ric

projection fran tlu:ee-c:l.inenional space onto a plane z n can be obta.i ned by


the followll"'9 operatioo:

0 0 01 ""

(X Y Z H) = {x y z 1) 1

(x y n 1)

(3-25)

0 1 0 0
0 0 0 OJ
0 0 n 1

'Ihcn,
[X* y* z 1)

(X y n 1)

Notio:! that. this transfoD1'1<'1tiOO ~ts a translatiOn in the z~on


by the amJU'lt n CJ1vP..n by the transfomatioo

'l'HRai-OINENSlOW. TRANSFOffofATIOOS AND PR:mX:TIOOS

T' =

61

l 0 0 0

0 l 0 0
0 0 1 0
0 0 n 1

follo.,'9d by a projectioo

ftu!l

now

infinity ooto the

.. 0 plane given

by the

transfm:matioo

T" = l 0 0 0
0 1 0 0
0 0 0 0

0 0 0 1
'l!le concatenation of T' and T" 1 i.e. , T" T' 1 will yield the transfoz:matjoo matrix

given in F.q. (3-25).

'lhe effect of tl1e translation is to nove the z .., 0 plane

to sate other position

in the object.

Proje::tioo onto the z .. 0 plane then oor-

responds to projectioo onto the z ,., n plane.

Axonc::Xretric projection transfotmations onto the appropriate zero plane


always contain a ooll.ltn of zeros, \olhi.ch oorresponds to the plane of projection.
Such project.i.cns are frequently called orthografhic projectioos.
ncnly used in rrechanical drawing.

= R.

the x

Exarcples of an axcn:ttet.ric projectioo onto

and y m planes are given by

T'

They are can-

1 0 0 0 and T" =

r1 o o o

0 0 0 0

0 l 0 0

0 0 1 0

0 0 0 0
L.O m 0 l

t 0 0 l

As noted in Table 3-1 the transfomation natrix for a trilretrix a>col'lCI'I'etric

'Ibis type of transformatioo \.as studied in

projection causes pure rotation.


Sec. 3- 5.

tia1s.

Aux.il.iary views

u.c;ed

in engineering drawings are tr.itnetric projec-

An exanple of a trilretric projection of the unit cube onto the z 0

plane after a 90 rotation al:x:>ut the x-axis is shown in Flg. 3-6.


In order to develop the oonditicns for diJretric and isaretric projections,

recal 1 that caubined rotatioos folla.;ed by pr-ojection fran infinity f orm the

basis for generating all

~tric

In particular,

projectioos.

WI:!

a rotatioo about the y-ax.is, follONed by a rotation about the x-a.xis.

Eqs. (3-7) and (3-6) the matrix project which gives this is

(X Y Z HI [x y z l)

cos~

-sin~

sin'P 0 cos 0
0
cax:atenatioo yields

0
0
o oose sine o
0 -sinO cosO 0

consider
Fran

> ,

L" c

A".\"

B" D"t -- - --e i " J"

A
B

c
D

E
F

0
0
0
0
1
1
1
l1

ll

Figure 3-6

(X Y Z H]

ll ,. .

ro
I

0 0 1 rl 0 0 0 =
0 0
01 1 0 0 0 0
0 0 0 1 a
1 0 1 0 -1 0 0
o 1 o 1 c
1 l 1 lo 0 0 1
0 1 0 1 o
0 0 1
1 0 0 1 E*
0 1 1
1 1 0 1 F'*
1 0 0 1 ~
1 0 1
1 0 1 I
111

= [x

~c

y z 1}

Projections .

coso smsin6 -si.n9cose


0
cos9
sine

oo]

(3-26)

~J

0
By use of this transformation matrix, the unit vector on the x-axis, (l 0 0 11 ,
0

transfo~

to
[X Y

z H)

= [COSQ sinsinS

-sin~cose 1)

and

x*

= cos,

y*

= slnsin6,

z -sincos9

In projecting ont:D the z o plane, z* is effectively neglected as previously

slnm by fl:i. (3-25) with n = 0 and Eq. (3-28) .


tion, the mitut1 z- axJ.S unit vector
/ x*

+ y 2

OCM

a result of this transform!lhas a magn~tude of

= ks2~

As

+ (sinsin6) 2

Slrri.lar1y, the unit vector on the y-ans, (0 1 0 1], transforms to


[X Y z HJ = (0 cose sine 1)
and

x* = 0,

y* = cose ,

'Ibe maqn1.tudc of the transfoi'T"Cd ~s lD'lit

cos

z =

sin~

vectOr

&= cose

is

T'OII

'lb create a dilretric projectioo, the I!B<plibx:le of the b.Q transforrmd unit

vectors is shortened by an equal mount.


y-axi.s wctors yields

El:]uating thL magnitude of the x- and

2
2
oos2 + sin ~sin e

2
Usi.n.J the identities cos

\-lhen the value of sine is

sin2~

cos2e
2

and cos & = l - sm2 e, it follo..'S that


. 2,.
sin2e
SJ.I\ " =
(3-27)
. 2
1 - sm e

=1

crosen,

and

is calculated by the use o[

D:J. (3-27),

the matrix in F.q. {3-26) produces a d.imetric projection.

now consider a specific e.xanple far a di.rretric projectioo. Qle rrotln:l


of choosing sine is to shorten the z-axis by a fixed mrount. Consider the unit.
vector on the z-axis, [0 0 1 1) . 'Ibis transforms to
[X Y z H} = (sincj. -cos~sine coscose 1)
\lie

x* = sin,
Now

we shorten

y*

.= -cos~sine

the magnitude of this transfomed unit vector to a value of l/2

by setting

or
~~2~
+ {1
5~
'f'

. 2 ) . 2&

Sl.Il ~ SU\

""

1
'f

Introducing Eq. (3-27) loods to

4
8sin e

2e + 1

9sin

=o

'l1lis equatioo has roots of sin2e 1/B and sin2 t _.. 1 . 0. \'hen sine
11/8
or e = 20 . 705, then sin ::: 1(1/8)/(1- l/8) or Q .: 22.208. 'l1le terms 1.0 tlle
transfornatioo matrix in F.q . (3-26) are thus determi.ned.

Using the values for a dilretric projectioo, the t:ra.nsforrMtion rretrix


{a:J. 3-26) is ven by

(Z Y Z H) = (x y z 1)

0.925820

0.133631 -Q.353553

0.935414

0 . 353553

0.377964 -0 . 327321

0.866025

A clinet..ric projectioo is sln-m in f'iq. 3-7.


Perhaps rrore cam at is the isoretric projectioo .

'1'0 form an isaretric pro-

jectioo, all three transfomed axes are equally shortened.


l::oth

'l1lis requires that

!. 0 0 1

l 1 0 1

1 !2

1 1

1 01 1
0 0 0 1
0 l 0 1
<

0!2 1

0 0 1 1

I 5 .,..

>"
O.S25820 0.133631 -~.353553 0
0.9354H 0.353553 0
0
0.377S64 - 0. 327321 0.866025 0
1
0
0
0

I! )"

I, -

0!1

I0 -

...
0
I

,y-.--==--___.. '
-4

OS

D netr1c

-0 !

I <

OS

OS -

The first oondition a9"in gives

sin =

. 2,..
Slll .,.

. 2-

sm
1- sin2 ~

2 ;;
1
2sin
~--'-~i'--

::

1 - sin2A

2
It follows that sin e 1/3, or sine 11/3 and
2
sin

t- ..

35 .26439.

Then

rh = !

and

oos 2 ~

= 1 - sin ~ = ~ or ~ = 45
The angle lolhich the projected x-axis makes with the horizc:nt.al is given

by
t.ano

= sinsine
cos~

For sin6 =

/i73, sin2~

2
1/2, and cos . .. l/2, this angle is
Q

1
= tan- (-;) = 30

This result is well knc:J..m to those wtx> have prcdnced an isaretric projectioo on
a drawing toard.

A plastic right. triangle with incluOOd angles of 30 and 60

is a cx:xutonly used tool for this purpose.

USing the angular values for an isoretrlc projection the transform:ttion


IMtri.x in Eq . ( 3-26) OOoc:mes

(X Y Z H) (x y z 1)

0. 707107

0 .408248 -0.577353

0 . 816597

0.577345

0. 707107 -0 .408249

0 . 577353

An exanp1e of an isaretric projectioo is also sh:Mn in Fig. 3-7.

Cblique projections such as cavalier and cabi."''et do not preserve ort:hcx:Jonality of the coordinate system.

Table 3-2 .

The characteristics of these O.;o are shown in

Since they are not frequently used in technical '-()rk they axe not

di.scussed f\lr"ther.
A si.JTple orthograiiUc projection onto a zero plane perpendl.cular to any

of the three ortrogonal axes .results when the corresponding co1llm in the 4 x 4
transfo.mation natrix contains all zeros.
~ =

For exanp1e, a proJection onto the

0 plal1e will resull when the follOWl.llg JMtnx


T =

1 0 0 0

0 1 0 0
0 0 0 0
0 0 0 l

~s

used .
(3-29)

66

MT>.'Il01l\TICAL IDn.1I'S FOR <X:NPllu:R GlW'HICS

Table 3-2
Cblique PrOject..ials
Oeser iptioo

Pro)ec+..l.O'l

'1\.Q axes appear perpendlcu.lar and are not

cavalier

foresrort.enerl; the third axis is inclined


with respect to the horizontal and is not
fore.sOOrtened
A special case of the cavalier projectioo

in which the third axis i s foreshortened


by a factor of 1/2

AI: algo.nthn for sirrple projections is given in .AppeD::lix


A

c..

c.

trirretric projectioo can be abtai1led by using the three-dim.:msional

rotation alg:>ritlrs presented previously followed by the sinpl e projectioo


lllg:>rithm given al:x>ve .
An alg:>ritl'ITI which inplerrents the specific diJrotric and isaretric transf or-

TI'ittion rratrioes discussed above [i.e. , Eq. (3- 26) with P 20 . 70481P ,

: = 22.20765

and ~ 35.26439, ~ = ~so respectively} and assuming projection


on the z 0 plane is give.'\ in Appendix c.

3-ll PERsPECTIVE

TRANs~rta-ts

As previously nentioned, nonzero elements in the first three

ro.~S

of the

last co1um o f the 4 x 4 transformatioo rratrix yield a perspective transforma-

tion.

perspective projection is obtained by ooncatenatioo of a perspective

transformat.l.on

foll~-ed

by a pro)ectial onto sare two-dirren.sic:nal

"vie.r.ri.n9"

plane. A perspective projectioo onto the z = 0 plane is given by tho transf o rrration
(X Y

H] = [x y

1]

1 0 0 0

= (x y 0

(rz +

1))

(3-29)

0 1 0 0
0 0 0 r

0 0 0 1
'Ibe ordinary transfol'li'Od coordinates arc

t.l)en

x*=H=rz+l
Y"

'lhc C]"...oretrical

eff~

( 3-30)

= yH = rz
___.Y~-,-.,...
+ l

of this transfonnation can b.! indicated with the aid

'm:REE-DlNF.NSiaw... 'rRA.~FUif.WI'IGNS A.~ Pinli:L"l'I<M3

67

The nontransfor:trod p:>int

of Fig. 3-8 .

P is transform..'>d to P* by the aoove


operatial,

WJ.t:h

r 1/k.

In Fig. 3-8

the center of projectia'l is located

at [0 0 - k ) dnd Lhe plane of projectial is z "" 0.

Smoe the above ope.r-

atial prodtrcs no translatial, the


origin is unchanged and U1C xy- and
x*y*-coordinatcs share thO sane

origin.

By using the

similar t.ri-

angles shc7...n in Pig. 3-8 it foll(1.o1S


that

{z + k)

or

xe

z +1

1<

Considermg the yz-plane in a similar

rrrumer gives

r OJCCIII'n
Figure 3-8 Perspective projectial
of a point.
(

'F'

z .. 1

(3-31)

C'crllcr ul

'Ibese are tho transform.."<! cxxmiinates produced by the rrat.rix operation with

r l/k.

This cperatJ.a'l produoes a perspective projectl.al on tl'lC'

fran a center of projoctial located at

=-k.

z ..

0 plane

In a perspective transfotmatial

the transfonrod space is rot Euclidean, since orthoqalaliLy of lhc a>-.cs is not

preserved.

!l.ft'\en k approaches J.nfinity, the ~tric Lransforrralion discussed

above is cbt:ained .
Equations (3-30) and (3-31) sho.ol that when z

rx.e to this iclentJ. ty transforn'at.ion,


changed by a perspective projection .

= 0,

then x

= x,

andy* --' y.

p:>ints in the viewing pl ane z "' 0 are not

'Ihis is ooly true,

rc.~vcr. when

the horro-

gencous ooord.inatc H is unity after the transfol:malicn has been a,wlied to a


p:>int [x y z l j .

Since aff.inc transfo:rmal.ians retain a value of nnity for II,

a perspective transfornatial 11'\lY be preceded by an arbitrary sequcncc of affine


transfoi"'T''ltions.

Thus , to obtain perspective views fran an arbit.rary view point,

affine t.ransformst.i.als are first. used to establish a ooordi.natc system with the

z- aJU.S al<nJ the desired line of sl.ght; then the pcrspccbve transforrrutioo i.s
applied and a projectiw transformation is used to project the total set of
p:>wt.s alto the viewing plane z 0 of the current coordlllAte syst.ern.

In prac-

tice , it is often l'lCO'Ss.cny to apply further affine transfornutl.ons to scale


and positton the proJected new (~f . 3-3).

fb..-eve.r 1 this

Above we have considered projectioo onto tl3 2 0 plane .

ray not a!.wars be desiiable .

Q1e

reason is that projectioo onto the

0 plane

loses the 2~rchnated infanration which can be useful in controll.ing the


bnghtness o f displayed points oo a plane (Pef. J-4 ). To include the 2-coordinate
infoOM.tion the perspective transfomation
(X Y z H) E {x y z 1) 1 0 0 0

lx y z (rz + 1)]

0 1 0 0
0 0 1 r

00 0 1

rx * Y* 2 * 1)

rrey be used and the full

X
y
Z
1]
rz+lrz+lrz+l

ional results obta.ined.

Here we note that the origin of the coordinate

unch.ancJed.

(3- 33)

Notice that the point At infinity

a'\

system ro

0 0 1] ls again

ro

the Z-axi.s l

0 1 0] 1

'('0;1

uansfoms to the noninfinite p-.>int [X Y z R] = [0 0 1 r) w.ith the ordinary


o:x:m:U.nates [x* y* z* lJ [0 0 lfr l], i.e . , a finite point m the z*-axis .
nus rreans that the entire positive half of the dcrrain
within a finite danain (0

parallel to the z-axi.s will

'"') is projected

Further, lines which were originally


app>ar to pass throught the point [0 0 l/r 11 .

rv::J;~

1/ r ) .

This point is frequently cal l ed the

%I

co

vanishing point of the perspective


transfomation.

\\hen the results o f

the transformaticn are projected onto


l n11ial
It n c:

,..

a plane, a perspective projection as


rre."''tiooed arove is obtained .

Assuni.ng

that the z = 0 plane is the projectioo

plane, the center of projectioo is


A

located on the sarre axis as the vanishing p:>int at an equal distance on the

opposite side of the zero plane; i.e .,


i f the vanishing point is located at

z l/r oo the z-axi.s, the center of


projection is located at z :: - 1/r oo
the z-axis.

'lhi.s is

s.~n

m Fig.

3-9.

t ,
Cen 1cr

t )f

p QJC:CIon

Figure 3-9

P.roJectiat of a line
parallel to the z-axis.

Similarly the perspective trans-

fooration

~I'IOOS

(X Y Z H)

(x y z 11

1\ND POOJfel'IQIS

- [x y z (qy + l)J

10 0 0

69

(3-34)

O l Oq
0 0 1 0

0 0 .0 l
with ordinary coord.in.ates

(x y z* 11

= [qy+1qy+lqy+l
x
Y
z

11

(3-35)

will result in a vanish.i.ng point located oo the y-axis at [0 l/q o 11,


perspective transfonnatioo

rx Y Z H) = [x y z 1]

1 0 0p
0 1 0 0
0 0 1 0

(3-36)

0 0 0 1

(X

+ 1))

Z (px

with ordinatey coord:i.nates

rx*

y* z 1) -- Ipx+lpx+lpx+l
x
Y
z 11

(3-37)

will result in a vanishin:] point located oo the x - axis at (1/p 0 0 1).

'1lle

transfoonatioos given in E>qs. (r32), (3-34), and (r36) are called single-point
or parallel perspccti ve transforrraticns .
Fig. 3-10a.

'!bey result in views such as sho.m in

Fic;ure 3-loa shows a single-point perspective of a unit

pxojected onto the z 0 plane.

C\t)e

'nle vanishing point ~ on the z-axis at z -10.

A rore natural single-point pe.rSfECtive can be obtained by first centering the

face OCFG with respect to the z-axis .


the unit cube by

tion.

X ""

That .is, translate the eight corners of

-0 . 5 and y = -0 . 5 before awlying the perspective opera-

'11-.e resulting view is sham in Fig. 3-lOb.

perspective i s the type that artists often use.

'1bis centered, single-point


It can, hc:7,..1ever , give a dis-

torted vi&t of the depth of the object i f the vanishing point is noved too far

away fran the center of the picture. This is what causes the "unnatural view
in Fig. 3- loa .
Lf b;o terms in the 4 x 1 colum nBtrix are nonzero, then a two-point or
angular perspective is obtain~ .

'Ihe o.o-p:>int perspective transfotm!ltion

[X Y z 1) = (x y z 1]

1 0 0 p

[x y z (px + qy + 1)]

(3-38)

~+1

(3-39)

0 1 0 q
0 0 1 0
0 0 0 1
with ordl.naty coordinates
[x*

y* z* 11 "" [px +

results in two vanishing points :


the y-axis at (0 1/q 0 1).

~+

1 px +

px +

+ 11

one on the x-axis at [1/p 0 0 1) arxl ooe on

This is shc7.n'l in Fig. 3-lla, where the results are

t lo \1 PI on ) 111.1\

>"

)'

.o

.11 }

10

G"

-ToVP1 on

AB l< l \

IIJ. 10
(

(j

E
ll

A"

Po5it.iat

Vectors

.....

~
tl.VI? and
Projecticn

,..

E"F"
Folo.iuon

Nolll\1 II zed l'criiu oo Vectors o f

Vectors o!
o f o ng- Tr.lnsfOYt:D- 'rransforrred
1na.l Clile t ion Mat.."'U! Cube

F
A

c
D

E
F
G

0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

0 1
1 1
1 1
01
0 1
1 1
1 1
0 1

1
0
0
0

0
1
0
0

0
0
0
0

0.1 "" 0 0 0 1
0.1
0 0 0 1
0
0 1 0 1.1
l
0 1 0 1.1
1001.1
1 0 0 1.1
1 1 0 1. 2
1 l 0 1. 2

Trons fo l'l"f'd C\.bP

0
0
0
0
0.91
0.91
0.83
0.83

c
o
t
p

c
r

0
0
0.91
0.91
0
0
0.83
0.83

0
0
0
0
0

l ..
1 s
1 c1 o
l e-

0 l f"'

0 1 c
0 1 t

).

c.o
A

--

G".l"

A.

'-

I .I

Pcrspec-

Positlon
Vectors

of orig1na1 CUbe

0
8 0
c 0
D 0
E 1
F 1

11.

0
0
1
1
0
0

0
1
1
0
0
1

t1ve Md
Projoctlat
Tr.vuofor'IT'dt.iat TransfoDMtion ,.latrJ.X
!'latrix

1 1
1 0
1 0
1 -o.5
1
1

1 1 1 1

1 1 0 l

0
1
0
4>.5

Pos.1.tion \'ectors

lbtm1lized Pos1.tion

o f Tr&ns!or:rood

voctort. o r TransfO,!t'IOd CUbo

CIJbe

0 1 0 0 0. 1 = -o.s -o.s
-o. 5 -{). 5
0 0 0 1 0 0.1
-o. s 0.5
1 0 0 0 0 0
-0. 5 0. 5
0 l 0001
o.s -o.s
o.5 -o.s
0. 5 0.5
0.5 0. 5
0

A =

0
0
0
0
0
0
0

1.1 C"
1.1 D"
1.1 E*
1.1 f"'
1.2 c

1.2

Fiqure 3-ll 'IWo-p:>.int pe.rspectivcs.

-o.s

-0.5

0
-o.s .-o.s
0
-0.455 0.455 0
-o.4S5 0.455 0
0.455 -0.455 0
0.455 -0.455 0
0.417 0. 417 0
0.417 0.417 0

1 A
1.

c-

1 E"'
1~
1 G1 r

proJc<:Ud onto the z 0 pl.ane.

In Fig. 3- ll.a, t !\e vanishing p::>ints aro at the

x-a.x.is at x - 10 aro on the y- axis at y 10.

If ""-e first center the z- axis

with r~ to the front face as s.~n in Fig. 3-l lb, a suitable t\olo-point
'tt'.is is du: to the fac t that the obJect

p:::rspective is still rot obtair.ed.

sh::lu.ld fl.rst be rotated aboot the y- ax.l.S in order to attai n an esthetically


pl&'!SJ..."lg t:w:>-pol.Tit per~ve .

'!his is discussed later .

I!: three te.rrS in the 4 x 1 coh..-:n fl"atriY. are nonzero, then a t:hree-pomt

or obL.que ~...ive is obtained .

z 11

(X y

= (x

yz

The throe-point pe.rspective transfo rmation

11r1 0 0 p, ~ [x y z

(px

+ qy + rz + 1)

(3-40)

0 1 0 q

ol

rJ

~0 0 0 1~
w~th

o:rd.ina.r:'J a:x>rdinates

(x y z- 1) [px + qyx+ rz + l px + qy + rz + 1 px + qyz+ rz + 1 1)


results L"l t.i-.ree vanishing pomts :

one at the x-axis at (1/p 0 0 1 ), one on

the y-axis at [0 1/q 0 1), and one at the z- axis at (O 0 1/r 1).

perspec"'_ive vie-N of a unit cube is

(3-41)

sl'~n l.TI

Fl.g . 3-12 .

A three-point

'Ihe r esults are proJected

In Fig . 3-12 the throe vanishing points are located on

onto the z = 0 plane .

the x-axis at x = 10, on the y-axis a t y 10 , and on the z-a.x.is at z "' - 10.

0:

0
c 0
D 0
1
F 1
9

0
0
1
1
0
0

PoSJ.t.ia'l Vector s o f
Transf oLHed

vectors ot

Vectors
of Ori9inal C\.lbo
A

~tm'll ized

PosJ.t:.1 on

Po5itioo
Trans formauon :-auix

0 1 1
1 1 0
!. 1 0
0 1 0
0 1
11

0 0.1

Trnnsfocrcd

0.1
0 0 -0.1
0 0 1

Cl:be
0 0 0 1 A "' 0
0
o o o 0. 9 a 0 0

Cl.lbe

o 1 o 1 c
o 1 o 1.1 o
l 0 0 1. 1 E
1001

F"'

o 1.1 c

1 1 1 1

1 1

1 1 0 1

l 1 0 1. 2 P

Dr-----.'

0 1 A

0
0
0
l
0.91 0
0
0.91 0
0
0
1
0
0. 91 0. 91 0
0. 83 0 .83 0

u,.
l

o
~

G
1

c ~----G"

a1

,., "'

,, "

>-10

T u VP2 on ~-.u.~
.H 11. IC'

A .- --+--~-

c-

Tc. \ Pion)nn

Tn \ Pl on , ,"
IU

8"

)"

o- --c-I "'-." -- -

lll I

1
1
1
l
1
1
1

.,

Figure 3-12 Three-point perspcctJ.ves .

TEOtH<US ~ fNERATING PERsPeCTIVE VIEWS

3-12

h1len a perspective viLv of an cbject is created, the horizontal reference

line is norrrally at eye level, as shown in Fig. 3-13.

Vanishing p:>ints arc then

p:>ints oo the horizon line (eye level) at which parallel lines converge.
3-14a shows heM the vanishing p:>ints are forned.

In genenU. , different sets o f

parallel lines will have different vanishing points.


Fig . 3- 14b.

Figure

This

l.S

illustrated w

Planes of an ooject which are tilted in relation to the ground

plane have vanishing points which can fall above or below the horizon eye level.

'ltlese are often called trace points and are sluwn in Fig. 3-14c .
\\hen viewing a CRl' display the positi.oo of the viCWJX>int or eye is normdly

fixed .

'Ihus , rather than rroving the viewpoint to ootain an acceptable perspec-

tive view, it is comon to ITW'Iipulate the position ard orientation of the OO)ect
displayed on the CRT.

This will normally require ooe or rrare rotatials and

translatioo.s of the object.


As we have seen, i f the viewing point is on a line normli to the center of

a wti.t cube face, then a single-point perspective "looks rl<Jht."

In this view

all reoed.i.ng ~!.anes con'll'er9e to one vanishing point oo the horizontal eye-level
line, and all perpendiculars are drawn as true vertl.cdls.
cube

'n1e front and back

faces are parallel to the picture plan and do not converge.

Papel

VP

- - - - - - - - - -Hor11on
1- yc lc\C I

St.liHIO po1nl

Figure 3-13

Perspective t.ransfoll!Ution to paper.

H r r

\P

\P

-- -

(
,.

\p

'

<::-::>
-- - --- ~

-- --

:cr ;;In.o..:s ::ltlra:lel


L.-.es .

Hot ron

\ P

--

TP .

, _.-

---

n
u

--- -- -- ------

--~---------

--

- - - -..:::--..,.. \P
-:::- -

--------

\-E will roN rotate the urut cube about the y-ax.is and translate l.t to the

point [0 m n].

'l11e resulting figure

~;.'ill

then be viewed fran a P'Sition k on

the z-axis and finally projected onto the z = 0 pl.aoo.

Uswg Eqs. (3-7), (3-11),

and (3- 29) with r = 1/k yields

-sre

cos~;

o -sine o

sine

cos6

1 0 0 01
0 1 0 0

,.cose 0 0

0 0 0 1

Is:~

1 0

L0

mO n + 1

0 0

0 0 0 1

0
cosO

Since projection 01to the plane z = 0 was desinld, the third oolum of t..'Lis

ll'atrix is all zeros.

NOtice that

t\Oo

of the t hree terms in the fourth col 1.1m

which oontrol perspective in the matrix are nonzero.

'Ihus a t'..\'rpoint perspec-

tive view will result.


'!be eight vertiocs of the unit cube, expressed in honogeneous coordinates,

can be represented as an 8 x 4 matrix .

r-hltiplication of t..l)is rratrix with the

above transf0%l'll4tioo rMtrix produces the required transformation on oach point.

'Illis

l.S

given by

-suw
..
~

0 0 0 11 fros6 0 0
0 0 1 1
1 0
0
0 1 1 1

Sl.n 0 0
0 1 0 1

1 0 0 1

1 0 1 1

1 1 l 1
1 1 0 lj

mO

k
0

!!.+1

cosO + !!. + 1
k
k

sin'"

1+m0

coso + !!. + l

1 + m 0

!!.+1
k

S.ln;.

cos

~+

1J

+1
k

0 -sinG + n

cose +sine

0 -sine + oosO + n + 1

k:

mo -sr-e + J<0

1 + m0

oose

e-

cose

oose + sinS 1 +

For

-sre f
+

K'

..

~+1

+ l

60 1 m :- 12, n : 1, an0 k = 1 , this matrix Of transfomcd, horrogcncous

ooordl.nates is

ro

-2

o2

0.86 -2 0 2 . 5
0 . 86 -1 0 2.5
0
-1 0 2
o.s -2 o 1.14
1. 36 - 2 0 1. 64
l.36 -1 0 1.64
0 . 5 -1 0 1.14

'

!ben, since

[!
H !B

[X"' '*
1] I

ll

the! proJected pcn.nts x, y are given by

0
0. 344
0.344
0

-1.0
-0.8
-0.4
-0.5

0 .44

-1.75

0. 83 -1.22
0. 83 -{).61
0.44 -{).88
'Ire transfotned cube is shown in Fiq. 3-15 .
the parallel sides of the cube.

...

Cl:lserve what has happened to

Lines which were initially parallel to the x-

intersect at ooe of the two vanishing points. 'lbe


intersections of the initial parallel lines occured at infinity. '!hey now occur

and z-axes respectively

nc:1n'

at finite values along the x-axis.

<:nly lines iniHally parallel to the y-axis

remain parallel after the t:ransfor:natioo.

Following sim.U.ar logic, a three-point perspective can be created and

vie..-ed fran a position k on the z-axis by first performing rotatioo.s about two
y

oose

,..

o - sine -sine
k
1

sine 0 oose
0

cose
k
!!+1
k

Vfl l

VP1
_.-~I
....--

//

_, /" " I I
-'/
I

/(

I
I

I
I

e ..

60

m -2
n 1

k. 1

Figure 3- 15

Perspective transfonnatioo .

For exanpl e , one might rotate 6 degrees about they-axis and

different axes.

then ~ degrees about the x-axis before applying the perspect i ve transfooretim .

A cooplete set of transfo:anatia'\5 on a unit cube to obtain a three-point perspective is then


1 000
0 1 00
00 1 0

.,...,

0
~

lan.l

o-....c 0
0
0

..,..
.,..

Ulll

.... .....

0
0

3-13

all.I!

.,..

0 000 I
[
1
DOC! I

-1

....~ .. w

1 0 0 0 <X>J'?
oI 00

rrnr

~-

0 r~

c ~._..-

11"1

..,... ( l&1rl' - """'0 II w

..

I ~Ulll C.lrl'i

f!!:!'"l

PoiNTS AT INFINITY
To sho,..t rrore clearly

\~t

has happened to points at infinity, consider

the following exanple.

'Ihree po1nts are given by 11 0 0 OJ , (0 1 0 OJ , and [0 0 1 0].

These

wct:ors represent points at infinity on the x-, y- , and z- axes respectively.

!New, performing the boo-tx>int pe.rspective transformation, given by,


'"1

o o o o.s

0 1 0 0
0 0 1

o.

o -o. s6

0.86

0.5

0.86

0. 5

Thus, the point at x

=co

-2 0 2

oo,

o o -o.86
I

transfoil'RS to x* 0.5/-0.86 -0 . 58 andy* 0 .

This is the vanishing point VPl in Fig. 3- 15.


to y*

o.s

'lbe point at y ..

oo

transforms

ari1 the point z "" transfoxms to x* 0 . 86/0 . 5 1.7 andy* ... 0.

This is the vanishing point VP2 in Fig. 3-15 .

'1he result is that points at

infinity in me coordinate system have been t.ransfox:nel to finite FOints in a


second system by use of harogeneous ooon:hnates .

ic of harOgenCOUS ooordinatcs , we again consider the transfometim of a l.1ne parallel to the z-axis onto
the x*z*-plane.

The line AB is shown in Fig. 3-9 .

Applying a perspective trans-

forrratim rratrix to a general FOint m the line gives

t-~TIID~TICAL EI~

78

FOR OJMPOI'ER GRi\PHICS

(X Y Z H)= (x y

1] rl 0 0 0 =

[X

(f + 1))

1]

1~

AB to the line A*B*

0 1 0 0
0 0 l

!..

0 0 0 1
(x+

This operation

(\o.~th

shown in f'ig. 3-9 .

at (0 0 k).

~hen

y- z* 11 =

c; +

1>

~+

1)

(~ + l)

k = l/4) transforms the initial

A*B* lies oo a line which passes through a vanishing point


the Z-<:OC>rdinate is neglected, the line A'*B* is projected onto

the pl.:me :z 0, as shc:Ml by line A' B' .

The oot result is a projection from

the line AB onto the plane z* = 0, fran a center of projection at (0 0 -k).

Notice the symret.ry of the vanishing point and the center o f projection.
An algorithm which will genexate a general perspective vie..~ is given in
l\ppendix

3-14

c.

RECONSTRU:T I(J.j OF T~-DIMENSIOOAL INFORI'IATIOO


'l11e reoonstructioo of a thrce-dinlmsional ooject or positioo in sp:x:e is

ca11:al

problem.

It occurs c:ontirn.ously in utilizmg rrechanical drawings which

are orthographic projections.

The rrethod of reconstructing a thl::ee-diltC'ISional

object or positioo frau o.o or nore views (orthographic projectioos) given on a


n'!Ciw\ical drS'Ning is well kno;.m.

,...

!Jo..-ever, the technique of reconstructing a

three-d:inl:msional position vector fran two perspective projectioos, for exanple,

tw:> photographs is not as well koown.

Of course if the trethod

l..5

va 1 id for

perspective projcctioos, then it is also valid for the sin'pler orthographic

projectioos, and in fact for all the projections srentioned above.


~

will shc7,.. belON, i f certain other Womab..oo

~s

FUrther, as

available , then no direct

kno,..lcdge is required about the transfor:JMtion .


'Recall that the general perspective transfomation can be represented as

gr>Jlet"al

4 x 4 nutrix.

Thus
(x

y z l)T '

T' =

T' u

(X Y Z H)

(3-42)

~re

T'tz T ' 13 T'14

T'21 T' 22 T'23 T'24


T' 31 T' 32 T' 33 T' 34
T'41 T'42T'43T'44
l1lO rosults can be pro)ectcd ooto a t::wo-diJrensiona1 plane, say, z "" 0 by using

e":l (.3-28) I i.e . I


T" ::. 1 0 0 0
0 1 0 0
0 0 0 0

(3-28}

0 0 0 1
OJnc:atenatioo of the 0.0 matrices yields

T = T,.T'

Til T 0 T
14
12

(3-43)

T2l T22 0 T24


T31 T32 0 T34
T41 T42 O T44
It is useful to write the transformatioo, say,
[x y z 1)

Til TU 0 T

14

::: (X 'i 0 1]

(.3-44)

T21 T22 O T24


TJl T32 O T34

T41 T42 O T44


= [x* y*

0 1)

(3-45)

Note that x* and y" are the coordinates in the perspective projeet.ioo onto the

z 0 plane.
the x

= 0 or y

'nle same procedure could be accutplished using proJecticns erato

: 0 planes .

Writi.ng oul F.q. (3-45) yields

T x + T2ly + T31z + T41 = Hx*


11

{3-46a)
(3-46b)

T x + T y + T z + T44
34
24
14

(3-46c)

using H from fl:J. (J-46c) and substituting yields

(Tll - T x*)x + (T2l - T x*)y + (TJl - T34x)z + (T41 - T44 x*)


14

24

(Tl2 - Tl4y*) x + (T22 - T24y")y + (T32 - T34y*)z

=0

(3-47a)

+ (T42 - T44y*) 0 (3-47b)

As suggested by sutherland (Ref . 3-9) this pair of equatioos can be considered

in three d.ifferent ways .


b.Q

First assure T and x , y, z are knc7.-m .

cquatims in the t:w:> unJ<no..ms x* and y*.

'lhcn t..hero are

'lllus, they may be used to solve

directly for the ooordinates of the perspective projectioo.

This is the approach

taken in all the previous discussions in this chapter .

Alternately T, x*, y* can be as.suted J<na..m.

In this case

equatioos in the three unJmown space cxx:>ntinates x, y, z.


ticns cannot be solved .

\ole

have two

'!he system of equa-

fioNcvcr, i f b.u perspective proJecticns say t:w:> photo-

graphics are available , then F.q . (3-47) may be wn.tten for both proJectims.

ru.s y1clds

~~1

(T~

~4x1)y + (~1

~4x*1)z

(~1

(-rfl - ~4y.1)x + (T~

~4~y + (~2

~l4y*1)~

(~2

- rr!4y*l) = 0

1-?11 -

~4x*2)x

~~1

~4X*2)y

- or;4x*2}z +

(~1

~4x2)

= 0

(~2

~4y*2)X

(~22

'S~.,2)y

+ (T;2 -

+ <-r!2 -

~4y*2)

a 0

~4x*l)x

(~1

~4y*2)Z

~4x*l) = 0

wher& tt.o superscripts l and 2 illdicate the first and second perspective proJectiOO view'S.

Note that the transfor.mations

These oqucttions rr.ay be rewritten .in matrix

~ and ~ need

not be the sarre.

form as

[AI (X] .,. (B]

(3-48)

~.ere

[A] ""

~ll

- rri4X*l

~1

~4X* ~2

-t-12 -

T~4xl T~l
1

~4Y* ~2

~11 - ~4x* ~21 - ~4x* ~1


2

~u - ~4y* ~22

~4y* ~2

~4x*1

~4y.l
~4x

~4y*

y Z )

(X) T :

[X

(B] T =

l~4x 1

~l ~4y*l

~2 ~4x 2

~l ~4Y*2

~2]

Equatloo (3-48) represents four equations :in t.00 three unknown space o:x>.rdinates
x, y, z.

The problen is over speci.fied and thus can be solved cnly in sane mean

or best fit sense.* '1hls is an extrerre1y


threc-diJrcnsional positional data.

E:x..arrp1e 3-2:

pcJWerful

technique for obta.ini.ng

'lliREE-DIMENSICNAL

Asslll'C that the rreasured position of a point in one perspective projectioo is (0.3763 -0 . 8258 0 1] and in a second perspective projection is
[0.6548 0 0.2886 1].

The first perspective proJectioo transform1tloo is knc:7.m

to be the result of a 30 rotatioo about the y-ax.is follo.--ed by a 60 rotation


*l\ rean squares tit can be

a:ltPJt.ed by solving the eqootioo

(A)T[A} (X) ~ (A)T(B)

~re

(f\) T (A) is square and of the co.r:rect d.irrensian for (B) . In particular
I>!J=[(AJT[AJJ-l[AJT[s]. Note that i f no solutioo result.s, then the iJrposed

conditl.oos 'lre redl.l"ldant and no uni.que solutloo which qives a "least" error
concli tion f"..xJ.Sts.

arout

the x-axis plus a translatioo of 2 units in the negative y-diJ:ectioo.

'Ihe point of projection is at z .,. 1, and the result is projected onto the z

plane.
'l1le second perspective projectioo is the result of a 30 rotat.ioo about

the x- and y-axes .

The point of projection is at y ... 1, and the result ~

projected onto the y =- 0 plane.

o.s

o o -0. 867

and

il

are t!'l.ls

~ ~ o.867 o -o.s

and

0 0
0. 867 0 0 0.5
0
-2 0 2
0

0.25

0 0. 433 0.867
0.433 0 0.75 -0.5
0
0 0
1

The A-flBtrix is then

[A]

0. 826252
-0 . 715969
0. 867
-0 . 5

0.67885
1
0.4129
-0.317712 0.7604
0. 182784 -0 . 8943

'

and

solution yieldc:

[B)T e (0 . 7526 0. 3484 0.6548 0.2886)


X ... [0 . 5 0. 5 0. 5] , i.e. , the center of a unit cube.

An al gorithm which utilizes this technique is given in Apperrlix C.


As a third way of CXX'lsidenng Eq .

(3-47)

\~

rote that if the location of

several points which awear in the perspective projcctioo are J<.no,.,n in object

space and in the perspective projection, then it is possilile to determine the


transfonnation elerrents, i.e. , the T . ' s.
~J

'Illese transfoD'I'atioo elerrents can

subsequenUy be tt<ied to determine the location of

technique descritEd alxlve.

points using the

To soe this ~ again examine Eq. (3-46), which nay

be rewritten as

- T34zx* - T44x* = 0

(3-49a)

T12x + T2~ + T32 2 + T42 - Tl4xy* - T24yy* - T34~ + T44Y* O

(3-49b)

Tllx + T2ly + T3lz + T41 - Tl4xx- -

T24yx~

Asslll\ing that x and y* as well as x, y, z are kno.-'1"1, the Eqs . (3-49a,b)

represent bolo equations in the 12 unknown transfornetioo elmcnts Tij.

Apply-

ing these equations to six noncoplanar kruwn locat..ions in d:>Ject space and in

the pers?tive projectial yields a system of U equations


'1hese equations can be solved for the T .. s.
~J

transfo.x:natian.

U \11"\l<:Jn.m.s.

Thus we have determined the

Notice that in this case ro prior Jan..r1edqe of the transfor-

rration is required.

I f , for ex.arcple, the pers?tioe projections are photo-

gra{tl.s, neilher the locatioo nor the orientation of the carrera is required.
In

matrix form the system of U equatioos can be written as

-x1xl * yl 0 -yl~--

x1

xl -x1Y1* 0

x2

yl -ylyl*

zl 0 -zlxl* 1 0
0

-zly1*

21

* Tu

y
1

(3- 50)

Tl2

y2 0 -y2X2* z2 0 -z2"2* l 0 X2 Tl4 I


0 y2 -y~2 0 z2 -zi'2* 0 1 y2 T21
-x~
2
-xyc3* y3 0 -y3X3* z3 0 -z 3x3 l 0 X3* T22
- xy 3* 0 y3 -y3y3* 0 z 3 -zl'3 0 1 y 3 * T24
-x4x4 y4 0 -y4x4* z4 0 -z4x4,. 1 0 X4* T31
- x4Y4 0 y4 -y4Y/ 0 z4 -z4y/ 0 1 y 4 * T32
-x2~*

x3 0
0

x3

)(4

)(4

)(~

xs -><sYs"

-x5x5* Ys 0
0

-ys~

zs

-z5x5*

Ys -ysys* 0

zs - zsYs"

x6 -x6y6* 0

y6 -y6y6*

26

o x5

T34

0 1 y * T41
5

-z6x6*

)(6

T42

-z6y6

y6

T44

)(6 0 -x6x6 y6 0 -y6x6* z6 0


0

Xl

where the subscnpts correspc:nd to points WJ.th f<na.m locatioos. n:tuatioos


(3-50) can be written in nore c:x:.ttpact form as
(A I ] [T] :: 0
Since Eqs. (3-50) are tx:m:>geneous, they will contain an m1n.tra.ry scale factor .
T
1"1\:ly, for ex.arrp1e, be defined as unity and the resulting lransfo.rma44
tl.oo norruUzcd. nus reduces the rcq..Uroncnt to 11 equations or 5 1/2 points .
~

If the transfornatioo

lS

nornalized,

t.~

the right-hand suie arrl the

Exanple 3-3:

the last COlUITI'l in (A I

us Jratr ix equatioo

lS

I is 11'0\ied

to

solved.

EIari'S fOR REXXhS'I'ROCTIQl

AS a specific ex.anple, cx::nsider the unit cube with the six Jcno..m corner
pomts

1.n

the physical plane q1.ven by

IPl =

ro 0 01
0 0 1

lo 1 1
10 1 0

l 0 0

1 0 l.J

thc corresponilinq points in the transfonrod vifM are q1.vcn by

(P*]

fXiUation (3-48) then becares


0 0 0
0 0 0

-1

o.J44
0.344
o
0.44
0. 83

-o.8
-0.4
-o.5
-1.75
-1.22

0 0 0

1 0 0

Tu - 0

0 1 0

T12

0 0

0 0

0 0

0 0

0 0

0 1

Tl4

0 0 0

0 0 0

0 1 0

T2l

0 0 0

0 0 0

0 l

0. 4

0 0

0 0

0 0 0

0.5

0 0 0

0 -0. 344 1

0 -o . 344 1 0 0.344 T22


0. 4

0 1 -0.4
1

0 0

T24
T31

-o.s

T32

0 0 .44

T34

0 1

1 0 -o. 44 0 0 0

0 0 0

0 0

0 1 -1.75

T41

1 0 -o. 83 0 0 0

0 -o . 83

0 . 83

T42

0 1 1.22 0 0 0

0 1 1.22

0 1 -1. 22

T44

1.75

SOlut.ia'l yields
[T) =

0. 867
0

-o.s
0

1
0

0. 5
0

0.867
0
-2

An algorithn which utilizes this technique is qiven in ~ C.

3-15

STEREOGRAPHIC ~CTJOO
Q1ce

an object has bePn transfoxrred to a desired positioo, many techniques

can be used to actually display the abject. Tec::hniques such as shading, coloring , etc. , are frcquP_ntly device-Oependent and are .beyald the scope of this
book. Others, such as hicklen-l..ine reaoval and cliArlng can be acmtplished in
either software or ha.rdnare. Arother useful display technique is the use of
stereo pairs to create the illusi.oo of depth.

Often stereogxaphic projection

can be used for this purpose rather than hidden-line rerroval. .

Graphical output

of cnqineering struct:ures such as bridges and towers lend therreel ves nicely to
ste.r:eographic projcctloo .

Also, the representation of three-dirrensi.onal

arra.nqerents such as piping systens, a.rchitect:ural designs, rredical >t:-ray

studies , the chcrni.cal structure of organic nolecules, and solid crystal oonfiguratio,s can be irrproved by the use of st:aJ::eographic projection .
Jn a stereoytafhic projectioo, a separate perspective view JTUSt be created
for each eye.

'

Then a stereo viewer such as sho..ln in Fig. 3-16 can be used to

view the apparent single thr

object.

If desiied, a

stereo~

can be designed and attached directly to the cntputer controlled output device.

For a hunan with average eyesight, the strongest stereo effect occurs at
a d.ist.ance of about 50 en in fralt of the eyes.

Thus, for an eye separaticn of

Ph..). /}

I
It
ll.

Plane

or

P rOJCC: I ion

Figure 3-16

stereo~ -

Figure 3-17

stereograpuc perspectives.

5. 0

Cll,

-1

the stereo angle is c tan

For a ste.roo vie-acr ~

(5/50) = 5 . 71 .

tr.e

let d be the scaled scparatioo distance betwetm

eyes (cf Fig. 3-17).

If

~ viewer has a focal length of k units, then the value of d .1s fixed by tl~

requ.i.reJtent tan-l (d/k) = 5 . 7l0

correct stereo angle c .

'lhus, d = k/10 i s required to 11'\;'lintam the

To obtain this scaled eye-separation distance fr<r.1 a

single view o f the obj ect, a -+d/2 = +k/20 horizontal translatioo is ~rforrred
before creating the left-eye perpsective view and a

-<1/2

= - k/20

oorizontal

transl.atioo is perfarrrcd baforo creating the right-eye perspective vie....


Before generating a stereogra{tlic projectioo it

LS

oonvenient to center

the object with respect to the z-ax:LS and then rotate i t about tile y- axis in

preparat.lon for a tw:>-point perspective, or about y and x in preparation for a

three- point perspective . One final pl;'E!Ca.utioo is advisable . ~tatioo rmy cause
sate of the points to be behind the p:>int of observatioo, z c k. 'lllcse over
tbe shoulder points cause a distortioo of perspective views.

To prevent this a

final transl ation in the negative z-cl.irectia1 can be rradc to ensure that all
p:>ints on the object lie on o r behind the x*y*-plane, e . g ., -z* !._ 0.

preliminary operations result in

re.~

'Ibese

positioo vectors \vhi.ch descr ibe the t.rans-

forned initial object.


To create a stereo pah, the rr.at.rix contai.n.ing the new posi tion vectors
l.S

t.ransfonred by use o f the two matrices


Left eye

Right eye

0 0

0 0

-~

20

-20

'Ihis creates two separate pers pective vie-'S , one for the left eye and o ne f or

At this int:e..orediate step the left-eye view is to tho r i ght o f

the right eye.

the ori gin, and the right-eye v i ew is to the left, as 50CMn in Fig . 3-18.
Le fl

_
..
----

c ~ c: \le~

,..
--~

c~~.L~----- o - - - - - --cil
F

l.tl l C:}( v

Figure 3-18

Intermediate Stereo Position.

'Ihc last ~rat.ia'l is to sep.-Lrate the two pcrspcctivc vie..rs by the p:rqer
di~

aloog the x-axis in order to place each view directly in front of the

proper e:;ye.

As

stnm m

F~g.

3-18 , (X*)R

l.S

the average

val~

between the

largest and S'T\l.Jlest value of x*R and (x")L is the averag-: value be~ the

largest ard smallest value of x*r.

t'e let. D = (X'*)L- (X*)R.

mJSt be calc.llatcd by searching the no:rr.ulizcd

~-val~s

The value of D

of each perspective

VJ.C:.l.

A final hori?.ontal transl.atioo in the x-directioo of L .. D + (E - 0)/2

for.

nght-eyc view and - L for the left-eye view places the stereo pair in

t.">)c

prqx>r positioo.

'Ille value of E is the actual eye separatioo distance for the

hll'\an observer,

"~u,c'.i i~

1!6

:wale c f thr output device .

for cxanple, i f

the final points for the right-eye view fall bet:..-een 2 !. ><P, < 4, arxl the final
pomt.s for the left-eye view fall

ootwcen -4

xt_ ~ -2 ,

then one might c:h;:x)se

to plot these two views on a standard sheet of paper, using a 10-unit scale

bet;...-een

-s

l"n'lSurcd

x* $.. 5.

Then, the actual 5 an distanoe

relativo to this scale o;..uuld be about E

bet\.~

= 2 . 5.

Q'le

hunan eyes
or two iterations

r.ay be useful to determine the best value of E to use.


An algor1tbn to generate a stereo pair for an ob)C'Ct wtu.ch has been p:l!Si-

tiooed and rotatG1 to form the desired view and parspective is given in
Afp>-Niix C.

I t uses the left and right ste:reo rratri.x pair presented above to

Vigure 3-19

Sinple stereo vi<.......

create the t:\10 perspectives and a final translation matrix to generate the
required eye separatioo distance.
An

exarrple of a stereo view of a siJTple

generat ed using the STERFX> subprogram of Apperxhx

ional wire frcwne

is sho.m

1.n

rig.

3-19.

The

positioo vectors describing the wire fra:re are


0 0 0

1 0 0

1 0 1
111
0 1 1

0 1 2
0 0 2
-1 0 2

-1 0 0
-1 1 0
0 1 0
Prior to cal ling the S'l'ERID subprogram, this daUl was first translated by usi.ng
Sli:lprogrcm
n =

-o.s.

J[YJ'RII.~

(Appendix

c,

Sec. c-10), with -0.5, m = -1.5, and

'lhen a 20 roUltion about the y-ax.is was per!orned in preparation

for a b.o-point perspective.


u9:!rl for this operation.

The stbprogram 3DYOOI' (1\ppcnd.ix C, Sec. C- 7) was

At this p:>i.nt a catpJter search sho..>ed that the

maxinun z-value was 1.9226 .

Then 3m'RA.~ was used

a<3<1in

n = - 1.9226 to place the object behind the x*y*-plane.

with 1

m = 0 and

At this p:>int STEREX>

(Appendix C, Sec . C-17 ) was call ed, using k 4 and E .. 2.

the stereo pair slxJwn in rig . 3-19.

= 0,

'lhis resulted in

However, a final overall scaling

~-as

a pplied to prcxluce Fig . 3- 19 .in order to fit the output to a particular storuge
t ube cro'.

REFERENCES
3- 1

lti:lerts, L. G. , "IJarogeneous Matrix Representation and t-'. arup.Uation of

N-D.iroonsi onal COnstructs, "

r:o:::urertt t1S 1405 , Lincoln L1.boratory, M.I.T. ,

carrin"idge, l1a.Ssachusetts, May 1965.


3-2

Ahuja, o. V. , and Coons, s. A., ..Gecrtetry for COnst.ruct.ion and Display,"


I.Et-1 Syst. J ., vol. 7 , nos . 3 and 4, pp . 188-205, 1968.

3- 3

\-bodsf otd , P . A. , "'lbe Design and lnplerentation of the GIN:> 3D Gra{iri.cs

Soft:<Hclre Packllge, .. Soft:ware-Pract. Exper., vol. 1, 1971.


3-4

\bxlsford , P. A., "GIN)-{)eSign and Inplesrentation , " CM Group Doc. 27,


U1L, carrin"idgc University, 1969 .

88

~11\TICAL EIJ.l.!EM'S

FtlR COMPl1I'ER

GRAPHICS

3-5 Cocns , S.A., ''Transfor.nation and 1-'atrices," unpublished notes ,


of

:-~clugan

Univers~ty

Short Course in CbrTpuler Aided Design , 1971.

J-6

Forrest, A. R. , "co-ordinates, Transfor:TI'Olt.l.Ons, and ViSUil.lizatioo


niques," CAD Group n:x:. 23, Catnbn.dge t'nivcrsity, June 1969.

3-7

forrest , A. R., "c,c,.pumtional

Gc~t.ry,"

Proc: .

roy.

Sex:. (London) , vel .

A321, pp. 187-195, 1971.


3-8

Kubert , q., SZl\00, J. , an:i Giulieri , S. , "The Persp:!Ctiva Representaticn

of F\lnctions of '1\.u variables," J . Assoc. c::atplt. t-\!ch.,


193-204, April 1968.
3-9

\1'01.

15, 2, pp.

S.!the.rland, I . E., "'lllree D.irrensional Data Inpul by Tablet," Proc. I EEE,


vol. 62, 2, pp. 453-461, April 1974.

CHAPTER 4
PLANE CURVES

4-1 INmOIXJCTI ()'~


Today a multitude of t....">Chniques are available for ltli1lllla11 y drawl.OCJ and
designing curves.

'Ihe instrunent userl can be chosen fran

pencils, pens , brushes, knives, etc.

A m1pass,

stra~ght

wide vanety of

edge, French curve,

ships curves , splinBB , tmplates, cm:l nany other rrechanical devices , as 'h'el.l

as r.odels , col or dta.rt.s , and perspective grids , rnay be used to assist in the
oonst:.rucLion of a c:urve.

A great

many different techniques and tools for cuxve

generation and display will also be needed \</hen using oatpUter graphics.

sare

of the ideas that have proven useful for generating plana, o.o-<11mensional
curves

ill'e

discussed in this chapter .

The previous b.o chapters have treated the transfo.rrt\ation of points.

curve may be presented by a rollection of points, provided they are closely


spaced as the niC3i us of cw:vature decreases.

Hc::lwe\ler , there are several

reasons why a mat:rematical representation of a curve has an advantaqe over its


representation by a grid of points .
1.

SOrre of these are

A !Mthatatical represen~ticn is precise, and the properties of the

curve such as slope and radius of curvature can be eas.Lly calculated .


rra~tlcal

2.

3.

~s

representation can be mt,w=t.ly stored

1.n

a cooplter.

o! an object represented mathematically in a muputer can

be easily ptcduoed.

4.

\\hen

C'lli"w"eS

1.nterpllation schsre

are analytically defined over the region of interest , oo


l..S

needed to cxrpJte in~te p::>i.nts.

'nle use of p::>l!'lt.s to represent curves has proven difficult

5.

\ooile."l it is

desirable to o::ntiru*"llY alter t:he shape of the curves to reet certa.L.n des1.gn

cr.1.ter.ta.

A rmthrn-atical representation of the curves has prove."\ t:llCh r.ore

cse.ful !or t.his PU-"1X>S8

we

ro.~

consider various techniques for math!!\atically

repre~ti.ng

tiNO-di.rre.n-

sio.na!. curves.

4-2

tb~PAAAVETRIC URvES

Either a p..lranetric or a nonpararretric foon can be used to represent a


CU..""\;'e mat:hm.atically .
A oonpararretric expressJ.on can be explicit or inplicit
in form.

For a plane curve, the explicit, nonparamettic expression takes the

form
y f (x)

(4-l)

Il' this fonn there is only one y-value for each x-value.

For t:lus reaso:'l the

explicit fotl':' cannot represent closed or CJ.l.tiple-valucrl curves . 'lhis limitat.la'l can be overCXXll!' by usin<; an inplicit eJ<preSsion of the fonn
f (x,y) = o

{4-2)

Hc7..Jever, a p::>i."\t on an in'plicit curve se;:p.eat rrust be calculated by fl.nd.ing the

.-..

correct root of an algebral.c equation.

'!he detem.ir.aticn of roots of inplicit

curves satctiJres requires le."l~ calculations .

Both eJ<plicit an:i iltpllcit nonpa.."'"ar'etric curves are axis-dependent.

'n'lus,

the choice of the coordinate systen can affect the ease of USl.nCJ the curves and
calculating their properties .

In spite of tl-.ese li!r.itations, nonparametric

curves have been 115M with success (cf Refs . 4- 1 and 4- 2) .

Silrple s.:ca'ld- and

thlrd-degrec cqwtions provide a wide vnriety of curve forms.


Fl:an a rotharatical p::>i.nt of view,

la'o..n set of data p::>i.nts

l.S

t:r.e problem of defining a curve frau a

cne of interp:>lation.

'lbe c:u.rw can be made to pass

tl'lrough all Jcnc:Mn t:0i:1ts by use of ?Jlyncnial i.nterp::>lation.

'lhis requires

~ter:'ilining the coefficients in the ll'Btheratical equaticn for a ?Jlynanial of

SOI'e ~ee.

~ actual

shape

be~-en t:.he data

p::>ints dept!nds

lplt'l

the order

o! th:: p::>lyroniaJ and the Ntheratical t:oundary cxmd1t1.ons "'hlch are applied.

:. the other hand, i f

data p::>ints are only approxit!ati.o:".s to sare

unknown "true" ~ues, then a curve is required which indicates tht: correct.
trend of the datu.

L"l general tlU.s curve l'l'c'lY pass t:hrou:jh ally a few data

FOint:s an:!, in fact , may not pass t:hrough .lilY of the data FO.i.nt.s.

'Ihis

PU\t.:F. OlRVES 91

requirmcnt exists when

fran

<:1

curve is needed to fit (intc.rpolat.e) data obtained

exper~tal

rroasu:rarent.s or other observed data.


est:imaled values over the r<UlCJC of observaticn.

This curve ht. glVes

\\hen the data points inherently conbin unc::ertainb,..s, the rrethod of least
squaros a.Ff>r<UJT'dtion is a cx:mronly used curve fitting (or c:llJ:'W fairing)
technique. 'this technique prod\IO:lS a curve fit of pr~ fonn y c f' (x)
~ch

minimizes the sun of squared y-deviations bcb.t.>en the observed and

estimated values.
{:tlysical

'!he

~n

pn;scrib...~

fonn

usually b.:tscd oo a Jcro,.rlcdgo of tho

whl.ch produced the data.

CCmronl.y prcscribe:J e><plicit, nonp.;u-curettic forms used in the least squares

technique are fOI-& functions , ~~tial functions, and polyrx:mials . l\ fX"""Cr


function might be prescnbacl as y = axb and c'lJl eJqX>nential fonn as y ,. aabx,
l\ general p:>lynam.al has

\\ilere a and b are constants.

c-r2 + . + crml,f. ReqardltSs of


techm.que requires solv1.ng a

sel

the presc:riOOd

'1

the fonn y =

C\..II'V\!

-+

C'r +

fonn, the least squares

of sinultaneous, linear algtiliraic equations in

order to determine the I.ITlkzv..m constants in the prcscr1lxx! equation.


Z.bst mrp.1ter facilities have library programs for least squ,...rc curvo
fitting .

Reference 4-3 oontaUlS a "'ell docunent..ed BASIC alC]Orittrn which irrple-

rrents this technique. For t.ha r~ of this chapter~ consider plane


curves which pass through the spccl..fied data points.
A general secord-deqree, urpll.c1.t equatloo
2
2
ax + 2bxy + cy + 2cy + f

.lS

"''ritten as

=0

(4-3)

If the curve is defined rc.J.ativc to a lOC2l coordinate system through which the

curve passes, then f ... 0.

By c.Wfi.Jung

the oonstar.t coefficients a, b, c , d , e,

and f , several types of plane curves can re produced.

Hound'lry oonditions arc

used to establish a particular curve through specific pomts , as shown below.

rf we now choose c =- 1. 0 m t:h.o genPral equation, then


~t

bcb.leen

l:w:)

to

dcf inu a cu.rve

[X>ints , hve independent oond.itions rust bP specified

determine the values of the remaining five coefhcients.

to

one choice is to

specify the position of the 0..0 end points, the slope of the. curve

segrrEnt

at

each end point, and nn i.nt.e.rn:;odiate point t..hrough wtuch the curve ITUSL pass .
If, instoad , \,~ specify b

=0

nnd c == l.O, then the rmalytlcal ~scription

of ti'C resulting curve is fi..xcrl by specify.iJlg only four additional oonditions,


su:::h as the boo end points and the u..o end slop.>S. An even s.wpler curve can
be defined t7j first sct.:ting a 1.0, b 0 , and c

1.0.

'Then t:.hc fonr of the

curve is given by
x

+/

+ 2t1x + 2ey + f = 0

'1lle three. ex>nd.it1.0ns rcqu1rro to flx d, e , and f can be the

(4-4)
1:'-0

em

po1.nts and

e.1.thcr the slop.. at the bcqi.nning or the sJ.or;c at the end of the curve: ~~t .

1\oot.her chou:e is to specify the t...o end IX>ints and a third internal rx:>int
through \o.hich the
A ~ght

curve nust pass.

line is obtained by setting a b = c "" 0 .

~ the

equatioo

is

dx+ey+f .. O

(4-5)

or
y

-(~)X

~=

11'0(

where rn is the slope of the straight line.

+ b

(4-6)

'Ihe values of m and b are fixed by

spec1fyi.ng the t:'-0 end points of the line.

create an inflection point in the curve ~t , it is necessary to use


a hiqher order curve such as a cubic. 'llris curve formcan be expressed by
'lb

3
a + bx + cc 2 + dx - y ... 0

(4-7)

Specifying the t:'-0 end rx>ints and the slopes at these two p.:>ints fixes the

values of the four coefficients.


A difficulty

arises \,'hen using axis-dependent nonparanetric curves i f the

end rx>int of a curve has a verti.cal slope relative to the chosen ooordinate
system.

'lhi.s infinite slope cannot be used as a ni.JI'et'ica.l bourdary conditi on.

It is necessary to change the coordinate system or approx.iJnate an infinite slope


with a l..arqe positive or negative value.

FUrther, when points on an axisdependent nonparanetric curve are calculated with equal i.ncrem::nts .in x, the
positioo of the rx:>ints will not be distrib.rt:ed evenly

curve .

alCI'lg the length

of the

This can affect the quality and accuracy of the gra{irlcal outplt..

difficulties lead to an interest in para!'llrtri.c curves for <XIiputer

'1hese

gra~ .

q_3 PAAA"ETR I c WMS


In paranetric form each cxxmlinate of a point oo a curve is represented

as a flDiCtion of one or nore paraneters. For a curve of one pararreter, the


p.:>Sition vector for a p:>int on a curve is fixed by all! val ue of the pare.rceter .
If the parameter is t and the curve is t:INo-diJTcnsialal, one writes
X= f(t)

(4-8)

y .. g(t)
The

positioo vector for a point oo the curve is then a single

ro.1

matrix given

by
P(t) = [f(t) g(t) J
(4-9)
If required, the nonparasretric fmm can be obtained f:tun the pararretric form by
eliminating t:.re paraooter fxan Fq. (4-8) to obtain one equatioo in terms of x

and y.
In a<k:tit1on to sinple curves, the paramet.rlc form is suitable for

PlANE OJRIJES 93

representing closed curves and curves


with multiple values at a given value of

an independent variable . 'nlc ~t


vector at a point on a para~"retric curve
l.S

given by

P' (t) =

Y-~

( ) L - -_ __

rx y' 1 ::r

[f' (t) g' (t) 1

(4-10)

10

~ the ' denotes differentiatial with LOt---._

_.

respect: to the

parar~eter .

the curve, dy/d.x, is written as

the tenn f' (t )

=0

I /

';.

in El:). (4- 11) ,

occurs~

Since an

one

= COS;J

y = sw.J

--

I I I"' // / """

: ~/

the s l ope dy/dx is infinite.

infinite slope

I I

(4-11)
~-b!n

'lbe slope of

./

_..--

--

10

10 t--...._

c:atp:>nent

of the tangent vector is equal to zero,


)

it ci:>es not introchx::e cx:mp.ttational


difficultics.

Since a point on a para:netric curve o ...._...__


is speci fiEd t:Jy a single value of the

parmreter, the parametric fornl is axisindependent.

"'

Figure 4-1

I0

Circle r.::prese.ntatia'\5

'lhe curve length is fixed by the range of the pararreter.

often convenient to noonalizc the parameter so that the

It is

par~t.r:ic

curve falls
between 0 ~ t ~ 1.0. Due to its axis-independent nature, a parametric curve is
easily transforned into a curve of the sarre shape but wi. th various orientatioos.
'!his is aooatpli.shed by using the tratrix multiplication techniques discussed in
the previous chapters to perform rotatioo, translatioo, sca1ing, and perspective

projection.
A ooopa.rison of the parametric and nonparametric form of a circu.l.a.r arc is
sllOn'n

in Fig. 4-1.

'1'hls figure was used by W:lodsford (Ref. 4- 4) to sln4 that

a choice of pararretric functions can be used to inprove the distritution of

gra,;hlcal repr-esentation. The


gtadrant of the circle shown in Fig. 4-la is represented by the non~tnc
fouu y = h - x2. Equal increments of x were used to obtain the FOints on the
arc. '1his form is inconvenient to catpJte because a square root algorit:bn is
necessary. It also produces fOQr results since the arc lengths are unequal.
Figure 4-lb is obtained fran the hr1sic parametric form given by
(4-U)
P (t) [oose sine]
'lhis produces good output since the arc l engths are equal, but the calculatial
is inefficient because trigJa'I'Ctric functioos require several operations to
catpJted points on a curve and thus give a better

<XIItpute.

Figure 4-lc is an alternate paranetric representation gi'V'Cn by

2
(l - t )

2t

+ t

(1 + t

rd l
Where t tanS/2 .

2)

This choice requireS very little

cx:Jil'lltation t.ine , but it is

a oatp:anise si.Jx:e the arc lengths are not exactly equal .


~,

consider the problan of determining the value of y

x is known.

\>~hen

the value of

As an ex.anpl.e assure that x 0. 5 and that it is required to deter-

r:u.Ite y a1 a unit circle.

For the explicit representatioo this is straightfor-

ward:

= A:

- x2 "' {0. 75 = 0. 866

For the para.rrotric representaboo it is first nece~ to solve for the p!U"a-

rteter t in terms of x and then use this value to obtain y .

Specifically for

the parazretdc representation of Eq. (4-12) we have

x cose
y =sine

Thus,

e = cos-lx =

ros- 1(0. 5) = 60
y = sin(60) = 0.866
Alternately, far Eq. (4-13)
X

2
1- t
- .;;.........-""
- 1 + t2

y -

2t

1 +

Solvin9 the first of these equat.ions for t yields


t

1 - X l/2
<t + x>

= /'1 =

0. 57735

and thus

y =

~~ =

4 = 0 . 866

For rrore <Xlitpllcated pararretric representations an iterative seaxdl technique


rray be 11ore convenient to firrl the unla'loNn values of an e><plicit variable.

4-4

tbPARAiflRIC

REPREsENTATIOO

a: Coorc SEcn oos

COruc sections fonn useful planar curves for rrany applicatialS.


S\J'!'r"drize sonc useful relationships frau analytic gcarotry.

~'Je ro-;

Figure 4-2 ill-

ustrates hc:Jw the intersection of a plane and right circular oone defines the
various conic sections, i.e., the CliCle, paralxlla, ellipse and hyp!'rtx>la.
The general definitial of a cadc section can be given as:

..
PLANE OJRJES 95

,
/

d
( 11

Figure 4-2
A

de

Cooic Sections

conic section is a curve described by a p;:>int which rrovcs

such that its distance fran a fixed p;:>int (cal led the focus)
divided by its distance fran a fixed line (cal 1 ed the directrix)
~

a constant

(called the eccentricity) .

All the c:ooic sections can be described by the general i.rrpl.icit

sec:::oro-

degree curve

ax2 + bxy +

C'i + dx + ey + f

: 0

'rtle cross product term bxy in this equatjoo oootrols the orientation of the

resulting

CCIIUC

with respect to sorre reference axis system.

If the reference

axis system is selected such that one of the a.~ is an axis of symretcy of the
curve, then b 0 . Since we can always rotate the curve such that. the axis of
S}ITI"'retcy is one of the axes of the reference systan, we need ooly consirler the
equation
a x 2 + c y 2 + d ' x ' + e ' y ' + f ' = 0
2

a ' - acos a + bcosasinet

(4-15)

+ csin2a.

c' = asin2a - bswcosa +


d ' = dcosct + esino
e' -ds:i.na + eoosa

ect:JS

f' = f
and

cot(2a ) .. a - c
b

(4-16)

Alternately i f the curve exists such that cne of the refereooe ~ is an


axis o f symretry, then iL can be rotated through any angle a to a new on.entatial.

If the coefficients a', c ', d' , e ', and f' are known far the original

axis of symtetry orientation , then the coefficients a, b, c, d, e, and f o(

Eq. (~-14) in the

rcw orientation are


2
2
a = a'cos a + c ' s1n c
b

= 2 (c '

- a' )cos~in,)

(4-17)

2
c = a I s1n
o ... c 1 cos2o
d :: d 'coso. + e ' siro
e :o e'coso. - d 'sino

-.

f - ...
Equatl.On (4-14) em then bo used to generate the requued curve.

'Ihe character of

conic dcscritwi by Eq. (4-14) is an ellipse, a para2


oola, or o hyperbola, de~~ing on t.l)e value of the di.$:r.i.minatc b - 4ac
(cf Ref. 4-5)

..

Narrely,

a parabola if b

th~

- 4ac

c:urve is

=0

an el11p5e or a circle if b 2 - 4ac < 0

a hyperbola if b 2 - 4ac > 0


Considen.."lg Eq. (4-15), a CJ.rcle occurs if a' = c ' .

'1l'le equation of the

cuclc with ce."lter at n, k and radius r is given by

(x ' - h)

(y' - k)

~ r2

(4-18)

h = ~
2a'

~
k = 2a'

r ~O

4a' 2

If r = 0 , the circle degenerates to a point .

A parabola occurs if a ' :; 0 and c ' = 0.


equatlal of the parabola is
(X ' - h)

\\'.ri t ten in the camon fox m the

(4-19)

4p (y ' - k)

h:: - d'
2

e'
p=4

= 2f '

- d'2
2e'

e 'JO
r

Equatioo (4-19) represents a paratola "-OOse axis of syrrtl'ntry is y ' .

If

PIA'IE ClJRVES 97

the roles of x ' and y' are interchanged, the x'-axis will oo the axis of

If p > 0, the parabola will open up or to the right; if p < 0, .1t

S}'ll"l'l'et.ry.

will open do..n or to the left.

occurs when neither a' nor c' in Eq. (4-15) is zero and both a '
the sane S.lgn,

. ...___ I 1 > 0. 'Ihe equatioo of the ellipse with


.l.e.
1 wucu a c

An ellipse
- -'
and c I 'nu.ve

oenter at (h,k) is then


(x' - h)

..

(l

> 6

(4-20)

(l

-d'

= 28'

k""
(l2

-e '

= ~

e2. ~
c
c;ao

g = -f'
\~

g =

o,

a point results.

'!be eccentricity of the ellipse is

I Q2 -

B2 < 1

A hyperbola is generated by Eq. (4-15) when neither a' oor c' is zero and

both have opposite signs , i.e., when a'c ' < 0 .

'llle equat.ioo of the hyperbola

with center at (h, k) is then

(x ' - h) 2

cl

(y ' - k) 2

- - 82

~1

(4-2la)

or
(y' - k}

(l2

(x' - h) 2 - l

B2

(4-2lb)

d' 2

= - f' + 4a

e'

+ 4c Cf?-O

If g - 0, the hyperbola degenerates into a pajr of intersecting straight lines.


NoW that in the

case of a hypertx>la the

d.irect..i.on of opening is determined by

the signs of a ' and c' in ccnstrast to an ellipse , \oo'here the orientatioo is

cootrollro by the relative signs of a ' and c '.

'lhe eccentricity o f the hype.r-

tx>la is given by

c ...

lcl + r?- > 1


(l

4-5

fb.wARAt-ETR IC CIRCUlAR

AA.cs

Hany of the early techniques for curve definition were based on the use of

nonparrumtric cx:nic sections.

As long as relatively short curve segrrents

defined, coordinates CX>Ul.d be chosen which produoed rea.scnably satooth c:urves ,

even through the point distri b.Jtion was not tnifonn. The shape of ships and
airplanes were adequately defined in this manner. One advantage of this ~
was the relative ease in ca.lculat.inq the intersectioo of boO curves, each defined
by nonpt\I'atretric, algebrAic cquatioos.

COOsider the ooterminaticn of a circle through three paints given by


[1 1) , [2 2] , and [3 2] respectively (see also Sec. 4-11).

'lb generate a

circle through these points , let a ' = c ' = 1 and write 6::). (4-15) as

where

\..e

+ dx + ey + f = 0
have drop{led the prines for coownienoe.
x

Evaluating this equatioo

clt the three points yields

2+d+o+f""'O
8+2d+2e+f=O
l3+3d+2e+f=O
Solving these three equations for the three unknowns gives d -5 , e -1,
and f 4.

Thus, the equation for the ciro1l ar arc through the throe given

points is
X

+ y 2 - Sx - y + 4

= 0;

:S_

The omter of the ciroJl ar arc is located at x h

e/2a - 1/2.

Using Eq. (4-18) the radius is r

tiation of Eq. (4-18) yields


2xdy+2ydy-SdyO

~2a

= I!0/2

= 5/2

and y k

"' 1.5811. Differen-

r
~ -

dx -

5- 2x

<2Y -

1)

I t follows that dy/dx 0 when x .. 5/2 and dy/d.x - a. when y

= l/2.

However ,

oote that this infinite slope docs not occur within the arc ~ent oo~
[11] and [3 2].

When

a1e

creates curves for use in <XIIplt.er graiilics , c:onsldcration ru;t

be given to how the user will define the curve.


t.O

create a circular arc ,,n.th a specified radius

For exlUTple, u . may be


~ ~ end

~sctry

poUlts, rather

than passing through three specified LX>ints as in the preVicus ex..:mple.

Exarrple 4-2:
Let the

o.o

CIK"ULAR 1\fC WI'1li FIXED AAD.ItS

end points be [1

quire a radius of r = 5.

11 an1 [3 2) as before.

In addition

we re-

Fran Eq. (4-15) we obtain the three equations whidl

result ftom these three cocilitions:


2 + d+e+f=O
l3+3d+2e+f=O

25 ;;

+ e 2 - 4af
2

4a
'Ihe solut1on to the

a}:x)ve

eqwUons

terms in the third equation.

l.S

nnre difficult due to the non.l.inear

An .tterative techni~ l11.lSt

oo

used.

By trial

and error, it can be sh:::Jwn that an approximate solution to the above set of

equations is

d - -8. 4

e = 5.7
f

o. 7

for a = c = l.O
Thus, the center of the cucular arc which r:rects the .irrposed oonditJ.ons oocurs
at x = 4.2 and y - -2.85. 'lhe arc no 1onqer passes through the int:.ermed.iate
LX>int (2 2].

on the other ha.rd, it may be necessary to oontrol the slope of the c..L.rcular arc at the initial and/or final powts. 'lhls can be done by choosing an

alternate set of caditicns.

E:xanple 4-3:

CIR:lJI1\R Me l..zt'IH A FDCFD

1u~

NG

:If an init1al slope of +1 is required at (1 1) and a final slope of zero

is necessary, then the final point oo the circular arc cannot be


spew..fied. For this case, we require

.11'll~lendelltly

at: X 1, Y 1

at x; 1,
at x

'lhese

~~

dx y. 1

= 3, ~;

"" 1

ocnditicns lead to
2+d+e+f=O
4 +d+e:::O
6 +d . 0

\olhich has the solutioo d = -6, e = 2, f = 2.

The equation for the circular

arc is thus
x

+l

- 6x + 2y + 2 = 01

Not1oe that x "' 3, y ~ (-2 ~ 132>/2

= 1.828;

~x

.S.. 3

i.e . , the final point is [3 1.828) .

If the final point an a circular arc truSt be spectiied, then only cne end

slope can be specified in additioo to two end points.

For e.xanple , to produce

a fillet between two straight lines, one might specify the initial point, the

final {Xlint, and the final slope.

Exanple 4-4:

CI10.1l.M .Ale WI'ni GIVEN END SUlPE

Given the end points [1 1] and (3 2) with dy/dx 0 at x ,.. 3 yields

2+d+e+fO
13 + 3d + 2e + f "" 0

6+d:::r0
'1hen d -6 , e 1, and f 3, with h 3 , k ~ l/2, and r -- 5/2.

luticn prcx:h:es a slope of 4/3 at the initial {Xlint.

'lhis so-

'Ibis may be t.maeeeptable

and an iterative so1ution nay be requi.rea to find a final {Xlint ~ch allONS

an acceptable initial slope.

An alternate approadl

is to require the user to

specify the radius wch will pnxluce acceptable slopes at the two end points

and to proceed as in Exanple 4-2.

PIAN 0JRVES 101

'lbese

~les

illustrate the problems encountered when trying to provide


~

a catJlUter software (or haJ:d\..'are) interface between

usPr and the graphlccll

'Dle creatioo of the desired curve may be straightforward, or 1.t rray

output.

require iterative techniques, depending oo the known or de!Sired charact.eristicn


of the curve.

Even 1Nhen the required equation for the

tions which produce \tlell-distributed (X>ints aloog the

Kno..m, calculamy be expensive in

C\.1IV{? ,l.S

C\l.t'W

Further, ~ nooparrureLric curves are created, care


nust be taken to find the real roots rather than iJMqiJl.'1ry ooes, and i.ndcpandent
terms of

<XJlllUter t.itl'e.

variable step sizes between consecutive data points may require


upcc1

<::ha.niJes based

the local curvature and ooordinate system.

c:Dlsider again the problem of pa.ssinq a circular are through three pomts.
If the points are far renoved fJ:Cil\ the origin of the coordinate systEm, l<m]e

values of the coefficients can occur. To avoid this, translate the origin or
the original coordinate system to the first point and define a new ooordi.nate
syst:en x'y' as shoNn in Fig. 4-3.

The coordinates of the three points, relative

to this transfOl:'lred system, are then


p

= (0 0]

((Xi- Xo) (yl- Yo))= (xl Yil


[(x2- xO) (y2- Yo)) lxi Yil
Since x

f'

= 0.

0 Yo = 0 due to the location of the transfonred coordinate system,

'lhe other t-..-o equations, obtained by evaluating the general equatioo

at P and P , are
1
2

x12 + y12 + d'~l + e ' y 1' 0

Xi2 + Yi2

+ d'Xi + e'yi

=0

SOlving for d ' and e ' yields

d'

e' ;

Yi )

Y2 (Xj_ + Yi ) - Yi (Xi +
<~i xiy~)

Xi(~

+ Yi ) - x]_ <Xi +
lxiY1 -

Yix2)

Yi )

It foll.ONS that the center of the circular arc, relative to the

nate system, is

x' _
c--

d'

:za' -

Yi<~
l

+ yl' ) - Yi(x'
2

<XiY2 - '91)

+ Yi)

x'y ' -coordi-

'lbe center ooord.inates relative to the

origir.a.l coordinate system are silrply

xc = x'c + x..u

>I

Yc .. yc' +Yo
\<.'hen f.Oints of intersection, offsets

for cutter tools , enclosed areas or


wltr"eS , or other such geatet.ric infor-

mation is needed, the required calculations nay be si.nplifl.ed by expressmg the


equatioos in explicit
form.

The explicit

form of the circular arc is given as


either y f(x) or x g(y) .

In t:erms

of the ooefficicnts of the general secondorder p:llyrouial equation, the first foon

is

y' = -

e' !

k2 -2 4(x 2 + d ' x ' )

and the second form is


fl.gure 4-3

Translated coordinate

x ' .. _ d '

system for a circl e

,42 -

4 (y '

+ e ' y')

In these fams calculations such as an area given by /y ' dx' or intersect:.i.ats

of the cucle with the ll.ne y '

ltD('

+ b can be rrade using rrat:henattcal tec::h-

ru.qucs.
As an exanplo of the generation of a na1paranetric conic sectioo, an al-

gorit.~

c.

far generat.ing a m1iplete circle nonpararretrica1 ly is given in Appendix

'Ihe ba.sic oonoept behind the algorit:lJn is that near the x....axis equal

incrcm:mts in t.y are used.

'111us, between y

!JX are used, and between x ... t r

12 and x

=0

and y

= .t

r 12 equal increments

== 0 equal 1.nc:rercnts in t:.y are used .

This algOrithm allows only multiples of eight f.Oints .

Further , to avoid prcbl ems

with the square root of negative nurrbers , the absolute val ue of the square root
ar~t

is used .

'lhc algorithn is carplicated and inefficicnt.

An exanple

of a full circle generated. with this algoritl'ln is shown in Fig . 4-4.


erates reasonable circular

se<;Jrel1ts

very cnrle segrrcnts elsewhere.

It gen-

in the middle third of each quadrant , but

t-bre points can be nsed to i.nprove the result.

If a sttt:X)th gra}:hical output is the prirre consideration, the pararrotric repre-

sentation subsequently discussed in Sec. 4-7 is rec:anronded.

4-6

PARNURIC REPRESEtiTATIGI OF WHC SECTI<l4S

PIA'IE OJRVES 103

A pararretric rcpresentaticn of conic sections is of interest bx:ause it


prodUces axis-independent curves.

curves for soue applications.

'111ese can have udvantages over nonparanetric

~vcr,

neither type of curve repr:esentat.ion is

a panacea, since both have advantaqes and disadvantages and both find uc.cful
applications in CXX'!t'Uter graphics.

'lhe conic sections can be s.inply represented in param:!tric form.


origin-centered circle can be paranetrically repxesentcd as
X = ro:>SB

(4-22)

y : : : rs.ine

(4-23)

where r is the radius of the circle and e is the parcuroter.

In sec. t1-3 ~

remarked that although equal incrementS of 6 \Qlld produce gcxxl output

a\

display device , the calculation was inefficient because the trigonaretric functions rrust be repeatEdly calculatod.

Followin<] Ref. 4-6 we shall show below

that a nore efficient algorithn is possible.

4-7

PARAt-1ETRIC RePRESENTATIGJ OF A CJRCI E


'!be circ:L! can be efficiently represented pararretrically by eliminating

the neoessity for calculating the triganretric functions at each step.

'Ihis

can be accouplished by using the double-angle fornul.as:


cos(9 + d 9) = cos9cosd9 - sin9sind9
sin(e + d9) = cosesinde + cosd9sin9
Noting that the circle will be cxxtpletely swept out for a range of 0 fran 0 to
2n and assuning that a fixed numer of p:>ints will be used , then dO will be a

constant.

TOO cartesian coordinates of any point on an origin-centered circle

are then given by

Xn+l

yn+l

= rcos(O
= rsin(9

+ d6)

(4-24)

+ d9)

(t1-25)

using the double-angle f orrrulas allows Eqs . (11-24 ) and (4- 25) to be rewritten as

xn+l = x 0 oosde - y0 sinde

(4-26)

yn+l = ><nsinde + yncosde

c4-2n

I f the circle is l ocated at h, k r elative to the origin of the coordinate system,

then we have
k)slrlde

(4-28)

+ (xn - h)sindB + (yn - k)cosd9

(4-29)

><n+l - h +
yn+l = k

(~

- h)cosde - (y0

A BIISIC subroutine incorporating this algorithn is given in Appendix

c.

since dO is constant, the values sinde and cosd8 rx:ec1 to be calculated only

once.

nus

ptoduces an efficient algorithm.

'lhe results of using this algorith:n

are stn.n in FUJ. 4-5.

4-8

Notice the equal spacing of the points.

PAEWEIRIC f?EPRESENTATIOO OF N-4 ElLIPSE


Fran the results or the circle

note thAt a fi.Xl:'d

,.~

n~

of points pro-

Vlded a tp:)d representation of the circle w1len <XX'U'lCCt.ed by short straight vector
\<r'ith a circle, the distributi.a\ of that fixed nurber of points 1.S obvicus equal-angle increments. Jb..~ve.r, for an ellipse, i f equal angle increm:mts

are ns'' to calculate the display points, an unacceptable rosul t will be obta:ineC
'lhis ls particularly true for el 1ipses with high eccentricities (E: = 1) , as stn.1r

m Fig. 4-6.

Here we see that the ends are not lldequately represented.

'lhl.s is

because ncar the ends of the ellipse the curvature is too large to be representee
by a f(!.N points.

.. ,

An alternate rrothod might be to use equal perirretcr lengths .


cjent. n\.J!li:)cr of lengths this ~d give a better representation.

ell1p5e would be overspecified a.l.ong the sides,


with a resultant waste of cxxtputer t:ine.

"nere

For a suffi-

Ha.--eve.r, the

the curvature is stall,

Further, as pointed out in Fe!. 4-5,

deten'ninatioo of the equal per.im::ter l engths involves calculation of an elliptl.c

Fiqure 4-4 Crude nonparametric


representation of a circle

Figure 4-5 Equal-angle representation


of a high-t>ccentric.1.ty ellipse

PIA'lE aJRilES 105

Figure 4-6

Equal- angle representat.ioo of a hiCJh-ecccntricity ellipse

periJreter length near the ends , "''here the curvature is l.arqe, and larger

pe.ri-

rreter incresrents along the side, where the curvature is smll.l .


To ove.rcx.xre the problEmS of (Xlint distri.butioo, consider the pararretric

representation of an origin-centered ellipse of san.ilrajor axis a and semiminor


axis b .

'Ihen

"''here e is again the paraneter.


ellipse.

X = acos6

(4-30)

y = bsin6

(4-31)

Varying e beboleen 0 and 2n 5\oo'OOps out the entire

A specified fixed number of p:>ints can be used to represent the ellipse

by t:aJd.ng fixed incrcrrents in the parameter

e, say,

increments of 2n/ (n - 1) ,

where n is the nl.llt:Jer of p:>ints .


xamininq the derivatives
(4-32)

dx - -asin6d6

dy

=bcosed6

(4-33)

shc7.ols that the desired perimeter i.J1crenents are aut:aratica l ly ootained.

e is near 0 or n, 1.. e ., near the ends, \ole have ldxl ;. 0


e is near Tf/2 or 311/2 , i.e . aloog the sides , jdxj .: ad6
near the ends

have mre p:>ints and alOJYi1 the sides

and
and

fe~~~er

jdyl bde~ and ~


jdyj o. 'nlus,

(Xlll\ts.

In fact

the ratio of the peri.Jreter l.ncrerre'lt size at the ends to that a lon<J the sides

is approx:irrotely b/a.

Further, note that in the case of a circle where b = a

the optinun representaticn also results ,

i.e., equal peri.rreter or equal angle in)

crements

Since equal l.OCrcrrents in the para-

meter

e,

i.e., a fixed nurber of points,

is to be used , an efficient algorithm can


be developed by again using the double-

angle formulas (Pef. 4-6) .

I'

Here the ell i(&

;. is a5S\.IIred to be inclined at an angle i


to the horizcntal , as sJ1o..m in Fig. 4-7.

Hence

x' .. xoosi - ysini

x'

y'

= xsini

+ yoosi

(4-34)

(4-35)

or

._I

x ' "" aoos6cosi - bsin9sini

(4-36)

y ' = aoos8sini + bsin6oosi

(4- 37)

Introdu::ing the coordinAtes of the

'

center of the ell ipse yields


(4- 38)

y'n+l = yc + x'sini
+ yn' cosi
n

(4-39)

n+l

Figure 4-7

Ellipse

y'sini
n

X'

X 1 00Si -

For the recursial fOD'I'lllas, note that the ellipse algoritlTn in Appendix C uses

a SOI'I'ew'hat different technique than used previously in the circle alqorithm.


In th:Ls case a teri(X>rary variable T1 i s used in the inner loop.

Snith
I

(~f.

4-6) has sb:1h'Jl that this alqorithm can be made still nore effi-

cient such that ally four additi.a\s and four nultiplications are required within
the inner loop.

Snith has also sb:7h'Jl that this technique yields the inscriOOd

polygc:n with max.irrun area.

'nlus, the additions and nul.tiplicaticns give an

efficient representation of the el] ipse , such as the CX81Tple shown in Fig. 4-8 .

4-9

PAR#ETRJc

REPResooAnON OF A PARABCX.A

Consider an origin-centered parabola opening to the right, .i. e. , with the


axis of S}'n1'retry the positive x-axis, as shown in Fig. 4-9.

In rectangular

cxxn:dinates such a ~l.a is repl:'escnted in l"aaparaJretric fonn by

l = 4ax
A parat~Ct.ric

(4-40)

representation of F.q. (4-40) is

= tan2e

(4-41)

y = 2/itAniJ

(4-42)

'
P~

CURVES 107

Figure 4-8
"''here 0 ~

e ~ r/2 .

Pa.rwetric representation of an ellipse

Alth::)l.Jh this provides an Nlequate representatias of a parab-

ola, Smith (Ref. 4-6) points out that it does not yield a figure with ma.xlrruml
inscribed area and thus is not the rrost efficient rcpresentatioo.

An alternate

parametric representation which does yield ma.'Cirrun inscribed area is


X=

a62

2ae
5"'-eeps OUt the entire parabola.
Y

~'here 0 ,S_

e s_

(4-43)
(4-44)

'Ihe parabola, ~Vcr 1 unlike


the ellipse, i.s not a closed curve. Thus, the arrount of the parabola to be
displayed must be limited by ch:losing a nruci.murn value for a emax. '!his can be
done in a variety of ways; e.g., the range of the x-cootdinato c:ou.ld be l..uru.ted.
If this is done then
CD

max

=/~
a

(4-45)

If the range of tha y-c:oordinate is limit.ol, then


Yrrex
emax; 2a
Once

emax

(4-46)

is established, an algorithm to calculate N rcpresentatl.ve points for

the parabola in the fl..rst. quadrant can be de~loped.

Once the parabola is obtair

ed m t:re fl.I'St quadrant, the rest of the parabola Wich appears in the fourth

ocu~

Figure 4-9
~ant

Para):x)la

can be obtained by reflection al::out the x-ax1s (cf Sec. 2- 10) .

An

appropriate alcprithm to obtain the required points in the first qu!ldrant is


given 1n Appendix c . In the algorithm a fixerl ntri:ler of points is specified

e is

and a constant i.ncreme.nt in

Parabolas with displaced centers or at

used.

other orientations ca.'"l be obtained using rotation and translation.


For en+l

= an+

d e , Eqs. (4-43) and {4-47) beoare

~ 1 ~ aen2 + 2a9nd~

+ a(de)

yn+l ~ 2a9n + 2adS


o,..hl.ch

~ray

be written as

~1

..

+ y0 da + a(d9)

(4-47)
(4-48)

Yn+l .. Yn + 2ad9

F.lgure 4-10 s~'S


relationships.
For

s~ifl.c

a."\ ~le

of a parmx>la generated using these recursion

purposes other pa.r21r00t.ric representat.Wns can be rore useful .

1his generally depe.."lds on the info:rmation specified by t.~ user.

a parabolic arc is to

oo drawn

bet~

For ex.a:rple , i f

t:"..o points, and oontrol of the end slopes

is necessary, then the folla..t1.ng form .lS suggested:


X (t)

= (0'"Y.

- -2R'):

P X) t

+ 2 (RX - PX ) t + PX

0 -< t < 1.0

Here the paraxreter is t, and the t:'NO end points of the paral:x:>la are P

arx:l Q (~ ~~.
end ta.'1getlts.

= (Px PYJ

11\c \-)

is the point of lntersectlOn of the t..o


call this rethod the vertex definitjon of a paral::ola , since

The pomt R

use of t.hrcc vertices P, Q, R defi:~es t.~ paral::ola as s.l-o.n ln Fig . 4- 11. A


rrore general method
defining a C"..!n't! by use of vertices of an CJFetl 01)'901"1
was developed by Bezier and is d.lsc.lSsed iT t:he nex-c chapter.

o=

Pll\NE ClJRVES 109

Figure 4-10 Parabola generated by the PARAOOIA alc;priilin

4-10

PAIWIEl RIC RePRESENTATI~

a= A HYPERBOLA

As was the case for the parabola, we asst.~te that

we want to generate a

hypertx>la which is origin-centered, with the axis of symretcy being the positive
x-axis.

'Ihe rectangular nonpararretric CXX>rdinate representation of this hyperbola

is

which inplies that the vertex is at a


and the asynptotic slopes are th/a.

parametric representatia'l is given by

where 0

x "' tasece

(4-49)

y fbtane

(4- 50)

s e ~ n/2

hypet'OOla.

yields the desired

smith (Ref. 4-6) points out

that with this pa.rametric representation


the inscribed p:>lygon is not of rrax.inun

area .

Ha..oever, it is of nearly rnax:inun


area, and t:r.e dcuble-angle fonrulas can
be used to yield an efficient algorithn.
To see this recall that
1
sec<&+ de) = cos (e + dO)
-

- cos660Sde - si.neSillde
and

tan(e + de) ~ tane + tande


1 - tanetanae

,,

't R ( R~ Ryl

1\
I
I

'

I
I

\
'

'I
I

'\ \
\

',

II

'

'1hls we may write

'b+-1 !asec

(e + d e)

= ..- bOOseab/_cose
- btaneswe

l
I

;. - ~cl

Figure 4-ll Vertex definition of


a parametric parabola

and
~n+l c ~ btan (5 + d 6)

Yn+l
'l'he algonthm HYPERBl

btan" + btarrl6
t

l - tan6tand"

b(y + btand>-)
r--~"'---::::-:---....,--

(4-52)

- b - yntand6

Appendix C uses tl'w:!se rclatiooships.

1.n

A"l alternate para11etric representation of a hyperbola which yields the


polyqt:Xl

.,.."1 th

max.i.nun inscribed area is

= acosh6

(4-53)

y = bsinh&
'Ibe

(4-54)

h~~rtx>lic functions are defined as coshe ..

(o 6 - c - fl)/2.

l\s

e varies

(e

+ e -e)/2 and sinh& =

!:tun 0 to co the hyperbola is traced out.

'll1e double-

angle fonnulas for CDsh and sinh are

'

CDsh(& + de> = oosheooshde + sinhesinhde


sinh{6 + d6) = sinh6coshd6 + cosh6sirurle
'nlese allow wrib.ng tqs. (4-53) and (4-54) as
~

= a(cosh6coshd6

+ sinh'-sinhd6)

YOTl = b(sinh- coshd& + c:osh~sinhd& )

or

~l = x0 coshd + ~ y0 sinhdt1

(4-55)

~ x0 sinhdfl + y0 coshd6

(4-56)

yn+l =

was the case for the paralx>la, the trax.iJtun value of e = enax nust be set in
order to limit the extent of the hyperoola. I f we coosidcr the branch of the
hyperoola in the first and fourth quadrants and wish to plot the portion of the
hyperbola for a .S. x ~ a + c, then
1\s

=cosh-l f-+c)
max
a

SWlarly other l.ilnits can be det.e.rlnlnErl.


C uses F.qs. (4-55) and (4-56) .

(4-57)

'Ihe Algorit:J"'TT ~2 given in Appendix

Since nost cx:r:puter systems do rot have hyper-

OOlJ.c nn:tions, the cxpone..'ltial relatl.ons haw been used, i.e. ,


-dj:j
d6
coshd6- e
+ e

dtl
sll\hdB = e

-dr
- e

and ths .:..nverse hypc:rbolic cosine has been .,..Titten as

PLANE aJRVES 111

cosh-lx = log(l + x) - log(x - 1)


2

An exanple of a hyperbola using this technique is shC7...n in Fig. 4-12.

4-11 Af>Rocen.RE Foo niE UsE OF Coote SEcrtCR;


In Sec . 4-5 the nonpararretric representation of a circle through t:hrc!e

points was cx:nsidered.

An essentially brute force

awroach

was adopted.

uere

we cx:nsider the sane problem; i.e., detexmine the location of ~ center and the

radi.us of a circle "hlch will pass through three specifl.c point.s.

However, here

"e divorce the problem of drawing the appropriate circle fran deteiJI\i.ning

~t

it is.
in the x,y,-cx:xm::hl'lilt~ sysl811,
1
2
3
'l1le general , na1pararretric equatl(Xl for the circle

COO.sider three arbitracy points P , P , P

as shown in Fig . 4-13.


t:hrou;}h these points is

(4-58)
+ (y - k) 2 ... r 2
in the xy-plane, direct substitution into

(x - h)

Since P , P , P IJ'ay be an~e


1
2
3
Eq . (4-58) rMY yield cxtrernely large rn.nbers .
resulting equations difficult.
nate

'Ihis ''"Ould rna.'<e solution of the

\'E! therefore translate the origin of the coordi-

syste:n to the first point P


1

As we shall see, this will also make the

,,

Figure 4-12

Paranetric representation of a hyperl::ola

'

..

\
~

l
I'

l
0

\.

'

Fl.gure 4-13 Circular arc


throogh three powts (gecr-etry)

solution rore oorwenient,

f'iqure 4-14 Circular arc


through three points (pararretxic)

Lett:in:J

x ' = x- m and y' y - n


\>tlcre m ar1 n are t.~ translatjon factors (cf Sec . 2- 27) , we have m: ,_, n,.. y .
1
Equation (4- 58) may then be written in the x ' y ' -cxxmiinate systan as

(x' -h ' )

+ (y ' -k ' ) 2 r2

h ' h - m and

(4-59)

k' = k - n

Dl.rect sub6tJ.tutl.on of the o:ordinates of P , P , P in the x'y ' -ax>rdinate


1
2
3
systen yields

h ' + k' 2 - r 2

0 for

'lbcse oguations represent til.ree equat.ioos in the three

an:1 thus may h.:! solved .

~,

h 1 , k 1 , an:l r

the systan of equations 1.s non.l.inear ard

quires an iterauve solutioo, l.lhl.ch is undesirable .

Notice,

~,

that becaus

the origin is at the first point, the fi.rst e:}Uat.ion can always be S\.btracted
fran the sec::ond and thl.rd equaUoos such that the nonl..inear t:etms are el.u:u..n.'lted.

"Ire resulting equ3t.ions are

PlANE CURVES 113

= x! 2

2x 'h ' + 2y!k'


1
1

~ - 2,3

+ y! 2

(4-60)

These are ttNo linear cquatJ.oos in the tw:> l.ll'lknc1wns h' and k ' \ohlich

directly.
2
2
h' + k' .

be solved
'llle radius r can Ulen be det&mi.ned fran the first equation r 2
CdR

its rOOius ar,- I"'CMi kno..n.


To draw the arc of the circle, we first translate diroctly to the center
of the circl e, i.e., to h ', k ' or h, k , as si10n'n in Fig . 4-13. Hith
'1hc locaLion of tl1c OUltcr of the circle and

e1

= tan

-1 yl*
,_

e2 =

and

-1 y3*

tan

x3

(4-61)

kno.m, a standard origin-oent:ered algorithn, either para~rutric or na1paranutn.c,

can be used to generate the points which describe the circular arc fran P to P
1

through P
2

CIK:UI.AR 1\0C PR:CE:I:XJRE

Exarrplcs 4- 5:

consider the three points given by P (3, 2) , P ( 4, 4) , and P (0, 6)


1

lating to P yields Pi (0,0), P2(1,2), and Pj(-3,4) .


1

Trans-

F.quations (4-60) are then

2h' + 4k ' = 5

-6h

+ 8k

!!0.

25

Solutioo yields k' = 2, h' = -3/2, and r"" 5/2 .

Translation to the center

yields P1* (3/2 , - 2) , P2*(5/2,0), and P *(-3/2,2) .


3
01

Thus, Eqs. (4-61) give

tan-1 (-2/(3/2)) ~ tan-1 (-4/3) - -53.13

82 = tan- 1 (2/(-3/2)) = tan- 1 (-4/3)

= 126. 87

'Ihis provides the angular input for the arc drawing S\lbroutine.

A parzuretric form is crosen to inprove the point distribution along the

arc.

Figure 4-14 shows the resulting pax-arootric rcprescntiltion.

used to generate this

'llle algorithn

is called 3PCI..RAR:: and is given in Appendix C.

The

pararootric circular arc subroutine was discussed in Sec. 4-7.

4-12 CJ RCULAR AAc I tfrERPa.AT I 00


The snoothness or fcumcss of a curve is generally a quahtative judgrrent

based oo t..t\at is pleasing to the huron eye.

Nevertheless, it

1.S

possible to

select a quantitative treaSUre of sztmthr1ess and qenerate curves according to


this critenon.

One such criteri.al used successfully by 1-\ehl.ll!! (Jef . 4-8) is

to minimize the inteqral aloog the arc length o the square of the cw:vature.

Curvature can be expressed as


y"

K""

(4-62)

.,here the

pr~

indicate diferentiatioo with respect to x .

Thus , the p.rcblem

is to rnini.'1lizc I, 'Where I is given by


1

= Jilds

(4-63)

The prcblem of rninimi.zinq the value of I by use of variational calculus

solved by

~eh.l~

(Ref. 4-8).

was

kl iJtp;rtant result of this solution , expressed

as a theorem, is stated as follows:

When a picce..rise curve is drawn

~'hich

mi.nirn:i,zcs the integral

al.crq the arc length of the square of the cu.r:vat.ure, then the

curve segrrents lie in a direction aloog ...nich the cw:vature varies


linearly bet\o.een the end points of each se<Jrent..
Assure that such a curve is to be

several interrrediate data points .


mic;ht loo.lc like that
K

s~n

drawn~

0.0 specified end points and

The curvature profile

in Fig. 4-lSa.

~.

I '

\OHJ;;ItOil

r I

"

these points

as pointed out by t-hhl.um,

a Ltner

be~

k.,_,

F1.guro 4-15 CUrvature profiles

PlANE aJRVES 115

the acblill direction of the lmear curvature variatioo is chfficult to dct.ermi.nc.

It requires the solutioo to elliptic integrals whose wtegratioo cx:nstants are


dependent in a catplicated '"'W'f oo the specified boundary conditions.

t-~un

suggested that an approximatioo to the piecewise linear curvature be rro.dc by

replacin<] the linear variattoo with a series of disocxltinoous steps, each with
constant curvature, as indicated in

F~g .

piecewise cx:nstant over the curve length.

4-lSb.

'll1e curvature profile is then

Since a ccnstant curvature descrires

a circular arc, the piecewise curve u; represented by a series of ci.rcular arcs


with various centers and radii of curvature.

1\ large

nt.111ber of steps, i.e.,

circular arcs, will produce a closer fit to the ideal. curvature. The required
nunber of circular arcs depends upon the separation distanoe between the dat..a
};X)ints, the dlange in curvature over the curve segrrent, and the required ~
of the graphical output. Detai 1s of this technique for generating snooth curves
by circular arc interpolat-ion are given in the cited reference. The output. of
the itcraoon process gives the value of racHus and center };X)int for each circular arc, as well as the specified x-values where the curvature c:hangcs. '1hen
sd:>routines for generating parametric c.ircular arcs can be used to produce the
actual pieoewise curve.
REFEROCES
4-1 07\TASAAB, "Fornela General Descripcicn, " Reg. No. 917-E, 51\1\B 1\KTI.EOOV.G,
58188 , Li.nkopi.rq, ~ . 1965.
4-2

"cat:puter Graphics Arrangerrent

Progrcm~, CCGAP Systems

Manual," NAVSIU.PS

090o-OJ7- 9030, e:AEll1>C 233083./MFTS, Naval Ship ~ing

center,

Washingtor

D.C., Nov. 1972.


4-3

Gottfried, B. s ., PrC?gramning with Basic, Schallll' s Outl.ine series, McGrawHill Book COrpany, Ne" York, 1975.

4-4

~sford , P. A.., "Mat:herootical Metrods in c.atputer Graphics- 1\ Survey,"

Gesellschaft f\1r Inforrratike , vol. 5, Synposiun on catputer


4-5

Gr~cs,

Berlin , OCt . 1971.


'l'hc:rnas, G. B., Sr., calculus and Analytical Gearet:J:Y,, J'ldll.son~ley
Publ.i..shing Carpany, carbridqe, t-1ass., 1954.

4-6

Snith, L. B., "Drawir} ellipses, hyperbolas or parabolas w1.th a fixed


n\J't'bcr of };X)Ults and nwc.iJtun .in.scribed area, " COJipUt. J . , vol. 14, p . 81, 1!

4-7 COhen , D. , "Linear Difference CUrves," in lldvanoed Cu!uputer Graprics ,


Plen\1'1\ Press, New York, 1971.
4-8

l-fchl\1'1\, E., "CUrve and SUrface Fitting based on Variational Criteriae for

Snoothness," Central lnstl.b.Jte for Industrial ResearCh (CIIR), Oslo, Nor!o.'ll}'


Dec. 1969.

THIS BOOK BELONGS TO

IKE HAYDEN

CHAPTER 5

SPACE CURVES

I~

'
5-1 Itfi"RROLCT ION
ll\::lst objects encountered in the real world are
l~ver,

t:.h...~ia\al

in nature.

nost drawul<J t:.ec:hmques are two-disneruucnal , the results bemg produc:ed

on a plane surface such as a drawing board.


represent.at.loo of

three~ialal

or sectional d.nwings.

'11lis frequently results in the

objects by

I'J:!allS

of t:wo-diJrensiona.l

Vl.L'".TS

'l1le use of a digital conputcr to ge.-,erate curves ndds

a new d.ireru.ioo to drawing techniques .


ional spaoo C'l..lrVeS can be
defined, gC!I'lC'!raLL..od , stored, rrenipulat:.ee , and plXldt.red as output. Sp;!CC cur\11"5
can be displayed oo a tw.'t>-d~ooal plane by use of ~tnc and perspective projectioriS, as d1.scnssed in Chapter 3, or three-<lurensional rrodels can

t::Y! prodooed directly by using a nu:rerically oont.rollf'O cutting tool.


present chapter extends the previous discussions for

CUIVO

The

dcscriptioo to three-

d imens.J.ona 1 space curves.

5-2 RPI ESENTATICU

OF

SPACE (aVES

As was the cage for plane curves, sp.~ ~ rray

mnparaztw:trically or pararretrically.

oo

reprosc.>nted either

'11l.ree-ditramsional spaoo c:urves expressed

'

SPJ\CE

117

in nonparaJtt:t.ric form a.re g.1.ven explicitly by a set of cquotions of the form


(5~)

x=x

y f(x)

= 9 (X)

Alternately a space curve rray be expressed in a nonp.trMPt:.nc, ir.phcit fonn.


In this case the space curve is represen~ed rnther'atically by the Lnter-sectioo

of the t"-0 surfaces g:Lven by


f (x,y ,z)

g(x,y,z)

=0

{5-2)

As an exan-ple, consider the t-..-o second-degree surfaces given by

y - z2 = 0
g(x,y,z) - zx- y2 ~ 0
f(x,y,z)

{So-3)

Fbr z ~ 0, x ond y can be expressed

terms of z to obtain the explicit Conn

l.l'l

of the curve defined by the intersecting surfaces


2

L,_
z

x =

z3

(5-4)

= z2

Notice that tho intc.rscct.i.oo o two secc:nd-degree surfaces l oads to a


th.ud-degree ~ curve.

'l1u..s techn.iquc of solving for z fran the ir.plicit

surface functioos is valid provided that

2!.
ll.
i4X oy

det

~~
X y

at a poi.'1t (x,y,z) which satl.Sfios tho


rrent applies when sol vi.ng for x
In

c.~

= f (y) ,

general, a pararrctnc space curve

surface equations.

= g (y) or y - f (x) , z
.lS

A similar argug (x) .

expressed as

x(t)

(5-5)

y ;: y(l)
z = z(t)

where the pararrotcr t varies over a given range

_ t ~ t 2 Roconsidaring
Eq. (5-1) we see that x itself can be considered a paraneter, X,. t, and the
sarrc curve is then expressed in param:!tnc fotm by

x=t

(5-6)

y = f ( t)

z g (t)
Further, i f we reconsider the oonparat"Ctn.c l.rrplicit representation given in

FJ::i.

(5-4) we see that

curve arc

we can let z

t:.,;

t, and the paranetric equations for that

)( - t3

=t2

y
z
~useful ~ic

(5-7)

= t

space curves have 1cno1,..n analytic solutims .

exa.-rple, a para!:et.ric space curve that is shaped like the seam


~1 ~ s

a1

For

a tennis or

expX'eSSCd by the following equations:


x = >. (acos {co +

~) - bcos3 {0 +

i> )

y =

i->

if) I

IJ (asin (6

+ bsin3 {6 +

z csin(2E)

( 5-8)

" 1 + dsl.n(2fl ) - 1

.c .

.. l.,
I

'
I

=1 -

dsin(2e )

=1

21ft , where 0 ~ t ~ 1.0.


space curve lies on a sphere o f radius a +b.
and the parameter 1

= 0,

and d

then the curve lies

a1

s~

+ d(!)
c
- d(!)

If d 0 and c 2 4ab, then the


I f a = 1.0 , b = 0 . 5, c .. /2,

of radius 1 . 5.

J\rother exa.-rple of a parametric space curve is the ci.rcular helix.

pararrotric equatims are given by

x = acost
y ~ asint

z
for a and b

0 and _..,. < t <

cular cyli.n.dor of radius lal .

'Ihe

ao .

(5-9)

= bt

'Ihis curve lies oo the surface of a right c irThe effect of the equatioo z

= bt

is to nove the
points of the curve uruforml.y in the z-di.rect.lal. After each 211 interval in
the pararreter t , the variables x and y return to their initial values, but z
increa.s es or decreases by 2n b l , depending upon the sign of b .
z i.-; callro the pitch of the helix.

'lhis change in

l'lben an ahalytlcal description for a curve is not known , an interpolation


scherre

may be used to fit a curve through a given set of

data p:>ints .

This

invol ves specifying boundary conditioos for the space curve in order to determine the coefficients for a given polynomial curve form and establ ishing a
soot.hness criterion.
r-'.any considerations enter into the decision of ho.l

curve.

to represent a space

'l1le form of c:xrrputer input desired, the type of nanipulat.ials required,

the ava.1lablc interface ~ user and cx:rtpUte.r, and the display device used

for

c;ral=hl-cal output can

all introdoce oonsideratims and limitations.

the input is a series of po.mts which lie

a1

t:llf!" desired curve , spl ine se<pents

arc often used to forr a szrooth curve through the p:>ints .

in the next sectial.

'nlese are discussed

SPACE aJRVES 119

5-3

CusiC SPLINES
The mat:hcrratical spline derives fran its {ilys~cal counterpart - ~ l ofts-

spline is a l.a1g narro.~ strip of "'COd or plastic used


by a loft..sman to fair in curves beO."een specified data powts. ~ s plines are

rran's spline.

A physical

shaped by lead weights called "d\.Cks."

By varying the ni.ITber and pos ium o

the lead "-eights the spline can be rMde to pass t.hrou.;;h the sp.."<Cified data

points si.Ch that the result.ing curve appears srooth or "fair."

If the physical spline is considered to be a thin elastic bcilrn, then


Eulers equati01 (cf Ref. 5-l) y.lelds

EI

M(X) = R(x}

where t-l(x) is the banding na1ent, E is Young ' s m::xlulus,


i.nert.La, and R(x) is the radius of cw:vaturc.

r is the J:l'al'Cl'lt of

For small deflect.Lcns the radius

o f curvature R(x) may be replaced by 1/ y", where the pr.irre denotes differentia-

tion with respect to x.

Thus, we have
y" (x) =

Assuning that

Ule

loti';>

d\.Cks act as sinpl e SliftQrts, them M(x) is a linear function

bebeen the supports .

Letting M(x) = A +

ax

and integrating the above equation

twice shows that the physical spline is descriOOd by cubic polyncmials between
supports.
In general the mathenatical spline

is a piecewise polyro1ual of degree K

with continuity of derivatives of order K - 1 at the camon )Ol.nts between


~ts .

Thus, the cubic spline has second-order continuity at the joints.

Piecewise splines of lo..r degree polynanials are usually rrore useful for forming
The use of lo..r~e<Jree polyranials reduces

a curve through a series of points.

the caputatJ ona 1 requirements and reduces mm-erj cal instabl.l i ties that arise
with higher order curves.

'D1esc instabilities can cause an undesirable wiggle

when several pomts nust. be jowed in a

CXJflTIDO

curve.

fb..lever, si.ncc l<:M-<legree

polync:rnials cannot span an arb~tracy series of points, adj aoent polynomial segJl'el)ts

are nooded .

Based on these consideraticns and the unalogy with the Fhz'si-

cal spline, a camon technique is to use a series of cubic splines with each

sec:rent spanru.ng on1y

boo points .

Further, the cubic spline is advantageous

since it is the l~t degree space curve which allo..rs a ~int of infl ection and

has lhc dbility to tl<dst through space.

111e equation for a single pararretric cubic spline seqrrent,

paraneter t ,

1.n

terms of a

qiven by
P(t) =

. 1

L
a.e;
. 1

l.=

l.

(5-10)

\."here P(t)

= {x(t)

y(t) z(t) J.

any p:lint oo the spll.ne.

P(t) can be considered the p:>Sitioo vector of

z ( t) \oohlch
of the posit.icn vector . The coeffi-

It has tllree carp::n:mts

rruy be o::nsidercd ~ cart..esian O::Xll:di.nates

cients B

l.

x ( t)

, y ( t) , ard

are det:.errni.ned by specifying four boundary oonclitl.ons for the spline

se<J'l'IC."lt .
(5-10) may be wr1.tten as

In expar.ded fonn Eq.

s 3t 2

P(t) = Bl + B2t +

+ s 4t

(5-11)

a given pair of points throu<;h \ohlch a curve ~'lt passes be the vectors
P , P.. (see Fig. 5-la) . COrresponding tangent vectors at these given points
1
are indicated by
the derivatives with respect to the parazreter t . WithU1 the cubic segncnt the pararreter t varies betw-een t:'"'=> end-point values ,_ and

let:

Pi, Pi,

~.

To s.irlplify t.h.e calculations ,

we can assign

= 0.

The required boundary corrlitions for each cubic segrre.nt o::nsist of the b.'O

For the single seqrrent

end points and the tangent vector at each end point.

beb.'OOn P and P , these conditions are given by


1
2
P(O) = Pl

(5-U)

P(t ) = P2
2

~~
dt t=O

P'

~lt=t =pi
2
Four relationships follow fran ~ . (5- ll) and (5-U):
P(O)

dP

dt t=O

= Bl
~

L:

(5-D)

P
1
(i-l)ti-zB.

l.t=O

i=2

=B

= P'
2
1

(5-14)

(5-15)

dP
~
= L
dt ,t=t
i=l

2B.
l)tl.-

(l. -

l.

SOlVl.ng tor

s3

and

s4

(5-16)

t=t

yields

B3
and

3(P - P )
2
1
2

2P'

P'

- t2 - ~

(5-17 )

SPI\CE OJRVES

U l

(5-18)

along with 8l

= Pl

P' . 'nl(>Se val'lf>S o f 8l, 8 , 8 , and 8 fix the


2
3
4
1
curve for tho cubic SC."<Jient. 'nlC shape o f the cubic sphnc scqrrcnt crpezds en
and 8

Furthe r, notice that the value of

the erXI-point (X)Siticn and tangent vectors.


the pararreter t

=~

at the end o f tre sec.;nent oocurs

.Ln

the results.

SlllCe

each of the end-point vectors and end tangent vectors has three mp:Jncnts , the
pararretric equation for a cubic space
~

and the pararreter value

C\ttVO

depends

at the end of the

up::lO

~'Ct.Or

12

component s

S~e<pent.

Substituting F.qs. (5-1 3) , (5-14) , (5-17) , and (5-18) into l:q. (5-ll)
yields the equation for a cubic spline segment:

P (t )

)(P2 - Pl)
Pl + Pi t + (
2

2Pi
-

P2

t.._

t2

t)t +

2 (Pl-P2 )

-l

Equation (5- 19) is for one cubic spline SC<JICnt.


for any two adjacent cubic

~ts

)
t2

PK(t) and PK +

P'
1 I

(5-19)

~2

It can be genera.h :r.ed

(t) , 1 ~ K _ n - 2 ,

wrerc

n is the nll!l'ber of data pomts throlgh \oohlch the curve J'IU.1St pass (sec Fig. 5-lb).

'the gencralizerl equations are of the form


p {t )

+ pIt.

)(PK+l - PK)
[

2PK
PK+l]
2
[ 2 (Pl<- "K+l)
PK I'K+lJ
3
- t
+
+ '""!
2 t

(5-20)

t2

t..

-~

and
PKllt) - r Kl ~ I'K+l"

.HI'Y2- Pl<ll

.. 1

''~1
t

PK2J
2
t
t. -

[ 2 (1"1<1- Pt<+21

Here we assl..l!te that the paraneter variat1.on is 0 ~ t ~ t

and 0

Pi:l
2
tl

r ;.2] 3 (5-21)
2

ll

for the h.rst segrrent

for the second secpent, etc .


3
For ex;:urq:>lc, if only three position vectors (data points) are specified ,
~ t ~ t

the Jov..tn conditions for the entire curve betl.'eCO P

arc the position


3
and the tangent vectors at the ends o f the curve, i.e. ,
1

and P

vectors P , P , and P
2
3
1
Pi and P) To ensure second-order continuity for a cubic spline, we inposc the
conditioo for <XI'lStant curvature at the internal joint between the 0..0 spans .
'Ibis in'plics that the second derivative, i.e. , P" (t) , be cantinoous across the
joint.
Fran Eq. {5-10)

we have
4

P" (t ) ..

(5-22)

( i - 1) (i - 2)

i =l
At the

end o f the first cubic spline segrrent,


P" = 68 t._
4"G

~re t = ~

+ 2B3

and at the beginning o f the secxn:1 spLine se<.Jent, where t-0 ,

122 Mr\11iD'Wl'lCAL EIWmi'S FOR cx:MPl-TER GRAPHICS

P" 2B

~t.lng

6~ [

these ~ results and using ~ (5-17) and (5-18) yields


3 (1>3 - P2)
l (Pl - P2
Pi]
[l(P2 - Pl)
2Pi
Pj ]

pl

t3
2

2 +~ 2
t2

f.lll.tiplying by

t:fi +

~t

2(t3 +

~
-~

~ -

2Pi

pi] [
t; 2

t2
3

~ (P2

- Pl)]

(5-23)

t3 - tl

and collecti.'lg terms gives

~)Pi

3 = ~3t3 [ t~(P3

- P2) +

(5-24)

...,h lch can be solved for Pi, the unk:rloNn tangent vector at the internal joint.
Again

nouce that the end values of the paran-eter t, i .e . ,

the resul ti.N3 equat; oo .


For n data points the results given above can be

cub.tc spline

~ts

and t , occur in
3

g~eralized

to yield n - 1

wit.l) position, slope, and curvature continuity at all the

internAl JOints . The narenclature for multipl e spline se<pents is ~n in


Fig. 5-lb . In the general case Eqs. (5- 20) and (5-21) apply for any 0..0 adjacent data points.

The secx:n:i-derivat.ive continuity condition Eq. (5- 24) ~

alizcs to
t.,-. 2r; ' t ,. l ' '1 -1 "Kl ' ly.lr;. l

rl'.:"l<:1'~...:, 1P)'2- PKl '~2(1'1'1. P"'ll .s, K1 11 -.,

(5-25)

(5-26)

..

I~

l''

rt~l(Pn
.
pnll .. t~ F'n-1 - l'n-2]
n-1 n ~

t) t

'!he expansion of Fq . (5-26) gives r. - 2 equatioos in n unknown tangent

voctors .

\-lhen the t\oJO and tangent vector s Pi and P~ are specified, then the

systan of equations is dete.rminant .

Thus, to generate a curve tt:e position

vectors P , 1 ~ i ~ n, al on; with Pi and P~, are specified. Then Elq. (5- 26)
1
is 11SE!d to calculate lhe i nt..enrediate tangent vectors Pi, Pj, . . . , P~-1'
Tlus calculation is rrost conveniently aco::c1plisr.ed by natrix inversion
(cf

sec.

5- 5) .

'l1le tangent vectors are then used to calculate the B. coeffl..1

cients g.tven by the 9f!f1eral ized focn of Eqs . (5-13), (5-14), (5-17), and (5-18) ,

for each curve segrrent, e .g . ,


(5-27)

B = P'

(5-28)

SPJICE CURI1ES 12 3

, .~

PK-+l

- 'i<.. l-

~+1

----::-P~

2r;

r,

(5- 29)

P'

K
2

(5-30)

lK+l

)----- ).

Finally, each etbic

is gen-

SC<}"'\!nt

erated by use of Eq. (5-10 ) , with

0 ~ t ~ tmax.

Before t:.he c::urvr can be

generated, the JTa'<im.Jn pararrcter value

,'\

,._

(':

tmax for each seqn-ent., i.e. 1 t. , L31


2

1
t , must be chosen. 'I'his do1ce
0

,,n ,..n

'n

will affect the curve snoothncss.

Continuity of second danvaUves at


the internal joints docs rot in i tscl f

.,.,. '

produce a srooth spline in the

P. P.' ,,
I I

S<m.SC

ro.iniJ:run curvature along the curve .

/
y

of

To

obtain a mininun, and hence nwd11tJm


SlOCXJthness, the ex>efficients 8

and 8

oust be minimi?.ed for each seqtYmt by

Figure 5-1 CUbic spline .

cl'x:losing tre correct wloos of the par-

aneter range within each SC<JilUlt.


additional carputatl.onal effort is normally not required.
for

c:OOosing

This

Swpler nethcds

tmax can be used to generate cuxves SII'OOth coough

tor rrost practi-

cal purp:>ses.
One approach is to set the rrax.im.Jm parazret.er valms equal to the chord

lengths

be~

sucx::cssive data FCints.

srrooth curves for graphical display.

This has proven to 91ve acceptably

A se<:x>nd approach is to rormalize the

variatioo by choosinq trrax '"' 1. 0 for each cubic segnent.


the previous cquatioos, each choice of t;,

rnax

As can be soon fran

will prodooc <!iffcrent coefficient

values and , hence, different curves through the given data fX>ints.

As the

M2Jnitw:iP of the tanqcnt vectors is changed, the slope of the cubic

5eC}tents

bet;:...JPcn data FC11lts is changed.

On the other hand, the di l'Cc~il'm of the

vectors controls thc shape of the cli>ic seqments at their cmd

5-4

t.aJ19ent

p...i ,. ~s .

~IZED PARA."TERS
In spite of the approxunate sr.oothness of the resulting curve, normali7.ed

paraJreter

defining a

ranges for al 1 cub1c se<JI11'!1lts of a spline cw:ve can be used when


C\.IL"W ,

\'hm this approach is

Eq. (S-26) ca.n ba .roarran<p:l in the form

u'?ed, 0

~ t

s. 1

for all spans and

'

(5-31)

P3

l 4 1 0 0

;(P - P
> - P'
r.
n- 2
n-2J

'i.'le four ccxllf1cients for each paranetric cubic equation, givcn by F.qs .
(5-27) and (5-30) , can be expressed in z:utrix form

B4 .,

a3

2 -2

-3

1 r-PK

3 -2 -1

0 0 1

01 PR

BlJ

OJ

1 ~ K ~ n - l

(5-32)

PK+l

B2

QS

_PK+lJ

\',"ith the nonr.llizcd fo.arulation the tridia<;Utal matrix in Eq . (5-31) need only

'

be i.wtj...--ted

to dete.rmi.ne the ta.ngent \:ectors at the inte.mal joints.

a set of n positioo wctors , tlu.s represents a cxnsiderabl e savmgs of m 1p.1ter


~.

tire.

l.f the positi.cn vectors are oot un.i!or:rnly distributed, experience

uxlicates that t:ht! resulting curves


l.lreter length
~"~

fi.'ld use

..

For

J..S

m:lde equal

to 1.ts

a_Y'@

not as st:mth as w-hen each segrrent. par-

local chord.

The nomallzed forna t 1an does

creating cubic bo\.ll'XB:ry curves for three-<:l.lmmsiCXlal surface patches

(see Chapter 6)
Although

par~l.c

C\i:>ics have rr.any advantages for representing and

nanipulating curves, there are also disa&rdl1tages \.hlch limit their usefulness .
Parametnc cub1.cs never reduce exactly to a c:u:cular arc , and so true circles
can only be approximated.

Also,

curves whlch are asynptotic.

t.~y

do not closely approximlte rrat:herretical

Nevertheless , they are widel y used for many

appliCliUons, expccially in the shipbuilding and aircraft industries.

5-5

13ruJlARY CcfiDJTJrJ~S
h~

Eq. (5-26)

l.S

used to determine the tangent vectors at the internal

JOl.nts o! a curve definod by n points, a nonsquarc rratri.x with n - 2 rows ar.d

n coll.lmS results.

'It.c tangent vec:---....or colum matrix contains n r:o..rs and the

coefficient cohr.n rratrix


in~

tx:Jnta.ulS

n - 2 roo-'S.

Thus Eq. (5-26) tndY be written

forrn

rm IP' 1 -

1a1

(5-33)

SPN:E 0JRVEs 125

- is an n M

2 x n matrix

P ' 1.S an n x 1 nattix

B is an n - 2 x 1 rr.rt.r.ix

'Ihe only nonzero terms

at

each ro.~ o f the nonsquar:e [l-l) -1rat.rix arc

M(.J, .J-1), M(J, J) , and M(J, J+l) for 2 ~ J ~ n - 1.

Hence the expanded form

of F.q. (5-33) is
M(2,1) M(2,2)

P'(I<,l)

r:ic3,2> 11(3, Jl

P ' (1<,2}

R(l\,2)

(5- 34)

U(t\, 3)

M(N- 1, N- 1) ~(N- 1, N) P ' (l< , N)


B(l<,N- 1)
A squ<s.re (t-S)""11'oaLr:LX LS I1C<X!5SlUY to ootain a unique solution for Lhe unknown tangent vectors.

The required square mat.nx M can be created by spcci fy-

ing boundary c:xnlitions lit each end of the total piecewise cubic curve as

sho.m be}.o..o.

In this r..ase Eq. (5-33) may be \oi'I"itten as


(M] (P. I

~~:: t-1 J..S

tOO required square rratrix.

(Pi , . . . ,

1 are given by

{5-15)

(B}

'Iben the internal tangent vectors

P~ >

(5-36)

[P' ) = [l1)-l[B]

[M]-l is the inverse of [M) .

cnce the

P '-values are known, B.-values for


l..

each segnent arc calculated using Eqs. (5-27) and (5-30).

Vany chc)l.m5 exist for specJ..fyinq the end boundary CCI"lditions for a plcce-

wise cubic curve .

Several differo.'"lt choices may be desirable i f ally a few

data points are kno.rm or 1.. P"~Ysical cn'lStra.ints require accurate ooot.rol of
the curve shape at the ends .

'l1le rrost direct solutioo is ootained by specify-

ing the two end tangent vectors P' and P ' of the total picccoiliso spline. '11tis
1
n
boundary condition is called tile clarrp?d end corrlibon .in Ref . 5-2, and the
encastered spline in Pef . S-3.

1he CC111'lete matrix equatioo for

tro cubic

spline curve is then given i:Yy


P ' (K,l)

1
M(2, 1)

~:(2 , 2)

M(3, 2) M(3 , 3)

(5-37)
BU<,l)

p (l(,2)

BIK,1l

P'(J<,))

B(l<, 31

M(N - 1,

r: -

11

11(N- 1,

Nl

P' (}(,N - ll

B(K,r; - 1)

P ' (K,N)

B(l<,N)

Eina."l'S FOR

126

t-11\'lli:o~TIChL

'Ihis

c:~ql~'ltion iJrplics that

P ' (J<,l)

rcsult..lng square (M)-mat.n.x

.LS

GRAPHICS

= B(K,l)

as is required.

nus

also t.ndi.aqonal.

NOtice that the

system of equauons can

ro.xiily be solV('d for the unl<noorn tangent vectors P ' (K, 2) P ' (J<,N - 1) .

Since

this (t-1)-nutrix is t.rid.iaqa\al, the solution can be obtainod very conciscly by


rne.'Vl..c;

nus procedure is \lSed in the a l gorithm \o1u.ch

of recurs1on fornul..as.

appoars in llppCndbc c.
Other CJi cxn:htialS will increase the nlrl'ber of I'O'Izero terms lJ\ the first
and ln'lt ro.15 of the M-matrix. Fbr ex<L"Tple , o::nsider the mathematical c:nd oon2
2
ditLoo that d P/dt - 0.

1bis oondition

.LS

called c1t:her relaxed or natural.

to zero for the first span (J< .. 1), wi th t "" 0 , and


using Eq. (5-17) lwd!. t.o

SettlJ"'C} Eq. (5-22) cqt.oal

P' +

...
I

P'

- p )

(P

= 1_2

(S-30)

If th('> s<tnv: end cx;r,diti.c:n is used for the last span (K N - l) , with t t

then with the help of f:):Js. {5-29) and (5-30) one obtains

2P '

n-1

'

+ 4P ' = ~(P - P

n-1

(5-39)

It follows that the 11002m'0 terms in the first row of the square (11)-mat.rix are

= 4.0.

P(N,N - 1) .,. 2.0 and M(N,N)


s1.de of

The nonzero tcnns in the last row are

1.0 ard t-1(1,2) - 0.5.

M(l,l)

~.

In the [B)-natrix , B(J<,1) equals the right

(5-38) and B(K,N) equals the right side of Eq. (5-39).

Notice that

this relaxed (natural) end condition also produces a tridiagonal (MI-mltrix.

otmr C!l1d concli.tions of practical use are the cyclic end oondition and
the antlcyclJ.c end candl.tion . A cyclic spl ine can be used to prodUce a closed
curvo or a portion of a C\J.t"Ve which repeats at intervals . It is based on the
'l\oA':>

follow.t..nq end oonchtion specificatialS


P ' (t )

(5-40)

P " (0) P" (t )


n n
1

(5-4 1 )

Pi (O)

n n

1..c., the s lope .:tnd curvature at the beginning and end of tJle curve are eqtkll.
Recallmq Eqs. (5-16) ard (5-28) to (5-JO) the condition expressed by

Eq.

(~40)

yields

2
P'- P '
1
r -1

3 (P - P

n-1

2P'
P' ]
n-1 _ -E. t

t2

t0

ln n

+3

2(P
- P )
P'
P'
n-1
n + n-1 + ..12 t cs- 42)
t
t2
t2 n
n
n

SinUlarly the condition expressed by Eq. (5-41) y1clds

J r)(l' -

lfl '1 - p I ) _ 11''1 _ r2 ~


t :1
l7
t2
1

I'n-1 I __
2P'n-1 _
tn

I'']
n

tn

fl ll'n-1 - -"P ) -Pi~


P'
tl
t
n

I'']

~ ~

t"

-n

(5-43)

SPACE CURVES

127

These ~ equatioos can be cxxtbined to yield a single equation "'hlch when com-

bined with the l+iratri.x yields a (n - 1) x (n - 1) square nntrix.


the order of the square rratrix has been x:edrerl by one.

Note that

'lhi.s is because the

sl.q)e and curvature oondi tioos inposed at t:\..'0 of the n JX>ints are no longer in-

'lfuls, there are only n - 1 independent slopes to be dctem.i.nod.

dependent.

We cxx1bine Eqs . (5-42) and (s-43) by nultiplying Eq. (s-43) by t

t..racti.ng it fran El:). (5-42).

and sub-

This results in
~]

(5-44)

li n
1\

Recalling that Pi P~ and rearranging the terms yields


2(1

t2
n )Pl

-1

P2f-2 + p~-1

Using this result allOw'S writing


t

2(1

+ ~)

t-i(2 , 1)

~-

3(P2 - Pl)-1- 3(Pn-l - p )!_

n tn

t2

(5-45)

(5- 35) as

-t2n

P ' (1<, 1)

t-1(2,2} M(2, 3)

P ' (K, 2)

8(1<,2)

t-1(3, 2) f.1(3, 3}

P' (K,3)

B(K,))

B(l<, l)

t-t(N - l,N - 1)

P ' (K, N - 1)

(5-46)

B(K, N - 1)

t-bnnal Gaussian e.l.imi.nation or otro.r matrix inversion rreth:xis can be used to


invert the nontridiagonal matrix in El';{. (5-46).
f'.btice that ~ P ' and B rratrioes are

r'OII

(n - 1) x 1 rratrioes as required

for matrix nultiplication in Eq. (5-46).


The anticylic spline is similar to the cyclic spline, except that
P (0) = - P ' (t )
n n
1

and

P " (0) = -P., (t )


n n
1

Following that sarrc prooedure used to derive El:J. (5-45) yields

t
2(1 + t;>Pi + Pit;-- Pn-l = 3(P2 t

P1 )~-+

l(Pn-l - Pn)t;;

(5-47)

Equation (5-47) s!nols that the only effect of irtt=osing the anticyclic end
oonditioos is to change the one in the M(l,t~ - 1) position of the f.t-matrix for
the cyclic spline boundary oonditioos (cf Eq. 5-46) to a minus one, as 'n"Cll

as the sign on the second term of B(K, N-1) .

'lhis type of spll.ne is useful for

produc.ing parallel end spans with end tangent vectors which are equal in magni-

US K\nm-MICAL ELEMEN1'S FOR CX:NFUI'ER GAAPHICS

tiXlc but opposite in directicn (cf Fig. 5-2b) .


The cubic spl1ne end conditions considered above are S\.IIITI\arlzed m

Table 5-l.
'ilili1<> .._ l

Dld Ccnd.LtlCI!\9 for Cl:blC Sphll'.cz


l'rllbtrl.X

U.J Q:J'IIilti oo

1.

~~t.

cpcc1ty P' !0) , P' It J

~ (1,11

~~ :urod

.Mil,ll - l

Ir.a t..ural
n:<JU!Z'I d 2P; dt 2 -

J. ()'r;L ~u.1n:
ell /at. e-o C!l / dL tt
n

.ro
2p

2
~
2
/ dt ~ ~ ~
/ dt

K1

'

rl-l

;o.l

MU-cyclic

B(K,NI

Cl."'f1 (onc4Sbl.Z'Odl
0

2.

B(K,ll

Nonzero ElAn.lnts lt\


First and IA.It Polo'S.

M(N,NI

=l

B(l<,l) I 0(J<,l)
BIK1 1>) ... U(K,NI

l (l/t
1
n
nA(K,N) - 61Pn- P 1

2
M!N,N - 1 )
H(1,2 ) ~ 0.5 K<N,m 4

B(K,l)

M( l,l )

BIK, l ) - 3CP2 - P l (tnltzl


1

'4(1

,2 ,

~(1 ,1{-1)

211 t,!t2 >


- t n/ t 2

(1/~)

-liPn-1 - r n 1 11/tn l

= l

je-tn

(3/2)!P - P

!'I (I< " ) :

IZidl!f i.nad

t..-..c'l-1

M(l,1 )

~e

di>1 dt ~ "' -dl'tdt ~

M(l,2 )

r-1

~( l,!i-1 )

t:...~,

.. 2 c1 t / t >
2
- tr!tz

s cK,l l 3 <P 2 - P
t-)(P

n-

; -1

<t,!t2 >

1 - p ) (1/ t. )

and

2
d 2v/ dt

~-

t-o
kl

ii
::2

dt

BIK,~) :

undctinod

t~

Kr.-l

Cubic splines will have CXJntinuous first and secc.rld derivatives w.1.th any of
these end ccrditions.

Hc7Never, if the nuroer of data. points is J.arge , 1:00

r;;utaticn t.in'O required to invert the (t-lj-matrix can be excessive when cyclic
spline or anticyclic splines are generated .

Additl.onal spline end conditions

are discussed in .Refs. S-3 and S-4 .


Ccrrparisons of the effects of the varicus erd conditions is shown
Fig. 5-2.

1'hcse results

AppE:ndix C.

J.n

obtained with the SPLDlE subroutine given in

In Fig . 5-2a, the "claaped" curve has a specified slope of dy/dx

(dy/dt)/(dx/dt) equal to -1 at the beginning and a slope of +l at the end. The


other C\.I.I"Ve has relaxed boundaJ:y conditions so that d 2P/dt2 = 0 at each errl
poi:"'t.

'Ibere is a s1.gnificant variation in curve shape, especially near the

bcqi..nrung.
dates powts .

&:>t.h curves consist. of three ctbic spans


~ c::arp.1ter

for thl.S ptl.rt icular output .

throlXJh

the four indicated

progtarn qenerates 10 wterm.."<liatc powts per span

'

SPliCE

aJRVES

129

lr-----------------------------~-----------

l't I

~--~--~--~--~--------~--~--~--~--~

Figure 5-2a

COOpari.son o f cl.alrped and relaxed end oonditioos .

l l r---------------~--~--------------~----~--------~

. ...

'

_,

..,

e L---~----~----L----L--~~--~~--~----._--~----~
\1
-'l
2

-u

Figure 5-2b

'
catplrison of cyclic and antiC}'Clic end corrlitioos .

F~gure

s-20 sb:lws bole closed curves, a curve with cyclic end coocli.tions

through the U data (X)ints, the first and last (X)utt being identical at x = 0 ,
y 0, and a curve, also closed, with an anticyclic end condition at x y 0 .

Notice that the di.rectioo of the initial end tangent vector is vertically up.tard,
while the cli.rectial of the final end tangent vector is vertically da.mward.
f'iqure 5-2c OCI!p9.res a relaxed end boundary cx:n:litioo to a cyclic end or::nli-

tioo.
curve.

This illustrates ~ a cyclic en:3 conditioo can be used with an open

Uoweve.r, the di.rection of the initial end tangent vector on the curve

with cyclic end conditions is the same as the direction o f the final end t::angent

vector.

E:xarrple 5-1:

'

alBIC SPLINES

Assune that the three (X)Siticn vectors P (0 OJ, P (1 2) , and P (3 2) are


2
1
3
J<na..m . We wish to detez:mine a cubic spline fit through these (X)ints usinq relaxed end o:::nditicns .

We base trrax on the chord lenqths of each span.

To begin we first calculate the chord distances t

;(~

t3

= ~x3

- ,_,2 + (y2 - yl)2


-

~)2

+ (y3 - y2)2

Usi.nq fl:!. (5-26) and the relaxed

ero

= 1(1)2
= ~3

and t :
3

+ {2)2

= IS

- 1)2 + (0)2 2

conditicn F.qs . (5-38) and (5- 39) I the

2 is

rMtnx equaticn required to find the int.ernal. de.rivativc P

1 0.5

Pi

2 8.472 2. 236 P'

0 2

vS (P2 - P1)
2
3/5(5(P - P ) + 4(P - P l)
3
2
2
1

Solvi.nq for the derivatives by invert.inq the 3 x 3 square mtrix and rultiplyi.nq yields

P2
Pj

1 . 1574 -0 . 0787 0. 0440

0.67l (P2 - Pl)


- 0 . 3148 0.1574 - 0.08798 0.671(5(P3 - P2 ) + 4(P 2 - P1 )J
0.1574 -0.0787 0.2940 3CP - P2 )
3

Thus,

Pi= 0. 5654(P2 - P1 l - 0. 132(P3 - P2l


= 0. 5654[1 2) - 0.132(2 0]
(0.3013 1.1308)

SPICE CURVES

131

Pi 0.2112CP2 - P ) + 0.264l(P - P )
3
1
2
0.2112[1 2] + 0.2641(2 0)
- (0.7394 0.4224]
Pj; -0.1056CP - P ) + 0.618(P - P )
1
2
3
2
-0 .1056(1 2] + 0.618(2 OJ
= [1 .1305 -0. 2111)
Recalling EkJs. (5-11) and (5-27) to (5-30) allo,.,s calculatioo of the ci.Dic

spline segmmts.

fbr the first segrumt

P(t) = B + B t + a t 2 + a t 3
1
2
3
4
and
B

82 ;

pi -

(0 0)

(0.3013 1.1308)

8 3 "" S(P2 - Pl) -

2Pi

IS" -

Pi

7s

= o. 6(1 21 - o.a944IO.J013 1.13081 - o.4472[0.7394 o. 42241

= ro

01

= 0. 17889(-1 -21 + 0.2(0.3013 1 .1308) + 0. 2(0 . 7394 0.4224)

[0.0293 -0.0472)
Oxx>sing

t/~

.. 1/3, 2/3 yields

t = o. 745 , 1.4907' and

P(0. 745)"" (0 O) + 0.745[0.3013 1.1305) + (0.745) 2 [0 0] + (0.745) 3 [0.0293 -o.0472]


= {0. 2366 0.8227)
arrl similarly

P(1.4907) = (0.5462 1 . 5289]


For the second span, Ekjs. (5-27) and (5-30) yield

11. p2 (1 2)
82

= P'2 =

[0.7394 0.4224}

3(P2 - P2 )

2P '
P'
2
83.
- ~a (0.19535 -0. 31685)
4
2
P'
P'
2(P2 - P3 )
84+ ~ + .2.; [-0.03253 0. 05283]
8
4
4
~

choosing

t/t3 1/3, 2/3 yields

2/3 , 4/3, and Eq. (5-11) gives

P(2/3) = [1.573 2. 1579]


P(4/3) = [2.256 2. 125)

are plotted in Fig. 5-3.

It should be noted that it l.S not


necessary to mvcrt the rratrix to obtain the internal derivatives . E>quatioos
'n1c re.sulLs

(5-24) 1 (5-38) I and (5-39) can be easily solved by sl:bstitutioo to yield the

~~ resw~.
An algont:hrl for gene.rat.lJ"-9 cubic spl.L"te fl.ts for n kno..n data p:>i.nt.s

c;1ven L" AWC."ldix

l.S

c.
~ fl.caticns to the" a!:x:M!

It is possl.ble to nai<e vari.o\!s

r ec"v-.ique "'t-.!.ch

may offer ~t for certa.1.n appll.cation.s. For e:<c:w""Ple, in Ref. s-s,


lann..lng describes an a.lgon.thlu in which the shape of t:he ~........e l.S CXXltrolle3
b'J varytng the tangent vector ragnitudes at the data points (!<rots/ thra.lgh
wtuch the curve passes . nus technique has found applicatial .1.n carp.rt:.cr-aided
footweM eesic;n.
Arother rethod for ir"provinq curve sn:x>thness for m<plic.l t cubic splines

was rcp:>rted l:tj. Detlt'a"\ (Pef. 5- 6) .

P-is technique requires an interactive

nt:reral Sl"...arch and the use of Gaussian quadrature mtcgration . Details are
descnbcd m the c.1t.ed reference. 'lhe t:ni.q-E feat ure of this n:thod l.S d-.at the
end c::ondltions are autaMtically selected based ~..{a' a rJ..nimiz.auon c:n.tencn.
It hAs been ased

1.n

the autmobile industry.

A t.echn.:..que ''sed to Sl:ccth out undesirable oscillations


oc:cur ~th cubic spl::.n~ mves

l.S

~o.hlch scr.et.b~s

the use of sp:ines ~ ter.sion.

tions occur since the cubic S?line

.l.S

OscJlla-

influer-..oed locally by each data p:>1r.t

I
W' .... :'CJ

- J lie:

- I

-2 ~--~~--~----~----~----~----~----~----~----~--~

2
Figure 5-2c Cc:r.pariscn of
open c.n::ves .

'

re~ and ~'Cllc

crd conditions for

11

SPJlCE CURVES

133

alonq the curve, and the lhin1 dd 1vativc is only pieoewisc constant.

Dis-

CXlCitinuities in third derivatives can

thus induce \JI"looanted inflection points


at certain locations

a.l.on<J

the curve.

Consl.der a {tlysical spline supported

If the

by docks at certain points.

thin, flexible beam has small oscilla-

tions 1 one way to retove them ...ould be


to apply tension to the ends of the beam .,
to SttOOth Out the spline.

-------

I']

A Jrathemati-

cal spline under tension is an appro.xi-

mation to this procedure. 'I'heory and


applications for this technique are dis-

cussed in Refs. 5-7 and 5-8 .

5-6

PllNDit-.G

PAFWn.IC

'n'le technique for paralx>lic blend-

Figure 5-3

ing presented here "'as first suggested

by A. W. Ovel::hauser (Ref . 5-9).


utive points sinultaneously.

J.

Results of cubic spline


fit for Exanple 5-l.

'Ibe interpolatioo scheue CXlCISiders four mnsec-

A srrooth curve between the 0.0 interior points is

generated by blend.i.ng two overlawing parabolic segnents .

The first parabolic

defined by the first three points, and the last three points of the

segnett is

set of four define the second

~lie

segnent.

consi der four oonsecuti-w points in space specified by the {X)Sitial vectors
P , P , P , and P '1\o,Q overlapping parabolas P(r) and Q(s) between these
5
3 4
6
points are sho.m in Fiq . 5-4. Each parabola qces through three points and each

is defined relative to its own local coordinate system.


th.rolxjh P

ur-ooordina~

and P

The parabola P (r)

is CjO\I'Im'led by the follc:Ming equatioo, relative to the

system
u = P(r)

= or(d

- r)

(5-48)

INhere as shown in F.ig. 5-4 r is rreasured alonq the crord length P P and u is
3 5
neasured perpendlcul.ar to r in the plane defined by P31 P 1 and P The chord
4
5
length between P and P is d. A parabola can be oorpletely specified by two
3
5
end p;:>ints P , P51 and a th.i.rd p;:>.int P on the curve. 'Ibe value of the CXJnStant
4
3
a is chosen such that the parabola P (r) passes t.h.rough P .
4
In a similar rranner I the parabola O(s) is defined so as

the p;:>ints p 41 p 51 and p 6

The equatia'\ is

to pass thrO\.Xjh

v = Q(s) = 6s (e - s)

(5-49)

Here s 1s rroasured along the crord length P P , v is perpendicular to s in the

4 6

plaoo defined by P , P , and P , and 8 is d'osen such that the parabola passes
5
6
4
throU'Jh P5 'Ihe crord length between P 4 and P 6 is e .
'Ihe par.urctcr t is now chosen as the distance measured alonq the chord
and P A curve CCt>, which is a blend of the blo overlapping
5
4
po.ralxllas, is c::onstructed bet:l.'een P ~ P by use of an interpolalioo schete.
length bct:l.-.;en P

1he blending curve C(t) is defined as

C(t) = [1- (f-)JP(r) + lf-JO(s)


0

where t

(5-50)

is the distance between P4 and P

'nle coeff!cients of P(r) and Q(s)

act as blending functions , varying linearly


respect.ively.

be~

1.0 and 0 , and 0 and 1.0

'11-.e {XlSition vectors P , P , P , and P

above are specified in teJ:rns of


5
6
tlle cartesian xyz-<:OOrdinate systern, whereas the blendin:J parabolas P(r) and
3

Q(s) are specified in terms of a local cx:ordinate system.

To derive the para-

rretric, parabolic equat.i.oos in tems of the xyz-<:OOrdinate system, the gearetry

'

sho..n in Fig . 5-5 is helpful.

bct'w'Oen P

In Fig. 5-Sa , P J is perpendicula.r to the cOOrd

4
Thus, the ur-plane can be defined by the ve;:tor cht prodoct

and P
5

(P

4 -

(5-51)

J) (P

5 - P 3) 0

If J is lo:::ated in the ur-plane at r =

m,

then in the xyzwo:x>rdinate system

J
and E>;J.

= P3

+ x(P

- P )
3

(5-52)

(5-51) may be written

(P - (P + x CP - P ))} (P -P ) ""0(5-53)
4
3
3
5
3
5

Solving for x in the xyz-<:OOrdina te sys-

tem yields

"I

(P4 - P3) (P5 - P3)

\)'

_, ... ,

. .t-./

x=

';
--;.-;- \
~

<Ps -

'6

P3>

(5-54

(P4 - P3) (P5 - P3)

PI

d2

With this informatioo tho vector equation


for a EX>int P on the parabola P (r) , rela-

tive to t:00 xyz-<:OOrdinatc system, is


given by

,I
Figure 5-4

Parabolic blendin:J.

SPACE; CURVES 135

P(r) = P

r
+
d(P - P ) + ar(d - r) (P - J )
5
3
3
4

(5- 55)

or after using Eq. (5-52) for J,


r
P(r ) = P3 + d(P5 - P3) + ar(d- r)((P - P ) - x (PS- P ))

4
3
It remains to deteonine a arrl the pararretric equation f or r

~rdinate system

P(xd)

is

(5- 56)

( t)

Since in the

P , it fo.l.la..os that the vector equation for P - J


4
4

or
Q -

1
d .x(l - x)

(5-57)

'l1le required relatiooship for r = r(t) can be obtained fran the C}ealctry

shown in Fi g . 5- 5.

It follows that

r = J<d +

tcose

(5-58)

Ps - PJ
cosO= (P - P )( t d )
5
4
0

(5-59)

For the paratola Q(s) , similar equations can be derived using Fig . 5-Sb.

For

the parabola Q(s) , the relaticnship s = s(t) is


p6 - p4
s = toos6 = t [ (P - P4 ) ( t e ))
5

(5-60)

and

(5-61)
Once the points are specified, the procedure is to calculate .x using
Eq . (5- 54) and then

a using Eq . (5-57).

by Eqs. (5-58) arrl (5-59) .


using Eq. (5-56).

For a given value of t, r is given

Finally , points on the curve, P(r) , are calcu.l.ated

This procedure is then repeated for the Q(s) parabola.

To continue generating a curve through aaH tional points, a blend.ing curve

C. (t. ) is foz:rned between each adj acent pair of points.


~

l.

'lbis creates a contin-

uous curve which is also oontinu:rus in first derivative at the internal data

points.

'lhese first derivatives can be easily detetmined i f Eq. (5- 50) is

rewritten as
C(t) = P(t) + (~)(Q(t)- P(t))

(5-62)

+ (- l ) (Q - P)
to
At point P4 on the ble.'lding curve, t = 0 and P Q.
ck::
dP

<at>

p4

- <at>

p4

(5-63)

'lbus

"nlat is, the slope of the blerv:ling curve

equals the slope of the parabola Plr) at


Likewise, at P on the blending
5
cur.<e, t
t ari P
Q. 'lhus ,

P
4

(~t)

p_

(~)

at: p

Ot

'Ibe equatioo for the blerrling curve

a r r(t l
I

C ( t) is

'

cubic ..men expressed m terms of

the haslC car-...esian coord.lnate system.


For t:his reason it can prodUce a p:>int
~

of .Ulflectioo within an interval.

\l

!4

~s

::.;1 -

c..._

ever, the blending cubic which defines

~ Ohl

the curve between p:>ints P and P does

- - f>6

terpolatioo

r)

~c

not pass through P 3 and P6 . 'Ihis behavior


makes parabolic blending a different m-

b f>

H:Jw-

than one INhich passes

a C"Jbic through four p:>i."lts on a curve.

FJ ;u.re 5- 5

Ge:m:!tric relatu:nships
r ft.) and s ( t ) .

wiqqles are not l.nt.roduoed

~g

According to Ove!i'.auser (P.ef. 5-9) , this


characteristl.c guarantees that spurious

the curve defini.tioo.

Parabolic blc.:.'ldi..nq can be used o.>'lly for _nternal segrrents of a curve .

te a swgle parabola, defined through the fliSt


an:i last throe data p:>l.nts respectively Cc f sec. 4- 9). 'Ihe di.st.anoe between
these p:>.iJlts can te smaller than that for other sec;rents in order to c:are.f ully

The t:1o.r.> end segr;ents rust each

specify the shape of the curve at its end points .

can te

uSE(}

in reqion.s of high

Also, closely spaced p:>ints

cur<~ature.

'1he technique of parabolic blendi.nq offers a different approach to curve

defi.nitioo a.'Xl generation.

it

was necessary to

vectors before the

In the cubic spline tech.lU.que discussed previously,

define the catplete set of points and two e.'ld tangent

...as ~ted.

polnts are needed to start a curve .

In parabolic interp:>l.ation, ooly three

These defl.ne the initial parabolic se;rrem:

t.etween points P and P passing through P A fourth point can then be acXied
3
2
1
and the cubic blerdi.nc; seg:tent beb.-een p:>ints P and P detexmined as shoom

above.

Su::oessive points may be added, one by one, and these determine the
cx:nunuous C"Jbic blendJ.nq cu..~ segmmts t.~t make up tr.e interior part of
tlv>

cun~e.

If the shape is rot mnect, the last

{:011\t

or p:>mts can be

delct.OO and a re11 s.h""'f.C defined by usL""~g alte.rnate points.

When an artist, stylist, or designer sketches, he or she uses short, over.lappir.g strokes to produce the cootou:r desired .

This is not unlike tile tech-

SP~

Ct..'RVES 137

Qloe the sketch is defi.Iw::ld in

nique that can be used with paralx>lic blencling.

a OCill'Uter, then the vectors definin<] the points can be qwc..-. ly displayed in a
variety of ways . In sare applicaticns it rray be desirable to sketch a shape
by using parabolic blend.ing and then use the resultinq junclia'l (X)ints as data

for other techniques.

Exanple 5- 2:

PAAAOOl.IC

Bu:NDn~

Assure that the positioo vectol:'S P [0,0), P4 (1,1), P (3,2) , rud P6 (4,3)
3
5
are J<nown.

We wish to dcte.rmine a curve between t:.he t:o..'O po1.nts P

and P

The procedure is

parabolic b l e..,din}.

Fbr each span catp:)Se(i of three points

1.

a. calculate x

b.

calculate (lor

c.

calculate r or s for given t

calculate the blended curve

2.

fbr the first span E):j. (5-54 ) yields

3+ 2
- - - 0 . 3846
13

c~+j><3i+2jl

(9

4)

(13)(0.3846) (1- 0. 3846)


~l ing

Ek}.

(5-58)
t

first calculate

\ole

fc2>

= 0 325

+ (1)

- IS

cose=
=

(2i + j) . (3i + 2j) .. 6 + 2 =

IS l.i3

/5 10

o. 9923

IS li3

and

r = xd + taos~ ~ 0.3846113 +

8t

1.3867 + 0. 9923t

/SID
fbr

t/t

1/3, t = 0. 745 , which yields r - 2.U6.

Equatioo (5-56) then

yields

P(r) : PJ + ~(PS- p 3 ) + nr(d- r) [(P4 - P3) - x(P5 - P3)1


P(2 .126) = PJ + 0. 5896(P - P3) + 1.0223 ( (P4 - P3) - 0. 3846(PS- P3 )
5
root + o.ss96(3 21 + l . o223lll 11 - o.J846J 211
= [O 0) + (1 . 7688 1 . 1792) + 1.0223[-0.1538 0. 2308)

usmg

= 1/3

P(2.126) (1.612 1 . 154]t/t


0

For t/t

- 2/3, t 1.4907, and r = 2.8659, &J. (5-56) then yields


P(2.8659) = (2.279 1.7487llt/t ~2/3
0

For the secocd span


(P5 -

p 4) (P6 - p 4)

X=

:::;

IT = 0 . 6154

(P6 - P4)

B
t

0.325

= ~

e = II3
(PS - P4 ). (P6 - P4 )
t e
0 . 9923

oos6

= tcose = 0 . 9923t

o. 745,

For t/t .. 1/3, t


0

and s

o. 7392 , &J.

(5-61) yields

s
=P4 + e(P
6 -

P4 ) + Bs(e- s)((P5 - P )- x(P - P4)J


4
6
P + 0 . 205(P - P ) + 0 . 6887((PS - P4 ) - 0.6154(P6 - P4 )]
6
4
4

Q(s)

-=
and for t/t

r1. 121

1. 2511 1t/t =l/J


0

= 1.479,

2/3 , t,... 1.4907 and s

Eq. (5-61) yields

Q(l.479) = (2.3882 1.584J i t/t 2/3


0

Equation (5-62) rray now be used to b l em the bNo parabolas to yield the
desired curve between P4 and P 5 :
C(t) .. (1-

) P(r)

for t/t0

<-=->oCs)

1/3,

ceo. 745)

= ~P(2 .126) +

j.oco.7392)

= [1. 648 1. 361]


and for t/t

= 2/3,
C(l.4907) = j-P(2 . 8659)

+ ~0(1. 479)

= [2 . 352 1.6398)
'Ihe results are

stn.m plotted in Fig. 5-6.

An algorithm which will inpl.erent

dt:-scnbed above is given in Appendix

c.

tre parabolic blendi.ng technique

SP~

5-7

Be:ziER

ct1RVES 139

Cl.Rves

The previously discussed r.ethods

for

ional-curve generation

have been oonstrained to pass through


all t.l'lo specified data points; i.e. ,
they are curve fitting ted\ni qucs.

1n

many cases excellent results arc achieved }


with these rretixis.

certain

~ks

'1be:re arc, however,

which render these

nethods ineffective for interactive "ab

initio" curve design.

'!his is due to

the fact that control of the

curves~

by nurerical specification of both direc-

tion and rragni.tude of tange.nl derivatives

does not provide the intuitive "feel"


required for curve design; i.e. , there

..J

is not always an obvious relatioo be-

Results of parabolic
blend.i.ng for Exanple
S-2.

tween the nlDI'tlers and the curve shape.


In addition, the cubic curve fitting

technique specifies a curve o f unique order, which d::les not vary fran spline

to spline.

In order to increase flexibility, nore points lTLISt be input, creat-

ing norc spl ines which are all sti 11 of cli>ic order.
An alternate method o f curve description has been described by Bezier

(Refs. 5-10, 5-ll , and 5-U) which

all~'S

the relation between input and output.

the user a nuch cp:-eater feel for

'lhis enables him to use the pxogcaan

as an artist , stylist or desi9J1&, varying curve shape and order by the use of
easily controlled input pnrarreters until the output rmtchcs the desired shap?.
A Bczior curve is associated with the "vertices" of a polygon which uniquely define the curve shape .

cnly the first and last vertices of the polygon

actually lie an the curve; however , the other vertioes define the derivatives,
order, and shape of the curve.

as sho.m in Fig . 5-7.

'lbus, the curve is defined by an open polygon,

Since the curve shape will tend to

follo.~

the polyga1

shape, changing the vertices of this pol}'9011 gives the user a III..ICh greater
intuitive feel.i.ng for input/output relationships.

All that is necessary to

increase the order of any curve segnent is to specify another interior vertex.
This qreaUy increases flexibility and owr:co1es many of the difficulties of
the cubic fli>line fitting and parabolic blending techniques .

control is easy with Bezier curves.

FUrtherrrore, local

span will
will retain

Any change in the -..ertic:es of a

only effect the curve within that span .

~ne

rest of the

o.lr'W

P.

---

r.0

,.
p

Figure 5- 7 N:xtenclature for Bezier

C'lll:'VeS .

unaffected .
'The mathematical

of the Bezier curve is a i:olynomial blending func-

basl.S

tion 1</tuch lJ'Iterp::llat:es bebleen the first and last vertices .

'The Bezier p;>ly-

related to the Eernstein polyranial.. 'Ihu.s, the Bezier curve is said


to have a Bernstein basis. 'lhe basis fuoct.ion is given by

nanial

l.S

. (t)

n,~

where

,n

1i)

= (~)ti(l
~

- t)n-i

(5- 64)

n!
i! (n-1}!

(5- 65)

with n being the degroo of the p;>lyocrnial and i the particular vertex in the
ordexed set (fra11 0 to n)

In general an nth order p;>lync:rnial is Sf'ECille::l by

The curve points are then give."l by


n
P(t) =
P.J . (t) 0 < t < 1
i=O ~ n,1
where P . contains the vector COtfXJne.,ts of the various vertices .

n + 1 vertices.

(5-66 )

At the start-

1.n9 point of a curve segrrent,

3n,O(O) ""
l\t the end point

nl (1) (1 - O)n-O
n!

(5-67)

of a curve se<;rent,
J

(l) = n! (1) (0)


n,n
n! (1)

n-n
(5-68)

Equatioos (5-67) and (5-68) along with Eq. (5-66) sl'x::7N that P (0) = P and
0
P(1) = Pn; .1..e., the vertices P and Pn lie on the actual curve seg;rent at the
0
starting point and the e."ld point respa:tively.
Another characteristic of the interpolatioo fln::tioo is tl-.at max:iirun

values occur at t

=.

i/n .

'1'his maxirrun is g'iven by Ref. 5- 12 as


(5- 69)

FOr ex.ar.plc, for a cubic ,

-4
9

SPACE CURVES

2
4
J3,2(3) - 9

141

1',

As an e.xa.'Tple, consider cubic

Bezicr curves, as sha.m in Fig. 5-8.


For this c;.,se n = 3. Assune equal increrents :m the pa.ra:retcr

segrrent, sa:,.,

t-=

o, l/3,

P,

for the

2/3, 1.

Then

--

using Eqs. (5-64) and (5-65) yields

3!

JJ,l(t) .. 11(2) I t (1 -

= Jt(l

- t 2)

= Jt2 (1

- t)

and

31

J3, 2(t) 2! (1!) t (1 - t)

"u

'

'111e results are tabulated in Table 5-2.


USing Table S-2 dl1d Eq. (5-66)

/fP,.
/ I

P,

4
2
l
P(J) ,. 27PO + 91?1 + 91?2 + 27P3

I
')A I

P;;- ~
""~.../I

'nlus, to create a cubic curve seq-

......... J

nent, it is only necessary to specify the

PI

the four p:>l;,:JOO vertices and then calFigure 5-8

culate JX>ints along the curve for

Bezier p:>lygons for

cubics.

0 ~ t ~ l.O using F.qs. (5-64) and (5-80)

Table 5-2
Results for Bezier Curve

n=J

J n,i

l/3

2/3

8/27

1/21

JJ,O 1

4/9

2/9

J3,1- Jt(l - tl

2/9

4/9

J3,2 = Jt2(1 -

l/27

8/27

J3,3 .. 1

as shc1...n arove.

tives .

t)

lt is not necessary to explicitly ccnsider parametnc deriva-

A user can quickl) learn to predict the shape of a curve which will be

generated by a certain p:>1}1901'\al shape.

Various Bezier cubic curve seqzrents

arc stn.m in Fig. 5-8 .


Although tt 1s not necessary to calSider curve derivatives in generating

142

l~C\L

EIDIENI'S FOR C<:M='ln'ER GRAPHICS

i.rrlividua.l Bezier curves, rraintaininq continuity of slope and curvature "tlen

JOiru.ng bolO eezio.r curves requires consirleratioo of these derivatives.


rth derivative at the st:.artJ.ng point

is given by
It

pr(O) ..

The

L: (-l)r-l.(:)P
.
1. 1.

n.

(n - r) 1 i=O

(5-70)

and at the end point by

n!
- (o - r) I

L:
i=O

(5-71)

'Ihus, the first derivatives at the end powts are


P'(O) = n(Pl- P )
0

(5-72)

(5-73)

'lhls illustrates that the first derivative of the Bezier curve at the initial
and fi.nal points is tangent to the initial and final pol}'90n segtrents, i.e.,

the end s lopes are fixed by the directiat of the line jo:i.n.ing the two end
vertl.ces.

Similarly the secC>l3 derivatives are


P"(O) = n(n- 1) (P - 2P + P )
0
2
1
(5-74)

P"(l)

= n(n-

)
l ){P - 2P
n
n-1 + Pn- 2

These results illustrate that the second derivative of the Bezier curve at the

initial and final points depends en the nearest two polygon segmnts or on the
nearest three polf9C11 vertices .

In general the rth derivatives at an end point

or start.ing point are detenni.ned by the end or start.ing point and its r neighboring poly<p1 vertices.
Continuity carlitions beb.'teen adjacent Bezier curves can thus be sirrply
specified.

If

one Bezier curve of order n is defined by vertices P1 and an

adjacent Bezier curve of order m by vertices Q . , then first derivative oontinJ.

uity at the joint is obtained when


P' (1) ,. g:J' (O)

o r where 9 is a scaler .

Using F.qs. (5-72) and (5-73)

01 - 0o =

~) CPn

- Pn-1>

Sinoe the curve must be ccntintDUS at the joint,


ooc:; sec}'l'ent

0o "" P0

(5-75)

Thus, the end of

is equal to the starting slope of the next segrent when the three

points 0 , P , P
are col.i.near . FOr the particular case of two adjacent
1
n n-1
cubic Bezicr curves (cf Fig. 5-9) , n = m = 3. If both diroctioo and JTa911itude
of the JOint tangents are to be equal, Eg. (5-75) yields
0 1 - 0 o = P 3 - P2 = ~ - P3

SPJICE

Figure S-9

First-order cxmt.inuity in

~ier

143

cubic segrents.

Thus
0 1 + p2 - 2P3
'!hat is, P is the midpoint of P o . Note that continuity of slope c:nly requires
2 1
3
that P lie on P o1 sare..nere bet\.-een P and 0
3
2
2
1
For the sane P and Q curves above, seoond derivative continuity is given
by

m(m - 1) co0 - 201 + o2 > = n(n - 1) (P _ 2 - 2P _ + P )


(5-76)
0
0 1
0
As a practical matter it may be necessary to increase the order of the

curve, i.e., .it.crease the nl.llber of p:>lygon vertices to rraintain higher order
derivative continuity.

This is frequenUy eas1.er than splitting the overall

curve into smaller setiJieJ'lts ard m:rintaining lower orders, say C\Dic, within the
~t .

nus

flexibility of increasing the order of curve

~ts to

get bet-

ter control of the curve shape is one of the major advantages of the Bezier

rrethod .

BEZIER aJRVE

Exanple 5-3 :

Assume that P0 (1 1], P (2 3), P2 (4 3) , and P3 (3 11 are the position vec1


tors of a Bezier p:>lygon .

Rlcall Eqs . (5-64) to (5-66)


n

P(t) ..

L
P.J . (t)
i=O ~ n , ~

n i
n-i
.n
n!
where J 0 , 1. (t) = (.)t
(1t)
and
\ 1) . , (n _ i)!
1
1
1.
have 4 vertices . Hence
n
6
(i) = i! (3 - i)!

and
J ,

ct>
0

0
= (l)t ct

3
2
J3 , l(t) = 3t(l - t)
2
J3,2(t) - Jt (1- t)

t>

= (1- t> 3

Here n 3, since

we

Thus

P(t) POJ3,0 + PlJ3,1 + P2J3,2 + P3J3,3


table of J
n, 1 for various valoo.s of
is given bela..~ .

Table S-3
)

1',

P,

.L

pl

JJ,O

0
0. 15
0. 35
0. 5
0. 65
o. 85

Coefficients for a Bezier CUrve

1
0~----~----~------~----~
I

figure 5-10

P(O)

J3,1

0
0.614
0. 325
0.275 0. 444
0. 125 0. 375
0. 043 0. 239
0.0034 0. 0574
0
0
1

J3,2

J3, 3

0
0
0. 0574 0. 0034
0.239 0. 043
0. 375 0.125
0.444 0.275
0. 325 0. 614
0
1

Results for Dezier curve


segrrent for Exanple 5-3. Finally

= P0 = (1

1}

P(O. lS) : 0. 614P + 0.325P + 0.0574P + 0. 0034P (1.5 1.765]


2
1
3
0
P(0.35) =0.275P0 + 0.444P + 0.239P2 + 0. 043P3 = (2 . 248 2. 367]
1
P(0.5) 0. 125P + 0. 37SP + 0. 37SP2 + 0. 12SP (2 .75 2. 5)
0
1
3
P(0.65) : 0.043PO + 0. 239P + 0.444P2 + 0. 275P = (3 . 122 2. 36)
1
3
P(0. 85) = 0.0034P + 0. 514Pl + 0.325P2 + 0. 614P = [3 . 248 1. 75]
3
0
P(l) ; P3
(3 1]

'Incse p:>ints are plotted aloog with the defining p:>lygon in Fig. 5-10.

An algoritr.n which nay be used to calculate Bezier curve segments given

t:re p::>sition vectors of the po1ygcn vertices is given in .Appendix c .

5-8

8-SPLit~ CLRVES
From a m2.tl'.ematical point of view, a

ver+ioes of a defining

p:~lyyat

C\lnE

wtu.ch is qenerated by us:ing t:.M

is dependent on sare interpolation o r approxima-

tion schcfrc to establish tre relutionship bcO..'eCJ'l the curve arrl the p:>1ygon .
This

schal~ 1.S

providod by the croice of a basis or

~ight..ing

functioo.

As

SPK.'E CURVES
noted in the

prev1.0US

145

section, the Bernstein ba.eis prod11ces &...-z.ier curves gen-

erated by Eq. (5-66) .

'lle;e

have several useful properties.

'1\.o chAracteristics of the Bernstein b<lsis, hc:Mever, limit. the llexibility

of the resulting curves.

First the nll!Tbar of spec1fied polygon vert1ces fixes

the order of the resulting polynomial which defines the

cw:ve.

For exnrrplr>, n

cubic curve nust be defined by a polygon with four verttces and three spans.
A polygoo with six vertices will always produce a fift:h-dcqree curve.

'Iha only

'Wa to .reduce the order of the curve is to reduce the n\.'Ulber of vertices, and

cnwerse.ly the only way t:o increase the order of the cur:vc is to ux:reasc the
m.1tbe.r of vertices.
'Ihe second limiting characteristic is due to t..he global nature o( the
Bernstein basis .

'Ihls rrcans that the value of the

\<o~ght.ing

function J

. (t)

n, 1
given by Eq . (5-64) is nonzero for all pararreter values over an entire span of
the curve. Sinoe any point on a Beder curve is a resul.L o! ~<~eighLing th!= values of all defin.ing vertia-s, a change in one vertex is felt 1:hrougl'xlut the
entire span. Practically, this elim.inates the ability to produo:! a local chango
within a span.
Fer e.xaJTPle, siJ1c:e the end slcp:s of a Bezier curve are established by the

directialS of the first

aoo

last polygon sides, it is (X)Ssible to change the

middle vertex of a five -point pol}'900 witOOut changing the di1ection of the
end s l opes .

However, tha shape of the total curve

nature of the Bemst=Pin basis.

.LS aff~

duo to the qlobt,l

This lack of lcx:a1 span oontrol can be detri-

rrental in sate applications.


'n1are is an:>trer basis, called the B-spline basis, \orhlch C<XItains the
Bernstel.ll basis as a spec1al case.

'lbis basis is generally nooglobal.

The

nonglobal behavior of a-spline curves is doo to the fact that each vertex P. is
l.

associated with a unique basis functiCX\ .

'111us, each vertex affects the shape

of a curve only over a range of parMeter values where 1.ts associated basis
function is nonzero .

'lbc a-spline basis also allows the order of the resulti.nq

to be changed without changin9 the mmber of defin:ing polygon vertices.


The theory for a-splines was first suggested by Sc:hoenbe.rg (Ref . 5-13). A
C'\.lt'VC

recursive definitioo useful for nt.Drerical cmput.ation was published by Cox


~-

5-14), and by de Boor (Re. 5-15).

Reisenfeld (Ref. 5-16) applied the

B-spline basis to curve defiru.t.lCI'I.


If

\<o'e

again let P(t) be the positioo vectors alon<J the curve, as a fmction

of the parall'cter t , a curve gererated by the use of the B-spline basis is given
by
n

P(t) =

L P.N. k(t)
i-o l. l.,

(5-77)

146

l~ICAL

EII:'0ll'S FOR

en~

GRAPIUCS

where the P . are t:re n + 1 defining polyqon vertices.


1.

FOr the ith oornalizcd B-spline basis curve or order k, the w.ighting func-

tioos N. k (t) are defined by the recursion fornulas


1,

1,1

1 i f x. !:. t _ x.+l

{t) =

J0

othexwise

N . k(t)

(t- xi)Ni,k-l(t) +(xi~- t)N~+l,k-l(t)

1'

xi+k-1 - xi

(5-78)

xi+k - xi+l

'lb:l values of x . are elerrents of a krDt vector which is cliscussed belo..r.

'lhe

l.

along the curve P(t) .


rrax
.
An additional variable rrust be uc:ed for a-spline curves to aocount for

pa~ter

var1.es fran 0 to t

the i.nherent added flexiliility.

'lhis 1s achieved by use of a knot vector.

~ xi+l for all


1
Examples of knot vectors are (0 1 2 3 4) and [O 0 0 1 1 2 3 3 3] . The

krDt vector is s.i.nply a series of real integers xi, slrll that x

xi.

values of xi are considered to be pararretric knots .

'lhey can be used to indi-

cate the range of the paraneter t used to generate a a-spline curve with

'

O -< t -< t max .


Recall that the pa.ratTeter range for a Bezier curve was arbitranly chosen
to be 0 .i t ~ 1 for a Bezier curve of any order.

'~ f'OI

deviate fran this con-

vention and use a knot vector to specify the paraneter variation for the

cut""'.l'e.

Fbr cx.a."tple, the vector (0 l 2 3 4) indicates that the par.uroter t varies fran
0 to 4.

'lhe m.aTber of inte.nred.iate knot vectors depends on the nmbe.r of spans

in the defi.n.i..ng polygon.

A d\~licate interrrcdiate knot

value indicates that

a nultiple vertex (span of zero length) occurs at a point, and an int:ei.1rodiate

knot value in triplicate indicates three coocurrent vertices


spans) .

(bot>

zero-lenqth

The actual point on a B-spline curve which corresponds to the value

of a paranetric knot (t xi) is called a gearotric knot.

It is convenient to

use evenly spaced knots with unit separation between roncoincident knots.
gi VI!S integer values for the

a:J"IPC)nents

of the knot vector .

'lhls

In addition to the

knot vector values, the order of the curve must be specified.

I f the order k

equals the nunber of polygon vertices, and there are no multiple vcrt1ces, then

a Bezier curve will be generated.

As the

lies closer to the defining polygon.

order dccre-1ses , the curve produced

'~

=2

the generated curve is a series

of straight lines which are identical to the defining polyqon .


'l'hc order of a curve is reflected in the knot vector that ls used to gen-

erate the curve.

It is necessary to specify knots of nultiplicity k at both

til" begl.M.i.ng and the end of the knot set.


pol~'qOI"l

For exarrple, oonsider a hve-point

(n + 1 - 5) with no duplicate vertices.

h1lcn there are no duplicate

vertices, the p.u-aneter t varies fran 0 t..o n - k + 2 over the entuc curve.

SPJ>a: CURVES

For a th.i.xd-ordcr curve defined by fiw vertices,


4 - 3 + 2

value of t

nwc

14 7

The conplete knot vector, using rrultiplicity of 3 at each end,

3.

is then given by (O 0 0 1 2 3 3 3).

A second-order

curve for tro sarrc defining

p:llygon has a knot vector (0 0 1 2 3 4 4), a."td a fourU.-ordec curve has


(0 0 0 0 1 2 2 2 2} .

If seven polygon vertices are used a thircl-ord,.J" curve

lS

desired, then the koot vector .is (0 0 0 1 2 3 4 5 5 51

a final cxanplc, consider a polygon of four djstincl vcr.t..locs. 'lhe knot


vector for a seoond-ordcr curve is [0 0 l 2 3 3}. Nc:M, if the 0.0 center verAs

tices are rMde to coincide so that a rrultiple kn:lt occurs between the two end

krx>ts , the knot vector for the sec:ood-order curve is I 0 0 1 1 2 2]


If suoothness is based on continuity of higher order derivatives, the
order of the curve determines how "srtooth" the curve is.

For exanp1e, a fourth

order curve is continoous in first and second derivative, as well as p:>sitlon,

along the entire curve.


The 8-spl.i..ne curve is matherrat.ically defined as a polyromiAl spline func-

tion of order k (degree k - 1} since it satisfies the folla.r.ing t:\..o oondiucns:


The function P (t) is a p:>lyncmial of degree k - 1 on eACh interval
(xi~ t ~

xi+l }.

P(t) and its

derivatiws of order 1, 2, . . , k - 2 are all continuous

over the entire curve.


'lhus, a fourth order a-spline curve is a piece.ri.sC! cubic spline.
Due to the flexibility of B-spl.i.ne curves, different types of control

"handles" can be used to change the shape of a curve .


by changing the integer order k for 2

COntrol can be achieved

k !:.. n + 1 , by usa of repeating vertices,

or by changing tOO nurber and/or p:>sition of nc:nrepeat.i.ng vertices in the defining polygoo.

These effects are illustrated in the follo.dng six figures.

Figure 5-11 sho.Ys three &-spline curves of different order, each de..fined
by the sarre four polyc;pl vertices given by

0 0

The second-o.rder curve

3 9
6 3

9 6
creates three straight lines bet\.Jeen the four vertices, the fourth-order curve
corresponds to the Be'.der curve for the p:>lygat set, al'X1 the t:hi.Id-order curve
produces a looser curve bet-..-een the two end points.

Notice that all three

curves have the sane end slopes, determined by the slope of the first al'X1 last

spans of the defining polygon .

As the order of a curve increases, the resulting

sha?> lod<s less like the defining p:>lygou shape.


tightens the curve.

'!bus, ioc.reasing the order

! t r---~--------------------~--------~------------~

'

'

I"

'

Figure S- 11

'

B-spline curves .

.----~--~----~----------~---------------~--------~

5/S

'
'

fL---._--~--~----~--~--~--~----~--~--~

F'l.gUre 5-12

'

Multiple vertex B-splinc curves.

"

SPliCE CURVES

149

Figure 5-U shows the effect of rrultiple vertices in the defini.ng polyyoo.
For each of the four curves shown, the order of the curve is equal to the n\.r.be.r
'lb! lower curve m fig. 5-12 is identlc-al

of vertices in the defining polY90fl.

to the lo..er curve in Fig. 5-ll, a fourth-order curve defined by four polyqa1
vertices.

'Ihe seo::::nd curve

vertex at [3,9) .

at (3,9).

l.n

Fig. 5-12 is a fi.fth-arder curve with a double

'Ihe third curve is a s.ixt:h-ottler curve with a triple vertex

The fiMl seventh-order curve has a defining pol yqon given by

001
3 9

3 9
3 9

3 9
6 3

6
e . g., four nultiple vertices at [3 91.

'lhis figure clearly shows how a curve

can be pulled clo$er to a speci fjc vertex positjoo by use of nultiplc vertices
while rraint:aining the sa~re end slopes for each curve.

()) the other hand,

decreasing the order pulls the curve closer to all polygoo vertices.
In Fig. 5-13 the defining vertex lS

l l r---~----~--~r----r----~--~----~----r---~----,

'

e L---~----~--~----~--_.----~--~----~--~--~

Figure 5-13

'

Multiple knot B-spline curves.

II

150

wmaP.TICAL El c:.V.ENTS FOR cn!PL"l'ER GRAPHICS

ro o
2 5

I4

8
6 3

6 3

8 6

l1o
'!1lat is,

for each curve.

\>'e

keep a double vertex at the fourth ele!l'ellt in the

polyr;p1 . Hen! the curve is al t.ered by chanqi..ng the order of each curve, ~
ing the defining p:>lygon constant. The first curve is of order seven , equal
to the m.:'li:er of vertices in the polygon . The second curve is of order five .
'lhls curve shape is closer to the polygon shape, expccially O('ilr the double

vertex.

The third curve is of order 3 .

Notice that a "knuckle" occurs at the


double vertex since the slope and curvature are discontinoous. A duplicate
vertex is required to create a knu::kle in a third~mer curve . A triple vertex
creates a kmx:k.le in a fourth order curve. This ability is a mmLll"1 requirement
in stup desl.gn.

I
I

Figure 5-14 deronstrates


the enUre shape of a curve.

local changes can be .rrade without afecting

Each curve is a

seven-point polygol"' with oo multiple vertices.

fi.fth~rder

curve, defined by a
'llle only difference bebolee.n

r~cu.

l:lnZt

""...........:lr.
.....t )"~
r.ulll:.lle ~

Fiqure 5-14

'

Local c::allrol of B-spline c~ .

ll

SP/tCE CURVES

151

each curve 1.s that the fifth vertex is rroved to a new posiUoo, as shewn in
the figure.

It can be seen that the first

part of each

curve is 1.11'\Chanqed.

'1llis behavior is a result of the nonglOOal. (local) nature of the B-spl ~


basis.

Figure 5-15 shcJo...'S curves of order 2 through 5, generated by a six-point


polygcn with no nultiple vertices.

'the fourth order curve is a cubic spline.

'1lle &-spline curve technique all.oNs a orne spline to be generated witll three

or nore pol ygon vertices .


fif~rder

Since there are five spans in this polyc:pt, the

'Ihe third-order curve may be of special

curve is the Bezier curve.

interest since it is tangent to the midpoints of the internal polygon spans .

nus characteristic is also sh::Jwn in Fig. 5-16, where a third-order curve is


generated with an eight-point polygon.

Ex.anple 5-4:

&-SPLINE CURVE

Cl:lnsidcr lhe sarre four polygon positioo wctors

tLc;ed

in the previous

'lbese are P (1 1) , P [2 3), P (4 3), and P (3 11


0
1
2
3
set for a second-ordP..r curve &!fined by four polycJOn vertices

exanp1e for a Bezier curve .


The knot ~tor

is [O 0 1 2 3 3) , where we denote

><o = o,

~ =

0,

X:z"'

1, ,

\ohm using Eq. (5-78) the conventioo 0/0 = 0 is applied.

><s
~

3.
N. k values
l.,

needed are
(t - O)NO

N0 , 2(t}

(t)

1
~- xo

c:

N2 , 2(t)

N3 , 2 (t)

X:z-~

c:

t)Nl,l(t}

X:z-~

(x

(t - O)Nl l (t)

N , (t)
1 2

(X:z3

- t}N , (t)
2 1

x3 -

X:z

(x - t)N
(t)
(t - l)N2 ,l (t)
4
3 1
+
x3 - x1
x4 - x3

x4- ~

5 - t>N4 , 1 (t)

(x

(t - 2)NJ , l (t)

><s -

x4

Specifically, fior t = o, N , 2 (0) = 0(1)/0 + (1 - O) (1)/1 1 . 0 and


0
N , (t) a 0(1)/1 + (2 - 0) (0)/l = 0. Fort= 0 . 5 we find N , 2 (t) = 0.5(1)/1 +
1 2
1
(2 - 0.5)(0)/1 = 0 . 5 , and fort= 1 we calculate N , (l) ~ 1 (0)/1 + 2(0)/0 = 0
3 2
other values of N. k are found in a similar manner.
J. ,

plete results.

Table 5-.4 gives the COir-

By usmg tl1e values of N . given in Table 5-4, points oo the


l.,)

seoond-order curve can be detennined.

P(t)

Ftun Eq. (5-77) , in general,

PON0,2 + PlN1,2 + PiN2,2 + PjN3,3

~TICAL E:I.EME:Nl'S

152

FOR CCt1Pvn::R GWIH!CS

1 ~ ~------------------------------------------------~

'

I S

t L---~--------~------------------_.

F~gure

'

____~___.____J
I

5-15 Varying order of B- sp1ine curves.

'

I L---~----_.----~----~--~----~----~----~--~-----J
I
?
ll
4
'

Fl.gure 5-16

'lhird order a-spline curve.

SPACE O.I'JM:S

153

Table 5-4
'oJeight.i.ng f\mctions for a second-Order B-Spl.tne

0.5

1.0

1.5

2.5

N0,2

0. 5

Nl,2

0.5

0.5

N2,2

0. 5

0.5

N3,2

0.5

l. , )

For t

= 0,

Similarly

+ P (0.5) + P2 (0) + P3 (0) O. S(P + P )


1
0
1
P (1) + P (0) + P (0) = P
1
2
3
1
P (0.5) + P (0. 5) + P (0) ~ 0.5(P + P )
2
3
2
1
1
In a like rranne.r the last three points are P(2) ,. P , P(2 . 5) 0.5(P + P ),

P(0.5) P (0 . 5)
0
P(l) = P (0) +
0
P(1 . 5) = P (0) +
0

and P(3)

= p3 ,

'l1lese points obviously fall on the straight lines joining the

polygon vertices.
Now, i f the order of the

curve is increased frau two to four tor the sane

four defining polygon vertices, a Bezier curve will be obtained since lhe order
l'lCW

equals the nt.nbe.r of vertices.

'lb! knot vector set (with tmax

3 - 4 + 2 ... 1) is [0 0 0 0 1 1 1 1).
by Eq. (5-78)

Values of the weight.ing function.s given

are
(t -

O)NO 3 (t)
0 - 0

t>

Nl, 4 <

N
(t)
2 14

N3 ,4 (t)

(1 - t)N , (t)
1 3

l-

(1 - t)N2 , 3 (t)
(t- O)Nl , J(t)
---.rr----;:o~- +
1- 0
( t - 0)N , (t)
2 3

1 - 0
(t - O)N) , ) (t)

1- 6

Proceecling with the requ.u:cd N.

l. ,

(l - t)N) , J (t)

+
+

1-0
(1 - t)N
(t)
4 3

1 - 1

evaluations,

(t- O)N , 2 (t)


0
0 - 0

(1- t)N , (t)


1 2

0- 0

N , (t)
1 3
~

13 (t )

II

N3,3(t)

:a

(t - 0)N , ( t )
1 2

6- 6

(1 - t)N , (t)
2 2
+
1- 0

(1- t)N , (t)


(t - O)N2 , 2 Ct)
3 2
1- 0
+
1 - 0
(1 - t)N , (t)
(t - 0)N , (t )
4 2
3 2

1- 0

1- 1

(t- l)N , (t)


c1 - t>N5 Ct>
4 2
12
N4 , 3(t) =
+- 1 - 1
1-1
'lhese N.

~.

equations in turn requi.n! N.

~.

(t - O)NO,l (t)

N0 , 2(t ) "'

(t - 0)N ,l (t)

1
0- 0

(t - 0)N

N2, 2{t)

uJ
I

2
0 - 0

''

(0 - t)Nl,l (t)

(1 - t)N)

l- 0

o.

0 -

{0 - t)N , ( t)
2 1
+
0 - 0

l (t)

( t - O)NJ, l (t )

N3 , 2(t) =

values given by

0 - 0

Nl,2(t) "'

(t)

1 - 0

(1 - t)N , (t)
4 1
+
1- 1

(1 - t)N , ( t )
(t - l)N ,l (t)
4
5 1
+
N4, 2(t) =
1- 1
1- 1

N5 , 2(t)

t)N , Ct )
6 1
1- 1

(1-

(t - l)NS , l (t)

1- 1

Let us evaluate the point on the curve at t 0 . 5.

Since the pararreter

variation as specified by the koot vector fa ll s between 0 ~ t ~ 1 for this


the value P (0 . 5) slx>ul.d oorrespcnd to the value P (O. S) found in tho Bezier

example in sec. 5- 7.
and N3 ,l 1 . 0.

For t 0 .5, NO , l N1 , 1 N2 , l N4 ,l N5 ,l
Thus , N0 , 2 = N1 , 2 = N4 , 2 = N5 , 2 = 0 , and
N2,2(0.5); 0 + (O . Sl(l) ~ 0 . 5
N3 ,2 (0 . 5)

tt~rk.ing backward

= (O.Sl(l)

it follows that N , 3
0

+ 0

= N4 , 3 =

Nl,3 = 0 + (0 . 5i(0 . 5)
(0 . 5) (0. 5)
N2 , 3 =
1
N3,3

= (0 . 5 )1(0 . 5)

N0,4

=0.5
0 , and

= 0 . 25

+ (0. 5) (0 . 5) - 0. 50
l

+ 0 = 0 . 25

Likewise
0 + (0 . 5)10 . 25)

= 0.125

N1,4 = (0 .5) 1(0 .25) + (0.5)1(0 . 5) - 0.375

&

case,

N6 ,l ~ 0,

SPN::I:. C'tJR\.1&S

155

(0 . 5)1(0.5) + 0.5(~ . 25) : 0.375

3,4

(0 . 5)i0.25) + 0

Finally, the point an the curve at

= 0.125

t = 0.5 is

given by Fq. (5-77) as

or

P(O.S) (l 1]0.125 + [2 3)0.375 + [4 3)0.375 + (3 1)0.125

= [2 . 75

2.5)

'Ihe x~t is then P

agrees with the

ee~:ier

= 2. 75

and the y~t P

= 2. 5, \oohlch

curve results.

Algoritl'lm9 which will generate the required B-spl.ire rusis knot vectors
and the corres{X>nding B-spllne curves are given m Appendix

c.

REFERENCES
5- 1

w.

Rigdon, A., Chlsen, E., Stiles,

2d editioo, John Wiley

& Sons,

and Weese, J ., t-t!chanics of Natcrials,

Inc., New York, 1967.

5-2 South, N.E. , and Kelly, J.P. , "An.llytic SUrface l'ethods," Ford Z.lotor
Catpany N/C Dewloprcnt. ll'rit, Prodl.d: Engineering Office, DeoerTber 1965.
5- 3 Nut.boume, A. W., "A Cubic Spline Package Part. 2 - 'nle Mathematics,"
Cc:xrput . Aided Des., vol. 5, no. l, January 1973.

5-4

Adams, J . Alan , "A Ccnparison of l-:ethods for CUbic Spline CUrve Fitting,"
Carput . Aided Des., wl. 6 , pp. 1-9, 1974.

5-S

t-~,

J . R., "Co!puter-M.ded Footwear Design:

A rrct:.hOO of c::a1stnlcting

srrooth curves , " SJ\TW\ (Sb:le & Allied Trades Research Association - SATRA

House, lb:::k.ingham

~d ,

Kettering Northants, England) Research Re{X>rt

R.R. 251 , December 1972.


5-6 Denman, H. H., "Stooth CUbic Spline Interpolation FUnctions," Industrial
Mathematics, J . Ind. Math.

soc.,

vol. 21, Part 2, Rl 55-75, 1971.

5-1 Cline, A. K. , "Curve Fitting Using Splines U1der Tension,"

ll.trro.s . Tech.,

no. 3, pp. 60-65 , 1973.


Sclr..oeikert, D. c., "AA int.eq:olaticn Ctlr\A:! usinq a spline in tension,"
J . Math. Phys. , vol . ~5, pp. 312-317, 1966.
5-9 OVerhauser, A. w. , "Analytic Definition of Curves and SUrfaces by Parabolic
5-8

Blending,"

Technical Re{X>rt No. SL68-40, Ford f-btor Cl::ltpany Scaentihc

IJ'OOratoty 1 1'1ay 8 , 1968.

5-10

Bezier, P. ., l:.;P10i des t-'dcirines

.JlC

S-11

~iml.

Control .r-utherratics and Flpplicatials , John \'Iiley & Scns,

London t 1972

~zier,

P..,

e:xanpte of an Existing

Ul surf Syst.!'1\," Proc. Roy.


S-12

Nurerique, twasson et Cie,

Transl.dt.ed by FOrrest , D. R. and Pankhurst, A. F. as Bezier,

Paris, 1970.

P.F.,

a~

soc.

Systan in the t-btor Industry:

The

(I.ondon), vol. A321 , pp. 207- 218, 1971.

Forru;t, A. R. , "Inte.rpolaticn and Approx:irraticn by Bezier Polyncmials, "


CNJ C".roup Doc. No. 45, l!-U.., catrbridge university, Q:tobcr 1970.

5-13

SChoc.nbcrg,

r.

J ., "Contributions to the Pl:cblm\ of Approximaticn of

Ek)w.dist.ant Data by Analync

F\lnctions, "

Q. Appl. l-lath. , vol. 4, 1946,

pp. 45--99; 112-141.


5-14

Cox, M. G., '"lbe Nurerical Evaluation of B-Splines , " Nathicnal Physical


Iatx:lratory

D!l..~

5-15 de Boor, Carl,

4, August 1971.
"()1

Calculat.i.ng ,.'ith B-Splines," J . Approx. 'lheory, vol. 6 ,

pp. So-62 , 1972.


5- 16

Rl.esenfeld, R. F. aerstein- Bezier l'ietrods for

of Free-Form C\l.n-es and SurfNYS .


\

l-arch 1973.

t.~

COrputer-A.ided Design

Ph.D. 'llll!sis, Syracuse tkriversity,

CHAPTER 6
SURFACE DESCRIPTION
AND GENERATION

Surfaces and surface representatim play a cntical role in rost design


and manufacturing prcx:csses.

'lb! design and manufacture of aut..ard:liles , air-

craft, s':ups, nachlne parts, glass..rcue, and clothing are obvious exant>les. ~
b:cldi.tiO'\al way of r<..-prescntir.g a surface is to use multiple orthogonal projections .

lb.-ever, l"'&ly couplex surfaces cannot be effic1.ently represented

Ul

this

rm.nner. <n,e devcloprent of L-rt:eractive cxx1puter-aided design techniques along


with that of ni.JiCI'ically controlled ooch.ine tools has lead to ~ developtent
of rrore effective rmlh:rls of surface representatim. Here we arc not oonoe.rned
with catpUter representatim of JUSt the pictorllll aspects of a surface, but

rather the rrathmt.ltical description of shape fran which either drawings or


ic.U controlled rmchine tool tapes can be obtained.

nt~Ter

The feasibility of produc-

ing a surface chrectly from a c:x:r:p..rt:..e stored representatioo of that surfo!lee

has been denpnstrated by Bezier (Ref. 6-1), Sabin (Ref. 6-2) , Peters (Ref. 6-3),
and others .

Various techniques of anal.ytically and nurerically representlng a threedin'ensicnll surface are discussed below.
a SlJ!'Ple spherical surface .

To

begin the discussicn we oons1.der

158

6-2

Nl\THEM\TICAL EI.F2'.ENTS FOR <XNPUI'ER GRAPHICS

SMRJCAL SuRFACES
SCire

properties of curves which are useful in surface defiru.tion can be

derronstrated by considering a surface of Jcno.m analytical description.

To this

end cons1der a spheriall surface .

Specific curves on t:he surface are defined by

planes wilich 1.ntersect the ~e .

As an exanple consider the intersectioo of


~l

a . 'Ihl.s is
1
The resulting curve lS a parallel of latitu:3e. 'Ihe equa-

a unit sprore and the plane defined by the surface z ..

sho.-m in f'ig. 6-la.

t.ioo for the parallel of latibrle is oot..ained by solving the two surface equ.a-

ticns silrultaneously.

The ncnpa.rairetric equation for a unit sphere is

~ + y 2 + z2 1.0

(6-1)

Thus,

zw
)

'

defines Ule intersectioo.


In Fig. 6-lb, the plane at

r : e0 which

intersects the sphere is defined

by

or

cx
- by=O
1
1

(6- 2)

..a I

-.

'\
\

-I

,~ I )

~I I

~"

, "'

l'nallcl ol latuudc

Figure 6-1

\l truloiln 111 lc'n~11ul1c

Int.ersectioos of a plane and sphere .

'!he resulting intcrsectioo of the plane and tOO sphere yields a para l lel o f

longitude .

am

Solving F.qs . (6-1)

(6-2) sinultaneously yiel ds the equatioo for

e. ,
the resulting curve, l..

2
il<_!>
cl

+ 1] +

i ::

1.0

1\ spherical surface patch can be foxued by four planes int.ersectl.l'} the


~.

as shc:1wn in Pig . 6-2.

'Ihis creates bolo parallels of latitude and two

parallels of longitude for the patch bolrdaries.

'llle vector equatioo f or the

result:.l.ng surface patch 5(9 , ~) is

-+

e2, am e) are unit vectors

where ~

= (cosesin$)e
2
l.Il

(oos~ >e

(6-3)

the rectangular coordinate system, and

is a p:>sition vector 01 the surface of the sphere as shown in Fig . 6-2.

'11\is

surface patch can be thought or as the locus of a p:>int in three-ditmnsional


space whi ch rroves with two degrees of freec1an cxmtrolled by the two pararreter

e and

vari.llhles
1\

~.

pararretric representation of the un.it spherical surface is


X

(6-4)

cos6~

y = sil16si.nQ
z

Notice that two pardlmters


tioo of a surface.

~;4 ~

v ~ 11/2 .

and are required for the pararretric representa-

The patch shc:1wn in

Fig. 6-2 is defi..ood betw'een 0

am

= cos'

9 ~ 'Jl/ 2

Fran Fig. 6-2 tNe

see that the surface paten is defined


by the four boundary curves AB, oc, CD,
and Dr\.

FOr the spherical patch these


1

are cil:cular arcs.

Further analysis of

Fig. 6-2 shows that the shape of a b::lundary curve can be descrHvxl by specifylJ

ing the tangent vectors at the end of

each curve, i.e., the eight tan<]ent

vectors at the end of each of the corner


p:>ints A, B, C, and D.

For a

()

analytical surface these end tangent

vectors can be obtained by d.if ferenti-

ating the equatim describing the


surface.

II

For the spheri cal surface

shown in Fig. 6-2 these are

as

..

as : -(SJ.n'ISi,n<f ) el +

-+

(COS6sin)e2

Figure 6-2
(6-5)

Spherical surface
patch.

$as ..

.. +

.
- {siM)e
(sl.noos)e
2
3

(cosecos)~

'Ihe rragn:i.t:u.'ie of each of these tangent vectors is unity .


~ =

(6-6)

At comer A,

(1 =

O,

Tr/2, and

as
..
ai = -c3
At oomer C,

n/4, E = r:/2 , and

as

1 ....

'aif .. -If~

as

3i =
as;ae

Here the rragnitude of

is

1/12, and

~l//2)2 +

"
1 +
e2- 12 c3
the IMgnitude of ilS/il4> is

{1//2)2

1.0

'Ib! l.angent vtctors at all four comers are shown in Fiq. 6- 2 and are given in
Table 6-1.

Table 6-1
Tangent Vectors for the Spherical
surface of Fiq. 6-2

Point

as;ae

as;ae

e2

-e3

1 ....

1 ..
12 2

...

CIS/CI

....

-e
li 2

1...
1 ..
-e --e
12 1 12 3

1+
-;

-e- -e

12

-12l

-el

12

....

1
~ 3

-e3

Iasr~l

The cross derivatives, or twist vectors , at the oomers are also useful

in describing the boundaries of a surface patch .

For the unit S{:tlerical patch

these are
(6-7)

'Ib! magnitu::ic of the twist vector is

Ia2s;aea.- o
a2s

aea~

Note at oomer A,

.C2eoos2 +
and at

c:os2Poos2~ .. COSQ

(6-8)

cm::ner c, a 2 sh"CI~ = -<1N2>~1 '!he twist

vectors and their rr.agni. t' !des for the comers of the spherical and surface patch
are sho.m in Table 6-2.

St.JRF'ACE DESCRIPI'Irn AND GFNEPATIOO

161

Table 6-2

Twist Vectors fur the Spherical


surface of Fig . 6-2
il/a~

Point

I /lB(ClS/

<as;ae>

1/12 e 2

1/l'i

-1/12 e 1

l/~

~>I

SUt'face normals can also be u91 to indicate the shape and orientation
of a surface patch .

'lt.e surface nonrals are given by the vector cross prc<}t.ct:

of two tangent vector s .

as

For the SFherical patch ,

as

N=aexa "'

It follo,..ts that at comers A and


+

e1

e2

-sin6sin9

cos9sin4

ocx~

sin6cos~

+
0, N ~ ,

...

(6-9)

e3

0
-sin
~

at corner B, N = -l/2(e1 + ~) and

a t comer C, N a - 1I 2 (e + e ) . 'nle no:mals at c::o~rs Band Care slno.n l11


2
3
Fi g . 6- 2 . 'nle out"...'al'd drawn normals for the surface patch are the negatives of
these

values.
A unit s urface

nornel is defined by ;:;

N/INI .

Expanding F.q . (6-9) gives

(6-10)
and
(6-11)

'lllus,
(6- U)
where

lnl = 1.0

(6-13)

A f.i.nal vector operation which is useful for surface descdpt.i<n is the

dot procb::t.

For the surface patdl under cxnsideratioo,

;;s ~
as ( C-uinl.llin01e (001i:t~le J ( ((X)Gf.C015;)e
.. .. (5.Ul'c.oa.tle

.. - (sin~le 1 0 (6-14)
~
2
3
1
2
1
Si.nce the dot product of these tangents vectors egual.s zero , the b.o tangent
vectors are perpendicular to one another.

'll\us, lines of

constant

(par-

to lines of 9 = constant (rreridians of

longJ.tu;!e) on the surface.


HaVl.nCJ used a spherical surface to illustrate a nmber of useful oouoept.s

for surfaces, e.g. , tangent vectors, twist vectors and surface normals,

"-'E!

now

consider rrcthodc: for describing rrore arbitrary surfaces .

6-3

PLANE

~FACES

Sate of

tr.e techniques for surface reprPSentatiCI'l are rrost oon\A:!f\iently

described by considering a plane surface . In thls sectiCI'l we restrict ourselves


to a four-sided plane surface. l1'le four sides def.i.nin<] the surface are four
pa.rarretric curves or lines which o:>nnect: the four corners
and form the shape o f

the boundan.es.
As sha..m by El:] .

(6-4) in the previous section, it is possible to express

points wtuch fall on a surface in terms of

w
1

pa.ra!l'eters be u and w.

parcllOOters.

Let these ~

The expression for the plane surface is then


x = f(u ,w)

(6- 15)

y g(u,w)
'Ille funct.i.als in Fqs . ( 6- 15) are chosen such that the four bouOOacy cuzves are

described by the follc7wd.."lg four oonditi.als :


u=c

u=c
2

c 1 .5.. w

c2

w~

w .. c

c1

c2

c2

'lhls defines a square in the tr,..._plane, as

(6-16)

in Fig . 6-3.

The functiCI'ls

"''hich represent the actual surface are t:OOse which map this square in the

u..~

plane into the desired surface in the xy-plane .


The derivatives of the point functions x and y as defined by Fqs . (6-15)

are

oXd + ~ XA..
dx auu
~

dy=fuou~
These equations can be written in matrix form as

[dxl = ax ax du1

au~

I'

(6-17)

ldyJ = ~ ~ awj
Equatioo (6-17) relates a differential change in the trN'-plane to the corres{Xltldinc; different al change in the xy-plane.

PlANE SlJRF7ICE

E-::xmtple 6-1 :

Consider the surface in the xy-plane defin<xl by two paranetric cqwtials


given by

x=Ju+w

y - 2u + 3w +

\.5oo'

Wl.th bomdaries specified by

=0

1.0

= 1 0 .!. w ~ 1.0
w = 0 0 -< u < 1.0
w = 1 0 < u < 1.0
u

'.Ihls surface is shoom in Fig . 6-4a.

'lbe equatioos for tm boundaries can be

obtained by substuting the appropriate u and w values.


u=O

ya3x

u = 1

y = 4x-10

w 0 y,..

'lhey are

<t>x

w=l y=x+2
'l11e derivati\1\:.:t which appear in the F.q . (6-17) are a~au
ay;au 2

+ w, and 1y/f!w

= 3

+ u.

of the boundaries can be found.

= 3,

~~aw

Co.

1,

Front these partial denvatives the slopes

It fol.lc::Ms that
~ ";)au 2 + w

dx

au

along w oonstant, and

al0119 u = constant.

These s lopes can be verified in Fig. 6-4a .

I f desired, additional pararretric l.inBs may be a<Xbl to help represent

the surface patch.

For exanple, when u 1/2 the equatiat for this parametric

line is y (14x - 17)/4.


(l Ox + 13)/U.

hben w 1/2, the pararretric line is y

These 0.0 surface paranetric lines are shcJ..m as dashed lines

in Fig . 6-4a .

Similar calculations can be made for an expressiat for a planar surfc'!IC'e


written as
u = f(x,y )

w=

g(x,y)

Figure 6-4b sh:lws the surfc'!IC'e defl.ned by


2

u -L
X

(6-18)

,2-

w:y

'!he l::loormries are 9iven by


u- 1

u- 4

- 1 <w< 4
1 <w < 4

w=1 1 -< u
w- 4

". ( '
C]-----+--------------+---

-<

l.i.u.i.. 4

'Ibe equations for each boundazy curve are

indicated in Fi9 . 6-4b .

Many other types

of curves, su:h as o:::nic sections , C\bic


splines, Bezier polynanials , o r B-spl.ine

curves can be used to de fine the boundar-

ies of surfaces.

c,

.c,

~--~-----------------~

~VED ~FACE REPRESENTATION

Before~

c.,

with the details

of the rcprcscntatioo of curved three-

F'i.<JUre 6- 3 Pararretric surface


rectan9le .

d..i.rmnsiala.l surfaces, it is necessary to


make several deM s1ons. First, we ass1..11re

a surface representatloo h:tserl oo a vector-valued para:retric oonoept.


are several reascns for this.

'lllere

'lhis type of representat..l.cn is axis-.in:iepe.ndent:

it avoids infinite slope values with respect to sare arbitrary axis system, it
all~'S

the unarrbi<Ju:>US representation of llllltivalued surfaces or space func-

t.ials , it facilitates the repz:esentatioo of space curves in ha ogeneous coordin-

ates, and it is oonpatible with the use of the

iooal. harogeneous

ooord.il\ate t.ransforrnatioos discussed in Olapter 3.


We will assme that a surface may be represented in a

i.e., a surface

l.S

~se

fashial;

cac!V)Sed of a nlreber of patches which are joined together

in sore fashioo at the boundaries .

No

attenpt will be rMde to represent a

oatplete surface analytically.


In order to efficiently represent a surface, sane notaticnal dctcils are

necessary.

For consistency we represent a curve as a vector valued function

of a SiJ19le variable; i.e., the cuxve P(t) is


P(t) - fx(t) y(t))
for a planar curve and

P(t) = (x(t) y(t) zCt))


for a space curve.

Here t is a paraneter.

As we have seen

in the previous

sections , n:presentatioo of a surface requires two parmreter values . 'lllus,


we assurre that a surface nay be represented by a bivariate ~-valued
two

y1'U "" \I._


'

Figure 6-4

functioo
P(u,w)
A

= (x(u,w)

Plane surfaces.
y(u,w) z(u,w)J

curve on this surface m!IY be represented by fixing either u or w, e .g. 1

P('\ ,w) represents a curve along u = ' \ constant, and P(u,wi) represents a

curve along w

w1

cono;tant.

A curve an the surface P(u,w) rray also be

represented by specifying sare relationship betl<.leen the

pararrctcrs, e.g .,

'I11is relationship might define the intersection of a plane witl,


a surface patch, for exarrple.
f (ulw) 0.

A poinL on the surface rre.y be represented by specifying values of roth


pararretcrs, i.e. , P ('\ 1 wi) , or by specifying ~ independent relat.i.cnshi.ps
beO.'eell the pararetcrs1 say, f(u,w) = 0 and g(u,w) - 0. Note that the latter
representation does not necessarily define a single fixed point.
We will consider that a surface patch can be built up ftorn knoNn data:

i.e. , we oonsider a surface to be constructive.

With this in mind we adq>t

the fol..lowi.ng convention:

data.
0 is the vtX:tor defining the surface coost.ructed from the input data P .

P is the vector obtained fran kr'lcMl or input design

'Ihus , P and 0 coincide ooly at the specified data points.

6-5 BILINEAR SuRFACES


One of the sinplest surfaces is the bilinear surface.

Coosider that the

four corner points of the surface are given in the u ,w-plane by P(O,O), P(O,l),
P(l,O), and P(l , l), the corners of the unit square. tte wish to construct a
bivariate functioo or bilinear surface Q(u,\.,t) where (u,wc(0,1)) allows us to

linearly-interpolate any p:>int on the surface . 'Ihis yiel ds


Q(u,w) = P(O,O)(l-u)(l-w) + P(O,l) {1 - u)w+ P(l,O)u{l-w) + P(l,l)u,.;
or
Q(u ,w)

(1 -

=(

u) u J rP(O , O) P(O,l)]

LP(l , O) P{l,1)

[1 w

wl

(6-19)

,..hlch is sha.m in Fig. 6-5 .

Here it is easy to venfy t:hllt

Q(O,O) : P{O,O,, etc.


sur~ace

Also, a (Xlinl in the center of the

(u = w = 0.5) is sirply

(P(O,O) + P(O,l)

QCO . 5, 0. 5)

PCl,Ol + P(l,l))

general, a bilinear surface and t-'le (Xlsi tion vectors of t!-.e ccmer points
of the surface are three dJ..""eJ'\Siona.l. 'Ihis is perl'>.aps easier to sec i f "-"e write
Ec;. (6- 19) in a rrore o:xtpaet IT'dtrix forr: . In particular ,
tn

Q(x(u,w), y (u,w), z(u,w)) =

where IJ is a (XlSiuoo vector on

L~

interpolated surface , P iS tile ll\3tri.x of


)

PI(! II - - -- - --,l"illl

Ql

PtU 1Sll:!5t

p ( I 01

Pl0.01

.. ..

a.,

,_ .

QtfJ.O)

. ..

Figure 6-Sa

""L '

-~~01.11

Qr flJ

..,

Planar bilinear surface.

r (1

positiOO \.'eetOrS o: the comer points, a"ld U

- U) (! - t:.)W U(l - W) u..-) .

An exan-plc using t:-..o-dilrensional posit.J.on vectors is shown in Fig . 6- Sa.

J..n exanple of a th.-ee-dilrensional bilinenr surface 1s sha.m in Fig . 6-Sb .

Fig. 6- Sb tr.e

as~

In

three-dir'er.siooal position vectors were four of the el.CJht

corners of a unit cube.


/In algorithm

dix

5-6

,..;uch will create a bilinear surface patch is given m Appen-

c.
loFTED 00

R1u.o

SuRFACES

Lofted cr ruled surfaces are freq..lently associated with the aircraft or

shipbu..l.d....r.9 ..n::lw;tries.
bor.Jndary

c-.JI:VeS

To obtain a lofted or ruled surface, asS\m'E! that bo.o

asscx:utted with the opf()Site s;dtts of

u ,w-pl..ane arc knc;r..n, say, P(u,O) and P(u,l).


t-lm t.E<:h.ruques discussed

tained by

.i.r. Chapter S.

t.~

11\

the

'lllesc li\3Y be defined using

a."l}'

A ruled or :ofted

u:early 1nterpolat.l.ng between these

t"-'0

unit square
surf~

of

is then ob-

curves, as stown in F'i.g. 6-6.

The intcrpol.atioo ~ is

Q(u,w) P(u,O) (1 - '-') -. P(U, l)\o.'

(6-20)

1'<1 II

I
O.S / )

\\COnSI:lOI

10

I'll 01

u-

con~tant O.S

'

II
lj

If

z
I

I
I

Pcu.IJ

Q f)l.tnc
Plu.lll

l>fO.(ll

I0

[x(u,w), y(u,w), z(u,w)J

((1-u)(l-w) (1-u)wu(l-w) w) P(O ,Ol

p(l I l)
((1-u) (1-w) Cl-u)w u(l-w) w) 0 0 0

0 1 0
l 0 1

01l
Figure 6-Sb 'lhree-dirrensional
bilinear surface.
and P(l , \,.) are knc1Hn.

O.St

Figure 6-6

P(O,l)
P(l,O)
-

Ql~

lofted Surface.

again note that

0(0,0)

= P(O,O),

etc.

F\.trther note that the edges of the mter-

polated s\lt'f.ace and the given data curves

are coincident, i.e.,


O(u,O) = P(u,O)
Q(u,l) = P(u,l)
Alternately

we can assme that P(O,w)

'Ihe lofted surface is then given by

Q(u,w) P(O,w) (1- u) + P(J,w)u


N}ain it

(6-21)

is easy to shc:M that

0(0,0) = P(O,O), etc.

Ex:anple 6-2:
'I\.'0 curves

sec.

U>f1w SURFJ\CE

P(u, O) and P(u,l) are given by cubic spline se<.JrellW {cf

5-3) .

Ne wish to find the equation for the lofted surface bebo.U!ll these two
l.xlundarlcs. 'l1'le cubic spline 5Cg~Ml'lt.s are assu-ned to have cl.arrped ends.
1\.ssi.M:! for

P(u,O)
p1 -- (0
p2 .. [0
P'1- [0
P'2- (0

and

0
l
1
1

0]
O!
1)
1)

P(u,ll
pl. [1 0
p2 = [1 l
P'1- [0 l
P' (0 1
2

0]
1]
1]
-1]

1-l..ence, csi."\g &i . {5- 19) ,

P{u,O) = [0 0 0] + [0 1 l]t ~ [0 0 -3]t2 + {0 0 2]t3


P(u,l) [l 0 0) + [O 1 l]t (0 - 0.6213 0.7929)t2 + (0 0.2929 -0.707}t3
Equation (6-20) then yields

ocu,w) . lw 0 0] (0 l l)t
'Zhi.s is the surface

fr-7

Ltt-lfAR

{0 - 0.6213w f- 3 + 3 . 792~~)]t 2 - [0 0.2929w (2 - 2.707W))t 1


in Fig . 6- 6.

Qxx.Js S~FACE

If the four bounda...-.y curves P(u, O) , P(u , l), P(O ,w), ar.d P(l,w) are I<J1a.m,

then it

rni~t

be assuned that a si.'Ipl e

and (6-21) in the

S\:1\

of the lofted surfaces

di.rections w::>uld yield "t:re desired result.

r..qs .

(6- 20)

If t:lus

1.5

dale, then

Q(u,w) P(u,O) (l - w) + P(u,l)w + P(O ,w) (1 - u) + P(l,w)~


(6-22)
tk::Me\.-er, examinatioo of F.q. {6-22 ) at the ex>rners of the surface patdl yiel.Cs
Q(O,O) = P (O ,O) + P (O ,O) , etc .
arxl at the edge.s,

Q(O,w) P(O,O) (1 - w) + P(O , l)w + P(O,w)


neither of which oorrespoods to the original data as they should.
Examination of F.q . (6- 22) sh::lws tl-.at the problem occu..""S because t.~e
corner points are oounted bdce, since P(O , O) is contained in both the P(u ,O)
and P(O,w) be~ curves.
'lhe oorrect result can be cbtained by suhtracting the excess contributicn
t~

surface due to duplication of the oorner points. 'Ihis yields


Q(u,w) P(u,O) (1 - w) + P(u,1)w + P(O,w) (1 - u) + P(l,w)u
to

(6- 23)

- P(O,O)(l - u) {l- w) - P(O ,l)(l - u)w - P(l , O)u(l- w)- P(l , l)uw
An exarrple of such a surface is ~ in Fig. 6-7. It can be readily stn.n
that at the oorner,
Q(O , O) = P(O,O)
etc.

ard Along t"le bo..ndaries,

Q(O,w) ==- P(O,w)


Q(u, l) P(u,l)
etc.

\\hlch .inplies that the interpolation is oorrect at the oorners and bo\.t\daries.

'Ihis linear blend of the four boll'ldacy curves is +Xe s.inplest Coons surface.
A rrore general COOns surface is discussed in Sec. 6-17 and Jef. 6-4.

notation,

at.

In vector

(6-22) may be written ctS

Q(u,w) Ill- u) ulfP!O,w>J + (P(u,O) P!u,l>)[l-wj- 11- u u}rP(O,Ol P(O,ll 1 [1

LP<l,w)

IPo,o> PU,uJ

-w]
w

or nore <XJLpactly as
Q(u,w) [1- u u 1] -P(O,O) -P(O,l)

P(O ,w) 1 - w
-P(l,O) -P(l,l) P(l,w)
w
0
1
P(u,O) P(u,l)
'ltle functioos (1 - u), u, (l - w), and w are rolled blending fmct.ions because
t:Ney blend the boundacy curves to produce the internal shape of the surface .

Exarrple 6-3:

LINEAR cx:x:Ri SURFACE

Let the four boundary "curves" be the d.iagc:nals of four of the sides of

a unit cuve as sha.m in Fig. 6-7.


Coc.ns

'''e wish

surface between these boundaries.


For the oenler point oo the surface,
~(0.5,0 . 5)

[0 . 5 0. 5 1)

to fiM the center point on a linear

~ (6-24)

yields

01 0.5

-1 -1 lJ
0 . 5 0. 5 0

0.5
l

Other points en the surface are calculated in a similar manner.

An algorithn

which will

~ate

linear COOns surface as described by


Eq. (6- 24) is given in Appendix c.

6-8

BIClBIC Ste=ACE PATOi


'1lle previous sections have discussed

the representatioo and descriptioo of

s.inple surface patches fmn a CO'ICEptual

point of view. Ne l"'f:M turn our at tention


to sane practical aspects . One of the
nore useful patch descriptions uses para-

rretric cd>ics for the edge curves P (u,O) ,


P(u, l) and P(O ,w) , P(l ,w) and the blend-

It

ing functions .

IJJ

'l'he blending fU'Ictions

for this schene are derived below .

Fran our previous work (cf Sec .

''

s-3)

recall that the fotm of a parcmetric


C\bic is (cf

BJ.

(5-ll))

P(t) ~ B + 8 t + B t 2 + B t 3
(6- 25)
1
2
3
4
Figure 6-7 Linear Cbon' s surface .
"'here P ( t) is a vector-valwd fmct.ion
having x-, y-, ~tpcue.nts. For cawenience we limit the range of the paranenter to 0 ~ t ~ 1; i.e., we use a nox:rna1 ized pararretric cubic. For the
bo\J'ldary curves of a surface, t "" u for one pair of curves and t w for the
other pair.

We

no,..t

derive the blending functions which will allow interpolation of

the points oo the unit square beb.~ the bolo paranetric Cl.bics describing the
edge curves , i.e ., bebo."een P(O) and P(l) . '!here are four \l1'lltnam coefficients
i.n BJ. (6-25) , and thus we nquire four i.ndepenoont equations . Pecalli.ng that
the derivative of the pararretric cd:>ic is
P' (t)

= 82

+ 283t + 3B4 t 2

(6- 26)

and letting t 0 or 1 i.n B:Js . (6- 25) a.nd (6- 26) yields
P(O)

(6-27a)

= ~

: 8 + 8 + 8 + 8
4
1
2
3
P ' (0) = B
2
P' (1) = 8 + 2B + 38
P(l)

Writing Eqs. (6-27) i.n matrix fonn yields

(6- 27b)
(6- 27c)
(6-27d)

SURF71CE OESCRIP'rim h.\10 GENF.:AAT!Gl 171

P(O)

P(l)
p. (0)
P' (1)

rs4

0 0 0 1

(6-28)

1 1 1 1 83
0 0 1 0 82
3 2 1 0 (J31

or
p.,. MB
Solving~ .

(6-29)

(6-29) for the coeffid ents, l. .e . , !or B, yields


B !.f"lp
-1

2 -2
-3

(6-30}

(6-31)

3 -2 -1

0 0 1 0
1 0 0 0
'lhis agrees with F.q. (5-22) .

S\Dstituting F.q. (6-30) into F.q. (6- 25) tlnd re-

arranging yields

P(u) = F1 (u)P(O) + F2 (u)P(l) + F3 (u)P' (O) + F4 (u)P ' (l)


where in general, ~i.th t as the paraneter,
(F (t) F (t) F (t) F (t))
2
3
4
1

= (t3

t 1)

2 -2

(6- 32)

(6- 33)

-3 3 -2 -1
0 0 1 0
1 0 0 0
'Ihe F i ( t) ' s CM be oonsidered as scalar blending fU'lct.ioos for the pararretric

ctbic.

'lhey blend the quantities P(O), P(1), P'(O), and P ' (l)

a cx:nti.nuous

C\l.t'W.

to !onn

Figure 6-8 sho..rs these blencll.ng functions.

toJe nt:JW utilize these results to gererate a b1C\bic patch.


~ure

~ther

~as

'lhe sane pn:r

used to develop the fonn for the bi 1 inear patdi is enployed.


~~ first oonst.r\ct surfaces which will satisfy one family of boundaxy ccnditioos along the edges where u"" 0 and u = 1 and than construct another surface
whidl will satisfy boundary cxmditions ala1g the edges where w = 0 and w ~ 1.
~ then carbine these results to obtain the bicubic patch.
Before prooeeding, sare notatiooal details are islportant. For oc:nvenien~
in later work we int..roduce a superscript notatioo for the derivatives of positioo wctors . In particular
that

Pa (u) .. a<lp (u)

aua

\F\li

p (0,11

P(l,O)

P(l,l)

r 1CwJ
PO,l(l,O) ~O,l(l,l)

1
P 'Cl,O) P1 ' 0 (l,ll r 1 1 c1,01 P1' 1 Cl,l)

(6-36)

f";> (wl

p- co,OI P 'CO,ll rl.lCC',CH .,t,IIO,II

Cw)

r 4 (w)

Alternately Fq. (6-36) may Le written tJore oonpactly as


Q(u,w) "' (u 3 u 2 u l)N P NT [w3 w2 w l)T

(6-37)

~re N is tho squaro I"Adt.rix given previously in Eq. (6-31), ll1ld P

matrix given in Fq. (6-36).

is the

~r

NT is the t.ransposc of N.

Examination of Fi:JS. (6 36) and {6-37) shaRS t.hat


is defined by the Cl.bic blending functions

biai:lk surfac:r patch

r 1 , F2 , r 3, F4 , four Cl.bic

bo\a'ldary

curves , four oorner points , eighL tanCJent vectors at the oorncrs, and four twist
wctors at the oorners .
'nle 4 x 4 P-rnatrlx may be considered as a boundary oondition rr..).trl.x.

It

cxntains only infonratioo aboul oome.r points, oorner tangent vectors , and
oomer twist ~ctors. For a given surface patch all thP elennnts in the P-

mrtrlx are kno.m oonstants.


can be c lass1tied as

Examination of the P-matrix

CoTJ"Pr

p;:

s}n..os

that the t:errs

w-tangent

ooonlinates : vectors

_ _ _ _ _ _ _.,. _ _ _ _ _

u-t.angcnt

vectors

Twist

vectors

Sinoe for the surfao:> palc:h to be physically ~le , adjao>nt boundary


curves nust intersect at a oomer, calStraints are placed on the specific func-

tioo used to represent the bou'ldaty curves . For eY.anplc , at oo~r A in


Fig. 6-9, P(O,w) ... P(u,O): at corner B, P(O ,,~) = P(u,l) 1 at oomer C, P(u,l)
P(l,w); and al corner

o,

P(l

,~r1)

= P(u,O).

A carp t ete deri vatim of the oonstraints inposed on the blending functialS

in order that they satisfy certain booodary CXX"'ditlons was derived in

~f.

6-4

and is giwn in Table 6-1.

The

sh~

of a bicubic patch is oontrolled by the ca'\tents of tho 4 x 4

P-rratrix, i.e., by tho l.ocatioo of the oorner PJSitioo vectors and the fT\agl\itWe and direction of the correr tanqent and bast vectors . Figure 6-lOa

stn.os the effect of c:hanging thr> magnit\XP but not the dirccticn, of the oorner tangent vectors along the (O ,w) ari<J Cl, w) boundaries.

Figure 6- l<b sho.ols

the effect of chanqinq the direct.J.on , bul not tl'lr> JTagnitude , of these sare
comer tangent vectors.

Figurr.s 6-lOc and 6-lOd show the cff<'Ct o f addi.ng a

twlSt. ~ to an initial surfacr; patch wit.h zero b.tist \JIC!Ctors .

174

NM'liEM\TICl\L EIJOJ-1ENI'S FUR OO.v.Pt7IER GRAPHICS


'lhe bicubic surface patch has been suc-

cessfully used to design surfaces (cf


P.efs. 6-5 and 6-6).
1
p 11.1)

Ho..-e'lleJ", several

discdvant.a9es exist when usmg bicubic


surfaro patdles in a carputer-aided
design system.

'1he rrajor disadvantage

exists because three different quantities,

position, tangent and odst vectors all


generally of different orders of rragnitu3e

nust be specified

to describe the surface .

For ex:anple, for .a patch 10 units long,

the tangent vectors mi\t


P<O.O) 1\

an order

of n-agnitu.Oe of 10 units, the twist vec-

zw

ha'v'e

tors 100 units, and the position vector


1000 units.

FUrt:har, the user typically

lacks intui tioo when creating surfaces by


changing elemnts in the definiJ'Ig rratrix.

For ex.oop1e, the oorner tangent vector


P 0 1 (0,0) p:>ints toward the interiol. o f

Figure 6-9

Table 6-1
Bounda!y Corxli.tion Inposee Constraints on

Surface Blending fUnctions

=0

or w = 0

= 1 or w = 1

Fl

F2

F3

F4

F' *
1

F'

F'3
F'

*Prirres indicate differentiatioo with respect to the


indepe.r.dcnt varicble either u or w.

t>

VU utll o n o r IOO f:e OI


\'Cli<H

P0 .1(0.11

\ a rt <lllllfl ul IIIIIScnl

ma,n uudc

~<Cllol

dared tun

...-......

pO.I(O.Ol

[)

Ze ro

I\\'"' a t C

Figure 6-10

11\ II C ' " ' ' ' B l (

COntrol of bieti:>ic surface patdles .

0 1
t:.angent vector P ' (0 ,1) points ;rway f.ran the inte.rior of the boundary curve

as shom in Fig . 6-ll . Also note that increnenting the y-cx:xrp::l')ent of the
ex>mer tangent vector P0 ' 1 (0 , 0) causes the (0 ,w) boondary CUlVe to bend q:> ,
0 1
"hereas incresnent.i.J'lg the y-cx:rrponent of the corner tangent vector P ' (0,l)
an equal anount has the opposite effect at the (0 ,1) corner.
pected behavior occurs when inc:rerenting twist vectors .

'!be sare

ll"teX-

EquAl dlanges in all

twist vectors cause qJpOSi te surface beOOs at the (0 , 1) and (1 ,0) ex>rners
cmpared with the effect at the (0 , 0) and (1, 1} oorners .

the

~ts

Thus, manipulating

o f the P boundary ex>ndition matrix can be cxm.fusing.

An algorithm which will generate the bicl.lbic surface patch described by

F.q. (6- 37) is giwn in Appendix C.

6-9 THE

F-PATOi

In order to eliminate sare of the prcblems lolhidl oca.tr when manipulating

bic\bic surface patdles, a si.JTplified version originally due to Ferguson (cf

Ref . 6-7) , called an f'-pat.ch , is sorret.:i.Jres used.


surface patch with zero blist vectors .

An F-patc:h is silrply a bicubic

Ql.ly first-order CXXltinuity is possi-

bl e across the boundaries of an F-patdl, because the surface is oonstrained to


leave zero cross derivatives at tile oorne.rs . This on occasion may lead to

176

l~J\!HE.l>oo-ICAL

EUMNI'S FOR C'G'.PUTER GRl\PHICS

surfaces which are not sufficiently srrooth


for sene appllcat.la15 . Nevertheless , it
~-~6-:-:-

pO.Iw o

is easier to oonstruct and rodify an


F- patch, and they are suitable for many
types of surface definition.

pO lw 1

In partic-

ular, F-patdJeS have proven to be useful


\

for axisymnetric surfaces, e . g ., vases ,

cups , bottles, aixa:aft bodies , etc .

a lnattal cunc

6-10

BEZIER SuRFACES
'lhe previous sections have dis-

cussed a n\.Dibe.r of aspects of surfaoe

description .

In all cases the tacit

as5\ltPti.on has been made that the necesA

sary mathematical infoxmaHoo such as

position, tangent, or 0.1.st vecton; or


blend.in; functicns is available. l:b..>Figure 6-11 Effect of change in
ever , providing this infoorat.ion may be
end tangent vectors an
ext:.renely difficult for the user, espethe bo\.l'daxy curve
shape.
cially a nonmat:heiMtical or 11011-Caq:lUbeJ:oriented user. A mnber of sc:he!nes have been devised to overocJTra this di ffib. f1 nal tunc

culty .

Prd:>ably the rrost S\ICQ?Ssful o f these is the extension of the Bezier

curve (cf Sec. 5-7)

to surfaces (Ref. 6- 8) .

'lhc surface equation for a Bezier surface patch can be written in the

form of F.q . (6- 36) .

Osing the biocmial rep~entatioo of a Bezier curve given

in Sec. 5-7, the equation for a surfac::E patch with boundary

CUI"VeS

described

by four point Be-zier polygons, i.e . , a 4 x 4-point Be2ier s urface patch is

given by

3
P(u,w) = [(1 - u ) 3(1 - u) 2u 3(1 - u)u2 u 3)18)

(l -

w) 3

3(1 - w)

3(1 - w)w2
w3
8= ~( 1,1 )

8 (1, 2) B(l , 3) 8(1, 4)


8(2 ,1) 8(2 , 2) 8(2 , 3) 8(2,4)
8 (3 , 1) 8(3,2) 8(3,3) 8(3,4)
LB(4,1) 8(4,2) 8(4,3) 8 (4,4)
'lhe B-tcnsor is O::Cip::>scd of the position vectors of the defining polygon
points , as sho,..rn in Fig . 6-U . In the Bezier fornulation , only the oorner

points A, 8, C, and 0 octua..lly he en

surface. Thc {X)int 8 , 2 dafines the


1
slope vector fran the first to the secthe

end p:>int on the first Bezier p:>l}'9XI in


the u-di.rection .

The {X)int 8 ,

de.f.ines

2 1
the slope vector fran the first to the

seocnl p:>int on the first 8ezier tx>lygon


in the w-clirectioo.

The p:u.nts

8 1,3'

8 2,4' 83,4 ' 84,3' 8 4 , 2' and 8 3,1 are defined in a similar manner.

'lbe tx>ints

s 3 , 2 interior to
2 3
3 3
the defining X>lygonal surface are used

~, , 8 , , B , , and

to define the twist vectors at the cor-

---

ners A, B, C, and 0 respectively.

"

( 1 - .....

As shown in F'ig. 6-12 the Bezier

surface is cnuplete1y defined by a net


of design {X)ints
face .

the p:>lygoo.al sur-

Cl'l

'Ihese X>l.Ilts

-- Unundar )

serve to define a

,-,r Ocl ttt

Llc ~li!O

Sur (;aH

ur(act

ntt

two-pararreter family of Bezier curves on


the desiCJll surfac:o.

Figure 6-12

To generate a para-

4 x 4 Bezier surface
~ture .

rretric curve on the Bezier surface shown in Fig. 6-U, let the pararretric curve
be defined by 0 ~ u ~ 1. 0 and w =

'i.,

where 0 <

'i. ~ l. 0.

Before this curve

can be generated, the elerrents in the s-tensor given by Eq. (5-53) DUSt. be
known.

For w =

S,

the matrix product


[81 (1 - w)

(6-40)

3(1 - w)~
3(1 - wlif
w3

w=C

produces four position vectors P , P , P , and P for the Bezier polyyon which
4
1
2
3
defines a Bezier C'UI"Ve with a pararretric value of w ""
The point P lies
1
on the surface bo\D'ldary OW, and the p:>int P lies on the surface bourdary 1w.
4
The points P and P are slq:e des1gn points which lie o ff the curve.
2
3
'nlen, the rMtrix prodoct

'i..

P(u,c )
1

3
[(1- u ) 3 3(1- u) 2u 3(1 - u)u2 u ) P

1
p2
p3

p4

(6-41)

giws the e>cpressioo for a point oo tbe surface along the curve w .,.
eadl value

U1

c1 .

For

F.q. (6-41) gives the oorresponding position 1.>ector for the point

on the surface.
The bol.lldary C\.IJ:'-~ for a Bezier surfaoo can be defined in an analogous

mar.ner to the Coons surface boundaries.

In fact, a Bezier surface can be placed

within the family of generalized Coons surfaces described in sec . 6- U .

exauple, aloog the boundary u = 0 1 0

For

1.0, the Bezier curve is

(6-42)

(51, 1' 52, 1 ' 53 , 1 1 84 111 (1 - w) 3


3(1 - w)Zw

3(1 - w)wl
w3
or alternately,
(6- 43)

z.
~

'Ihe Bezier boundacy curve for 0

1.0 1 w = 1. 0 is

c [(1- u) 3 3(1 - u) 2u 3(1- u> 2 u3J 54 , 1

(6-46)

412
8
41 3
84 ,
'Ibe equations for the other two boUI".dal:y curves can be written directly 1 with

the aid of Fig . 6-12 .


It is saret.iJres desirable to create a surface patch that is rot described
by a square tensor.

a couplex surface.

'lhi.s can be used to al lo,.r sinple curves to be bounded by


As an exanple, the surface sho.m in Fig . 6-13 has three-

point Bezier curve boundaries along u 0 and u

curve l:x::undaries along w ..., 0 and w l. 0.

=1. 0

and five-point Bezier

The equation for the bo\.U'&ty along

w 0 is given by

[(1- w) 2 2(1 - w)w

'llle equatioo for the bouOOary along u

=0

w2J

(6-47)

is

[(1- u) 4 4u(l - u) 3 6u2 (1- u) 2 4u3 (1- u) u4 J

(6-48)

--

a,,

---v. -oFigure 6-13 3 x 5 Bezier surface.

'lhe surface equatioo is then given by

P(u,w) = ((1- u)

2
4u(l- u) 3 6u (1- u) 2 4u3 (1- u) u4 ][Bl f (l- w) 2

t~l

(6-47)

w)w

A five-point Bezier boundary curve has an advantage over a four-point

curve, since a change in the central design point does not effect the slope at
either end of the bouroacy cu.rve. 'lllus, t.l)e surface shape can be changed without disturbing the slope design points, which may then be independently spe<:J.fied to satisfy continuity requi..rerents with adjacent surfaces.
'1lle Bezier surface discussed above can be represented in the fonn of a
cartesian product surface. In particular the surface .l.S gl.Ven by

L L: Bi+l , j+lJn,1. (u)Km,J. (w)


i O j-o

Q(u,w)

{6- 48)

\o.t lere by anal ogy with F.q. (5-63),

Jn,i- ~)ul.(l - u)n-l.

(6- 49)

f.!iwi (1 - w)m-j

(6-50)

n,J

and m and n are one less than the mll'ber of pol}'9011 vertices in the w-

aoo

Bezier has been successful in using his technique in a production environ-

n-ent as described in Ref. 6-8.

In the Uni.surf system at Rclgie Pcnault a free-

hand curve is first drawn with a pencil in the xy-plane to give y f(x) .

o::rrputer controlled drafting lT\!lChine used as a ctigither receives the input


ooordinates of the polygon vertices which roughly define the curve.

'1lle result-

ing Bezier curve is then drawn by the CXZtpUter controlled drafting rrach.ine.

rn::rli ficaticns are needed, the

pol~t

If

vertices are adjusted and the curve is

redr1Jwn mUl the designer is satisfied.

A th:reE~immsional curve is oo~

by repeating the process to produce z : f (x)

nus rrethod is used to define the four bomdaJ:y curves for a surface .frane-

The surface definitioo is then catpleted by specifying the coordir\ates

\o."Ork.

of t.ie rc:na.in.ing surface


a CCITpUte.r prograrmed to
described surface curves
dice a
ional

design

~rk

points.

'lhls data is then input into

prrrlx:e rotated, scaled, or perspective vieo..'S of the

or into a c:arputer ccntrolled cutting rnach.iJ1e to pronodel !ron a block of polystyrene foam.

A. P. Annlt (~f . 6-9) has also developed

which makes use of Bezier surface patches.

a design system called MJLTim

His system allows easy use of various

types of Bezier boundary curves, rangin<J fran a three-point to a seven-point


curve definihoo. 'Ihis capability is dependent \Xl the binomial. nature of the
blend.i.ng functic:ns . A surface f~rk of six-point and four-point curves ~'85
found useful for m:my applications. '!he system allo.ols for curve splitting at

any point to produce a pair of cxmtinlDus C\.I["\1!!5 of the sarre order as the previoos single curve. 'Ibis system is described in Raf. 6-5 and discussed in detail
in Raf. 6-9 .
Serre of the difficulties associated with Eq. (6-48) as with the eezier

curw are concerned wi. th local control. This is because the Jl'O\Ie'!'ent of one
point on the polygonal generating surface will affect the entire Bezier surface .

'lhls can be a distinct disadvantage to the designer, especially for detail

work.

In order to obtajn local control a patch nust effectively be sulx1ivided.

'lhe use of a B-spline basis, i.e . , by using B-spline curves as bl.endin<} fmc-

ticns, eliminates this problem.

This is discussed in the next sectioo.

An al9Qrit:hn which will generate a Cartesian product surface based oo

Eq. (6-48), using eezier curves as the blending f\.D"'Ctions, is given in AWendix

c.

6-11 B-sPLINE SuRFACES

IITplernentatioo of 8 spline surfaces can take many foxms.

Perllaps the

si.nt>lest is the cartesian produ:t surface analogous to the Eozier surface of


the previous section . Fbr a a-spline surface the corresponding Cartesian prodlX:t surface is
rn

Q(u,w) =

rn

L: L
i=O j=O

8.+1 ' +lN. k(u)M. L(w)


~

,]

~.

],

(6-51)

\o.'here by analogy with F.q. (5-78)

N.

l., 1

(u)

N. k(u)
1.,

l i f x~. !. u .!. x.~ + 1

0 otheiwise

"" (u - xi)Ni,k-1 (u) + (xi+Jc - u)Ni+l,k-1 (u)

xi+k-1 - xi

xi+k - xHl

and the xi are the elem:mts of the k knot vector discussed in Soc. S-8 .

(6-52)

Further,

i 1 i.f yi s.w s. yi+l

~ , 1 (w)

lo~ise
=

(w -

y.) M. L-l (W)


J

],

+ (yj+L - w)Mj+l,L-1 (w)

yj-+L-1 - yj

yj+L - yj+l

and the Yi are the elat\.!nts of the L koot vector discussed in


and n are

ale

(6-53)

sec.

5 8, and m

less than the m..1rber of vertices in the dt:fininq (.Olyqons in t.~

~ and w-directions respectively.

def.ininq polygonal surface, as

The Bi+l, J+l are the pos1boo vectors of. the

srown

for exanple in fi.q. 6-12.

As with B-spline curves , knot vectors with vanous dL--qroes of rrultipll.C"ity

can be defined in either the ~ or w-directions. ~r , the above fonrat:ion


requires that each defining polygon in a given di.J:ectia'l must h.Jve the sarre
degree of mult iplicity in a given direction.

Alternate for:nul.at.u::ns could

allow various degrees of knot IT'l.llt.iplicity in a given di.rectl.on in order to


i.ncrGase the flexilJility of local ea1trol. Further di.scussioo of h::w &-spline
curves can be used to form surface patches is given by

s.

A. Coons, ~-1. J.

Gordon , R. F . Rieoonfeld, and others in Pef. 6-10.

6-12

teeRALI ZED ~S ~FACES


Exatninatioo of the results di.scussed above SUJ9f!Sts a uore qeneral repre-

sentation for a surface.

Follc:Ming Forrest (Pef. 6-11)

scalar funct:.ioo B

'lbe

r,1. (u) .

introduce a

<je.l"lel"al

e.r ,1 s serve to blend the boundary oanditions

and/or boundary curves to fonn a surface.

The r subscr ipt indicates that the general blen:l.i.ng functioo is TNeig.hted
by a single-valued function representing a bourx1ary derivative of o.rder r .

For curves , r = 0; for tangent vectors , r = 1; and for curvature or twist

tors, r

==-

2.

vec-

'I1le i subscript indicates the position on the unit l.ll.'-square of

the function bel.llCJ weighted by the

sr,i . Here

we assi.Ure that u = u

1 is inplied:

e . q .,
BO ,l (w) is the ble.ndi.ng function weighting the curve P(u,l).

s0 , 0 Cu)

ls the b l ending

f~oo

\\-eighting the curve P(O ,w) .

Forrest (~f . 6-10) has pointed out several properties of these blending func-

tions.

If a patch is specified by boundary curves alone, then

f
~ Oij lS the

.(j) =6 ..

0, 1

lJ

Krooecker delta , i.e., 61 j ::. 1,

= j and 6ij 0, i -,J j

As an exanpl e , recall the cquaticn describing the bilinear surface, i.e.,

182

M'M"HEMb.TICAL EUM:mS FOR CXl-1PtJI'ER GRAPHICS

Q(u,w) (1 - u) (1- w)P(O,O) + (1 - u)wP(O,l) + u(l- w)P(l,O) + uwP(l,l) (6-19)


Now suppooe t.hat we replNP the linear blending functioo (1 - u) by

still require that

s0 , 0 CO)

.. 1 and

s0 , 0 (1)

o.

s0 , 0 Cu)

but

Further, we replace the linear

s0 , 1 (1) 1, (1 - w)
and w by s , (w) with
0 1

blending function u by SO,l (u) and require BO,l (0) 0 and


by

s0 , 0 (w)

s0 , 0 (0)

s0 , 0 (l)

-= 0
Equatioo (6-19) m:ty then be written as

and require that

= l and

B , (0) and s , (1) 1.


0 1
0 1
O(u,w) r 0, 0 CuJB0 , 0 !wJP(0,0) + e0 , 0 CuJ60 , 1 ~J P(0, l ) a , 1 CuJ & , Cw)P (l,Ol
0
00
\\hlch may be written as
l

Q(u,w)

L s0

i-o

. (u)P(i,w) +

, l.

E a0

j~O

j (w}P(u,j) -

Noting that in Eq. (6-54 ) r

o,

0 1 Cu)~O,l(w)P(l,l)

E E

i=O j=O

'

~ s ,

0 .~

(u}B j(w)P(i,j) (6-54)


0'

we see that thesla s.inple bilinear

COOns

surfaces admit only positional continuity.


The bicubic surfaces discussed in Sec. 6-8 can also be written in a rrore
general form.

First let's coosider the bicubic lofted surfaces represented by

fl:!s . (6-34) and (6-35) .


In the

lfOre general notatic:n Eq. (6-34) m:ty be written as

and F.q. (6-35) as


(6-56)

Otu,v)

~<~here

the blendi.ng furx:tioos , i.e., the Bij ' s, cbey the relatioo.s
p

6 (B

r ,1. (u) 1

= Br , l. (Uj)

= 6
pr . 6l..j

\.F\1,
)

Thus
80 , 0 co>

s1 , 1 CO)

1 , 80 , 0 <1> - s0,0 co> - s0,0 cl>


= Bl,l (1) = Bl, l(O) = 0, Bl,l (1)

catparisoo of F.qs. (6-55) and (6-56) with E):}s . (6-34) , (6-35) and r ecalling
D:j . (6- 33) shows that
3
(8 , Cu) & , 1 Cu) f\J,O(u) B , tu)J,. (u
00
0
11

u 1)

2-2 1 I (F (u) F2 (u) P3 (u) F~ (u) J


1
-3

3 -2 -1

1 0 0 0

and
3 w2 w l)

(w

2 -2 1 1
-)
0

) -2 -1
0

1 0 0 0

(6-57a)

'l\lrru.ng no.t to the bicubic surface patch itself,

we see that

~.

(6-36)

nay be written in the general notatioo as


l

OCU,v ) ..

L E

11

pr 'OU ,w)ll

lui

r,.

1-<l ,.0

By substitutioo

L ~

TO ~

11

PO,e(u,j)l! '"'' - L }' L L rr,all.)l r llul

l~ 1";1) roO ..0


'
'

J""' (6-58)

and/or differentiatioo it can be sho.m that at the oorncrs


Q(i,j) a P(i, j)
Ol' O(i,j) Pl,O(i, j)

0 o,l(i, j) PO,l(i,j)
. ') -- pl , l(l.,
. J' )
0 1 , 1(1.,)
ard aloog the boundary curves
O(i,w) = P(i,w)
Q(u,j) P(u,j)

0o, l(u, j)
0

N:)tice that since r

=1

PO, l(U, J' )

1,0(.1. W) -_ Pl'O(.l. W)
1
1

here, normal derivatives can be satisfied across patch

boundaries to first order i.e. , bicubic patches may be joined with first order
CXI"'t.inuity acruss the boundaries.
Forrest (Ref . 6-ll) has sho.om that it is p:lSS.ible to generalize U1e Coons

surface descriptioo su::h that higher order bollndary cx:n:litians can be satisfied.

Assuning that we wish to satisfy nonml derivatives to order m oo u "'

order

llt

and to

n . oo w = wj , then the surface boundary curves are given by the functicns

pr, O(i,~) ,

with 0

funct.ioos by
1

Q(u,wl

1o.()

.l

~~

,:::()

~ r ~m1 ,

ar , .1.. Cu)
r

and B

0 ct,w)llr

. (w) .
s,J
1

,1

(U)

~ s ~nj ,

and P0 ' 5 Cu,j) , with 0

"1

Lo

~ ..

and the blending

The surface equation is then

0 1
P ' Cu,jlf 11 , M-

,'

01

.,

E 1: riO()
L 1:
Pr'
CP()

110() }II()

6-59)
(1.,)1&,. 1 cuHI8 M
,
,1

where the blending functions have the properties


p

Br, i C~l = opr 6ik

for 0 ~ p ~ m1

as , j (~) = 6ps . ojk

(6-60)

for 0 ~ p ~ nj

Equation (6-59) represents the rrost general foon of a CCons surface.

It should

be noted that rrost inplenentaticns do not utilize this fonn, but rather ooe of

the special cases discussed previoosly.


Forrest (Ref. 6-11) points out that i f in Eq.

PO , s(u, j)

(6-59)

fi'i

L L

pr , s(i,j)Br i (u)

iO r=O
then the last two t:ems of Eq. (6-59) cancel

'

am the surface equatioo is

o<u,w> =

rn.1

r 0
L:
L:
p , <l,w> a . <u>
i=O r=O
r,l.

which is a typo of ruled or lofted surface.

p r,O(.l.,W ) =

then the surface eguation

(6-61)

Siroilarly J.f

n.

L ~

pr' s(i,j)B ). (w)


j=O s=O
s,

l.S

Q(u,w) =

n.

:f: PO, s(u, j)f;s

j ::{) s::::O

J. (w)

(6-62)

which is a .ruled or lofted surface using the a1t.ernat.Et boundary conditions .

If both the condi.ti01S represented by Eqs. (6-61) and (6-62) are iJTposed,
then the surface equation is
1
Q( u w) =

rni n.

L
.L
L
~ pr' s(i-j)Br i (u)Bs
ieO JO r-0 s;O

j(w)

(6-63)

which is the so-called tensor prodoct or cartesian product surface.

F.quation

(6-63) is .i.Jif.Orto!lnt because it represents the natural extension to surfaces of

the c:auron rrethods of curve approximation.


by Eq.

The cartesian surface represented

(6-63) or the lofted surfaces represented by Eqs. (6-61) and (6-62) are

the nost frequently :irrplerrented forms of Coals surfaces.

Yhen m
n. = 1 and the 8 . . 's are given by Eq. (6- 57) , Eq. (6-63) repre1
)
l. , J
sents A bic\bic patch, i.e.,
1

Q(u,w)

L: E L: L:

pr' s(u, j)Br i (u)Bs ). (w)

i=O j=O r-0 s-0


sho~~S

Ccmpilrison of Eq. (6-63) with Eq. (6-58)

form.

that it is of a rrore limited

In particular, the bicubic surface patch described by Eq. (6-63) depends

only en oomer infoanation - positicn , tangent, and twist vectors , alalg with

the cubic blending functions to determine the interior shape of the patch .

The

bicubic surface patch described by Eq . (6-58) a l so takes into acoc:unt the


boundary curves which outline the patch when det:e.rmi.ning the interior shape of
the surface patch.

The bicubic surface

patdl described by Eq. (6-58) is thus

rrore qeneral.

Notice thllt in Eq . (6-56) and its special cases, 5\.ITI'IUtion occurs for
i

0 and 1, j - 0 and 1, i.e., fran one boundary curve to the other.

This

in'plies that the interior of the surface patch is govemee entirely by the boundary CUl"V'Cs, oomer points , oomer tangent and twist wc:tors , and the blending

functi.cn.

That is , the interior of the surface patch is controlled by the ex-

terior boundary conditions .

lf, however,

"'~ 5\.IITl

flan 0 ~ i ~ M, 0 S.. j S.. N,

thr>...n all curves P(u ,w) and P(u,wj) between the boundary curves, and in fact any
1

SURFACE DEOCR.IPtiOO AND GENERATIOO 185

nox::mal derivatives on these curves, cs.ro accounted !or.

'1hi.s a llows specifying

interior curves and bound!uy ccnditioos to assist in controlling the inter ~or
In this case the surface is ~ represented by

shape of the surface patch.


w

0 u,w)

.,

"

)~
1-o M

,.c.

(u1,VIt r '"'

IJ

l:

I" ,c (u,wjiO

)'<! ...0

.J

'wl -

.,

l.. L ) ~ [

o_.,

"-<! .:;()

IMI

,,r,,l<l " )
I

r' &

t
li

."'1

(6-64)

Here the blend.i.ncJ curves satisfy t..OO relatioos


p

6r,i (~) 6
pr
p

8S,J. (wk): 6pr 6jk 0 -< P -< n). 0 ' k <- N


Notice that the degree of the int:erp:>lated nomal derivatives is given by mi and
Further notice that for N = N -= 1, F.q . (6-64) roduces to the COons surface
described by Fq. (6-56) . Figure 6-14 il l ustrates the difference bet:\..Jcen the

nj.

surfaces described by Eqs. (6-56) and (6-64).


blended suraoe.

Figure 6-14a sho....s an exterior

only the boundar:y cuzvcs P(u,O),

P (u,l), P(O,w), and P(l,w)

and the corner points, CO!i1er tangent, and twist vectors at A, B, C, and 0 are

considered in blending the center of the surface patch.

Figure 6-14b shot.-s an

interior blended surface where the interior curves P(u ,O. S) and P(O.S,w) are
also consideruc:.

'!he generalized lofted surface and the cartesian product surface can be
obtained in a manner ana.l.ogous to

trose in t:re previous section .

They are

given by
H

Q(u,w)

m1.

= L0 L:0

Q(u,'W) =

>.=

r-

n.

L ~

r 0
p ' (u. ,w) 8
~

PlO.II

. (u) (6-65)

r,~

-._.;...
P..:Iu.:.::I)_ -!:!PII. II
('

0 5
P ' (u,-w)B

j=O s=O

(6-66)

j (w)
'

and

P(u.OI

(6-67)

6-13 CooCLUS I(lll


'llle final two chapters have been an

introduction to scrre of the current rrethods for curve and surface descriptioo.s .
l>\any other techniques have been

and used with varying

~s

suggested

of

This is a young and dynamic field with


rte.J

SIXX)eSS.

ideas and techniques cx:nstanUy

Figure 6-14

Exterior and interior


"blended" surfaces.

appearinq in the literature.


To actually inplerrent these techniques in a production or desi gn environ-

rrent requires nany rrore considerations than can be discussed here.


requ.irerrents will depend

\pln

the needs of specific applicat.J.oos.

specific
Px001errs

such as jo.ininq surface patches, calculating cutter path offsets, determining


intersections of ll.nes ard surfaces, designing data and file structures in

\oohi.ch to store and r.-anipulate the infollt'ation , writing analysis programs to


calculate neoded paraneters, rEITOV:i.ng hi.ddE.>.n lines ard surfaces for proper

graphical dl.splay, etc . , are the types of requ.irerrents that will arise.

Sere

solutions to these problem5 can be fo\D'd in the current c::atpUter-aided design

liau-ature.

The reader of this book sOOuld be able to build upon the founda-

tion presented herein to create a capahil i ty to rreet his needs.

RFERENCES
6-1

Bezier, P. E., E?tploi des Machines a Cunnande

1'.\Meri~,

r.u.sson et Cie,

Paris, France, 1970; Bezier, P. E. , "Exanple of an Existing System in the


.t-btor !Mustry:

'lbe Un.isurf System," Proc. ~ -

soc.

(London) , Vol. A321,

pp. 207-218 , 1971.


6-2

Sabin, fot. A., "An Exi.sti.ng Systen in the Aircraft Industry.

'1he British

Aircraft CO.rporatioo NumetiC31 M3st.er Geatetry Systan," Proc. !by.

soc.

(Is:rdon), Vol. A321, pp. 197- 205, 1971.

6-3

Peau-s, G. J ., "Interactive Curputer GraJ;i'U.cs Applicatioo of the Bi-<::ubic

Pa.ranetric SUrface to Engineering Design Prob1ens," !-tD::nnel1 [):)uq1as


Autatetion Conpany.

II

II

St. Ionis , Ml.ssouri, presented at Society of Indus-

trial and Applied Mathematics 1973 National l'leet.ing, HMpton, va., 18-21
June 1973.
6-4

COons, S. A. , "'Surfaces for Cooputer-Aided Design of Space Forrrs, " t-1. I. T .


Project tW:, t-W:-TR-41, J une 1967.

(Also as MJ 663 504) .

6-5 Annit, A. P. , "Curputer systems for Interactive Design of Thrce-Dimmsiona1


Shapes," Ph. D. Thesis, Carrbridqe University, NoveTber 1970.

6-6

Lee, T. M. P. , "Analysis of an Efficient liCl'togeneoUS Tensor Representatioo

of Surfaces for Catputer Display, in Advanced Carputer Graphics.


by Parslo..r, R.

o. ,

Edited

and Green, R. E. , Plen\Jtl Press, New York, pp. lll9-ll41,

1971.

6-7

Ferguson, J. C. , "t-l.lltivariable CUrve Interpolation," J. Assoc. Cooprt:.

Mach., Vol. no. 2, pp. 221-2.2 8, April 1964.


6-8

Bezier, P., Numerical Control-fo'.athematics and Applications, (translated


by A. R. fbrrest), John Wiley & Sons, Inc., Laden, 1972.

SURFJICE DESCRIPTTQI1 1\.''-m GEl!ERATICN 187

6-9

Armit , A. P. ,

"~ti.patch ;mel

f.Ultiobject Desiqn Systerrs," Ptoc.

Soc. (I.a1don) , 'A:>l. A32l, pp. 235-242, 1971.

6- 10 Bamh.il1, R. E. , and Riescnfeld, R. F. , "c:::onvuter Aldecl Gea1et:ric: Desiqn,"


Academic Press , New ork, 1974.
6-11 Fo rrest, A. , "On CXlons and other M2thods for t;M Representation of CUrved
Surfaces ," Colputer Grapucs and Image Processinq, Vol. 1, pp. 341-359,
1972.

APPENDIX A

COMPUTER GRAPHICS
SOFTWARE

IP

lit

I~I

Ill

In developing the cx:n:::ept.s for a cr:rtprl:er graphics software system it is

ronvenient to diVJ.de the overall system into several parts .

'1\.o of the obvious

parts are the sq{X>rt CXJTpUter and the graphics device itself.
harct~e.

taken.

These are t:oth

In considering these descriptions a not too nant:M vi ew sh::luld be

In general, the st.q?part catpUter is the system on \olhich the data base

exists and on which software manipulation of the data base occurs.


~re

However , in

syst:.ems this function rray be t:hysically split ootween tw::> or nore

systcns.

CXXJp..lter

'Ihe gra[i\ics device is the hara..mre which actually produces the picture.

A concoptual view of a c:x:JTpUt.er graphics software system is sho.om in Fig . A- 1.


'1\.o sofb.ve systems produce an interface between the support oonput.er and

the graphics device.

'nle first is the data base manipulation software.

'llle

mathematical basis for this system is the topic of the main part of the book.

It consists of routines to translate, rotate, clip etc . ~ data base. Speci.fic


algoritms to perform nany of these functions occur later in Appendix c . 'Ibis
software system is mtpletely device-independent since it is only <XI'lCCrTled with
mathcm!ltical manipulations.
The scoond is a software system ~hlch provides an interface betweer. the

noiTI\ll "drawing functions" and the hardware associated with a particulnr graphics
device.

It is this system which causes the neoessnry codes (infomatioo in

t:.erns of binary bits) to be sent

to the grar:hics devioo to cause that

~ce to

CXMVl'ER GRAPHICS SOF'IWARE 189

draw lines, plot FOints, etc.

Although as outlined in Sees. A- 1 cUrl A-2 t.Alw,

this software system can be made minimally devi.oe-<Jependcnt; it cannot be made


cocpletely dcvioe-~t..

Because of this Sees. A-1 and A-2 ally conocpt-

ually discuss this software system.

A-1 U:wuJtR

tMPHICS PRIMITIVES

As Feinted out aOOIIe, .....tlen designing cr ~a corputcr graphics

systan

it is convenient to define those areas ~e the 51J(JEX>rt cx:xrputer I!USt interl!ct


with the grat:nics device. All graphics devirns, of course, reoeivc info:omtion
fran the supp::>rt cx:xnputer as a data stream <X:Il'{X)SCd of binary bits.
ular

cases cne or rrore bits tray be Sl.gnificant..

In partic-

However, except for very

sofhisticatcd users , the c:arposition of this data st.rerun is seldan of i.nt.&cst.


It. is rrore convenient. to think of the fun.d.anental effoct.s that tho data stream
has oo the graphics device. 'lhese fundamental effects are called graphic
primitives . 'Ihcy generally fall into three areas: cursor control, device state
or rrode control , and graphic input. Here cursor is used in a general sense to
rrean the e.lec:..t:on beam on a

Q{}'

graphics device, the print head on a teletype,

high-speed printer , electrostatic dot matrix printer, or the pen oo a pen and

ink plotter, ~-

We Wl.ll briefly

discuss the grat:hic primitives associ-

IIRIT

ated with each of these areas.

Fran

these graphic primitives several carr-

pouro graphic cx:xnrands can


OOA

~PI.lATIDl

::

be developed

which are of nore general interest.


rumtl llJ'Mf.R '

These will be discussed in the next

secticn.
'lbe boO graphic primitives associ-

!VI~

MlA &'~

ated with cursor control are


t.nve the cursor
TUrn the cursor en/of!
'lhe function of each of these primitives

.-1-.I
C,_.,UCS
tEVTCfS

is sel -explanatory.

'nle graphic primitives associated


W1th device state or nrx3c control are,
for exanple:

Figure A-1 Q:r)ceptual vie.~ of a


cx:xrputer graphics software system

Al(ilantm'eriC !rode (1)

Graphics m:x1e (2)

190 MM'HENATICAL

FOR CCK't1l'ER GRAPHICS

Standby rrode (3)

Absolute o:x>.rrlinate node (4)


lelati~ (increrrental)

o:x>rdlnate ucde (5)

Frase the screen (6)


Dash line rmdc (7)

01rVcd line nnie (8)


I.oc:2l t.racki.ng a\ (9)
I.ocal tracking off (10)

etc.
For sare gra~cs dev:Loes , particular nodes ZMY not be appropriate and for

others additional

nojes

might be a color CRI' graphics device

also be regul.red .

For the latter

are required.

...mere

ease a

particular exanple

blue, red, and yel.l.o,..r ll'Odes

~uld

Ho.r.-ever, the above list represents those required for a

Before continuing, a ~d about the

reasooably sophisticated graphics device.

I~
II

function of each of these various m::rle.s or states is in order.


Alphammaric and graphics mxles are generally associated with devices \oo'bich

can interpret a data stream as either alftl,anllroric characters or graphic elements.


St.andhy rrnie generally is nsed to disable the terminal such that it ignores data
sent to it and also data ge.'lerated by interactive devices such as key boards,
light pens, etc. J;bsolute and relative cx::ordi.nate nodes detel:mine W'lether the
o:x>rdinatcs specified in the graphic primitive positioo <:Xm'\\Uld are to be interpreted as absol ute or ro.lative o:x>rdinate data.

far stora<Je b!he CRr graphics devices.

'!be erase node i s .ittp>rtant

Dashed line noie allows the generatiat

of dashed lines using the hard..are characteristics of the grapucs device.


CUxved line node is used to activate hard.mre curve generatl..oo .

UX:a1 track.in9

node can be used to act.l.vate hardware, whlch allows a visible cursor at a CRI'
~cs

device to fol.l.ow the IrOveJTent of an interact!vc input device such as

a light pen or the pen at an analog table.

'lhe graphic primitive associated with graphic .input is


read the cursor {X)Sitian .

positioo vector, i.e., either x,y-pai rs or x,y ,z-triplets.

All .interactive

coputer systems and higher level languages have adequate faci 1 i ties for accepting alphamJroric character input, and hence character in?Jt is not considered

as a grafhic primitive .

Fran the above

see that there are essentially four g:raprlc primitives


which CXIOCCptnally can be represented either as ccmrands within or subroutines
of a hlgher level langu.l9e su:h as BASIC or FCRI'RAN. 'these four primitives are
\o.e

cn-1Ptm:R GRAPHICS sc:FJW\RE 191


CHFP (control variable)
1-DVE (coordinate, coordinate, <.coordinate>)
KlE (control variable)

oc
~

(coordinate, coordinate, <coordinate>)

< > is used to represent optional variables.

'1hc control variablP in CJIO'F

<XIllld be an integer with a 0 or 1, indicating that the. cursor is eit:.hc!r o ff or

oo respectively.

'lhe control variable in f-OE could be an int.eqer assiyned a

specific nean.inq, as indicated above in parenthes.is to the right of each individual f\lJlCtion .

These four graphics pr.iJnitives can be cutbined into ~al

cntpound graphic elcrrents which are of nnre intel:'est to the general user.

A-2 CdwreR

GRAPHIC

Eumrrs

'1lle cxxtputer graE=hic primitives discussed in t:lx! previous section can be

cxxtbined into OCITpUter gra{ilic elerrents.

'lllese are generally c:crtp;:lUnd operations;

i.e., they generally involve rrore than ooe of the graphic primitives. 'lhe
grapti.c elercnnts are of nore fundatrental interest to the user than the ~c
primitives.

In fact , tOO

user

may not be aware of the graphic primitives .

h}a.in, as with the graphic primitives, the graphic elerents can be placed in
three categories : drawing functions, term.ina.1 or picture control f\..B"'ct.ials, a.OO
interactive device control func:tials.
'1lle classification rrethod discussed in Sec. 1-6, as ~Nell as traditional

drawing rrethods, assist in dete.Imini.ng the fundarrental d.rawi.r;J elorents.

A user

will .....ant to be able to nove the cursor about without drawing, to draw a lule,
and to plot a point.

It is convenient to be able to do this in either absolute

o r relative coordinates.

'nlese ideas lead to six gr~c elcroonts:

1-bve Absolute
1-blle Relative

Point Absolute
Point Relative
Draw Absolute
Draw Relative

In addition the user will want to b! able to print textual nnterial at a speci-

fied location in the picture , say,


Text Absolute
Text Relatl.ve

il

ll

I~

II

In each e-lse it is <:nlvenient to oonsidcr t:hbt the action initiates fmn

the current

!X)Sit ion

of the cursor.

Functionally each o f these g:rcq:hlc elc:mmts

can be described in terms of grapuc primitives.


algorithm might be

z.m

For exanple 1 the t<love Absolute

1.

Set graphic rrode -

2.
3.

'1\lrn cursor off - Q.'D"F 0


Set absolute ooordinate m::xie - 1'100 4

4.

r-bve to the coordinates sped ficrl - MJJE (coer. I coer . 1 <ooor. >)

5.

Set alfila m:x:ie - MD l

The Point 1\bsolutc algoritlln might be

l.

Set graphic rrode - l-o:>E 2

2.

'!'urn cursor off - CNJFF 0

3.

Set absolute coordinate rrode - 1'100 4

4.

l1olle to the coordinates spec:i fi ed - MJJE (coer. 1 coor.

5.

'1\u:n cursor on - CNJfl' 1

6.

'1\u:n cursor off - CNJFF 0

7.

Set alpha node - M:DE l

<coor . >)

'lhe Draw Absolute algoriilin might be


1.

Set gra{Xric m:x:ie - 1-o:>E 2

2.

'1\lrn cursor on - CNlFF 1

3.

Set absolute ccardi.nate nu de - MDE 4

4 Move to the coerdinates specified - l-oJE (ooor. 1 coer. 1 <ooor. >)


5. '1\lrn cursor off - CN)FF 0
6.

Set alpha rrode - ra>E l

a:x1 the Text .Absolute algorithn might be


1.

Set graphic JtPde -

2.

'1\u:n cursor off - CN:lFF 0

3.
4.

SeL absolute coordinate rrode - t-roE 4

l>bve to location - M:NE (ooor. 1 ooor. 1 <ooor . >)

Set ctlpha rrode - l-DDE 1

6.

'1\lrn cursor on -

7.

Print characters

8.

'1\lrn cursor off - CN:lFF 0

M.DE 2

CN)FF

'The four relative coord..mate el.c:!rel\ts have the sare algoritl'ITsl except that the
tlu.rcl oc::mnarrl sets relative nrxk ~mE 5) . Tho above algorit:tm; set each required

<nnvrER GHAPI!lCS SOF'!WARE 193


graphic primitive every t.iite it is used and loove the graphic device with t.he
cursor off and in alpha 11\'XE.

'lhis is good i.n.surana::.

Hon1Cvcr 1 ilJl .increase

in

the efficiency of data transmissicn can be achie~-d at the expense of ~

additi<na.l cattplc.xity.
might be

For exwplel the alqorithm for the Point J\bsolule cu:nmcl

1.

Is the devi~ in graphic rrode?


node - r-a: 2

2.

Is the cursor off?

3.

Is the device in absolute coordinate node?

lf yes - CQ'lt..lnue I tf no - sci CJrlrflic

If yes - CQ'ltinue, i f no - tum cursor off - c:N:E'F 0.


If yes - CXlntinue, if no -

set absolute coordinate node - ln:E 4.

to the coordinate spocified -

4.

~bve

5.

'l\J.rn cursor on - OOOFF 1

~OVE

(coor. , coor. , <coor . >)

'lhi.s schere requires that a small storage b.lffer \o.hich oootains infonnaHon

representing the "state of the device" at the end of the previous graph1c OJIIm:md
exist.

~.

the potential exists for reducing the nlll't:>er o! data stroam

e1emmts which nust be camunicated to the graphic device.

Further, analysis

of the orlgin.:al algorit:lTn sl-oJs that if a rrethod can be devised to antic1patc

lo.hether the next camand will be a graphic c::cm'l\'md or a 110'\C]raphic (alphd)


mand, then addi ticnal efficiencies result.

ca:~

Before cmt.inu..in<.J it should be noted

that although functionally identical, these alqorith!1\s might be structurod


differently for different graphics devices .

Terminal or picture CCI'ltrol g:raphic elerents are associated w1.th initia 1iz-

ing the graphic device, erasing the screen for storage tube CRr graphics devices,

start.ing and ending frarres for refresh CRr graphic devices, and buffering the
data stream and on CXl01'TIClOO sendiJ'lg it to the graphics device .

For exanple, the

graphic elerrents

Initialize the

~vice

Begin Fraire
~Buffer

could serve these purposes.

runcti<nally, the Initialize the Oevicc cx:mnand

serves to set the default ccnditioos and zero the outpUt buffer; the Begin Fra!re

COII'and serves to erase the screen for storage tube CRl' grapuc devices , to
indicate a new plot for pen and ink devices, am to rotify a refresh grapuc
devioe that the picture is curplete and a new frmre nust be started. 'lbc 0\Ilp
Buffer CXX'I'ITland serves to send the stored data stream to the graPrics device and

leave the device in alpha rrode.


Fran the user ' s point of view the control of interactive devices rrust be

rrore explicit than a siiTple cx:rmand to read the cursor p:>sition .

in Sec. 1-5 there are several interactive gr<q:h.ic devices avail&>le.

Activat.i.ng an Analog Tablet

Activating a Jat Stick

llctivating a Light Pen

Acti.vatin<J Cootrol Dials


1\ct..ivating f\lnctioo Switches
Others can be &dded as is required or a general graphic input elerrenL can be
developed.

As an ex.anple, the algorithm for activating an analog table with

local tracking might be


Set gratillcs rr00e - tOE 2

2.

Set absolute coordinate node - KX>E 4

3.

set

4.

lead the cursor positioo

5.

Read any table switch posit.i.a\s

6.

Turn off local tracking -raE 10

7.

Set a4ila node - MX1E 1

Reading the CUrsor Positi.oo

l.

Ill

As

mi.n.inun the input gnqiUc elesuents sOOuld include

~~
I~

As discussed

local tracking - t-IDE 9

'llle other graphic elenents would have simi..lar algorit:Nns.

Again ec:cnanies in

the data strean can be obtained by using sq:histicated chedti.ng procedures for
the various nodes, etc .

A-3 CANoorCAL SPACe


It is necessary to carplete our discusstoo of graphic syste.rrs by considering
the various spaces or coordinate systems \o.tlich are o f interest to both the user
and the system architect.

1here are three spaces that are of interest-user sp.x:c, canonical space,

am device spaoe.

user space represents the coordinates or uruts in \o.bich the

application is perfonmd, cancniCAl space is a pseWo space used to obtain


device

, am device space represents the coordi.n.atc system in \o.hlch

the graphics device nust be <Oiressed, e.g., raster points or units for CRI'
devices, inches or oentirreters for plotters, etc.

'lhese are illustrated in

Fig. A-2.

'Ihe cxu::ept of a caoonical or pseudo space is of interest.

By using a

standard cananical or pseudo space for all graphic devices, device-independent

CXJIPU'reR GAAPHICS SFlW\RE 195

graphic software CM rrore eas1.ly be

obtained.

In pa.rtio1lar, the picture

is

first trans!Onred fran user spoet or m-

ordinates to the st.andard canonical space

----

0 1'---

and then transfoDOOd fran the canonical

--~ space to the appropriate dPvioe space.

A s.i.!Tt>le concept for the canonical


space assures lhat the addressable area
is the unit square in the first quadrant;

I ' - ----:-

n User space

6 211

i.e., the

addr~ssable

area of the psa;ido

graphic device represenl-ei by the caocn-

ical

is 0 -< Xa< 1 . 0, 0 -< ya< 1.0


Although this aF{Cars to limit thc p1.cture
..r -

to a square format, this is not necessarily true.

'lhe 1.0 x 1.0 square fo.mat is

assl..llled for

arrong graphics

devices and is predicated on the basis


that many plotters and uost storage bJbc
CRr grafhics devices have a square ad-

-----

dressable area .

tiJWever, addressable and

viewable areas are not necessarily identiCA'll.

rectangle; e . g. , rrost storage tube CRl'

0'---- - -

1 graprics devices have a viewable area that


is approx:i.Jrately 0.8 of the aMressable

b Canonc al ip.acc

(\. )') r
1024

rhi~

area in one c:lim!nsioo , nost often the


vertical dinen.sion . In this case , the
viewable area is assured to be 0 ~ Xv ~ 1.0

area may not be 'cwablc

--

780

Frequently the vielriable area is a

o ~ Yv ~ o.a.

Further, llWlY ploLt.ers


have the ability to extend one axis inand

definitely.

In this case the vi~'able

area is asS\.J'!9i to be 0 ~

Xv ~ a ,

where

a is SOli! nurber ...,hich is greater than

one.

Q1e

oould, of oourse, argue that the

addressable area slnl1.d then be rectangular.


HQJ...-ever, unless extrete care was taken
with scale factors , distortioo of gearet.ric
1024
(say)

Figure A-2

Grat:hlc spaces

figures ....ould occur; i.e., a circle "Ould


be seen as an ellipse.

'lb.i.s is , of oourse,

unaccepta.ble for gearctric oc::rtpUter ~

APPENDIX B

MATRIX OPERATIONS

I!

II

II

A few sirrple rules fran natrix algebra are given here for convenience.

matr-i:t is si.nply a rectangular array of nurbers \llh.ich are


rules .

8-1

governed by these

T~Itn.OGY
'Ihe array of nll'lbers \o."hich make up a natrix are called its elements .

elements form rows and oolum.s within a natrix.

'Ihese

If the nl.ll'ber of rows and

ool ums are ogual, the matrix is cal l ed square.


COnsider the 4 x 4 square matrix given by
all ~2

13 ~4

~~2~3~4

a31 a32 a33 a34


a41 a42 a43 a44
'lbe first subscript refers to the natrix

l"CM

ard the second refers to the JTatr.ix

oolum.

Thus, a 34 is the element in the thixd reM and fourth oolum. A natrix
of m l"CMS and n oohrm.s is cne of order m x n . In the square nstrix abo\.~ ,

'\! ~ 2 ,

~ ,

44 are called its dia./'r:at cl.<- Pttc .


'lhe sun of the diagonal elements in a square natrix is called the trace .

m nand the ele1ents

and a

'IATRlX OPEAATI<::I\'5 197

i<lcr.titJ.! rnat.t~:..X
is one in \lohich every ela:ent is zero, with the exceptioo of the diatplal
elerents , l.o.hich are all U'l.ity. An exanple of a 3 x 3 identity rutri.Jc is :
1 0 0
A zero matJ-i.z is one in which every e 1errent is zero.

An

0 l 0

0 0 1
'l'No matrices are

qual only when each e1eroont in one is equal to the corresp :n:l-

ing elerent in the other; that is, they r.ust be i..de.ntical.

B-2

AooJTIOO AND SuBTRACTICtf


If

b.Q

defined.

matrices are of the

sa~re

order, then additioo and subtracb.on are

To a&3 or substract tw:> matr.ia>s , the operation of addi t ioo o r sub-

tra ct.i.oo is applied to each o f the corresXlnding eletelts.

1 2 3

1 4 7

4 5 6 + 2 5 8

As an e.xanple :

2 6 10

6 10 14

7 8 9

3 6 9

10 14 18

1 2 3
4 5 6 7 8 9

1 4 7
2 5 8

0 - 2 -4

and

B-3

3 6 9

2
4

0 -2
2 0

t'u..TI PL ICATION
t-latrix n'lll.tiplication is the nost useful matrix cp"ra tioo for cnrputer

graphics .
n2 x

"'2

Consider one matrix of order n1 x m1 and a semnd rmtrix of order


For n'lll.tiplication of t:\<\0 matrices to be deflned, the value of "1 rrust

equal the value o f n '111at is , the nllt'ber of co11.11V\S in the first natrix must
2
equal the nl.ll'b:!.r of rows in the second matrix.
'lhe rules for matrix nultiplicatioo are best described by the follCMi.ng

exanp1e.

If [A] is a matrix of order 4 x 3 and [B) is a square matrix of order

3 x 3 , then the matrix prodoct (A] (B) is defined by the following op?ratial .

u u u
. 21

"'ll

~1

bll

~)

.,1

b21 b2l 1:.2]

on 6 )]

l>ll bJl b)l

n u

010

2J

43

~~~

~t'n ' 4 1~1 ~lbll. 'l.P22 lf>ll ubu 1/>n 4 lf'JJ


~1bu. "2i'n "2/'n -,lbU a,_f7J -+ "J/>J~ ubu 'lt'll ,fl33
~l~l )-/>'ll ~i>ll il11bu 1i'22 rJ>u ~)lbll 3 3ZD2J 4 lJbJJ
c1~1 ct'7l 0 ct>ll

clb17 0 cib22 4 cf>12 <~~c lbll .ac:l'cJ oc/>llj

Not.ice that a 4 x 3 matn.x


In general,

'1.

!tl.ll tipl ied

by a 3 x 3 matrix produces a .; x 3 Matn.x.

f1. x ~

x 11'2 rratrix.

n1trix U."':S a ~ x ~ matn.x, "'here


l..s a nurerical exa:-ple , o::nsl.der

"'1 3- r1 21
4 2 L) 4j

1 1

4 +

6 8+ 8

1 +

G.

6 4
l3 2.,.

u, =

l+ 9 2 +
2 +

12 12 + 16J
+ 6 6 + 8

ttt = ~,

phcatlal 1.s izrpor...ant.

10 16 1
4 6
18 28

L 9 14_
'Ihat is,

1.n

Thus, the order (sequence) of mllti-

Matrix operatior.s folla..r tt.e fust and second disc:i-

butive 18:'..'5; e.g., A(B + C)

ciative law

-10 141

The operatioo of matrix nultiphcation is ~ o::rrm.rt:ative.

general, [A) (B] is rot equal to [BJ (A).

produces

A(OC) '"' (AB}C

N3 + 1C. and (A+ B)C AC +

a:.

Also,

t.~

asso-

applies .

'Ihc det.en:'J.nant of a square rat:rix (A]

l.S

denoted by

AI .

'lbe det.e.rrni.nant

For our ~ . it 1.s suffic1.ent


to illustrate the nethod for find.inq the det.enninant of a 3 x 3 square rnatrix.

has rrany useful properties in rratrix theocy .

lf

M=

r all

en ~3

a21 a22 ~3
l a31 a32 a33J

~1 a12 ~3
4

21 ~2

23

a31 a32 a33 !

~ (~2a33- ~3a32) - a12 ra2la33 - a2~3l)


+ al3 (a211132 - ~2a31 )

nus gives a single m.rerical value for the dete.t:mmant.

of
3 9 4

6 1

81

12 5 3
'lhe result is

3(3 - 40) - 9(18 - 16) + 4(30 - 2}

= 3(- 37) - 9(2) + 4(28)

-17

Q::nsider the evall2ttm

1'11\TRIX

B-5

OPEAATia~

199

INVERSE OF A SGt..IARE f'1ATRI X


There are many techniques for cal culat.i.nq the inverse of a squara trotrix.

t10St catp.lt.er languages have fmct.ions or subrouunes "ni.ch will perform U1e
repetitive calculations necessary t:o evaluate the clCJI'Nlts of the inver$(. o f '
given matrix.
In algebra, where single variabl es are ccnsidered , if ax:. Y 1 then x "' a- 1J',

...nere

a - 1 is s imply the reciprocal o f a, e . g ., a -

1/a.

In 1ratn.x al<)Cbr::ll,

aro

the reciprocal of a matrix does not exist. Ho..IL~r,


the [X) = [A ) -l[Y), where (A) -l , is called the inverse of tre

divisioo is not defined

if (A)(X) = (Y] 1

square matrix fA}


A matrix inverse will exist i.f the matrix is square wid i f tho nntri.x is

noosingul.ar.

'Dlus, not every square IMtri.x has an inverse.

l:bNever, if the

determinant of the square matrix is nonzero and an inverse exists , then that

inverse is unique.
'Ihe inportant property o f a matrix uwerse that is used 1n thi s book is

that, for any square matrix [A), the equal.J.ty (A] (A]-l

= {I)

is valid, where

[I) is the irlentity rratri.x.

Coosider the matrix product o f the G.o folla.t.i.ng 3 x 3 tMtrioes :

1 2 3
1 3 3
2 4

6 -2 -3
1 0 0
-1 1 0 0 1 0
-1 0
0 0 1
1
If this p.roduct is represented by 1\1 (B] = fil, then (Bl is equal to (AJ-

APPENDIX C
DATA BASE
MA IPULATION
ALGORITHMS

II

II

The algorit:l"cns presented m t.l'ri.s sect.ron are based on the rmtheratica!

d' SC.JSsion presented in the l:x:xly of the te.".


...Titten

l.1l

Oartrouth SJ.Xth Eiht.J.on Bi\SIC.

'they are given as subprogrc'li"S,

They can easily be converted to other

la."'9".1a9es . The algont:h:':'.s are rot intended to be tlY.. rrost efflcient posslhle.
'!h..~ are mtended to be in.st:.n.r=tive. Eac.'ll of the transfomation a:go:ithlts
asst.meS that the data base is presented in ord:.nary coordinates. 'llle algorithm
then develops the necessary hcn:x;eneous coordinate representat:.J.cn, performs the
transfot:m:iticnl and returns to ordinary cxx:>rdinates.

The aw-1re.nt ineffic~c..-.cy

associated "'ith reconversion to ordina.ty coordinates has boon deliberately


acx::epted since experience indicates that users norrrally W:J.ll perfonn or.e or o.o

transfon:ations, display tr.e result, \oohl.ch requires ordir.ary coord.lnatcs , and


then c::ontwoie . If a&H tior.al efficiency is required the reader can either rrc:xtiy
the algoritnr.s or develop his or her own based on t:re theory presented in the
body of the text;.

algcnth:n for a."\ arbitrary translation uti Hzing han::qU'lE.'OUS coordl.J'lates


is g!.ven bclo..~ il.S a BASIC !a.n3ua9e s...:bprogra:'n. It is based on sec. 2-15.
An

2DTRANS
100 SUB" 2DTRAl5" : P, X( ) , Y() ,M, fJ
' 2-D
110
' P:Ntl-:BER Of X,Y- PAIRS
120
' X( ):ARRAY CONTAINit\G X-ax:JRDitU.'TES
130
Y() : ARRAY CONTAlNir\G Y-COORDir~TES

'M:X TRANSLATION FACTOR

l 40
150
160
170
180
190
200
210
220

' N:. Y TRANSLATION FACI'OR

DIM U(100 , 3) , V(100,3)

U=ZER(P , 3)
MAT V:ZER(P , 3)
FOR 1:1 TO P
LET U(l , 1}:X(I)
LET U(l , 2):Y(I)
LET U(l , 3)=1
NE:.XT I
~~T

230

240
250
260
270
280
290
300

310
320
330

TRANSLATION

MAT T:ZER(3 , 3)
LET T(1 , 1):T(2 ,2}:T(3. 3)=1
LET T(3 , 1):M
LET T(3 , 2):N
~1AT

V:UT
FOR I=1 TO P
LET X(I):V{l , 1)
LET Y(l):V(I , 2)
NEXT 1
SUBEND

100 POSITICN VFrl'ORS

RDIMFt:SION

~v

FI LL WI1li ZC.Ros

SET UF H(l.l(Xjfljf:OOS
POSITION VECTORS
I

REDIM.ElJSION T ~ILL ~lTH ZEROS


I PLACE 1 I s ON LIA OF 'I MATH IX
' SET X TRANSLATION F/,CTOH
'SET Y TRANSLATIO!I FACTOR
'CALC, TRANSLAT~ POSITION VECTORS
I

' RETURN TO PHYSICAL CWR .

A SC'Il ing algoritm is given bela;o~ as a 81\SIC language subprogram.

The

algorittm based on Sees . 2-11 and 2-15 provides both l ocal and overall scaling.
'lbus , distortion of a shape can be aa:aupl..ished.

It util izcs

l"otogetle()US

nates.

2DSCf..LE
100 SUB"2DSCALE": P, X() , Y() , A, O,S
110
' P:MJHBER OF X, Y-PAIRS

120
130
1 ~0

150

' 2-D SCAlE

' X():ARRAY CGNTAINING X-COOJIDINATES


' Y{):AJIRAY CONTAINING X-COORDINATES
' A:X STRETCHING FACTOR A>1 STRETCHES A<1 CONTRACTS
' D:Y STRETCHING FACTOR D>l STRE'ICHES 0<1 CONTRACTS

160

' S:OVERALL SCALING S< 1 fl~LARGES S> 1 REDUCES

170
180
190

DIM S(100, 3} ,Q(100 , 3)


II.AT S:ZER( P, 3)
~~~T O:ZER(P, 3)
FOR 1:1 TO P
LET S(I , l }:X(l)
Lei S(I , ~):Y(I)
LEi S(I , 3):1

2CO

210
220

230
240
250
26G
270
280

NEXT I
HAT T:ZER(3, 3)

LF.T T(1 , 1):A


LET T(2 ,2}:D
LET T(3 , 3):S

'100 POSITION VECTORS


' REDIMENSION S&C FILL

WI~

ZEROS

' S1' UP tn100ENEOUS


I

POSITICtJ VECTORS

'RED!ME!\Siot~

1 FILL WlTr ZEROS

' SET X STRETCHING FACTOR


' SET Y STRETCHING FACTOR
' SE1' OVERALL SCAWKi

coordi-

If

II
II

I!

202 l'tl\niEMM'ICAL
290
300
310
320
330

ELEMEl1I'S

FOR

a:l-lPlJTER

GRAPHICS

II.AT O=S*T
FOR 1:1 TO P
~f X(I):Q(l , 1)/0(1 . 3)
Ltl (I):Q( I, 2)/Q(I,3)
NEXT I

'CALC. TRANSFOJito1ED POltn'S


'CALC. PHYSICAL ODOR.

]llO SUBEND

C-3 A Tlo.O-DII'a4SIONAL Pm..ECTION

Ai..GOOJ~

A siJlt>le algorithn to reflect al:x:lut either the x- or y-axis is given below


as a BASIC language subprogram.
and uses l'xxtogeneous coordinates.

'Ihis routine depends on tro analysis of Sec. 2-5

This operation is also frequently referred

to as mirror itrage.

2DREFLT
100

110
120
130

1 ~0

150
160
170
180

190
200

210

SUB"2DREFLT": P, X() , () ,N
' 2- D REFlCTION
' P:Ntt-!BER CF X,- PAIRS
1
X():ARRAY CONTAINING X-COORDINATES
' Y():ARRAY CONTAINING -COORDINATES
' N=REFLECTION CODE 1=X-AXIS , 2:Y- AXIS
Om S( 100 ,3) ,Q(100,3)
'1 00 POSITION VECTORS
1 REDIHENSION S&Q FilL Wrni ZEROS
HAT S:ZER( P, 3)
HAT Q:ZER(P,3)
1SET UP l0100ENEOUS
FOR I : 1 TO P
LET S(I, 1)=X(I)
' POSITION VECTORS
LET S( I,2):Y(I)
LET S(I,3):1

220

~'EXT

230
2ll0

MAT T:ZER(3 ,3)

250
260

IF H:2 THEN 280


LET T( l , 1):T(3. 3)=1

300
310
320
330

1(2,2):-1
GO TO 300
LET T(2 , 2):T(3, 3)=1
LET 1( 1,1) : - 1
MAT O=S*T
FOR I:1 TOP
LET X(I):Q( I , 1)
LET Y( l):Q(I , 2)

]110

NEXT I

270

280

290

' REDIMENSION T FlU. Wlnt ZEROS


SET UP TRANSFORf'1ATION 11ATRIX

LET

' CALC. TRANSFOIIMED POINTS


'CALC. PHYSICAL COOR.

350 SUBEND

C-4 A GNEAAL. TclJNENSIOOAL RoTATION


An

~11H'1

algont:hn for o.o-dirnensiooal rotation

below as a Bol\SIC langu.'lge subroutine.

arout

an arbitrary point is g1ven

It utilizes the analysis of Sec. 2-16 .

2DROT
100 SUB"2DROT" :P, X() ,Y() ,T1,H,N
'2-D ROTATION
110
' P:NUMBER OF X,Y-PAlRS
120
' X( ):ARRAY CONTAINING X-COOP.DINATFS
130
'Y():ARRAY CONTAINING Y-COORDINATES
140
'T1:ROTATl0N ANGLE IN Dn11EES
150
' H:X TRANSLATION FACTOR
160
' N:Y TRANSLATION fACTOR
170
DIM S( 100 , 3) ,0(100,3)
I 100 POSITION VEX:TORS
HAT S:ZER(P, 3)
180
'REDIMENSION S&O FILL
190
HAT Q:ZER(P , 3)
'WITH ZEROS
200
FOR I=1 TO P
'SET UP H~OGfliEOUS
210
LET S( I, 1):X(I)
I POSITIOt; VECTORS
220
LET S(l , 2):Y(l)
230
LET S(l, 3):1
2110
NEXT I
250
LET T2:T1/57. 2957795
'CONVERT TO RADIANS
260
HAT T:ZER (3, 3)
'REDD1ENSION T FILL Wlnf ZEROS
270
LET T(l, 1):T(2,2): COS(T2)
'SET TRANSFORMATION MATRIX
280
LET T(1,2):SIN(T2)
290
LET T(2, 1 ) : ~IN(T2)
300
LET T(3, 1):-M (COS{T2)-1 )+NSIN(T2)
310
LET T(3 ,2):-MSIN( T2)-N( COS(T2) -1 )
320
LET T(3, 3):1
330
HAT Q:ST
' CALC. TRANSFORMED POINTS
340
FOR 1:1 TO P
CALC . PttYSICAL COC>R.
350
LET X(l):Q(I, 1)
360
LET Y(l) :Q(I, 2)
370
NEXT I
380 SUBEND

C-5 A T~-Dit-NS ICJW. Sc.ALir; AL.~Infl


An alC}:)ritnn for t.hree-di.n'I!!TI.Sional scaling is given as a BASIC language
sui~"'gtam.

It is based on Eq. (3-4).

3DSCALE

100 SUB11 3DSCALE" :P, X() ,Y() ,Z(},A,E,J,S '3-D SCALE


110
' P:NUMBER OF X,Y, Z- TRIPLETS
120
' X():ARRAY CONTAINING X-COORDINATE
130
'Y():ARRAY CONTAINING -COORDINATE
140
' Z():ARRAY CONTAINING Z-COORDlNATE
150
' A:X STRETCHING FACTOR A)1 STRETCHES, A<l C~'TRACfS
160
' E:Y STRETCHING FACTOR E>1 STRETCHES, E<l CONTRACTS
1 J:Z STRETCHl t\G fACTOR J>l STRETCHES, J<l CONTRACTS
l70
1
180
S:OVERALL SCALit:C S> 1 ENLARGES S<1 REDUCES
1 100 POSITION VECTORS
190
DIM U( 100, 4) ,V( 100 ,4 )
200
~tAT U:ZER(P 11)
'REDIMENSION U&V Fill WITH ZEROS
210
~!AT V:ZER(P, 11 )
220
FOR I: 1 TO P
' SET UP HCMXJENEOUS
230
LET U(I , l):X(I )
' POSITION VEC10RS
240
LET U(I, 2):Y(I)
250
LET U(l, 3):Z(l)
260
LET U(I , 4): 1
270

NEXT I

280
290
300

HAT T:ZER( 4, 11)


lET T( 1, 1) :A
LET T(2, 2)=E

REDI.HENSION T FlU. WITH ZEROS


' SET X STRETCHING FACTOR
SET Y STRETCHING FACTOR

I~

204 t-IA'mEMI\TICAL

310

E'OR CO>IP\Il'ER GRAPHICS

LET T(3 , 3)=J


LET T(4 , 4):1/S
NAT V:U1 T
FOR I: 1 TC P
LET X(I):V(I , 1)/V(I , 4)
LET Y(I ):V(l, 2)/V( I , 4)
LET Z(I):V(I , 3)/V( I , 4)

320

330
340
350
360
370
380
tiEXT I
390 st.'BEND

C-6

SET Z STRETCHING FACTOR


' SET OVERALL STRETCHll~ FACTOR
' CALC . TRANSFORMED POINTS
' CALC. PHYSICAL ODOR .

~ Al..GORITif-1 FOO THREE-DIMENSIONAL lbTATION

ABour

TI x-Ax is

"'t.e algorithm given belo..1 as a BASIC language subprogram alla..'S rotatjoo

of the position vectors of an object a1x>ut the x-axis . I t utilizes tatogenecus

coordinates.

3DXROT
100 SUB" 3DXR0'!": P, X( ) , Y() , Z() , Tl
110

120
130
140
150
160
17C
180
190
200

210
220

230
240
250
260
270
280
290
300
310
320
330
340
350
360
370

C-7

' P:~WM81:.R

OF X, Y. Z- TRIPLETS

' 3-D

ROTATION ABOUT

X- AXIS

' X():ARRAY CONTAI NING X-COORDINATES


' Y():ARRAY CONTAINIKG I -COORDINATES
' Z( ):ARRAY CONThlNit-.'G Z-COORDINATES
'Tl:ROTATION ANGLE IN ~GREES
DIM U( 100 , 4) , V( 100 , 4)
'1 00 POSITION VECTORS
HAT t:ZER(P , 4)
' REDINENSlON U&V FILL WITH ZEROS
MAT V:ZER( P,4 )
FOR I=l TO P
' SET UP lO'.oGENEOUS
LET U( l , l ):X(l)
' POSITION VECTORS
LET U( I , 2):Y(l)
LET U(l , 3)=Z( l )
LET U( 1, 4): 1
t.EXT I

LET TZ:Tl/57 . 2957795


~~T T=ZER(4 , 4)
LET T(l , 1):1(4,4 ): 1
LET T(2 ,2) :T(3,3)=00S(T2)
LET T(2 , 3): SIN(T2)
LE~ T(3, 2):- T(2, 3)
~~T V:U1 T
FOR 1=1 TO P
LET X(I):V(I , 1)
LET Y(I ):V{I, 2)
LET Z(l):V(I , 3)
NEXT I

' CONVERT TO RADIANS


' REDIMENSION T FILL WITH ZEROS
' SET UP TRANSFORMATION MATRIX

' CALC . TRANSFORMED POINTS


' CALC. PHYSICAL ODOR.

SUBE.~D

~ AI..GORITlf-t FOO T~EE Dit>ENSIOOAL RoTATION

Aaoor

n v-Axis

'llle algorittln given belo..1 as a MSIC language subprogxam alla..'S rotation

of the position vectors of an object alx>ut the y-ax.u;.


coordinat:!s.

It utilizes taJcxJeneons

3DYPOT

tOO SUB" 3DYROTW:P,X(} , Y(),Z(),T1


'3- D ROTATIC~ AEOui Y-hXIS
110
'P:NUMBER OF X,Y , Z-TRIF~Jr.S
120
' X( )::ARRAY CONTAINING X-<XX>RDWATES
130
' Y():ARRAY CGN'fAINitiG Y-COORDHJATES
140
' Z():ARRAY C0~7AINING Z-COORDINATES
150
'T1::ROTATIOt\ At.CLE IN DECREES
160
DIM U(100 , 4),V{ 100 , 4)
100 FOSITICN VEC"IORS
110
~!AT U:ZER(P , 4)
' REDDiENSION U&V FlU. WITH ZEROS
180
~!AT V:ZER{ P, 4)
190
FOR I: 1 TO p
SET UP HCt-1CKiE.NFDUS
200
LE1 U( I , 1) :X( I)
I POSITICtl Vf.CTCRS
21C
LET U{I ,2):Y(I)
220
LET U(I , 3):Z(I)
230
LET U(I , 4): 1
21.;0
NEXT 1
250
LET T2:T1157 . 2957795
'CONVERT TO RADIANS
260
MAT T::ZER(4 , 4)
' REDIMENSION T FILL WITH ZEROS
270
LET T(1, 1}::T(3,3):COS(T2)
280
LET T(3, 1}:S!N(T2)
290
Lt.'T T( 1, 3) :-T(3, 1)
3CO
LET T(2, 2)=T(4. 4):1
310
HAT V::UT
' CALC. TRAl\SFORHED FOINTS
320
FOR 1::1 TOP
' CALC. PHYSICAL COOR.
330
LET X{I)::V(I, 1)
340
LET Y{I):V(l ,2)
350
LE: Z(I):V(I , 3)
360
NEXT I
I

370 SUBENO

C-8

~ Al..GoR Jnt1 FOR Tt-REE DWENSIOOAL RorATIOO

ABouT

n Z-Axl s

The algorittln given below as a BASIC language sut:program p.rovides far three-

diJrensional rotation about the z-axis .


3DZROT

100 SUB"3DZHCT":P , X(),Y() , Z() ,T1


'3- D ROTATION AB0111' Z- AXIS
110
'P:NUMB~n OF X, Y, Z- TRIPLETS
120
' X{)=ARRAY C(lTAINI NG X-COORDINATES
130
'Y():ARRAY CONTAlttH.'G Y- COORDDJATES
1 Z():ARRAY OONTAINih'G Z- OOORDltlATES
140
150
'Tl:ROTATICN ANGLE IN Dt::GREES
160
DIM U(100, q} , V(100 , 4)
' 100 POSITION VECTORS
170
HAT U:ZER(P, II)
' RED~SION U&V FILL WITH ZEROS
180
11.AT V:ZER(P, 4)
190
FOR I: 1 TO P
' SET UP HOKCKifllEDUS
1 POSrTION VECTORS
200
LET U(l , l):X(l)
210
LET U(I , 2)=Y(l)
220
LET U(l , 3)=Z(I)
230
LET U(I , 4):1
2qO

UEXT I

250
260
270
280

LET T2:1 1/57.2957795


11AT T:ZER( 4, 4)
LET T(1 , 1):T(2, 2):COS(T2)
1.1-.'T T( 1, t'):-SW(T2)

' CONVERT TO RADIANS


1 REDD'.SiSION T FILL W
ITH ZEAOS

I~

II

'

290
3CO
310

LET T(2 , 1):-T{l , 2)


LET T(3 , 3):T(~ . ~):1
~~T V:UT
f"Ok I: 1 TO P
LET X(l):V(I , 1}
LET Y(I):V(I,2)
LET Z(l)=V(I , 3)
f,E.XT I

320

330
3~0

350
360

'CALC. TRANSfORMED POitrrs


' CALC. PHYSICAL COOn .

37C SUBEND

C-9

~ AlGCRint1 FOR THREE-DU'NS IOOA1.. RfLECTlct4S


An algorithm which will perfonn three-dJ'iJTellSi.onal reflectialS th.rough the

xz, or yz is given bel~ as a BASIC language sutpr:ogxam.


Reflections about other planes can be cbtained by a cacb.inatioo of rotation and
reflection .

ooordi.nate plat'.es

~,

3DREFLT

100 SUb"3DREFLr' :P, X(} , Y() ,Z{) ,N

' 3~0

1110

'P:NUMBER OF X,Y , Z-TRIPLETS


I X( ):ARRAY CONTllillt:G X-COORDINATES
'Y():ARRAY CONTAlfnNG Y-COORDINATES
'Z( ):ARRAY CONTAHIING Z-COOf!DINATES

150

110
120

130
160

170

180

190
20C

210
220
230
240
250

260
270
280

N:REFLECTION CODE: 1:)[{-Pl.ANE, 2:Yl-PLAflE, 3=XZ-PLA~t:

DIM U(100 ,4}, V( 100, 4}


f"IAT U:ZER( P, 11)

100 POSITION VECTORS

FOR 1:1 TO p
LET U(l , 1 ) :X( I}

SET UP fD'.OOEl~S
1 POSITION VECTORS

~~T V:Z~R(P , ~)

LEi U(I , 2):Y(l)

flEXT 1
~.AT T:ZER( 4 , L)
If N:2 THEN 310
If N=3 THEN 3~0

T(1 . 1 ):T(2 , 2):T(~ , 4):1

290

~i

T{3 ,3):-l

300

GO TO 360

310
320
330
340
350

LET

310

38C

390

~00

~ 11
~20

' REDIMENSION U&V FlU. WITH ZEROS


I

LET U(l , 3):Z(I)


LET U(I ,11):1

LET

360

REFLECTIOtiS

T (~ . 4):T{3 , 3):T(2 , 2) :!

LET T{1 , 1)=-1


GO TO 360
LET T{l, 1):T(3,3)=T(4 , 4):1
LET !(2 ,2) =-1
f".A T V: UT
FOR 1:1 TO P
LET X(I):V(I , 1)
LET Y{I):V(I , 2)
LET Z(l):V(I,3)
UEXT 1

SUBEND

' REDIMENSION T FILL WI'Ill ZEROS


' SET UP TRANSfORMATION ~lATRIX

CALC , TRANSFOR.'IED POHITS


CALC. PHYSICAL COOR.
1

DATA 81& f.'.ANIPUI.ATIQl ALOJRITI!I-ts 207

c-10

AA h.GORJTK'l FOO TlffE-Dit-ENSI~AL. TRANSlATIOO


An

algorit:hn for translation in three dinlmsi.al!> is given below as a BASIC

l anguage

~rogram .

It mlkes usc

of~

100 SUB" 3DTRANS" :P , X(),Y(),Z() , L ,l'I,N


110
' P:NUMBER Of X, Y, Z- TRlPLeiS

'3-D

coordinates.

TRANSUTJQN

120
130
140
150
160
170

' X():ARRAY CO~TAIN!NG X-COORDINATES


I Y():ARRAY CONTAINING Y-COORDINATES
Z{):ARRAY CONTAHUNG Z-COORDINATFS
' L.:X TRANSLATION FACTOR
' N:Y TRANSLATION FACTOR
I N:Z TRAl&SLATION f'ACl'OR

180
190
200

DIM U( 1 00 , 4) , V(100 , ~)
MAT U:ZER(P , 4)
MAT V: ZER(P , 4)

RFDINENSION U&V f'ILL WITii ZEROS

2 10
220
230
240
250
260

FOR 1= 1 TO P
LET U(l , l):X(I)

'SET UP HCI'lOOfllf..OUS
'POSITIOt~ VECTORS

LET U(l , 2):Y(I)


LET U(I ,3)=Z(I)

LET U(I , ~)=1


NEXT I
HAT T:ZER(4 , 4)
LET- T{ ' , 1):!(2, 2):1
LET T{3,3)=T(4 , 4)=1
LETT(li,1)=L
LET T(4,2):H
LET T(4 , 3):N
HAT V: U*T

270
280

290
300
310

320
330
3110
350
360

FOR I: 1 TO P

LET X(I):V(I , 1)

' 100 POSITION VECTORS

REDD-IENSION T FlU. WITH ZEROS


PLACE 1s ON orAG . OF T-MATRIX
I

'SET X TRANSLATION FACTOR


' SET Y TRAMSLATIOt~ FACTOR
'SET Z TRAUSLATION FACTOR
'CALC. TRAt~ POSITION VECTORS
' CALC. PHYSICAL COOR.

LE~

Y(l):V{l , 2)
LET Z(l):V(l , 3)
NEXT I

370

380

390 SUBEND

C-11

/'Jt4 Al.GORJlH"t FOO lt-REE-Dit-e4SIONAL ~TAT I ~

Ainrr Pt~v

ARBI'TAARY Axis IN

SPACE
An algori t:hn which will produce a

ional rotat im about an

arbi trary axis in SP-loe is given below as a BASIC language subprogram.

based on Eqs. (3-17) ctnd (3-18).

3X;ENROT

100
11 0

120
130
1110
150

SUE" 3DGEN~':P , X{) , Y() , Z() , Nl , N2 , N3,T1


' P=~R OF X, Y, Z-TRIPLETS

' 3-D GENEFAL ROTATION

' X()=ARRAY CONTAllll~~ X-COORDINATES


' Y():ARRAY CONTAltllt~ Y-cooRDlNATFS
' Z():ARRAY COt.TA!Nlt;(; Z-OOORDlNATES
' N1:DIRECTION COSINE OF ROTATI~ AXIS W.R.T . X-DIRECTION

It is

II
I
II

16G
170
1BlJ
19~

2r
21~

nr
2Y
2~0
~5r

;2:r-II<EC1ICN COSH<E C.f pJTATiot. ~.JIS w'. q . 1. Y- CI PECTICN


ti"':!;lfrECTIC~. ~l':E <F F"JTA:liY. A.X!S W. P. ~. Z-!;IFECTIG!~
1
Tl:P.OTAT!C~. I..!.'Cl.E 11 IZ;PEE:
o1u uct~ . ~>.vc c~ ,~ ~
' lOG f":.>.'"IT!UN VECTOPS
P~T L: ZE?(f , ~)
' FEDIY.E'lSlGtl ~'J FILL '.OITH ZEfiOS
1
1

P~T

FOr I= 1 ro P
LET UCl 1 l):Y.(I)
LF: UCI , 2):Y(I)

20

nr
2er

?jC

30"

;,r

~2G

3')f'
3140
"'SG
3~0

37r
3e('l

;r;,o
llQt
~tr

1,2f'
~~G
~uo

I< 50
J~ f.O

V:ZEF.(r l 4)

~-r

U(I , 7 ):Z(I)

LE1

Ull,~J:l

t-."EYT 1
I'J 7 T:ZEP( I. , u)
LI='T T2:T11!:7 .29':,7795

Lf.T
l.E7
lEI'
LE1'
Lf.T
LET
LI='T

' ?EC:P.I.f1,!:IC'! 1 fill \HI'!" ZE.~S


' a;!NEF.l Tl TO RAtlANS
1(4,4):1
~r:; UP TrANSFCF ~.ATlO~: ".ATPIY
TC 1 1 J :~;l ',l+( ,-t.1 1 fol} 1 COSC12J
1( 1 ,2) :Nl t;2 1 ( l-COS(T2) J'f !:;IN(T2)
1( 1, 3J=~i1 1 13 1 C 1- COHT2) )- 1~~ "'1!.(1'2 )
1(2 1 1):,1 1 !.2 1 ( 1 -CGS(T2)H\3- :.It~(T2l
TC 2 ,2) :'.2 1 1.2+( 1-t.~ t;2) 1 COSCT2)
T(2, ;):t.c:;( 1 -CUSCT?J> + ~:t Sll.(T2)

LET rc3, '>=~l ' N!' <t-ecsl~),.~;i?' sr.cr2J


LE!' r(3,2>=~f'IN:~ c t-ccs<u-tsn.cr?>

ti.T TO, ~):~;~ (;( 1-!.!1 'l!J 1 CVSCT2 )


W,T V:U 11
' ':I.LC. TFM;:FOf"EC FC!t\TS
FOr 1:1 T~ r
LET Y( 1 ):V( I I 1)

' C~LC. fP.Y~IC~L coo~.

LET l(l):V(l , 2)

LET

Z(I):~(I,!)

t.'EY.T 1

suwm

An ll9Qritl"rl ft;_,r a s.wq::le c~.J.c proJectl.oo c.nto a ~ro plane per-

IY-"ldlcular w MY of the tl'.ree

o~nal

axes is

g1~ l:x:lo.~

e.s a BASIC

S'~Og't'al"'.

PFGJ
lif. ..UE:"HCJ" : P, Y.(), Y( J , Z{) 1 t1
' I'FOJE.CTIOtl
11C
r-=r:uveEP or x, YI z- TRIPL'!S
12C
' Y( ):AP~AY CGtm,H\HC Y-COORDINATES
1~"
' Y( ):APPAY CCI;TAININC Y- COJFCINATES
lt:C
' l( ):APf<AY CCNTI.lNir.C z-cOOFDINATE.S
1SC
~. : CCir..E ~l...11H .R r:;IJICATI':C PEFPEl:CICIJLAR liYIS:
lG~
' 1=Y-AY1S, 2=Y- AYIS , "'=Z-AXIS
17C
DIP U( 1CC , ll) , V( 100 , q J
' 100 POCITICI: VECTCPS
1
1H
t'.Al U:ZE.P{r , 4)
PECI,.,~;SI0.' U~\' FILL \.ITH ZEFOS
i~

t'~T 'J=ZE~(P,4)

2r'

FCF I= 1 Th P
L: UC: , l):X(J)
1..7" uc , l' J='f CI J

21~

nr

2~0

' SET UP

~~E.'~ctiS

' ?r~!TIO\ VEC7C~S

LET U(1 , 3}=ZC!)

2~r

LE7

2Sr

Pt'E>'T I

?'f

111\l T:ll~(IJ,t)

Uf! , ~):l

~EDl"~PlSICti

T Fill IOI'ni ZETtOS

la.'lqllage

270
280
290
300
310
320

330
3110

350
360
370
380
390
QOO
410
1120

LET T(1,1):T(2 ,2)=1


LET T(3,3):T(~ , Q):1
IF N= 3 THEN 350
IF N:2 THEtl 330
LET T(1 ,1 ):0
00 TO 360
LET T(2,2):0
rn TO 360
LET T(3 , 3): 0
..-.AT V=UT
FOR 1:1 TO P
LET X(I):V(l,l)
LET Y(l):V(I, 2)
LET Z(I):V(1,3)
NEXT I
SUBENO

' PUT

1' S 00 AlL Ot A ELF-Y.ENTS

' SET APPOOPRIATE

DIAOOt~AL

TERt1:0

' CALC. TPAt:SFOFME'D POI NTS


' CALC. P~YS!CAL ODOR .

C-13 A DIMETRIC PROJECTIVE AlGORITif'l


An algoritlm which i.nplercents the specific dirretric transfornatioo given

in Eq. (3-26) and ass\11\ing projection ooto the z = 0 plane is giwn belo.~ as a

BASIC language subp.rogmrn.

Dlt1E1RIC
100 SUB"Dlt-IETRIC": P, X(), Y() ,Z()
' Dlt-IF1'RIC Pnc)JFCTION
110
' P:NUMBER Of X, Y,Z-TRIPLETS
120
' X():ARRAY ~iAINI~G X-COORDINATES
130
' Y():ARRAY CONTAINING Y-COORDllJATES
140
' Z():ARRAY CONTAINING Z-COOPD~ATES
150
DIH U( 100 ,4) ,V(100,4)
' 100 POSITIO~ VECTORS
160
MAT U:ZER(P , 4)
' REDIY.EriSION UbV FILL WITH ZFROS
170
MAT V:ZER(P , 4)
180
FOR I= 1 TO P
' SET UP OOMOOENIDUS
190
LET U(I,l):X(I)
'POSITION VECTORS
200
LET U(l , 2):Y(l)
210
LET U(l , 3):Z(I)
220
LET U(l ,4)= 1
230
flEXT I
240
MAT T:ZER( 4, 4)
'REDIMENSION T FILL WIW ZEfiOS
250
LET T(1,1):0.925820
' SET UP TRA NSFOR~ATION ~~TRIX
260
LET T(1 ,2):0.133631
270
LET T(2 ,3): 0.353553
280
LET T(1,3):-0. 353553
290
LET T(2 ,2):0.935414
300
LET T(3,1):0. 37796Q
310
LET T() ,?):-0. 327327
320
LET T(3 , 3):0.866025
330
LET T(!l ,4):1
340
t'AT V:UT
' CALC. TRAfJSFORfiATlON
350
FOR 1:1 TOP
' CALC. PPYSlCAL ODOR.
360
LET X(I):V(l ,1 )
370
LET Y(I):V(l,2)
380
LET Z(I):V(I , 3)
390
NEXT I
400
CALL "PROJ": P,X() ,Y(),Z() ,3
'PROJECT ON TO Z=O PLA~f
410 SUEEIJD

It

C-14

fJ/~ lsa-TR1C PRoJECTIVE /\.GOOint1


An

algonthn \ofu.ch ir.ple-ents the

Sec. 3-!.o (1 .e.,

c.q. (3-26)

wit.'"t e

sa etric tranSfon ation disc:ussec! in

=35.264

on the z 0 plane is given bel0oo1 as a BASIC

CiOO ~ = 45] aro assu-.J.ng proJect:..ioo


1~

sd:program.

1CC SUE"lSOt'..ET":F,X(),Y(),Z()
' ~!C PPJJex:Timl
110
'P:t~EP OF X,Y,Z-!RIPL~
120
' X():APPAY COh'TAII~I.ll; X.COOPDll\A!ES
130
' 't():APPAY CC:;tAINn~ Y-cooPDINATES
11;0
' Z{) :t.PP.AY CONTAINL~ Z...COOPCI~iATES
150

160
170
160
190

200
210
220
230

zuo

DIY U(100 ,u ) ,V(100 ,JJ )


f'I.AT U:ZE.Il(P,1.)

f'I.AT V:ZEP(P,~)
f"'F I= 1 TO P

SET

U(I ,l ):X(l)
LET U(I ,2): Y(I)
LET U(I ,3): Z(I)
LET U(I ,~ } =1
LET

t,"EX7 I
~.AT T:ZEP(4 , U)

280
290

LET 1(1 , 1) : 7(3,1): 0.707107


LET 7(1,2):0.4082~8
LET T(? ,2):-C. C82~8
LET 1(1,3): -0.577353
LE: !(!, 3):0. 577353

300

LET

310
320
330
340
350
360
370
380

LE7 !(2,3)=0.577345
LET T(1.,4):1

250
260
210

I"J.T V: U1 T

FOR I: 1 TO P
LET X(I):V(I ,1 )
LET Y(1):V(I ,2)
LET Z{I):V(I,3)

ZEPOS

HJKXjE!."EOUS
' POSITICN VECTOPS
(p)

' FED!~!:~ T FILL ~!TH ZEPCS


' SE! L? !PA~~fCP~ATICS ~~!PIX

' CAU:: . TRAl~FQFI.#.ATIO~


'CAU::. PHYSICAL CXJP .

NEXT I
'PRCJECT Q:rG Z: O PtA1:E

Pi~ fu;oo tnf'l FOO PeRsPECTtVE TRANs~ATlOOS


An alqontlrl ~o.hl.ch

as a

~ITr

1(2 , 2):0.816~97

390
CALL "PPOJ":P,X() ,'t() ,Z () , 3
1100 SIPI....ND

C-15

' 100 POSITIOt: VECTC?S


' fEDI'"ENSIOt: ~V Fn.L

Bl-SIC

will generate a

perspective

V1ewi

1s given

lan<Jua9e subpro<JX&.t.

l UJ SUC." FC.r~FEC": f 1 ,X( J , Y() , Z() , F, C, F. fE.f.SPECT 1\'E. !f..:J...Fvf.YJ.UC!i


11 C:
' P 1:MJ.'o.!:Ef' Vf X, Y, Z- :?IPLETS
1eO
'Y (): A"FA Y CG.,1/.l1.lt.G >:- CCA..FIL:tJ.rt..S

b?lcy

130
140
150
160
170
180

190
200
210
220

230
240
250
260
270
260

290
300
310
320
330
340
350
360
370

380
390

'Y():ARRAY-CO~TAltcll\G

Y-COOfiDINATES

' Z():ARRAY CO~TAI~1NG Z-COO~Dl~ATES


1
P:X- AXIS POINT (;f PROJt.CTlOI
'C:Y-AXIS f'Ol~T Of PROJECTIOf,
' R:Z-AXIS POINT OF PROJECT!~
DIH U( 100,4),V(100,4)
I 100 f'CSITIOJ'oc VE.C'I\JhS
MAT U:ZER(P1, 4)
I REDlMEI..SlU. ~ v FlU. ~11li ZE.hGS
MAT V:ZER(P1 , 4)
FOR 1:1 1U P1
' SET UP IUIC(jEM:OUS2 10
LET U( l ,1):X(l)
I POSITION VEX:TORS
Lt.T U(l , 2):Y(l)
LET U(l, 3):Z(l)
LiT 0(1,4):1
HI:.XT I
NAT-T:ZER( 4,11)
REI.ilMOOlON T- FILL ~ITh ZEhOS
LET T( 1, 1):T(2,2):1
I PL.ACf. 1' s 0~ D
lAG. Gf T I'IATfHX
LeT 1(3, 3):T(4, 4):1
Ll:.-r T(1,4): P
' SET X PROJbCTiotJ Pvl~~
U-1' T( 2,4 ):0
I SE.T y Pf\GJECUON POltlf
LET T(3,4):fi
I SET z PftbJECTION PU
11.1
MAT V=UT
' CALC . TfiANSfORMA1'lON
FOR I:1 10 Pl
' CALC. PHYSICAL COOn.
Lli X(l}:V(1 ,1 )/V(l ,4)
LI:.T Y(l):V(I ,2)/V(l , 4)
LiT Z(l):V(I,3)/V(I , 4)
NeXT 1
SUbE.t<U

C-16

Ttte-DWENSJONAL RECONSTROCTJON Au~rm'IS

tive project.icns, say, tw:> fh:::>togxafi\5, \orilen the natrix transfOll'IVltion e.l.elrents

are known is given

bela.~

as a BASIC language sutprogxam.

It is based

(3-48) .

3DRECON1
100 SUB"3DRECON 1":T( , ) ,S( , ),X1 ,Y1,X2 ,Y2,X(, ) ' 3-D RECONSTRUCTION-I
110
' T(, ):4 1l TRANSFORMATION ~lATRIX FOR THE FIRST VIEW
120
' S( , ):tl1 4 TRANSFO~ATION mTRIX FOR THE SEX:OND VIEW
130
'X1 , Y1:000RD1NATES OF POINT IN FIRST VIEW
140
'X2,Y2=000RDINATES OF POINT IN SECOND VIEW
150
DIM A( 4, 3) ,B(4 ,t ) ,C( 3, 4) , D(3 , 3) , E(3,3) , Y(3 , 1)
160
~AT X=ZER( 3,1 )
' FILL X-MATRIX-WITH ZEROS
170

180
190

200
2 10
220
230
240
250
260
270

280
290

FOR J: 1 TO

FOR I: 1 TO tl

' FIND

POOJEX:'TIOt~

PLANE

' IN T-t".ATRlX

IF' T(l,J)<>O niEN 220

NEXT I
00 TO 250
NEXT J
PRINT "TRANS T IS rm A PROJECTION"
00 TO 660
ON J 00 TO 260 , 290 , 320
'ELIMl~ATE 0-COL~J
LET I 1=2
I FR(Xo1 EOOA
TIONS
LET 12=3
GO TO 340
LET 11:1

Q'l Elg.

300

310
320
330

3il0
350
360
370
380
390
400
1;10
420
430
IIIJO
450
IJ6C

470
460
490
500
I

510
520
530
540
550
560
570
580
590
600
610

LET I2=3

ac m

3110

LE1' 11:1
LET 12:2

FOR J=l TO 3
'F'IND PAOJE'CTION PLAr.E
FOR I: 1 TO ll
' IN s-f".ATRIX
IF S(I , J)<>O TPEN 390
NEXT I
GO TO 420

NEXT J
PR!tii "TFANS S IS NOT A PROJECTION"
ro ro 660
Oll J GO TO II 30, 460, 49C' ELit'IMTE D-COLl11 N
LET J1:2
' f'PO~l EctJATIONS
LET J2=3
GO TC 510
LET Jl: 1

l-...t'T J2::3
CO TO 510
LET J1:1
LET J2=2
FOR 1:1 TO 3
' SET UP A-fo'ATRlX
1
LET A(1,I):T(I,I1) - T(I,4) X1
LET A(2,I):T(I,I2)-T(I,4) 1 Y1
l-~ A(3,I)~S(I,Jl)-5(I,4) X2

LET A(4,l):S(I,J2) -S( I, 4) 1 Y2

I
l-~ E(1,1):T(IJ,4)'X1-T(4 , 11)
LET E(2,1):T(Il,li) 1 Y1-T(IJ , I2)
LET e(3,1):S(4 ,4 )1 X2-S(4,J1)
LET 8(11,1):S(4,1J) ' Y2-S(4 ,J2)

h"EXT

~AT C::TRN(A)
~:ATRIX D::C1 A

620
610
fJ.AT E:li\V(C)

640
fo'AT Y:C1 E
650
~:AT Y.=E'Y
660 SUEElJO

' SET UP P-1-'.ATfiiX

'TRANSPOSE' A
' fORM SC ('IATfllX FRO~ A & lT' S
' INVE~T SCOARE VATRIX
' FORM A TRANSPOSE E
'08TA IN SOLUT!Ot.

~ANSPCSE

to reconstruct t.~ transformation used to obtain a perspective


projection fran the )o1or..n location of six p::>i.nts in the I=bYsical and projectiO'\
An algoritlln

spaces is given below as a BASIC language subpt'Ogram.

It is based on F.q . (J- 50)

in the oor.nalized fonn.

3DFCON2
1C<> SlJ8"30REX:ON2" :X(,) , ll( , ) , TC , )
'3-D RECONSTRUCT!Oti- 2
110
'X( , ):61 3 fo'ATIHX COIITA~lt.G n!E LOCATIO.\S Of' nzE SIX POif.liS
120
'
lN PHYSICAL OOORDI~ATES I~ ORDER
130
' U( , ):6 2 ~ATRIX COUTAINING WE LCCATIOt,S Of' TilE SA:-'E SIX
140
'
POH:I'S IN 1liE PEPSPECTI\'E VIEW I~ nzE SAt--E OROEP
150
'T( , ) :TJJE ll 4 TPAt~F'OR."'.ATlON HATfllX
160
DDI. A( 12 , 12) , 8 ( 11 , 1l ) , C( 11 , 1) , D( 11, 1) , E( 11 , 11 )
170
MAT T::ZER(4 ,ll )
' FILL T&A ~ATRICES ~ ZEPOS
180
MAT A=ZER( 12,12)
190
FOR 1=1 TO 12 STEP 2
' SET UP A~.ATPIX
200
LET J=J+l

210
220
230
240
250
260

LET A(I , 1):A{l+1, ?):X(J , 1)


LET A(I,4):A{I+1 , 5):X(J, 2)
LET A(I , 7):A(I+1,8):X(J,3)
LET A(I , 10):A(l+1,11 ):1
LET A(l , 12):U(J,1 )
LET A(I+1 , 12):U(J , 2)
LET A(l , 3)=-X(J, 1) 1 U(J ,1 )
LET A(l+1 , 3)=-X(J , 1) 1 U(J , 2)
LET A(I , 6) : - X(J, 2) 1 U(J ,1 )
LET A(I+1,6):- X(J,2) 1 U(J,2)
LET A(I , 9):-X(J, 3) 1 U(J , 1)
LET A(l+1 1 9):-X(J , 3) 1 U(J,2)
NEXT I
FOR 1=1 TO 11
FOR J:l TO 11
LET B(l ,J ):A(I,J)

210

280
290
300
)10

320
330
340
350
360
370
h"EXT J
380
LET C(I , 1):A(l,12)
390
NEXT I
400
MAT E:lNV(8)
410
MAT D=E*C
420
LET T(1 , 1):D(1 , 1)
430
LET T(1 , 2):D(2 , 1)
440
LET T(1,4):D(3,1)
450
LET T(2, 1):0(4 , 1)
460
LET T(2 , 2): D(5 ,1 )
470
LET T(2, 4):D(6,1 )
480
LET T(3,1): 0(7 , 1)
490
LET T(3 , 2):D(8,1)
500
LET T(3 , 4):0(9,1 )
510
LET T(4 , 1) : D(10 , 1)
520
LET T(4 , 2):D(11,1 )
530
LET T(4 , 4):1
540 SUBEND

C-17 A STEREO

' SET UP P.&C t'.ATRICFS


' FOR~ e-~ATP.IX

' fORM

C~ATRIX

'CALC. TRANS.

~~TRIX

~Illfl

to generate a stereo pair for an abject ....nich has been positiooed and rotated to fonn the desired view and perspective is given bel.c7.ol as
a 81\SIC language subprogram.
An algorithm

STEREO

100 SUB" STERfl>" : P1 , X( ) , Y( ) , 1 () , K, E' , A( , ) , B( , )


110
' P1:tlUM!ER CF POINTS USED 10 DEFitiE OBJECT

120
130
140
150

160
170
180
190

200
210
220
230

' X0=ARRAY OOtri'AINI~G X-COORDD;ATES


' Y():ARRAY OOtri'AI NING Y-GOOPDINATES
' Z( ):ARPAY rotri'AINING Z-cODRDINATES
' DIM X(Pl) , Y{P l), Z(Pl) It-; t-'Alt\ PflOORAt-1

' K=FOCAL LENGTH OF STFRW VJE'fo'ER


' E:DISTAt\CE EETWEEti EYES Of OBSERVE? (RELATIVE' 'IO OUTPUT g:ALE)
' A( , ):RESULTUlJ X1 -, Y1 -COORDINATES FOR LEFT EYF

' DIM A(P1, 2) IN MAIN PROGRAt-1


' B( , ):RESULTING X 1 -,Y 1 -COO~DINATES FOR RIGHT EYE
'DIN B(P1 ,2) IN t'.Alll PROGf!AtJ
Dlfo! U( 100, 4)
DUI l( 100 , b)

214

~CAL

ElEMENTS FOR a:t-1Plll'ER GRAPHICS

240 DIM R(100 ,4)


250 DIH P(100 ,4)
260 DIM 0(100 , 4)
no FOR I:l TO Pl
' SET UP ~"<XJENEOUS
280
LET U(I ,l):X(I)
' POSITION VECTORS
290
LfT U(l , 2):Y(I)
300
LET U(I , 3): Z(I)
310
LET U(I , 4): 1
320
t~XT I
330
~AT T:ZER(~ , 4)
'CREATE LEFT- EYE PEPSPECIIVE
340
LET T( 1, 1):T(2,2):T(3, 3):T(4 , 4):1
350
LET !(3 ,4 )=- 1/K
360
LET T(4 , 1):K/20
370
I".AT L=U1 T
380
LET !(4 ,1 ):-K/20
'CREATE PICHT-EYE PERSPECTIVE
1
390
fo'.AT R:U T
400
LET X2:X6=0

410
LET X3=X7=99999
420
FOR 1:1 TO P1
430
LET P(I,4):0(1 ,4 ): 1
' NORMALIZE RESULTS
440
LET P(I,l):R(I ,1 )/R(I ,4)
450
LfT P(I , 2):R(I , 2)/R(I ,4 )
46o
LET C(l , 1):L(I, 1)/L(I, 4)
470
Le-r 0(1 , 2):L(I , 2)/L(I , 4)
480
LET X1:P(I , 1)
' FIND X1 t-'AX/MIN FOR LIR EYES
490
LET X5=0(I ,1 )
500
IF X1>X3 THEN 520
510
LET X3:X1
520
IF X1<X2 T~F.N 540
530
LET X2: Xl
540
IF X5>X7 THEN 560
550
LET X7=X5
560
IF X5<X6 THEN 580
570
LET X6:X5
580

590
600
610
620
630
640
650
660
670
680
690
700
710
720
730
740

NEXT I
LET O:(X6+X7)/2- (X3+X2)/2
LET

t-'.AT

LET
LET
ti.AT
LET

' F~D

EYE SEPARATION

DISTA~CE

L:D+(E-D)/2
T: ZER(ll , 4)
'TRANSLATE PICHT- EYE VIEW
T(1 ,1 ):T(2 ,2):T(3 ,!)=T(4 , 4):1
T(4 ,1 )=L
R:P1 T
1(4 ,1 ):- L
'TRANSLATE LEFT-EYE VIEW

t-'.AT L=01 T

MAT A=ZF.R(P1,2)
MAT S:ZER(P1 , 2)
FOR 1: 1 TO P1
LET A(1 ,1 )=L(I ,1 )
LET A(I ,2): L(I , 2)
LET B( I, 1):R(I , 1)
LET E(l ,2):R(I , 2)
~EXT

' SET UP RETURN

~ATRIX

750 SUE!EtJD

C-18

~ Al.GOO lnt\

FOR

A CbwARN"ETRIC CIRCLE

'Ille Al.goritnn given below as a BASIC l..anguage subprogram generates a circle


based on a nonpa.rairetric representatioo.

4-5.

The Algorithm

1.n

It is based on the discussi oo of Sec.

the next section is reo:xntended for circle generation .

t-.PCIRCU
100 SUB"hPCIRCLe" : H, K, R, t-. , X() , Y()

110
120
130
140
145
150
160
170
180

190
200
210
230
240
250

260
270
280
290
300
31o
320

330
340
350
360

37C

380

390
400
410
1120

430
440
450
460
ll70
480
490

500
510
520

530
5~0

550
560
570
560
590
600
6 10

'
'
'
'
'
'
'

H, K:X&Y COOR . OF CEIITER


R: RADI US OF CIRCLE

' f,(ltiPARAMITRIC CHiCLE

t-.: NlR-lbER Of POIf\ T!:> L'.SII1ED


X( ):ARitt.Y COUTAit>lhG TI-E X-cooROIMTES Cf CIRCU:
Y( ):ARRAY CONTAlhlt.'G lliE Y-OX)RDlkATFS OF ClkCLE
NOTE :t\ HliST BE DIVISIBLE BY EIGHT . If NOT PPOGkAM WILL
USE ~EXT HIGHEJ\ NUMBER Dl VISIBLE BY EIGhT
LE.T A::lloT(~/8)
' DE1'E.I<iHt.E If DIVISIBLE BY EIGhT
If A:N/8 T~EN 2 10
U.T t. 1::(A+1 ) 1 8
' SET h1 DIVISIBLE BY EIGPI
GO TU 230
LET N1::N
MAT X: ZER(t-. 1+1 )

HAT

u..,-

Y: ZER(~ 1+1 )

D:R1 ( 1-1 /SCR(2))/(N1/8)

LiT X( l) : R

' CALC. INCREl'IF.NT


' CALC. INI1IAL POIN1

LET Y(l ):O


FOR 1:1 TO N1
I F 1: 1 TIJE.tl 370

' CALC . POINTS AROUND ORIGiN


' DETERMINE SECT. FOR CALC .

I F A&S(X(I))<0. 0005 THEN 320

GO ro 340
lF Y(l )>O THEtl 440
GO TO 590
IF Y(l)<0. 0005 THEt~ 500
IF Y( 1)<0. 0005 11-lEN 430
1F Y(l )>: R/SCR(2) - 0.0005 Thlll 400
U.T X( I+l ): X(I) - 0
' CALC. PO~TS
LET Y(l+1):SQR(ABS(R R- X(I+1 ) 1 X(I+1 )))
au 'IV 640
LlT Y( l+1):Y(l) +D
' CALC. POit.TS
LET X( l+ 1):SCR(A6S(R*R- Y(l+1) Y( l +1)))
GO ro 640
IF Y( l )<:R!SCR(2)+0. 0005 Tr~ 470
Lli Y( l +1):Y(I)- D
CALC. POlt.TS
LlT X( l +1):-SOR(A&S(R*R-Y(l+1 ) 1 Y(l+1 )))
GV TO 640
LE.T X(l+1): X(I) - D
' CALC . PO:U.TS
LeT Y(l+1):SCR(AbS(R*R- X(I+1 )*X(l+1 )))
GO TV 640
IF X( l)>- 0.0005 THEN 580
IF -Y{l) >:R/SQR( 2) - 0. C005 THEN 550
LET X{ I +l) :X(l)+D
' CALC. POINTS
Le7 Y( l +l) : - SUR(AbS{n*R- X( l+l ) X(l+l )))
Gu TO 6UO
LET Y( l +l):Y( I)-0
' CALC. POINTS
LET X( l +1):-SCR(AfS(k*R- Y(l+l )Y(l+l )))
GC TO 640
l f - Y(l)<:R/SCR(2)+0. C005 THEf4 620
LeT Y{l +l):Y( l)+D
' CALC . POINTS
LET X(l+l ):SCR(ABS(R R-Y{1+1 ) 1 Y(I+1 )))
cv ro 640
Lei X( l +l) ;X(l)+O
' CALC . POINTS

0-~5

DEG.

45- 90 DEG.

90-135 DEC.
135- 180 Df..G .

18D-225 DEG .
225- 270 DEG .

270-315 DEG.

620
315-360 CEC.
630
llT Y( 1+ 1 ):- SQR(ASS( R*R- X( 1+ l) I X( 1+ 1)))
6fJO
NEXT I
650
FOh 1: 1 TO ~ 1+ 1
' T'RAHSLA'I ClRCl.E
660
LlT X{l):X(I)+H
670
llT Y(l):Y(l)+K
680
NEXT I
730 SllBENO

II

216 MAmEl-MICAL EUMNl'S FOR CXMroi'ER GRAPHICS

C-19 P At..GORITK'i

~A PAJWmtC

CIRCLE

An algontiln for a pararootric representati.al of a circl e is given as a

BASIC language subprogxam.

I t is based oo f):}s . (4-28) and (4-29) of Sec. 4-6 .

CIRCU:.
100 SLb"ClitCLE":t1 , }, , P, /. , X() , Y()
' PAF-AI'iETFIC CIRCLE
110
'h:X- CUJ110I;,ATE. OF CE.hTE.h OF THE CIRCLE
120
~=Y-COORDihATE Of CENTEfi OF tr.E CIFClE
13C
' .h:F.ADIUS
1l40
' N:NUMbE.H Of POIM'S Ql', CIRCLE
150
' X() ARkAY COI~TAirJING THE X-COORDINATES Of FOWTS Of~ CinCLE
160
' Y() ARRAY CONTAlllUIG Tr.E Y-COOFDI!,ATES OF POINTS Qt. CIRCLE
170
LeT P:2*3.111156/(tl- 1)
' CALC . INCREMEliT Th THETA
180
LET C1:CUS( P)
' CALC. CuNSTANiS

190

LET Sl:SIN(P)

200

LE.T X(C):H+R

210

~T

Y(O):K

' CALC . INITIAL POit.T

FOR H: 1 TO N
' IM~ER LOOP
LET X(M):H+(X(M-1) - H) 1 C1- (Y(K- 1) - K) ' S1

220

230
2110
250

LET Y(H):K+(X(M- 1) -H) S1 +(Y(M-1) - K) ' C1


NEXT H

.<\llf,ff.JO

C-20

PARN~ETRIC Eu.IPSE Al..GOOmt\


1he alC}Clrit:hm given below as a BASI C l.angu8<Je su~rnm generates an

ellipse.

It is based oo Eqs. (4-38) and (4-39) of Sec. 4-8.

E.LUl'SEl
lCO Sl.c"ELUPSC.l" :H,K ,A,B,I,ri, X(} , Y(}
110
' r:X-COOFDI~ATE Of CENTER Cf THE ELLIPSE
120
130
1~0
150

160
170
180
1<;0

2CO
210
220
230

21l0
250
20

270
280
29C

' 1\:Y-coofiDINATE Of CEtiTER Of THE ELLIPSE


' A:LEt.GTH Of SEMI- MAJOR AXIS
' b: LEl:CTH Gf Sffil - t-:IIJOR AXIS
'I:INCL~ATIU A~GLE OF MAJOR AXIS IN ~cGREES
' N: MJMBER Of POlt1TS ON ELLIPSE
' X() :ARfiAY CXitiTAThmG THE X-CGOROI.NATES Cf POit>TS ON ELLIPSE
' Y(}:ARHAY ca~TAl~ING TP Y-COORDlNATES Of POI NTS ON ELLIPSE
1 CALC . THE INCREMEliT IN TilE PARAMETER
LE.T P:2 3.1.1!156/(t-.-1 }
LET 11: 1/57 .2957795
' CONVERT I TO RADIANS

LET C1:CGS(I1)
LET S 1:SIM 11)
U.T C2:COS( P)
U.T S2:Sit.( P)
Ll1 C3:1
LET S3:0
FOR M: 1 TG t.
LET X1:A1 C3
LET Y1:61 S3

' CALC . THE COSINE AND


' Sll~E

CR Til l t.CLlNATION At-GEL


' CALC . TilE lt-.CFIEMEh'TS HI COSINE
' A~O SINE OF THE PAPAMETER u;cREME~;r
INITIALIZE THE ACCU~ULATIO~
' VARIABLES
' BEllIt-. INNER LOOP
' CALC. Ir.CRE11EUTS It. X AND Y

3CO
310

LET X(~)=H+X1 1 C1 -Y1 1 S 1


lti Y(I1 )=1<+Xl ' Sl+Yl 1 C1

' CALC .

320

LET T1:C3'C2-S~' S2
LET S1: S31 C2+C31 S2

CALC . NFJoi At.GLE fOWLLAS


'DOUblE ANGLE. F'Ofi SI,_E
' OOUE!LE. AIJGLE FGk COSINE

33~
3~0

350

360

LEi Cj:Tl
hEY.T M
SUbEtrD

~~~

X At.O Y

C-21

~ Al.G001nt1 ~ A PARNrRIC PARA&U


'Ihe al<JOrithm for a pararretric parabola given bela.. as a BASIC language

is based oo Eqs. (4-54) and (4-55) of Sec. 4-9.

subprogram

PAf\A80L.A

100 SUE" PAIW30I..An :A, PI, N,X () , Y(}


' PARA."ETRlC PARAOOU.
110
' A:VlSTAtiCE FRCJ1 FOCUS TO VERTEX OF P~ABQLf,
120
' Pl:I~.AXll-lUM ANGLE (DEGREES) (CF. EO. ~-45 OR 11-116)
130
' N: Mlt'.SER Of POINTS ON PARABOLA
140
' X():ARRAY CONTAlNII."C WE X-COORDINATES CF POINTS Cf: PAFAfCLA
150
' Y():ARRAY COt-'TAlNlt.:c TilE Y-COORDINATES OF f>ClriTS Ct, PARAECLA
160
LET P:P1/((N-1 ) 1 57 . 295)7795)
' CALC. l~CREY.E~T IN THF.TA
170
LET X( 1): 0
' INITIALIZE
180
LET Y( l )=O
190
LET Al:A*P*P
200
LC~ B1:2*A*P
210
FOR ~=z TO N
' ll!t!ER LOOP
220
LET X(~I):Al+X(M-l)+P*Y(N-1)
230
240

LET Y(M):Bl+Y(I'.-1 )
NEYT M
250 SUBEND

c-22

~ ITWIS

Foo

PAIWETRIC

HvPEROOLAS

An algoritbn which generates a pa.ranetric hyperbolll is given belCM as a

BASIC snbpxogcan.

'lhe al<JOritbn is based oo Eqs. (4-57) and (4-58) of

sec.

4-10.

l1YPE.I1b 1

100 SUB"HYPEfiB l" :A , b , N, X{),Y()


'PAAAH.ETRIC HYPERBOLA
110
' A:DISTA~CE FllOI-' Cl:.mER Of HYPERBOLA TO VERTEX
120
' B:DETEfiHH4ES SLOPI:.. FO ASYP.PlGTES:+-6/~
130
't.:tMlEE11 OF POI~TS Otl HYPERBOLA
140
' X():ARRAY CONTAlt.U~ X- COORDINATES OF POINTS ON HYPERBOLA
150
' Y( }:ARRAY CONTAH INC Y- COORDINATES OF POit.TS ON HYPERBOLA
200
LET P:) .l 41592654/(2*( N- 1))
' CALC . PARAt'.ETEk INCREJ.~E.NT
210
Lf.,T C2:CGS( P)
' CALC. COSlNE ,SlNE , TAMiENT
220
LE.T S2:SW( P)
' OF PARAfJETER I~CRENENT
230
LET 12=T~(P)
240
250
~60

270
280
290

300
310

LCT Q9:b1 T2
~1 S9:b1 C2
LET X(l):A

'INITIALIZE

LET Y(1):0
FOF< H:2 TO N
'U,NER LCOP
LET X(M):(S X(H-1))/(S9-Y(N-l)S2)

LET
t\E.XT

320 SIJSEND

Y(H):(b' (Y(~-1)+09))/(8-Y(M- 1) 1 12)

Another al<JOritbn which generates a param!triC hypertx>la is given below as


a BASIC subprogram.

'1his al<JOritl-rn is based on Eqs. (4-61) and (4-62) of

218 MMl!E:'.ATICAL EILMENl'S FOR a::MPUlER GRAPHICS

Sec. 4-10.

'1his alcprithn yields the port.ial of the hypcrlx>la in the first


'lbe port:.i.als in the other quadrants or nonorigin-oentered hyperlxas

quadrant.

can be obtained by appropriate .rotation, reflect..i.oo, and translatioo operations .

HYPERE.2
100 Sub"hYPERB2" :A , B,C,N,X(), Y()
110
'A::DISTMICE fRGI CE~'TER OF

120
130
140
150
160
170
180
190
200
210

220
230

PAJWIETI\IC HYPEf\BOLA

HYPERECLA TO VERTEX

&:DETtRHI~ES

SLOPE fO ASYM~ES=+-B/A
' C::LltUT OF X-COOi1D:U ATE
' lY::Ml-lEEk Of POlhTS CU HYFERBOLA

' X():ARRAY

CON1AINI~G

X-COORDINATES OF POINTS ON HYPEI\BOLA


' Y():ARkAY CONTAlNH.C Y-CC<JRDINATES Of POINTS Ot\ HYPERBOLA
LET P2:(A+C)/A
' CALC. PARAMETE!i ItCftEliDtr
LET P1::((LOG( 1+P2)/LOG(10))- (LOG(P2-1)/LGG(10)))/(2*(K-1 ))
LET C2:(EXP(Pl)+EXP(-P1 ))/2
CALC . GOSH P1 LtT S2:(eXP(~1) -EXP( -P1 ))/2
' CALC . S:U1H Pl
LET X(l)::A
LET Y(l)::O

' lNITlALIZE

2110

FOn M=2 TO t.
' lJ:t,EJi LOOP
U.T X(M):Ci_>aX(M-1)+(A/E)*S2*Y(N- 1)

250
260

LET Y(M):(b/A) *S2*X{M-l )+C2*Y (~~1)


t.XT M

I(

It
li

If

II

270 SUBE!\L

C-23

~ Al.OORillfl ~

ACIRCLE TtmG! T~ PoiNTS

'!he alcprithm given below as a BASIC Stq>rogra.'ll detelll\i.nes the circular arc
passing through three points.

It is based oo the discussioo of Sec. 4-ll.

3PClhAkC
100 SUE"3PCIRARC" : X(),Y() , t- , H,K, R,S(),T() 'ARC ntRU THREE POINTS
110
I
X(). Y( ):COORDINATES Cf THfiEi POll\'TS
120
' N::NW.BER OF STRAlChT UNES TO REPRESENT ARC
130
I H' K::); . - COORDINATES Gf CEt'fTER ( RETURf,ED)
140
' fi:RADIUS (RETURNED)
150
' S():ARRAY CON1AIN1NC X-OOORDI1~ATES OF CIRCLE
1
160
T():ARRAY CONTAINING -COORDINATES OF CIRCLE
170
~~T A:ZER(3)
DIM & SET EQUAL TO ZERO
160
MAT B=ZER( 3)
190
FOR 1: 1 TO 3
' CGPY X() & Y() ~~~ h() & B()
200
LET A(l):X(I)

210
220
230
240

2SO

260
270
260
290

300
310

320
330

LET B(l):Y(I)

!~EXT

CALL"21YfRANS.":3,A(),B() ,-A(1),-8(1) ' TRANS. 1ST POINT TO ORIClt\


CALL"SOLVE" :A() , 8() , H1 ,K1
' SOLVE fOR CENTER Of TRANS. ARC

LET H:X( 1)+H 1


LET K:Y(1)+K1

' CALC.

LET R:SOR(H1*H1+Kl ' K1)

' CALC. RADIUS


' TnAfiS. CIRCLE TO ORICD;
' CALC. BECit,NlM; & ENDING At.GLES

CALL"2DTRAt~.":3,A(),8() ,-h1 ,-K1

CALL" ATAt," : A( 1) , 8( 1), T1

CALL"ATAh'':A(2) , b(2) ,T2


CALL"ATAtt" :A( 3) ,8(3),T)

11:11*57 .2957795 1
LET T2=T21 57.29577951

LET

C~TER-COOJ\OINATES

' CHANGE RADlAhS TO DEGREES

~0

350
360

310
380
390
400

410
420
430
440
450
460
470
1180
490

500

5 10
520
530
540
550

560

570

sao
590
600

LET T3:T31 57 . 29577951


IF T1<T2 ~H 420
' TEST FuR DlfrlkEN1 CASES
IF T2>T3 1hEl 470
'Tl >T2>T3
l.I:.T t3:T3-360
' T1>12<T, CASE 1
1 1l.ST lf CASE 1 COfifii:.CT
IF ABS(T3-T1)<360 ThE.l~ 470
LET T3=T3+360
' T1>T2<T3 CASl 2
LET T1:T 1-360
GO TO 470
lF T2<T3 THE-N 470
'Tl<T?<13
LLT Tl:Tl-360
' T1<T2>13 CASE 1
lF ABS(T3- T1 )<360 HltJ, ll70
' TEST If CI.SE 1 CCR!lECT
LlT T1:T1+360
'T1<T2>T3 ~ASE 2
LET T3:T3- 360
CAl.L"AkCA":H.K,fi,T1,T3,N, S() , T{) ' IlM\<1 ARC TifHIJ Tift 11iftE.E Ptilt.TS
SUBEND
SlJB11 SOl.VE11 : A() , B() , H1, J\1
' SOLVE FLR COOlfi at- ClhCI.
1 A() , B():COOR OF 3 POINTS WHEn A( 1):8(1):0
' Hl , Kl:X , Y-COOR OF CEhTER (RE1'URt.Et}
MAT C:ZER(2,2)
t1AT D:ZER( 2 , 1)
f-1AT E:ZER( 2 ,2)
JI.AT F':ZER( 2. 1)
FOR 1:2 TO 3
I SET UP MATRIX
LET C( l-1, l ):~A(I)
LLT c< I-1, 2>=~~<I>

l.lT D( l-1, 1):A(I) 1 A(l )+B(l) 1 8(1)


NEXT I
MAT E:~~V(C)

610
' CALC. CE~TE11
620
HAT F:E'D
630
LET H1:F(1 , 1)
' SET CEliTER ECUAL TO H1 , K1
640
LLT K1:F(2 , 1)
650 SUBEI\D
660 SUB" ATAt.'' :X , 'i , A
' TAl\ G- (YX)
670
I
'i:PROGftAH Flt.:DS TAf.GI:.liT Of ('i/)1)
680
' A:TAtiC~'T Of ( Y/X) It RADIAl-S ( RETURUE.C)
690
IF Y<O THEh 760
700
IF X:O THEI-l 740
710
IF X<O 'Ilil:.tw 760
72G
l.CT A:A1N{Y/X)
' Q-90 DE.C.
730
GO TO 850
71lO
LET A:1.570796327
' 90 DEG.
750
GO TO 850
760
LET A: 3 . 141592654 -AT~(ASS(Y/X)) ' 90- 180 D~G .
170
00 TO 850
780
IF X:O ThE~ 840
790
lF X<O THEN ~20
Boo
LE.1 A:6 .2o3 1&5308-ATil(AbS(Y/X)) ' 270- 360 CEG .
b 10
(j{j 111 850
b20
LET A: ATir(ABS(Y/X))+3 . 1111592654 '180-270 DEC.
b3o oo TL o5o
' 270 DEG.
SliO
LlT A:4 . 71236698 1

x.

85o st..w.o

86C S{j8"ARCA" :X,Y , R,Tl.T2 . l.X() , Y{)


' PARA!-'E'Tn:C CifiCULAk AliC
670
' X: X-CUJfd.at~A TE CR CEfiTEf. <F AfC
66o
Y= Y- COOROl!';ATE: OF' cEt.n.R oF Afie
b~O
' J<: RADIUS <..f AP.C

900
9 10
920
930

' T1 , T2:bi:.GlliNH,G AND Etl!il"G AtiGlFS II~ r.t:.GfiEES


'f:NlJJ-.bE.h <l-' POl l, T!S TO REPFIESENT ARC
' X( ):AfilfAY COtTAit.II.C lliE. X-CCORDDd\TES GF 1llE AF.C
' Y( ):Ak~AY COtlTf,It\It..C 'WE Y-COORDI.KATES Of TFE ARC

220 MMREl-'J\l'ICAL El..EMENTS FOR ClH'U'I'ER GRAPHICS

guo

LiT T3:T1/57 . 395b


LET P:(12-T1)/()7 .295b (~-1 ))
LET C1:CGS(P)

95C
960
970

U:."T Sl : Slr~(P)
l'1 X( 1):X+R1 COS(T3)
LeT Y(1):Y+h 1 Slh(T))
Fu4 1'.: 2 TO N

98C
99C

1COO

' CHA~E

OtCREES TO

RADIA~

' CALC. lNCkEr-1E(ti-1)T IN RADlA(h-l )S


' CALC . COS & Sltl Cf' lliCREJ-'.EtlT
' ll.lTIIILIZE TilE ACCI.i1Ut..ATIOtl
'VARABLE

' CALC . X, Y <XX>R .

1010
LET X(N):X+( X(l'l-1 ) - X)C 1-( Y(N-1 )- Y)*S 1
1020
LET Y(I'I):Y+(X(~l-1)-X) * S1+(Y(t-1-1}-Y}C1
1030
fJUT ~
1040 SUBErlu

C-24

~ Au:.ootnt1

Foo

CNERAT1NG

Cusrc SPurt:s

II

to n lax:Jwn data r;oints with


various end bounda.ry cxnlitioos is given belCM as a 81\SIC language subpX'OgUim.
'1be algorithm calculates the paran-eter range based upon chord di.stance between
data r;oints rather than usi.nq noonalized splines .

SPUhE

An algorithn for generatin<J cubic spline fits

100 SUB"SPLit.E" :S ,t. ,P( , ) , Cl ,C2 , N( ,) ,B(,) ,L(), Z, U(,) ,C(,)


110
' S:CONTROL VARIA8LE S=2 FOP 2-D CURVE, S=3 FOR 3- D CUIWF.
120
tl=t:tJPEER OF DATA rorrrrs
130
' P( , ):ARRAY COt.'TA lt.l}.{; DATA POINTS
1!10
' Cl:WITIIil END COt\DITIOr,
150
' 1: RELAXED
160
' 2:CLAtIPED
170
I 3=CYCLIC
180
'll:AJITICYCI..IC
190
' C2:Fit.AL E~D OONDITION
200
'!:RELAXED
210
' 2:CLAMPED
220
~mE: IF A CYCLIC OR AA'TICYCUC TIIITIAL EllD CONDITION
230
' IS SPECIFIED TI!F FINAL EJJD CONDITION IS ALSO SPECIFIED
21l0
'N(,):MltiZEliO El.FI~ ENTS OF M-t-'..ATRIX, SEE EX). (5-33)
250
'f~ MUST HAVE Dlf'ltflSSIONS OF ( N, 2) OR 01 , 3)
260
' 8( , ):ELEMENTS OF B-11ATRIX , Sfl: EO. (5-33)
270
' B ~lUST HAVE Dll'l.ENSIONS OF (2 ,N) OR (3 ,N )
2b0
' l():SPAN CHORD LENGTiiS
290
' L ~11JST HAVE DlJffiNSIORS OF ( N- 1)
300
' Z.:tru'~BER CF IrrTEf\f1.EDIATE FQHITS PER SPAN
310
' U( , );;ELEI".EtJTS IN TANGENT VECTOR MATRIX , SEE EO. (5-33)
320
'U MUST HAVE D~NSIOtlS OF (2 ,N ) FOR 2-D AND (3 , N) FOR 3- D
330
'U( 1, ):X-COMPQt,J:lrr
31.0
'U(2, ):Y-COOPOt~Etrr
350
'U(3 , ):Z-COMPOl f.l,T IF APPROPRIATE
360
'f.oTE: IF CLAMPED El\0 CONDITIOt-JS ARE SPECIFIED
370
' 1FFJ~ 11fF VALUES FOR TilE TANGFUT VJ:X:TORS FOR
380
'lliE fiRST ao Cl>tiDITION tiUST EE IN U( 1 , 1), U( 2 , 1), U( 3 , 1)
390
' AIJD FOR WE LAST El~D COliDITiotJ IN U( 1,tl), U(2 , N}, U('3 , N)
!IOO
' C( , ):ARRAY rorrrAINnx; GEltERATED FQlllTS Al..Of<G CURVE
ll10
' C 1-'UST Hf..VE D111EriSIONS OF (2,P~+(N- 1) Z} OR (3 ,N+(t-1-1)Z )
!120
' C( 1, ):X-eot-'POf.o"Ef,T
1130
c ( 2 , ) : y-cot-'.POfJ-..1rT
!;llO
' C(3 , ):Z-COt-'FOf!ENT IF APPPOPRlATE

ll50

LET Z=Z+1
'ADD a\E TO 00. INTE!lMEDIATE POINTS
IF C1 >2 THEN 560
' GENERATE OiORD L.ENGn1S AND El.rnEt-.TS IN B-,u-, At..n 1"-t'ATRICES
' \t.'HIOI DEPEt.D l1POl\ Th"E SPa:IFIED El>L rotUHTIOt~S.

ll60

ll70
l!8o
ll90

CALL" EhDP~T": S ,N,P ( , ) ,N(,), H( , ) , L(),Z,U(,),C1 , C2


'D~.PLEME~i

GAUSSIAN EllMINATION TO S)LVE FOR WE


' U"1<l~C7tt"h TAPliEtlT VECJ'ORS.
CALL" CAUSS" : S IN , P( I) ,N( ' ) , E( , ) ' LO , U( ,)

500

510
520
530

co ro sao

51l0

'INVERT ~:ATIUX M AltO SOLVE FOR m;K~tl TANGEUT \lECTOR


' (CYCLIC AND ANTICYCLIC SPLThES ONLY)
CALL''MATINV": S , N, P( , ) ,N(,), I1(,),L() , U(,),C1,Z
' GENERATE ll!E POl US Clf TliE SPUUE CURVE
CALL"CURGEN":S , .. ,P( 1 ) ,L() , Z, U( , ) , C( , )

550
560
570
580

590 SUBEND
600 SUB"Et.DPNT'' :S, N, P( I ) ~ ~<
6 10
620
630

~IATF!IY

U.

' ) , B( ' ) ,I..() IZ , U( I) ,C1 ,C2

lF C1: 1 THEN 680

LET N(1,2):1
LET N( 1,3):0

61lO

FOR K:l TO S
LET B(K 1 1):U(K ,1 )
NEXT K
GO TO 700

650
660
670
680

' FIRST POW OF

t'-~ATRIX

' FOR CLAMPED INITIAL fllD COIJDlTlotl


' SET

B(K, l):U(K,l) FOF CL1PF.D END

LET M1 , 2) =1
'FIRST ROW Of t-1-MATRIX
LET tl( 11 3) : . 5
' FOR PELAXEC D;D CO"DITIOI~
FOR J:l TO N-1
lF C):3 THEt 760
' CALCULATE TliE 2- D SPAN CEORD l..EttcniS

690
700
710

720
730
71lO

LET L(J ):SCR((P( 1,J+1)- P( 1,J)).2+(P(2,J+1 )- P(2,J))-2)


GO TO 770
' CALCULATE iliE 3- D SPAN CHORD LEtm-P.S

750

760
770

8oo

LET L(J)=SCR((P( 1,J+1 )- P( 1,J))-2+(P(2,J+1 )-P(2,J)).2+(P(3 ,J+ 1)- P(3 ,J))-2)


NEXT J
IF C1:2 THEN 820
FOR K:!l TO S
' SET B( K, 1) FOR RELAXED END
LET B(K , 1):(3/(21 L(1))) (P(K ,2)- P(K,1))

8 10

NEXT K

fl20

IF C2: t

830
840
850
860
870

LET ~(N , 1):0

7&>

790

880

890
900

910
920
930

940

TH~ 890

LET N(N, 2): 1

' LAST RO',J OF t-1-MATRU


' FOF CLAl-lPED FINAL DJD CONDITION

FOR K:l TO S
LET S(K , t~):U(K , t-t)
' SET E(K,N):U(K , N) FOR CL.Afo'PED EJ.ID
NEXT K
GO TO 9ijO
LET N(N ,1):2
' LAST ROW OF 11-MATJU)(
LET N(N 1 2):1l
' FOR RELAXFD END CONDITION
FOR K:1 TO S
' SET B(K ,N) FOR RELAXED END
LET B(K , N):(6/l.(t\-1)) 1 (P(K , N)-P(K , N-1})
NEXT K
SUBEND

950 SUB"CAUSS": S, t, , P ( , ) , ~ ( , ) , f( , ) , L() , U( , )

960
970
980

990
1000

1010
1020
1030
l OllO

FOR

J:2 TO N-1

LET N(J,l}:L(J)
' CREATE t.()t\ZERO VALUES FOR
L.ET N( J , 2):2i'( L(J)+L(J- l))
'ltiTERNAL RO\t.'S CF ~1-!'ATRIX
LET ti(J , 3):L(J- 1)
FOil K= 1 TO S
' CREATE flOWS 2 nillOUGH r.- 1 OF P41ATJHX
LET B(K , J)=3 (L(J-1)~2' (P(K,J+1) -P(K,J)) +L (J)-?'(P(K , J)-P(K , J- 1 )))
LET B(K ,J):B(K ,J)/(L(J)*L(J- 1))
~~T K
NFXT J

1050
1060
107C

' THE FOU.<J"ll~j I S TilE GAUSSIAN El.II-~ThATION ,

FOR 1:2 TO ~

IF ft( 1 , 1) :0 TrEN 118C


l..E'T ():?~(1- 1 , 2)/1;(1 , 1)

1o.80

FOR K: 1 TO 3
LET MI,I<):N(I , IO*C-N(l- 1,K+1)

1090

1100
1110

L-~ B(K ,I):B( K , I) C-8(~,1- 1)

t~XT

1120
1130
1140

1180
1190
1200
1210

1220

1230

' RE'DUCE

LET C:N(l,2}
FOR K: 1 TO 3
LET

1150
1160

1170

' ll>PHALIZ'

~{I,K}:N(l , K}/C

' t.OR~1ALIZF

LET B(K , l):B(K,l}/C


NEXT K
tiEXT I
FOR K: 1 iO S

FOR J:O TO N- 1
LET

U(I< , ~-J):{B( K, t-

NEXT J
NEXT K

' SOL\'f FOR UNKtl>\iN

TA~ENT

VECTORS

J)- N( ~-J , 3) 1 U(K , Jl+ 1- J) )/N(N- J , 2)

1240 SUBEND

1250

SUB"CUflCEN":S,N , P(,) , L() , Z, U( , ) , C( , )

1260

LET 1:1

1270
1280
1290

FOP J:1 TO N- 1

' SOLVE FOR n'E FOUR CUEIC SPLD;t: COEFF .

FOR K: 1 TO S

LET F{1 1 K):P(K,J)

1300

LET F(2,K):U(K , J)

131 0

LET F(3 ,K): (3/L(J)A2) 1 (P(K , J+1)- P(K , J})- ( 1/L(J)} (U(K , J+ 1)+2*u(K , J))
LET F(4 , K}:( - 2/L(J}-3)*(P(K,J+1)-P(K 1 J))+( l/L(J)-2) *(G( K1 J+1) +U( K1 J))

1320
1330
1340

t.EXT K
FOR

1350

1360

T:O TO L(J) STEP L(J)/Z


IF J: 1 THEN 1380

IF T<>O THEN 1380


GO TO 1490
FOP K: 1 TO S
' CALC. POI.trTS ALOI~ COEIC SPlliE
LET R(K):F{1,K)+F(2 , K) 1i+F(3 , K) ~ (T-2) +F(4 , K) ' (T-3)
NEXT K
IF S=3 THE~ 1450
LET C( l,I}:R( 1)
' CREATE C( , } MATRIX OF RESULTS

1370
1380
1390
1400
1410

1420

1L30

LET C(2 , I):R{2)


GO TO 1480

1illl0

LET C(1 1 I):R(1)

1450
1460
1470

LET C(2,l):P(2)

111~0

LET 1=1+1

1490

LET C(3,I):R(3)
h!XT T

1500
NEXT J
15 10 SUBEJ.'D
1520 SUB"!oC.ATitV":S , N,PC , >IN<,> ,o< I>,L( >,u( I> ,c1 , z
1530
Dltl. t{(70 ,70) ,C(70) , V(70 , 70) ,W(70 ) ' DIYENSION WTE11NAL JJ.ATRICFS

1540
1550

1560
1570
1560
1590

1600
1610

1620
1630
1640

ti.AT f-': ZER(N- 11 tl- 1)


MAT C:ZER(N-1)
MAT \or:ZER(f,- 1}

' l1UTIALIZE

AND ~EDIHHiS!Otl
' EACH INTERNAL t'.ATRIY

HAT V:ZERO.-l , tl- 1)

J:l TO ~1
' CALC. SPAt; CHORD W~TPS
IF S=3 THE'N 1620
LEr L(J)=SCIR( ( -{ 1 ,J + 1) - P( 1 1 J}) -2+( P( 2 ,J 1)- P{2 , J )) - 2)
OG TO 1630

FOF

LfT L(J):SCR((F(1 1 J+l) -P(


t.'EXT J
LET S):L(N- 1)/L( 1)

1, J))-2+(P(2 , J+ l} -P(2 , J })-2+(P( 3 , J+1) - P(~ , J ))-2 )

If' Cl : 4 TBEN 1730


U:T f" ( l , 1):2+?*S3
' FIRST RO" Of fi-~ATRU
LET H( I , 2):S3
' FOR CYCLIC SPLINE
L...!:i 1:( I , t~ l): 1
FOR I<: l TO S
' SET B(f , 1) f'U~ CYrUC Sf-Llt.F.
LET S(K, 1) :(3/L(l)) * (S3 1 (P(K,2)-P(K,1))+(1/S~)t(p(r,,N)-P(Y. N-1)))
NEXT I<
'
GO TO 1800
LET P( 1, 1)=2+2*S3
' fifiST POll OF t'~IATfflY
l.FT ~( 1, 2):53
' FOR AUTICYCLIC Sf'LltlF.
LET M( 1 , t,-1 ):-1
FOR K=1 TO S
' SET E{K ,l) FOR ANTICYCLIC SPLHf

1650
1660
1670
1680
1690

1700
1710

1720
1730
1740
1750
1760
1770

LET B(K , 1 ):(3/L(1)) 1 (S3 1 (P(K , 2)-P(K,1))-(1/S3)'(P(K,N)-P(~,N-1)))

1780

NeXT K

1790

1800

' SET UP I NTERIOR 1-'.ATPIX AND mVERT

1610

FOR

J:2 TO N1
LET H(J ,J-1)=L(J)
LET M(J ,J ):2*(L( J )TL(J-l))

1820

1830
1840
1b50

FOR K: 1 TO S

LET

B(K,J)=31

' C~F.ATE RO~!S Of' 8-t-I.ATRIX

(L(J- 1)-21 (P(K , J+1)-P(r , J))+L(J)-2*(P(K ,J)- P{Y. ,J-l)))


LET B(K , J):B{K ,J)/(L(J) L(J- 1))

1860
1870
1880
1890

t-EXT K
hEXT J

~~T V:INV(M)
FOR K:1 TO S

1900

FOR

19 10

1920

n- 1
LET C(J):B(K ,J)

' INVERT M-f".ATP.IX

J: l TO

' CALC. SINGLE llOI C-11.ATPIX

NEXT J

1930
1940
1950

1960
1970
1980
1990

2000

MAT H:V 1 C
FOR J: 1 TO N- 1

' CALC . TA"GEliT VECTOR VALUFS

LET U(K ,J):l\(J)


IEXT J
NEXT K
IF C1=4 THElJ 2040
FOR K= 1 TO S
LET U(K ,IH:U(K, 1)

' CREATE TAt.GElli' VECroP 1-'.ATRIY

2010
2020
NEXT K
2030
GO TO 2070
2040
FOR K: 1 TO S
2050
LET U(K , ti):- U(K , 1)
2060
NEXT K
2070 SUBEND

C-25

' CRF:ATF t.'O~ZEhO VALUE"S FOR


'lh1'ERNAL FOWS OF 11-t-IATFIX

' SET FINAL TANGE:toT:lliiTIAL TANGM

' SET fiNAL TANGEtiT:- IIHTIAL TANGENT

~ t\Lc;oo(llf1 FOR PARABOLIC &..ENDING


An algoritlm which iJTplenents the parabolic blending t.ec::hni.q\e described

in Sec. 5-6 is given belCM as a BASIC language S\i'p1 o.:~ram.


PARBLEND

100 SUE"PAPlf<O" : R( , ) , f , C( , )
PARABOLIC BLEt.Olt!G
110
' R( , ):ARRAY CONTAitW~ nil:. OX>RDit.ATES Of FOUR POltiTS
120

130

' R( 1, ):X-COOnDlNATES
' R(2 , ):Y-OOORDINATES

224 1-!M'HI:MM'ICAL EI!ENIS FOR CGlPUI'ER GRAPHICS

140
150
160

' R(3 , ):Z-CCORDUJATfS


' N:NUHBER (F POINTS ~ CURVE
'C( , ):ARRAY roNTAir.ING POUlTS Ot ELEt:DED CURVE

170
180
190

' C( 1, ): X-CCORDINATFS
' C(2, ):Y-COORDINATES
' C(3, ):Z-ccORDINATES

200

21C
220

230
2110
250
260

270
280
290
300
310

320
330
3140
350
360
370

t.OTE :

c 1-1l.ST

HAVE DD'!EliSIONS (F (3 ' t!)

01._, P(3 , 611) ,0(3,61;)


~'AT
~AT

S:ZfR(3, 3)
T:lER(3 , 3)
HAT F=ZEfl(3 ,N )
HAT C=ZER(3 , tl)

' Al.LO\\S UP 1U 6!1 SEG'tliTS


' IrJI1IALIZE AtiD Dl~EllSIOl>'

LET TO:SQR((~(1 , 3) -R(1 , 2))-2+ (R(2 , 3) - R(2 , 2))-2+(R(3 , 3) -R(3 , 2))-2)

FOR J : 1 TO 3
FOR 1:1 TO 3
LT S(l ,J):R(I , J)
LET T(I,J):R(I,J+1)

NEXT I

' CALC . TO

' SET UP TO GEtiERATf PARAEOLAS

THRU FIRST WREF. POHrJ'S


' THRU LAST 'JllRE POIN1S

NEXT J

CALL"GEtl" : S( , ) , 1, TO, N, P( , )
CALL"GEN" : T( , ) , 2 , TO , N,O(,)

' GENERATE PARAFOLA 'JllRU FIRST THR~E POINTS


' GEtlERAT PARABOLA WJ!U LAST TI1REE POilns

K:O
FOR 1:0 TO

' GElJERATE IlLEt'IDED aJRVE

LET

1
LFT K=K1

38o
390
LIOO

STEP ( 1/(N-1 ))

FOR 1:1 TO 3
LET C(l,K):( t-T) 1 P{ l,K)+T*O(I , K)
t.'EXT I

1110

f;EXT T
420 SUEEtiD

430
1140

450
460
470
1180
490

500
510
520
530
5110
550
560
570
580
590
600
610
620

630
640
650
660

SUB"GEJ~":P(

, ) ,St , TO , N, X( , )

'P( , ):ARRAY CONTAihlt.x:i ntf;E'E POlh-iS FOR PARABOLA


' P( 1 , ) :X CCt-'POtiENT
' P(2 , ):Y COMPONE~T
' P(3 , ):Z COf.1l'Ot,ENT

' S1:C0tn'ROL VARIABLE l :FIJ!ST PARMlOLA , 2:SECOND PARABOLA


' N:tml-1I!ER CF POINTS 01~ PARAE<JLA
' TO:CHORD LENGT1i B'l'W~ MltDLE POI ~1'S
' X( , ):ARRAY roNTAINThG 1l!E POUlTS 00 niE PARABOlA
' X( 1, ):X-COI1.POt~ENT

' X(2 , )=Y- CC+IFONEI!'T


I

X( 3 ) =Z-COI'POf~fl;T

~~T T:ZER(3)

FOR I= 1 TO 3
LET T(I):P(I , 2)- P(l , 1)
LET S(I):P{I ,3)- P(l , 1)
LET I~( I):P(l,3)-P(I , 2)
J,f.XT I
NAT U:S*S

' SET UP
' P(SUBII)- P(SUB3)
' P(SUD5)- P(SUB3)

HAT V:T*S

' CALC. n'E 001' PflOOOCT (CF EC. 5-Sll)


' CALC . X (CF' EO. 5-54)
' CALC. ALPHA (CF 8Q. 5- 57)

LET D:SOR(U)

670
680
690
700

fiAT W:fi*S
LET T1 :\,/(T01 D)

710

0010 730
LET T1:V/(TO*D)
lf1' K:O

730

DII~EliSIO

HAT S:ZR(3)
liAT IJ:ZER( 3)

I..E'T X:V/U
LET A:1/(UX ( t-57X))
If 51:2 THE~ 720

720

'INITIALIZE &

' P(SUB5) - P(SUBII)

( CF' EO. 5-Sll)

' CALC . D-2


' CALC. 0

' CALC . COS(nlFTA) (CF' EO . '.)-5Q)


' CALC. COS(TI'f'TA) (Cf

ro.

'i-SQ)

F'OR T2=0 TO 1 STEP(1/(~-1 ))


LET K=K+1
LET T=i0 1 T2
LET R=T*Tl
IF S 1=2 TH1'.; 800
LET R=R+X1 D
FOR J=l iO 3

740
750
760

110

' CALC. POUlTS ctl PAPAKILA


' CALC. T

780
' 'If.ST FCR FlPSl OR SECOND P ARAf~ A
790
800
810
LET X(J 1 K):P(J 1 1)+(RID} 1 S(J)+A1 P1 (D-R)I(T( J)-Y ' S(J ) )
820
NEXTJ
830
t;EXT T2
840 SUSf.tiD

c-26

A Bezi ER CtJM

Al.GOOITif'\

lin alqoritl'ln which Will

a BASIC language subprogram.

generate BezJ.er curve segronts is given belo.t as


It is based oo the discussioo of Sec. 5-7 .

BEZIER
100 SUB"BEZIER": N1,,S,X(,),Y(, ) 1 Z(,) , P,R(,) ' EEZIER CURVE
11 0
' Ul:NlJI.BER OF VERTICES IN eEZIEJl POLYGON
120
' S:COtiTROL VARIABLE 2=PLAtiE CURVE , ) : SPACE CUPVE
130
' X( , !):ARRAY CONTAINit,G lliE X- CCfo!PQt,Et-,T <F POLY<n: VERTICES
1110
' Y( 1 ~ ~.:ARRAY COI~TAINl~'G ntE Y-CGt'POtiEtiT Of POLYGON VERTICES
150
' Z( I 1 ):ARRAY COtiTAINIMJ ~E Z-C<l'!PONE~'T CE POLYGON VERTICES
160
' P:t;UiffiER OF POIIJTS ALO~G EEZIER CURVE
170
'R( 1 ):ARRAY CONTAINING WE POlt"TS ALOMI WE BEZIE.R CURVF.
180
I R( 1 I
)::X-cOt'PONEtfT
1
190
R(2 1 )=Y-cOfJPONEln"
200
I R(3 , ):z-co~Por. Etrr
210
' INITIALIZE AND DINEt-.SlON AlL fJATRlCES
220
' ASSU1"ES A HAXIYtR-" Of 10 POLYGOt\ VERTICES
230
NAT J=ZER( 1 1 N1)
240
~~T C:ZER(1 1 1)
250
~tAT D=ZER( 1, 1)
260
MAT E=ZER(1 1 1)
270
lT N:tll-1
280
' DEFINE F1JNCTION TO EVALUATE BIN011IAL EXPANSION (Cf &'. 5-65)
290
DEF FNF(X)
300
IF X:O THEN 360
3 10
~T Y=1
320

LET Y:Y1 X

330
31:0
350
360
370
380

LET X=X-1
IF X:O THEt\ 380

roro

32o

LET fllf =1
0010 390
LET fliF: Y

390

Pt;a.o

400

LET K: 1

410
420
430
ll!IO
450

f'OR T:O TO 1 STEP 11 ( P-64 1)


' GF.tlEfiATE EASlS FUt!CTiot, ( CF EO. 5-64)
FOR I= 1 TO t.
LET J( 1I I+ 1):( FNF(~)/{F11F( l)*FtlF(N- I)) ) ' TAl* ( 1-T)- ( t.- I)
r.EXT I
t".AT C=J'X
' GEUERATE POI~'TS AWiC A
1 2- D OTi 3- D BEZIER UJRVE (CF EO . 5-66)
P.IAT D=J'Y

1160

226 MJ\1111:M\'riCAL lill.1'U:N'l'S FOR CCl1PlT.IER GAAPHICS

ll70
ll80

LF.T h( l , K):C( 1, 1)
LFT R(?, K):0(1 ,1 )

lJ90
500

IF S:2 THEN 520


~AT E:J z

5 10
5?0

LEi

510

IIEXT T

' CREATE POUlT RESULTS

R(3 , K):f(1 ,1 )
LET K=K+1

5ll0 SUBND

C-27

8-SPLINE ALGORITHM
Algorithms "'hlch will generate the required B-splinc basis knot vectors

and &-spline curves are given

bela.~

as BASIC l.arJuage s\bcrograms .

Msed oo tOO di.scussion of Sec. S-8 .

1lley are

Note that tha subprogram B-spl 1ne CAlls

'nlc 5\.bprog:ram a-spline uses the Cox and de Boor algorithm to generate

1<1\'01'.

the a-spl ine curves o r various order.

PSPLINE
100 SUb "BSPLli~E" : A, C, V( , ) , S , P , R( , )
11 0
'A:Nl.I-'BER CF POLYGOt. VEfiTICES ~n:us at-E

120
110
140
150
160

170
180
190

700
210
220
230
? liO
250
260

270
280

' C: O"rfR Of 8-SPLlNE bASIS


' V( , ):ARRAY CONTAINit.'G DEFINING POLYGON VEPTlCFS
' V( 1, ) COti'TAI NS X-COORDWATES
' V(2, ) CONTAIKS Y-COORDUJATES
' V( 3, ) COtrfAlt.S Z-COORDINATES
' S:CONTROL VARIABL.E S:2 FOR 2- 0 CUflVE , S: 3 FOR 3- 0 CURVE
' P:THE UU}1JER Of POit;JS GEJERATED ALOfXi ntE CURVF
' h(, ):ARRAY COtiTAlNII-.G 1lfE FSULTit.G B-SPLINE CURVE
I k( 1.
) CONTAI~ X-COORDINATFS
' R(2, ) CONTAINS Y-GCORDINATES
I R( '3 ,
) CONTAINS Z-COORDitlATES

' N( ,):Io.ElGHTlNG

fUt.CiiON (Cf EO. 5- 78 )

DlM N(25 , ?5) , X(100)


!~.AT 1\:ZER((A+C) , (A+C))
LET B:A-C+2
CAU.." KNaf":V( , ) , B, C, X() , S

300

FOR w:C- 1 TO C.B


FOFI 1=0 TO B+( C-1) 2-1
IF I<>H THE~ 350

320

LfT Ml , 1): 1

330

GO TO

290
~10

3~0

35C
3N'
370

3b0

390

liDO
4 10
420

430
440

' REDlMEt.S lCti N & FlU. Win! ZF'POS

IF X(l):X(l+l ) THEN

350

LET N(I , 1):0

3~0

' INCREMENT KOOT VFC'TOR SUBSCRIPT


' CHECK FOR A GF.OMFTRIC KOOT
' CALC. VALUF.S
' fOR N(l , l) i U~ES 260- 320

NEX1 I
F'CJR T:X(\.1) TO X(W+-1)-. 0S STEP . OS
LT L=L+ I

K:2 TO C
fOh 1:0 TO A

FOR

'INCFI&.ENT PARAtAfTER i

' CALC. VALUES

OF N(I , K) IN

' LINES 3~0-4 lJO


If N(l , K-t )<>O 1HEIJ 1J30
LET 0:0
GO TO 11110
LEi D:((T-X(I)) tHI , I<- 1})/(X(II<- 1)-lC(I))
If fl(l+1,Y - 1) <>O THEN 470

' fiRST TERH ,


' FC'. ( 5- 78)

450
460

LfT E=O
GO 10 480
LET f::((X(l+K)-T) 'tl(I+l , K-1) ) /(X{ +1!'}-Y(l+l)) ' SECGW JF~ ,
1 E(.l. ( 5-/r )
LET N(l ,K)=D+E

470

!lliO
490
510
520
530
540

LET G:V(1 , I) U(l,K)..C ' X-COY.POt,fJ;T OF P{T)


lEI' I!=V(2 ,I) l t-;(I , K)+H
If 5::2 THEN 5 30
LET 7.:V(3, I) N(J,K)+Z
NEXT 1
IF K=C ~E~ 590

550

LET G:O

SM
570

LET H:O

500

LET Z:O

500

t1EX1 K

590
600

LET R(L, 1):G


LET R(L ,2):H

610

If S:2 THEN 630

620 LET R(L, 3)=Z


630
640
650

660
670
680
690
100
710
720

730

LET G:O

LET H:O

' RESET INITIAL X, Y, Z VALUES

LET Z=O
NEXT T

NEXT W
LET L=L+ 1

LET R(L, l):V(l , A)


LET R(L , 2):V(2 , A)
IF S:2 THEN 730

LET R\L ,3):V(3 , 1)


SUEEND

740 SUB"KNGr": V( , ) , B,C, X() , S


750
' V( , ): ARRAY CONTAINII:i DEFINH!G POLYGON VERTICES
760
I B:l-ii\XIKUI~ T VALUE=A-C+2
770
' C:ORDER OF B-SPLIUE BASIS
780
' X( ):ARRAY OONTAINlt\G YtJCYf VECTORS GEIJERATED W TIHS SUPRO\fl'ltiE'
790
' S:O:JNTROL VARIABLE S=2 PLANE' S:~ SPACE CURVE
800

8 10
820

830
840
850
860
870
880
890
900
9 10

920
930
940

950

960
970

FOR I=O TO B+(C-1) 2

IF I>C-1 THEN 840


' ASSURE MULTIPLICITY Cf' DEGRE'F' C
LET >:(1):0
' I.S..<;IGN ~IULTIPLE El4t KmT VELIORS
GO 10 960
IF I<B+C 1liEtl 880
' CHECK If END J:IICYf VErl'ORS REAC~FD
LET X(I):X(l- 1)
' ASS!Gt, NULTIPLE OP DUPLICATE KNOTS
GO 1U 960
IF S=3 THEN 9 10
IF V(l , l-G)<>V( l, I-c+l) Tf-1Efl950 1CHfC(( FOR REPEATIIOCI VERTICES
IF V(2 ,I-C)<>V(2 , I-C.1) THEtl 950 'C~ECK FOR REPEATltol; VF'RTICFS
GO TO 650
IF V(l , I - C}<>V(l , l-C+l) 111Eil 950
IF V(2 , I - C)<>V( 2 , I-C+1) 11-lHJ 950
IF V(3 ,1-C)<>V(3 , I-C+1) THEt. 950
GO TO 850
LET X(I):X(I- 1) +1
' ASS IGf~ SUCCFS.<;IVF IN'Jl:RtfAl. Vtx:lORS
tlF.XT I
SUBEND

________________________________________.....

C-28 fw

AlroRlnt'l FOR A BllltAR ~ACE PATOi

An alqorithn which will create the bilinear surface patch describ>rl in

Eq. (6-19) is given belo.tl as a BASIC language subpro:Jram.

BlUNEAf,
100 SUB"BIUNEAR":N , ~I , P( ,),0( , )
' BILINEAR SURFACF
110
' N:N~IBER (F IhCRFJIDiTS Of U
120
' t-::N\n'IBER Cf' ThCRf.MENTS (F W
'P(, )=CO~TAHIS THE COORDINATES OF n!E OORNER POitfTS
130

140
150

160
170
180
190
200
210
220

230
2110
250

260
270

280

' P HAS DIY.ENSIONS Of 11 1 3. FIRST COlJ.'N OOIITAINS X' COI~PONENTS , SECOND Y-<:Ot-'.PONENTS , THIRD Z-cQI-'.PONENTS
' OF THE CORNER POSITION VEX:TORS.

' 0( , ):CONTAINS THE COORDINATES OF n!E UfTERPOl.AttD SURfACE


' C WlLL HAVE DIHE~SIONS Of (H+1HN+1) 1 3
' TiiE FIRST 11+1 COORDINATE PAIRS COIIRESPOtiD TO U:O: CONSTANT
' THE SECOtiO M+l COORDINATE PAIRS CORRESPOND TO U:l/N:COtJSTANT
' THIRD M+1 COORDINATE PADS COIIRESPOND TO U:2/N:CONSTAN-T
' NOTE: 0 MUST BE DD'.ENSIONED I N DRIVER PROORAP
MAT O=ZER((N+l)*(M+1) , 3)
' J\EDIMENS!Otl C & FILL WI'nl ZEitOS
FOR 1:1 TO N+l
' SET UP U:CONSTANT LOOP
LET U:(I- 1 )/(t~)
'CALC. INCREMENT FOR U
FOR J: 1 TO M+ t
' SET UP ~ LOOP
LET !<:K+ 1
' 1~1CREMEh1' POINT CCUlnER
LET W:(J-1 )/M
' SET W

290

LET Q(K , l ):P(1 , 1) 1 {1- U) 1 {1-W)+P{2,1 )*{1- U) 1 W+P(3 ,1 )*U*(1-W)

300

LET C(K, 1):C(K,l}+P(4,1) 1 U1 W ' CALC. X- ca-PONENT

310
320
330
3q0

LET

O(K , 2}:P(1 , 2} 1 (1-u) 1 ( 1-W) +P(2 , 2) * ( 1-U) 1 W.P(~,2)'U*(1-W)

LET 0(K , 2):Q(K , 2}+P(4 ,2) 1 U1 W ' CALC. Y-CCllPONENT

O(K , 3}: P(1 , 3) 1 (1- U) *( 1-W}+P{2,3 )1 (1-U}1 W+P(3 , 3) 1 U1 ( 1-W}


LET O(K, 3):Q(K , 3}+P{4 , 3)' U1 W ' CALC. Z-~PONE~T

LET

NEXT J
360
NEXT 1
370 SUBEND
350

C-29 fw AL.GORrllfl FoR LrNEAR


An alqor:l.ttm \llhi.ch will

~s

SmFACE

generate the linear COOns surface descrjbed by

Eq . (6-24) is given below as a BASIC language ~rogrmn .

The algorithn

that the botndary curve c:-.an be described by equally spaced (in paranet:er
values) p:>ints on the OOundal:.y curves. '1he P(u,O) and P(u,l) curves are assured
to be describ>rl by the sarre Ill.l1ber of points as are the P{ O,w) and P(~w) curves.

a5Sl.l1'eS

COONSLIN
100 SUB"UfiEAR COONSLHI" : N, M,A( , ) , B(,) ,C(,) , D( , }, 0( , ) ' LINEAR COONS SURFACE
110
~=NUMBER OF POINTS Qt, THE P(U , O) AND P(U,l) POUNDARY CURVES
120
' M.:NUMBER a: POUlTS Qt, THE P(O ,~I) AND P(l ,~ ) EOUNDARY CURVES
130
' A( , ):ARRAY COiflAININC THE POINTS Of\ n!E P(U,O) CUflVE
1!10
' HAS DD'ENSIONS OF til 3
150
' B( ,):ARRAY <XlNTAitliNG n!E POINTS ON 'mE P(U ,1 ) CURVE
160

HAs DIMENSrOt,s OF tJI3

Dt\TA B.Z\SE N11NIPI.lL1\TIW ALC:XlRI'I1f>1S 229

170

' C( , )=ARRAY CONTAINING THE POINTS ON THr PC O,W) CURVE

180
190
200

' D( , ):ARRAY CONTAINING THE

' HAS D~ENSIONS OF M1 3

1 HAS

POl~TS

ON TPE

P(1,~)

CURVE

DUIENSIONS Of M' 3

'Q( ,):ARRAY OONTAINI~G THE CURVES WHICH DESCRlfE THE SUnFACE


' HAS DWEIIoSIOOS Of (N1 M) 1 3. THE FO!lMAT IS FOR A FIXED

210
220
230

'VALUE Of U. THE NFXT M 110\ot'S Cf" ~E 0 t'A'I'IflX CONTAIIJ


' THE VALUES FOR VARIABLE W.
' OOTE: 0 MUST 1 DU:NSI~ED W DRIVER PR(.(jFAN
MAT Q:ZER(N1 M, 3)
' RDli-1EM0tl 0 & FilL \oilTH ZEPOS
FOR K: 1 TO ~I
' CALC. SURFACE
LET U=(K-1)/(11-1)
FOR J= 1 TO N
LfT ~~(J- 1 )/(N-1 )
LET S:S+ l
FOR L= I TO 3
LET O(S ,L}:A(K ,L) (1- W)+B(K , L) 1 W+C(J,L)*(l-U)+D(J,L)*U
LET ~(S,L):O( S ,L ) -A (1,L) 1 (1 -U) ' ( 1-W)-B( 1,L ) ' ( l-U) * ~
lEf O(S , L):C(S ,L)-A(N ,L) 1 U' ( 1-W)-B(N , L) * U'~J

2~ 0

250
260
270
280
290
300
310

320
330
340
350

NEXT L

360

370

NEXT J
NEXT K

380
390 SUEEND

C-30 PH

AL.Goolltt1

FoR A BICUBIC ~ACE

PATCH

An al<JOrltbn ~ will generate the bicubic surface patch described l:1f

Eq. (6-37) is given below as a BASIC l..anguage subprogram.

'Lhe routine assures

that the boundary condition and the blending functioo rratrioes are known .
eiCUBI C
100
11 0
120

130
1~0

150
160

170
180
190
200
210

220
230

240
250

260
270
28o

290
300
310

320
330

SUB"BICUBIC ": U 1, ~1 , X( , ) , Y( , ) , Z( ,), O (,)


~-CUEIC
' U1:NO Of H~REI-lEt-.TS ALONG u-DIRECTI ON
' Wl:NO rR It:CRE~Et-.TS ALONG W- DIRECTI ON

SURFACE

' X( , ):~

X 4 ARfl AY COfJTAINil\G THE X- COHPOUEtn'S Of WE


' P OOutfDARY CONDITION 111\TRIX EO. (6- 36)
' Y(, }:4 X 4 ARRAY CONTAINI OO THE Y- COI'PONEt\TS Of TiiE
' P BOUtlDARY CONDITION 1-'ATRIX EQ. (6- 36)
' Z(, ):4 X ll ARRAY C:OttrAI NlNG THE Z-COMPOtiENTS OF THF
' P BOUtiDAHY COI4DITION l1ATRIX EO . (6- 36)
' P(,)=~ X 4 BOU~DARY CO~DITION MATRIX EO . (6- 36)
' N(,):4 X 4 BLENDING FU~CTION MATRIX EC. (6- 31)
' U( , ):1 X t1 ClTBIC BLENDING VECTOP EO. (6- 37)
' W( , ):!1 X 1 CUBIC BLENDING VECTOR EO. (6- 37)
' 0( , ):MATRIX COt\TAWUIG THE POSITIOU VECIOFS FOR 1llE
' FHCUBIC SURFACE , !-lAS Cll1EriSIOt\S Of ( U1+1)*('-1+1) Y
' FIRST COLUt-.1" IS X-COtJPOtlENT
' SECOIJD <XlL~N IS Y- COt-'POtiENT
' THIRD COLWN IS Z- COI'.PONElli'
'FIRST WI+ 1 l:Ul1FJJTS FOR U:O
' SECOND Wl+ 1 El.~Eltl'S fOR U: 1/U 1, ETC .
t'.AT P::ZER(4,4)
' REDD't1Sl0N 11.ATRI CES &
~.AT N:ZER( 4 , 4)
' FILL WI1} ZEFOS
~.AT U=ZE~( 1,4 )

MAT W:ZER( 1,4)

3~0

~:AT C=ZER((lJ1 1) n.1+1) , 3)

350
360
370

~T

380

HAT t:ZEfl( 1, 1)

390

LfT U( 1, 1):2
L:."J li( 1, 2):N(2 ,3>=- 2
LET t1(2 , 1)=-3
LET N(2 , 2):3

~T

A:ZER(ij,l)

~AT E=ZER(~,l)

~00

1110
1120
1!30

LET
LET

~~

C:ZER(4 , I)

1170

LET K=Kl

480

FOR I=O TO U1

LET U2:l/U1
LET U(1 ,1): U2~3
LET U(1 , 2) =U2U2
LET U(1 , 3)=U2

510

520
530
5110
550
560

' CALC. TRANSPOSf Of' N-t-'.ATRIX


' CI.LC. X-CXWPOHEliTS CF
' SUFFACE EUYEltfS

'SET UP U-NATfiiX

LT U(1 , 4):1

FOR J=O TO \:1


LET L:L+1
LI::T /2:J/W1
LET W(1,1):~2~3
LET w( 2. 1>=W2*~.2

570
580

590
600
610

' SET UP \o\-1-'.ATRIX

LET W(3,1):W2
LET W(4 , 1):1

11./iT A::JII U

NAT E=P*A
NAT C:JJ*B

620

63C

' CALC . SURFACE ElEl1BlT

f'1AT D:U* C
LET C(L,K):D(l, 1)
liEXT J

6110

650
660

670

t;EXT I
IF K:2 THEN 720
IF K>2 WElJ 740

f.8o
690
700

710

,...AT P:Y
GO TO 1170

120
730

P:Z
ro 470

I'..~T

ro

740 SUSEtiD

C-31

IJ(2 , ~)=-1

!-I.AT M=TFt. (t:}


t1.AT P:X

500

t.~..ATRIX

N(1 , 3)=N(1 ,4):U(3,3):tl(4,1):1

~50
1160

490

' SET UP

' CALC. Y-rot-'PO~Ef'ITS OF


' SURFACE fl.E}lEWI'S
' CALC. Z-OJI-IPONENTS Of
I SURFACE ELE:l-'ENTS

BEziER SuRFACE INERATIOO Al..GOOJTHH


1\n algorithm which will generate a cartesian prcxhx:t Bczier surfaoe based

on F..q. (6-48) is given below as a BASIC language subprogxam.

Bezier curves are

usoo as the blending functials.


FI:ZSUflF

100 SUo".EZSIJPF":X( , ) ,Y( , ),Z( ,),t.,I",P,S( , )


110
' X( , ):1\Rf<AY Q)~,TAllUI; THE X-CC,..FCtlEt.TS
120
'Y (, ):AflfiAY Q)t.TAilllNG THE Y- C()I.fCtlEliTS
130
' Z( , )=ARrAY Q)t.TAWit.C WF Z- CQIPCt:EliTS

' I:EZIE~ SURFACF

OF 'nlE' POLYGOt. VERTICES


OF nw POLYCO~ VFRTICFS
OF WE' POLYCO~ VERTICFS

140
150
160
170

180
190
200
210
220
230
240

250

260
270
280
290
300

' FORf'lAT IS nlAT Si"O\\IJ IN FIGS. 6-1 2


' N=ORDEfi OF niE DEFINING BEZIER POLYGONS
' I'I=ORDER CF niE DEfiNI NG BEZIER POLYGONS
1
P:NUI'BER CF GRID LINES FOR TilE DEf'IlUNG

'S( , ):POSITION VECTORS FOR SURFACE

ooro

GOTO 370
LET Ft:F=Y
FNEND
FOR C: l 70 3
LET \ 1:0

' GRID POSITION VECTORS

fi.A i B:X

' X- CCI1PONENT

HAT E=Y

'Y-W1 PO::ENT

GOTO 460

GOTO 460
tAT E.:Z
' 2-cot'POUEt.T
FOP U: 0 TO 1 STEP 1/( P- 1) ' FOR FIXED U CALC. VARIOUS \t' S
FOR H: 0 TO 1 STEP 11( P-1 )
LET Wl:\\1+ 1
f'OR 1:0 TO N
LET Jl:(FNF(N)/(FNF(I) *ftlF(N-1))) 1 0-I*( 1-U)-(tJ- I)
FOR J: 0 T0 M
LET K1: (FlJF(~1)/(PNF(J ) 1 FNF(V-J)) )w-J 1 ( 1- W) -(H-J)
LET S(C , \1 1 ):S(C ,W1)+B(l~l,J+1 ) * J 1* J\1
NEXT J

5 10
520
530
5~0

580

' FOR EACH C011PONENT CALC. SURFIICE

ON C GOTO 410 ,430 , 450

500

570

300

LET fliF: 1

ll90

560

GRID

LET X=X-1
IF X:O THEN 360

460

550

rEF~lNG

LET Y=Y*X

340

390
400
4 10
420
430
1140
ll50
460
470

FOR U:CI AllD '=1


FtiR W:Q ANO \.-1
SURFACE

LET Y:l

320
330

380

& 6-1 3

' S( 1, ):X~ENTS
' S(2 , )=Y-c:ot-'PONF~'TS
' S(3 , )=Z-00-\PONEM'S
' F'ORt-IAT IS niAT FOR A FIXED VALUE Cf' U TilE tJEX7
' fl El..El!E"TS 00t4TAIN 1liE \IALUES FOP TiiF CURVF C( U(SUP [), W)
' S HAS OlfiEt:SIO~S OF 3 X P-2
11AT B: ZER( N, H)
' REDIMOOIOf, & ZEPO INTERf'..AL Nf\TRIX
~F FNf( X)
' DEFINE f'UNCfiON TO CALC. FAC10HlAL Cf EC. ( 5- M)
IF X:O THEN 340

310

350
360
370

' t,OTE: X, Y, Z HAVE Dl!'EIJSIOt-:5 OF N X

NEXT I
NEXT W
NEXT U
NEXT C

590 SUBEfiO

INDEX

A/0 ccnverter, 8

Axis:

arbitrary, 43, 54, 56, 207

APr, 1
Absolute coordinates, 4, 191
Active ax>rclinates, 4, 191

nde~:2'1c::e ,

93

Axoncrnet.ric projection, 60, 62, 64, 208

Affine transfonnation, 59

Algorithms, 200

BASIC, 200

Alphan\ft!ric keytx>ard, 8

Basis, Bernstein, 140, 145

Alpham:rreric node, 190

Basis function, 140, 145

.Analog tablet, 8, 10, U, 30, 194

Be;un,

.AnalytiC ge<:llCtry 1 94

Begin frame 1 19 3

Analytic space curve, 118

Bernstein basis, 140, 145

Analytic surface, 158

Bernstein polynani.al, 140

Angular perspective, 69

BEZIER, 225

~tions,

Bezier:

55

Area, 34

curve, 139, 225


p:>lyycn, 176
surface, 176, 179, 230
BEZSURF I 230

Array, 4

BICUBIC, 229

Associatl.ve, 198

Bicubic lofted surface, 182

hlticycl.ic spline, 126, 129

Arbitrary axis, 43, 54, 56


Arc. paratoh.c, 108

INr.Ev. 233
Bl.cubic surface patch, 170, 173,
183, 229

Circular helix, US
c~

end, 12s, 129

BIL.INEAR, 228

Clipping, 6

BiUnear Coals surface, 182

Closed curve, 93

Bilinear surface, 165, 167, 228


Bilinear transfonmtion, 47
Bistable stora<Je tube , ll

nx3es, 188
COnnutative, 198

Bits, 4

carprt:er aided &!si911, l, 157

Bivariate vector, 164

CCIIpJter aided

Blended exterior surface, 185

catprt:er graphics, 1, 3

Blend,ed interior surface, 185

Concatenation, 6, 44
COnic:

Blending curve, 134 , 143


Blending functioo, 140, 169,

1 71 , 174
Blending, parabolic, 133, 137, 223

Color CRI', 190

lMI"IUfacturing1

sections, 94, 111


ncnparametric, 102

parmretric, 103

8:>undary cooditicn matrix, 173

COnstructive surface, 165

B::>u!ldary coodltions , 91, 120, 124

Continuity, 123 , 142

174

second-order, ll9, 121

B::>ur.dary curve, 176

OOOtrol

BSPLINE, 226

co::NSLIN, 228

B-spline, 226

Ooans surface, 168, 170, 181, 228

djals,

8, 10

curves, 144, 148, 151

bilinear, 182

surface, 180

generalized, 181

linear, 168, 170


cabinet projection , 65

COOrdillate trode, 190

ca 11 i graphic, 12

Coordinates:

Canonical space, 194 , 195

absolute 1 4 1 191

cartesian product surface , 179, 180,

display, 6

Ca.trode ray tube , 4, 11, 16, 18, 23

txxrogeneous, 4, 38, 42, 46, 200


incra'rental , 4

Cavalier projection, 65

relative, 4, 191

center of

transfonood, 25
user, 6

184

projection , 40 , 60 , 67

Otaracte.rs, 7
CIJCIE, 216

Cross derivatives, 160

Circle, 95, 96

Cross prcdu:t, 57, 161

nonpararretric, 214

CRl' display, 73

parametric, 103, 215

CUbic, 92

Circular arc, 93 , 98, 112, 115,


218

Circular arc inte:q;olatian, ll3

Bez.ie- curve, 141


blend:in9, 172
pararretric, 170

234 INDEX

oottcns, 20

Direction oosine , 55
Directnx, 95
Discriminate, 96
Display buffer, 12
Display oontro11er, 12

<Xlntro1, 189

Display coordinates, 6

spline, 1191 1301 220


spline, parmretric, 119
spline segrrent, 121, U3

CUrsor, 4, 10 , 20, 189

Display file, 5

CUrve:

B-spl1ne, 144, 148, 151

Distortion, 32

Bezier, 139, 225

Distributative, 198

bl~,

~t

134, 143

boundary, 176

cl osed, 93

tratrix plotter, 11, 16, 23

D>t product , 57, 161

l):)uble buffering, 13

cubic, Bezier, 141

Draw absolute, 192

fitting, 91, 139

Drawing f~mctions t 1881 191

9Merator, 3

DJ:un plotter t 13

mathematical, 89

raster scan, 13
0\mp blffer, 193

nonparamrt.ric, 90
pararretric, 92

I:XIal

Dyr-.amic notion ,

2 , 11, 13

plane, 89
second deqree, 91

space, 116
CUrved line Jrode t 190
CUrved surfaces, 164

Eccentricity, 95, 97
le!l'elts 1 196

EIL.IPSE1, 216

Ellipse, 95, 97

Cyclic spline, U6, 129 , 132

parametric, 104, 216


Elliptic integral, 104, 115

Dashed l.ine rrode, 190

Encaste.red spline, 125

Data base, 4, 188

Olta stream, 189

End tangent, 159 , 176

Derivative, partial, 163

Enla.rgerrent 1 32 t 41

Derivatives, 162

Erase, 11

Determinant, 198

Brase node, 190

Device independent, 189

Euclidean gearetry, 59

Device space, 194, 195


Device state, 189

F.\1lers equation, 119

Explicit representation, 90

Diagonal elenents I 196

Explicit space curve, 117

Dials, control, B, 10

Exterwr blended surface, 185

conditioos , 128

Digitizer, 20
DIMETRIC, 209

File, 4

Dllretnc, 60, 63

Fitting,

projcct.l.on , 209

cutVC,

91, 139

Flat bed plotter , 13

~I LHJOI

fl.&CktJ" , 7 , II , l l

Uflll itJ t

l'oc:u:. , 9'>

llfl'l i c 1t

p.:-r

1'-p.ll d a, 17C,

rn r t:'fr u

J'unctlm:

h tctr.:tll

pi

rl

:111 ~ , 117

~.,.....

, <1

nl:h 1 uuo:Jp , I 3

IJ luwliJ~<J, 140 , If I), 171 , l7 4

Tnriuiu

tlr.twmrl , Ulll , l 9 I

Ju f] IY'l:lflfl JI(HIII

f.J11ll r ,l)

lnitl,

l ~('(j r.r..ti.J r, 1HI

11)

lr'l", ?i. , 11'1

11:.-~ .

~],

l'IJ

1'""' ,

1 ~4

hyp riA" )lu, 11 0

lrtf HJl , fll uph i t

l ntPr. wt i\11 11t -v an CYIIII rnl, I<JI

lnlrJroJI, II 1 t 11 , 1()1\, lJ 'j

poi nL, I &2

lnlrc ity trr~rtulo~t ir11a, ~!

L'Wi.t..cJMs , 8, 10 , lJ

fll ti'YII''li\11 I~VlC

t rnnir~tll cnnl m l, I 111

\1\_'Ct.o r

Vtlll~ ...) ,

tUI I 1'! 11 1111'1! I l OtiO ,

Jlil
l nt~'lIC'I

H4

h." ()r otiA liC.:S, I, 7

Tnl r fd , 1118

w. ll)ht inq 1 lit 'J

rntr rl()l blourlod


("; Ot r c'l l

I :71Vl C.':r~u

t:Cn.ralizt'fl
rtJlOr ,

<'I 'Jl

Hurf.'l(Y , JRI

{unclior., 101

l>CJ J ,Jt

~ J rt.'\ll ll

'l lVI ' ,

'}!)

i iM ,J J

r.rc~flluc

111\11 rtP ),YJ

t VI

HX~:I

J89

r.rph l o> :

10 1 4:.l

rioJa

(."Uoll ' '

110

1 :110

ISur tr ll

tk:vit"'' IRii

II\ II

J(,')

lnt rf'.tort IIIIJ I i 111

c;rrJhu: pnmll

I I uI

.rc, 1 11

f.rc.JJ,hir (l(tlt n t , L9l

inpul, laCJ

lll'J

uri '""' , lltfi

liiU:I"(.IfJ l L 1011 , ')0 I

1111 Vf' ,

( l '()rl'(lry, ('f' r.,(

lnl rJJrlloal 'tl

hll l lol"'',

(,I) ,

prQ I' I

I t II ,

(,

2]()

llallroK1 i Vf, I, :l

llrx ~ , 190

[,IJrY, H, 10, lO

.Jt'fol

14, HJ

U lVI ,

IJ,, rclcrlf 'Y, I l , I I


lf.lrtt.l.ar d~ 1r1Cltr '1'1'1" 1>1 t.lJr, 7
IIHJh

1'"' 'f d

lJ :l .t

pr an ti r, Jl , 2]

llrFno:JI~o..t liJS C"Y "I lrlll r lol at ~

. , 4,

4(, , 200
IM'I:JQH, ]17

,,,, i l 1711, J<;ll

IR1 4l ,

JUdi .

')}

1 ~. n, '10
r.lsll! pr:inttr , H,
L l~l t

t.i 01 Jll tit l iHJ I JO , I}

IM1!1Ch..? , /Ill

llypt

111

11'1 ,

rt/) ) ,, , 1,.,, ,.,,

pM.urt t 1 lc, I ()A , 1.17


ltyptrl/>I tr: h~ c.1. ioo , I I 0

h 1etvl 1 Jr,C)
int trJ.n l. I u .. ,, lf,r.
t

r''"

J.illl .. :

I o nrut 1 .lfa'

, ,

IMI , 1/0

236 INtEX
parallel, 29

l>buSe, 8, 20

surface, pararretrlc, 163

f\bve absolute , 192

transfox:mation of, 27

t-11LTIOBJF.X:T, 180
~tiple

Local tracking, 194

vertices, 146, 149

IDeal tracking node, 190


Lofted bicubic

surface,

Lofted surface, 166,

182

18~

t-:atural end, 126

Nc::llc:CrmUtati ve, 50

Loft:sn:ms spline, 119

Nonpararretric circle, 214

Longl.tude, 158

Nonpa.rarretrlc ronics , 102


tionparmnetric curve , 90

l'lachine tool, 1

NOnsi.ngular, 199

Manipulation software, 188

Nontridiagcnal matrix, 127

~~pping,

Noxrral., 160

34, 41, 162

~~them:ltical

curves, 89

unit surface, 161

!'\athematical spline, 119

NormllizaHm, 39 , 93

Matrix, 24, 196

Nornalized parMeters, 123

addition, 197

Nf'C!K!F. f 214

algebra, 196

t-.'Urerical control, 157

iden~ty,

25, 41, 197

inverse, 41, 199

Cbl.ique perspective, 72

inversion, 122

Cblique projectim, 65

multiplic:atim, 5 , 25, 33 , 197

Order, 196

multiplier, 2

()rt}x)g'raphic projection, 208

nontri.d.i.agc::l'la, 127

Oscil1osrope, ll

product, 177

OUtward normal, 161

square t 421 1251 196

OVerall scaling, 40

subtracticn, 197
tranSfonnation, 28, 47

PAAABOLA, 217

tridiagonal t 124 1 126

Parabola, 95

zero, 197

parametric, 106, 217

l1idpoi.nt transfoDM.tion , 28

arc, 108

Minicxxrputer, l

blending, 133, 137, 223

r-bde control , 189

Parallel lines 1 29

f>bde:

Parallelograms, 30

curved line, 190

ParaJreter, vector valued, 164

erase, 190

Pa.rarretrlc circle, 103, 215

graphics, 190

Paranetric caries, 103

1ncrerrental, 13

Panuretric cubic, 170

loc:Jsl tracking, 190

Pararcetric cubic spline, ll9

standby, 190

Parmretric curve , 92

Im.EX 237
Parametri c ell i pse, 104, 216

Points, t.race, 73

Paratrctric hyperbola , l OB , 217

Points , transfo rmation of , 25 , 28

Parametri c parabola, 106, 217

Polygon, 139, 146

Pararretric space curve , 117

Pararretric surface, 159, 162, 164


P.ARBIDID, 223

Bt..~ier,

176

Pol}"C]alal surfAce , 177

Polyncrnial, 91

Partial derivatives, 163

Bel:nstllli'\, 140

Passi ve graphics, 14, 16

spline, 147

Patch surface , 159 , 176

Position vector, 92, 120, 159 , 166, 190

Pen , 4

Potentiareters , 8
PROJ , 208
Project ion , 40

Pen and ink pl o tter, 11, 16, 23

Perspective , 4 7
angular1 69

axonamctric, 60, 62 , 64, 208

gearet.r:y , 59

cabinet, 65

oblique , 72

cava l ier, 65

projection, 60 , 66 , 67

transfo rtl\l1tion , 76, 77 , 210

center of, 40, 60 , 67


d.i.netr ic , 209
i.scr!etric, 210
oblique , 65

two-point , 71 , 75

orthographic, 208

s ingle point, 69
three point, 72

Phospror, 12

perspective, 60, 66, 67

Picture, 3, 4

st:.ereographic , 84

Picture control functions , 191. 193

Pi ecewise cubic, 120, U2 , 147

Raster scan , 11, l3 , 23

Piecewise surface, 164

Rea)

Planar bilinear surface, 166

Rec:::OI'lSt:ruction, 78 , 2ll

Plane curves , 89

laluc:tion , 41

Plane surface , 162, 165

Reflect1on , 26 , 31, 47, 51 , 53 , 202 , 206

Pl otter , dot matrix, 11, 16, 23

refresh rate, 12

Plotter, flat bed, 13

~fresh

Plotter, pen and ink , 11, 16, 23

Pel.ative ooordinates , 4, 191

Pl otting head , 4

Relaxed end , 126, 129 , 132

Point absolute, 192 , 193

lesol ution 1 23

Point at infinity, 68 , 77

Rotat ion , 31, 33, 36, 40, 43 , 47, 50 ,


52, 56 , 202

Point functi.oo , 162

t.iJre, 2

tube , 11 , 19 , 23

Point, inflection , 92

ab:lut arbitraty ilX.i.!J, 207

Point-plo tting, 20, 23

al::out

Point , vanishing, 68 , 73 , 76

about y , 204
about z , 205

Points, 41 24
Points a t infinity , 4l

x, 204

Ruled surface, 166, 184

238 INDEX

Scale transfo:rnation, 48
Scaling, 26, 32, 34, 40, 47,
201, 203
Scan

conversion, 13

Scissoring, 6

curve, 91
degtee surfaces, ll7

Steroo viewer, 84
Stereographic projection, 84
Storage

tube, 11, 16, 18

Storage buffer, 193


Straight~.

27, 28 , 92

Secmd degree

Stretching I 26

Second

SUperscript notation, 171

Second order CXX'Itinuity, 119, Ul

Support carp.rt:e.r, 188

Shear, 26, 34, 40

Surface:

Snoothness, 123, 147

Bezier, 176, 179, 230


Coons, 168, 170, 181, 228

analytical, 158
bicubic lofted, 182
bilinear, 165, 167
bilinear, Coons, 182

Software systan, 188

b-spline, 180

Space, canonical, 194

cartesian product, 179, 180, 184

Space curve, ll6

ccnst.r\rtive, 165

Shearing, 47, 49
Single point perspective , 69
Sketching, 136
Slcpe, 29, 163

Slope, infinite, 92, 99

analytic, US

curved, 164

explicit, ll7

exterior blended, 185

.inp1 icit, ll7

generalized Cool IS 1 181

pararretric, ll7

interior blended, 185

Space device, 194, 195

intc.qx>lated 1 166

Space, three-dirrensia'lAl, 37

linear O:x:ns, 168, 170

Space, user, 194, 195


Sphere, 158

lofted, 1661 184

no.tml.ls, 160

S[:herical surface, 159

parametric, 159, 162, 164

SPLINE, 220

pa.ra.nctric lines, 163


patch, 159, 176

Spline:

anticyc1ic, 126, 129

patch, bicubic, 170, 173, 183, 229

cubic , 119, 130, 220

patch, bilinear, 228

cubic segrrent, 121, 123

planar, bD inear, 166

cyclic, 126, 129, 132

plane, 162, 165

1oftsmans, ll9

polygmal, 177

mathsnatical., 119

representaticn, 157, 162

po1ynanial , 147
Square matrix, 42 , US, 196

secmd degree, ll7

s~

sphe.rical 1 159

rrode, 190

nll.ed, 166, 184

STERI:X> I 213

tensor product, 184

St.eroo pair, 213

vector valued 1 164

nmr:< 239
Tangent, end, 159, 176
Tangent vector , 93, 120, 122,
159, 173

Teletype, 16, 22, 23

TWist vector , 160, 173


200EnECT, 202

2DR:Jr, 203
2D6CALE, 201

Televisicn, 12

Tensor product surface, 184


Te.Irni.nal ccn trol functioos, 191,
193

'tWo-point pe.rspecuve, 71, 7".:J


I.NIAPI', 1

Text absolute, 192

Lnisurf system, 179

Textual material 1 31 191

Chit sphere, 159

300fNJVl' 1 201

3DRBc:x:Nl, 211

!.hit square, 34
Unit surface normal, 161

3DREFLT, 206

L"nit vector, 62

JOOCALE, 203

Unit vectors, 159

3t:1l'RANS , 207

User coordinates, 6
User space, 194, 195

30>rn0l', 204

3DYrol', 205
JDZJOr, 205

Vanishing {X>int, 68, 73, 76

Three diJrensional data, 23

Vanishing {X>int.s, 74

Ihree cllirensimal Sp&ee , 37

Vector, 24

JPCIRI\K: I 218

cross product, 161

'lbree {X>int perspective, 72

generator, 20

'lh\Eb wheels, 20

magnibxJe, 160

Trace, 196

position, 92, 120, 159, 166, 190

Traoe {X>ints, 73, 74

tangent, 93 , 120, 122, 159, 173


twist, 160, 173
unit, 62

Track ball, 8 , 20

Transfonnaticn:
affine, 59

valued functioo, 164

bilinear , 47

val ued pa.ra.neter, 164

linear, 5

unit, 159

lines , 27

Vertex definitioo, 108

rratrix, 28, 47

Viewport, 6

midp:>.int , 28

Visioo windc:M, 7

perspective 1 76 t 77 1 210
{X>ints, 25, 28

Weighting functioo, 145

scale, 48

Wi.nd:lW, visicn, 7

Transformed cx:ordi.nates , 25

~li..rxbwing,

Translation, 39, 44, 47, 54, 200, 207

Wbrk length, 4

Tridi.agonal rratrix, 124, 126

Trilretric, 60

zero

~ratrix,

197

Cover photos: DAVID F. ROGERS


The cover photographs show parametric
solut1ons of the compressible boundary
layer equations. Photos 3, 4, 5 show
vanous v1ews of the shear stress as a
tunct1on of the pressure gradi ent,
parameterized with surface temperature.
Photos 1 and 2 show the surface heat
transfer rates as a function of the pressure gradient, parametenzed with
surface temperature (Ref. Phys. of
Flu ids, Vol. 12, No. 3, 1969)

I
I

0-07-053527-2

Das könnte Ihnen auch gefallen