foleyjd96a computer graphics principles and practice 2ed in c

Download FoleyJD96a Computer Graphics Principles and Practice 2ed in C

If you can't read please download the document

Post on 28-Nov-2015




63 download

Embed Size (px)



    Foley van Dam Feiner Hughes SECOND EDITION in C



    SECOND EDrriON in C James D. Foley, Georgia Institute ofTeclmology

    Andries van Dam. Brown Unitersity Steven K. Feiner, Columbia University

    John F. Hughes, Brown Unilersity

    By uniquely combining current concept$ and practical applications in computer graphics. four well-known aulhors provide bcre the most comprehensive. authoritative, and up-to-date coveruge of the field. The mponant algorithm~ tn 20 and 3D graphics are detailed for t.a.~y implementation. including a close look at the more subtle special cases. There is also a thorough presentation of lhc malhematical princi-pl"" or geometric lran;formalion; and viewing.

    In thi~ book, the authors explore multiple perspectlves on computer gmphlcs: the's, the upplicauon programmer'$, the package unplemenlor's. and the hardware designer's. For example, the i.sues or user-centered de_~ign are expenly addressed in three chapters on interaction techniques. dialogue design, and user imerfnce software. Hardware concerns are examined in a chapter, contnbllled by Steven Molnar nod Henry Fuchs, on advanced architectures for real-time. high-performance graphics.

    The comprehensive topic coverage includes: Programming wuh SRGP, u simple but powerful ra-ter graphics pickage thai combines features of

    Apple's QuickDmw and the MIT X Window System g.mphics libmry. Hierarchical. geometric modeling using SPHIGS. a simplified dialect of the 30 gmphics

    >t:mdard PHIGS.

    Raster graphics hardware and soft,.arc, including both basic and advanced algorithm~ for scun convening nod c lipping line>, polygons, conic;. spline curve$, and te~l.

    I mage synthesis, including visiblesurfuce determination. illumination nnd ;hading modeJs. image manipulation, and aoualinsing.

    Techniques for photorea.lislic rendering. including ray tracing and radiosity methods.

    Surface modeling with parametric polynomials. including NURBS. and solid-modeling reprcscnmtions such as B-reps. CSG. and octrces.

    Advanced modeling techniques such as fractals. grammar-based models, particle systems. physically ba~ed modeling. nod volume rendering.

    ConceptS of computer a.nimation and descriptions of state-of-the-an animation systems.

    Over I 00 full-color plates and over 700 figures illu>trate the techniques preseJlled in the book.

    The bc as now avail-able in thb C-langunge version. AU code has been con-vened into C, and all change' through the ninth pnnting of the second cduion have been incorporated. The

    hoo~ \many OUI!\l.mdmg feoltU~ C'OilllllUC 10 Cll\Utc lh po'nion a. thl! 'tandard computer gmphic' 1e~1 and reference.

    ISBN Addison-Wesley Publishing Company


  • Computer Graphics PRJ CIPLES AND PRACflCE

    SLC0:'\0 EDITIO:'IJ in C

    Foley vun Dam Fcmcr Hughes

    James 0. 'oley (Ph.D., University of Mochogan) is lhe founding dorector of the interdiscoplinary GraphiC>. Visual tl31oon & Uubo~t) Centu at Georgoa ln~ttlute of Technol 01)). and Profe;sor of Computer Scoenc:e and of Electrical Engoneenna. Coauthor "'ilh And~ an Dam of Funda mrntols of lmtructllt Computtr Graphu:s, Foley os 3 member of ACM. ACM SIGGRAPII. ACM SIGCIII. the

    Hu~an Factors Society. IEEE, and the IEEE Computer Soeocty. l ie recently as Editor-in-Chief of ACM Transllt 110m"" Graphics. and l~ on 1he editoriul boards of Compllltro arul Grapllrcs. User Modtlm~ uml lnrtrat rum. and Prtstna. Hi, reunli7nlion. Hi~ re-search lnlere~l\ onclude compu1er ~rnphic. hypcnnedja S)Stems. and \\OrkMalJons. He is pas! Chaim1an of the Compuung RC\Cmh Msocia1ion. Choef ScocnlJ" at Elee-tronoc Bon~ Technologoes. Chairman of ObJCCI Po.,.er' Thore Con-ner and Da>od ~oguodula. he has. on addouon. publt;hed over eighl) papeo. In 1990 van Dam recel\ed the NCGA Academoc A"Jrd. on 1991. the SIGGRAPH Stccn A. Coons A\I.Jrd. and on 1993 the AC\1 Karl V. Knrl>trom Ou1St3ndong Educa1or A""ard.

    . tc,en K. Feiner (Ph.D .. Bro"n Un.-ersuy) is Associa1e Profe.>sor of Computer ScJence at Columbo Unt\er. virtual worlds. augmented real it). knowledge-oo.>ed desogn of gmphics and mullimediu. animmion, visualiza. tion. and hypermedia. Dr. Feiner is on !he edjtotial board< of ACM Trwtsacrio11s on GrliJllrics. /1! Tramaaio11s "" I /srwli:ation and Compllltr Grapl11rs. and /tcrromc Publtshi"R and is on the C\ecutove board of the IEEE T~>, tutorial>. and panels.

    John ~ Hughes (Ph.D .. Univers 11y of California. Berkeley) is nn Assistunl Professor of Computer Science nl Brown Univc110ily. where he codirec" !he computer gruphics group "'th Andries van Dam. Ht> research onlerests are in appli cauon; or mathematics to computer gntphJcs. scienulic!Jon. mathematical sh3pe descnpooo. malhemato-cal fundamentals of con1pu1er gruplucs. and low-dirnen-;oooal !apology and geomett) He o< a member of the AMS. IEEE. and ACM SIGGRAPH. Hos recent papers ha.e appeared in Complller Graplucs. and in Visualization Con fcrence Proceedings. He al~o ho~ n long-standing in1ere~1 in !he u;e of COmpulcr graphics in mathematics educalion.


    The Pa5Call>nguage ersoon of Conrpmu Graphr~s Pnn rrpln and Pramu. Stcond Edtlton remruns available. ISBN 0201-12 110-7

    lmroduwon w Computer Grcrplllt'S is an abbreviated vcr MOn of' Foley, va.n D:om, Feiner. and Hugtocs thai focuse~ on tO(liCS e with '""' 1ccbnical bad-ground. also with example, on C. Added to the orig~nal list of auth(m. Richard Pholltp. "a; pnncopall) responsoble for thos adapcatioo. ISBN 0-20160921-S

    For on formation aboUI other Addison Wesle) bools. you may acce>> our electronic cn1nlog through the World Wide Web nl http: I /WoMN .aw. com/ or through gopher aw.can



    James D. Foley Georgia Institute of Technology

    Andries van Dam Brown University

    Steven K. Feiner Columbia University

    John F. Hughes Brown University


    ADDISON-WESLEY PUBLISHING COMPANY Reading, Massachusetts Menlo Park, California New York

    Don MiUs, Ontario Wokingharn, England Amsterdam Bonn Sydney Singapore Tok)Q Madrid San Juan Milan Paris

  • Sponsoring Editor. Peter S. Gordon Production Supervisor: Bette J. Aaronson Production Supervisor for the C edition: Juliet Silvm Copy Editor: Lyn Dupre Text Designer: Herb Tecllnical Art Consultant: Joseph K . Vetere nlustrators: C&C Associates Cover Designer: Marshall Henrichs Manufacturing Manager: Roy Logan

    This book is in the Addison-Wesley Systems Programming Series Consulting editors: IBM Editorial Board

    Ubrary of Congress Cataloging-in-Publication Data

    Computer gJllphics: principles and practice I James D. Foley ... (et al .). - 2nd ed. in C.

    p. em. Includes bibliographical references and index. ISBN 0-201-84840-6 I. Computer graphics. I. Foley, James D., 1942-

    T38S.C5735 1996 006.6'6--'c20 95-13631



  • To Marylou , Heather, Jenn, my parents, and my teachers Jim

    To Debbie, my father, my mother in memoriam, and my children Elisa, Lori, and Katrin

    To Jenni, my parents, and my teachers

    To my family, my teacher Rob Kirby, and my father in memoriam

    And to all of our students.





    Communications Architecture for Distributed Systems

    An IntrOduction to Database Systems, Volume I, Fifth Edition

    An Introduction to Database Systems, Volume U

    Computer Graphics: Principles and Practice, Second Edition

    Structured Programming: Theory and Practice

    Conceptual Structures: lnformation ProCessing in Mind and Machines



    R.J. Cypser

    C.J. Date

    C.J. Date

    James D. Foley Andries van Dam Steven K. Feiner John F. Hughes

    Richard C. Linger Harlan D. Mills Bernard l. Wiu

    John F. Sowa

    Gene F. Hotfnagle

  • Foreword

    The field of systems programming primarily grew out of the efforts of many programmers and managers whose creative energy went into producing practical, utilitarian systems programs needed by the rapidly growing computer industry. Programming was practiced as an art where each programmer invented his own solutions to problems with little guidance beyond that provided by his immediate associates. In 1968, the late Ascher Opler, then at IBM, recognized that it was necessary to bring programming knowledge together in a form that would be accessible to all systems programmers. Surveying the state of the art, he decided that enough useful material existed to justify a significant codification effort. On his recommendation, IBM decided to sponsor The Systems Programming Series as a long term project to collect, organize, and publish those principles and techniques that would have lasting value throughout the industry. Since 1968 eighteen titles have been published in the Series, of which six are currently in print.

    The Series consists of an open-ended collection of text-reference books. The contents of each book represent the individual author's view of the subject area and do not necessarily reflect the views of the lBM Corporation. Each is organized for course use but is detailed enough for reference.

    Representative topic areas already published, or that are contemplated to be covered by the Series, include: database systems, communication systems, graphics systems, expert systems, and programming process management. Other topic areas will be included as the