12
Monographs in Visual Communications

Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

Monographs in Visual Communications

Page 2: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

Springer-Verlag Berlin Heidelberg GmbH

Page 3: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

Les Piegl Wayne Tiller

The NU'RBS Book Second Edition with 334 Figures in 578 Parts

Springer

Page 4: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

Prof. Dr. Les Piegl U niversity of South Florida Department of Computer Science and Engineering Fowler Avenue,ENG1l8 Tampa,FL3362o-5399, USA

Dr. Wayne Tiller GeomWare, Inc. 3036 Ridgetop Road Tyler, TX75703-8906, USA

ISBN 978-3-540-61545-3

Cip data applied for Die Deutsche Bibliothek - CIP-Einheitsaufnahme Piegl, Les: The NURBS book / Les Piegl; Wayne Tiller. - 2. ed. -Berlin; Heidelberg ; New York; Barcelona ; Budapest ; Hong Kong ; London ; Milan ; Paris; Tokyo: Springer, 1997

(Monographs in VÎsual communications) ISBN 978-3-540-61545-3 ISBN 978-3-642-59223-2 (eBook) DOI 10.1007/978-3-642-59223-2

NE: riller, Wayne

This work is subject to copyright. AII rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in other ways, and storage in data banks. Duplication ofthis publication or parts thereofis permitted only under the provisions of the German Copyright Law of September 9, 196.5, in its current version, and permission for use must always be obtained Crom Springer­Verlag. Violations are liable for prosecution act under German Copyright Law.

CI Springer-Verlag Berlin Heidelberg 199.5 and 1997

The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt Crom the relevant protective laws and regulations and therefore Cree for general use.

Cover design: Design & Production, Heidelberg Typesetting: Nancy A. Rogers, NAR Assoc., Annapolis, MD, using T EX

SPIN: 11012641 33/3111 - 5 - Printed on acid-Cree paper

Page 5: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

To the memory of my mother Anna, and to my father Janos

L.P.

To my grandmother, Fern Melrose Bost, and to the memories of

my grandparents, James Raney Bost, Pearl Weeks Tiller,

and Albert Carroll Tiller

W.T.

Page 6: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

FOREWORD

Until recently B-spline curves and surfaces (NURBS) were principally of interest to the computer aided design community, where they have become the standard for curve and surface description. Today we are seeing expanded use of NURBS in modeling objects for the visual arts, including the film and entertainment industries, art, and sculpture. NURBS are now also being used for modeling scenes for virtual reality applications. These applications are expected to increase. Consequently, it is quite appropriate for The.N'URBS Book to be part of the Monographs in Visual Communication Series.

B-spline curves and surfaces have been an enduring element throughout my pro­fessional life. The first edition of Mathematical Elements for Computer Graphics, published in 1972, was the first computer aided design/interactive computer graph­ics textbook to contain material on B-splines. That material was obtained through the good graces of Bill Gordon and Louie Knapp while they were at Syracuse University. A paper of mine, presented during the Summer of 1977 at a Society of Naval Architects and Marine Engineers meeting on computer aided ship surface design, was arguably the first to examine the use of B-spline curves for ship design.

For many, B-splines, rational B-splines, and NURBS have been a bit mysterious. Consequently, for the last several years a thorough, detailed, clearly written, and easily understood book on B-splines and rational B-splines has been needed. Thus, it was with considerable anticipation that I awaited Les Piegl and Wayne Tiller's book. I was not disappointed: They have elegantly and fully satisfied that need with The.N'URBS Book. In developing the material for the book, they draw from their considerable academic and industrial experience with NURBS to present this rather complex subject in a straightforward manner: Their presentation style is clear and detailed. The necessary mathematics is presented with considerable attention to detail and more than adequate rigor. The algorithms (many of which are in C-like pseudocode) are well thought out and meticulously prepared. In the interests of accuracy, each and every illustration in the book was computer generated - a monumental task. They have created a book of lasting value.

B-spline curves and surfaces grew out of the pioneering work of Pierre Bezier in the early 1970s. Perhaps one can consider B-spline curves and surfaces the children of Bezier curves and surfaces, and nonuniform rational B-splines, or NURBS, the grand­children. The timing is about right; they have certainly come of age.

Finally, it is only appropriate to acknowledge my pleasure in working with both Les Piegl and Wayne Tiller to bring this project to fruition.

David F. Rogers Series Editor

Monographs in Visual Communication

Page 7: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

PREFACE

Non-Uniform Rational B-Splines, commonly referred to as NURBS, have become the de facto industry standard for the representation, design, and data exchange of geometric information proce~sed by computers. Many national and international stan­dards, e.g., IGES, STEP, and PHIGS, recognize NURBS as powerful tools for geometric design. The enormous success behind NURBS is largely due to the fact that

• NURBS provide a unified mathematical basis for representing both analytic shapes, such as conic sections and quadric surfaces, as well as free-form entities, such as car bodies and ship hulls;

• designing with NURBS is intuitive; almost every tool and algorithm has an easy-to-understand geometric interpretation;

• NURBS algorithms are fast and numerically stable;

• NURBS curves and surfaces are invariant under common geometric transforma­tions, such as translation, rotation, parallel and perspective projections;

• NURBS are generalizations of nonrational B-splines and rational and nonra­tional Bezier curves and surfaces.

The excellent mathematical and algorithmic properties, combined with successful in­dustrial applications, have contributed to the enormous popularity of NURBS. NURBS playa role in the CAD/CAM/CAE world similar to that of the English language in science and business: "Want to talk business? Learn to talk NURBS".

The purpose of this book is basically twofold: to fill a large gap in the literature that has existed since the early seventies, and to provide a comprehensive reference on all aspects of NURBS. The literature on NURBS is sparse and scattered, and the available papers deal mainly with the mathematics of splines, which is fairly complex and requires a detailed understanding of spline theory. This book is aimed at the average engineer who has a solid background in elementary college mathematics and computing. No doctoral degree is required to understand the concepts and to implement the literally hundreds of algorithms that are introduced.

During the four years of writing this book, we have

• surveyed the available literature and presented important results;

• continued our research on NURBS and included the latest developments; in fact, about half of the book contains new material developed in the last few year~:

• developed a comprehensive NURBS library, called Nlib Vl.0, V2.0. This li­brary is the result of over 20 man-years of experience in NURBS research and development, and it combines new and well-tried software practices applied in previous systems that we designed;

Page 8: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

x Preface

• tested every single formula and algorithm, and presented graphical illustrations precisely computed using the routines of Nlib. This book does not contain any hand-drawn figures; each figure is precisely computed and hence is accurate.

We are pleased to present all of the accomplishments to the reader: (1) the book as a comprehensive reference, (2) Nlib source code (to order please see page 639 of this volume), and (3) the illustrations to instructors who adopt the book to teach a course on NURBS. In order for the reader to appreciate the enormous amount of work that went into this reference book, we present some data. To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

• 1,524 programs, that required

• 15,001,600 bytes of storage, which is roughly equivalent to

• 350,000 lines of code.

It was no picnic! Some years ago a few researchers joked about NURBS, saying that the acronym really

stands for Nobody Understands Rational B-Splines. We admit that our colleagues were right. In the last four years, we were largely influenced by this interpretation and tried to present the material in the book in an intuitive manner. We hope that this helps change the acronym NURBS to EURBS, that is, Everybody Understands Rational B-Splines. We welcome the reader's opinion on our job and suggestions on possible improvements.

It is our pleasure to acknowledge the help and support of many people and organi­zations. First and foremost, we are grateful to our spouses, Karen Piegl and La Vella Tiller, for their patience, support, and love. We owe special thanks to Nancy Rogers of NAR Associates for the beautiful typesetting job, and David Rogers for the editorial and technical discussions that led to many improvements in the manuscript. We also thank Jim Oliver and Tim Strotman for the many suggestions and technical corre­spondence that helped shape this book into its current form. Tiller also thanks the many past and present colleagues in industry who over the years contributed inspiring discussions, valuable insights, support, and collegial companionship: They know who they are. Piegl's research was supported in part by the National Science Foundation under grant CCR-9217768 awarded to the University of South Florida, and by various grants from the Florida High Technology and Industry Council.

March 1995 Les Piegl Wayne Tiller

It is less than a year since the first printing of The NURBS Book. Due to its popularity, Springer-Verlag decided to publish a soft cover edition of the book. Apart from being significantly more affordable, the second printing corrects a number of errors; redesigns Algorithm A3. S to elilllinate the use of a local array; and fixes minor bugs in the knot insertion algorithms, AS. 1 and AS. 3, as well the degree elevation algorithm, AS. 9. Apart from these corrections, this printing is identical to the first printing.

July 1996 Les Piegl Wayne Tiller

Page 9: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

CONTENTS

CHAPTER ONE Curve and Surface Basics 1.1 1.2 1.3 1.4 1.5

Implicit and Parametric Forms Power Basis Form of a Curve . Bezier Curves Rational Bezier Curves Tensor Product Surfaces Exercises

CHAPTER Two B-Spline Basis Functions 2.1 2.2 2.3 2.4 2.5

Introduction . . . . . . . . . . . . . . . . . . Definition and Properties of B-spline Basis Functions Derivatives of B-spline Basis Functions Further Properties of the Basis Functions Computational Algorithms Exercises ..... .

CHAPTER THREE B-spline Curves and Surfaces 3.1 Introduction................ 3.2 The Definition and Properties of B-spline Curves 3.3 The Derivatives of a B-spline Curve . . . . . 3.4 Definition and Properties of B-spline Surfaces 3.5 Derivatives of a B-spline Surface

Exercises .............. .

CHAPTER FOUR Rational B-spline Curves and Surfaces 4.1 4.2 4.3 4.4 4.5

Introduction . . . . . . . . . . . . . . Definition and Properties of NURBS Curves . Derivatives of a NURBS Curve . . . . . . . Definition and Properties of NURBS Surfaces Derivatives of a NURBS Surface Exercises

1 5 9

25 34 43

47 50 59 63 67 78

81 81 91

100 110 116

117 117 125 128 136 138

Page 10: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

xii Contents

CHAPTER FIVE Fundamental Geometric Algorithms 5.1 Introduction.. 5.2 Knot Insertion . 5.3 Knot Refinement 5.4 Knot Removal . 5.5 Degree Elevation 5.6 Degree Reduction

Exercises

CHAPTER SIX Advanced Geometric Algorithms

141 141 162 179 188 212 227

6.1 Point Inversion and Projection for Curves and Surfaces 229 6.2 Surface Tangent Vector Inversion . . . . . . . . . . 235 6.3 Transformations and Projections of Curves and Surfaces 236 6.4 Reparameterization of NURBS Curves and Surfaces . . 241 6.5 Curve and Surface Reversal . . . . . . . . . . . . 263 6.6 Conversion Between B-spline and Piecewise Power Basis Forms 265

Exercises ...................... 279

CHAPTER SEVEN Conics and Circles 7.1 Introduction 7.2 7.3 7.4 7.5 7.6 7.7 7.8

Various Forms for Representing Conics The Quadratic Rational Bezier Arc Infinite Control Points . Construction of Circles Construction of Conics Conic Type Classification and Form Conversion . Higher Order Circles Exercises ............... .

CHAPTER EIGHT Construction of Common Surfaces 8.1 Introduction.... 8.2 Bilinear Surfaces . . 8.3 The General Cylinder 8.4 The Ruled Surface . 8.5 The Surface of Revolution 8.6 Nonuniform Scaling of Surfaces 8.7 A Three-sided Spherical Surface

CHAPTER NINE Curve and Surface Fitting 9.1 9.2 9.2.1 9.2.2 9.2.3

Introduction . . . . . . . . . . . . . . Global Interpolation. . . . . . . . . . .

Global Curve Interpolation to Point Data . Global Curve Interpolation with End Derivatives Specified Cubic Spline Curve Interpolation .......... .

281 281 291 295 298 310 320 326 330

333 333 334 337 340 348 351

361 364 364 370 371

Page 11: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

Contents xiii

9.2.4 9.2.5 9.3 9.3.1 9.3.2 9.3.3 9.3.4 9.3.5 9.4 9.4.1 9.4.2 9.4.3 9.4.4 9.5 9.5.1 9.5.2

Global Curve Interpolation with First Derivatives Specified Global Surface Interpolation .....

Local Interpolation . . . . . . . . . . . Local Curve Interpolation Preliminaries . Local Parabolic Curve Interpolation . . Local Rational Quadratic Curve Interpolation Local Cubic Curve Interpolation . . Local Bicubic Surface Interpolation

Global Approximation. . . . . . . . Least Squares Curve Approximation Weighted and Constrained Least Squares Curve Fitting . Least Squares Surface Approximation Approximation to Within a Specified Accuracy

Local Approximation . . . . . . . . . . . . . Local Rational Quadratic Curve Approximation Local Nonrational Cubic Curve Approximation

Exercises ................. .

CHAPTER TEN Advanced Surface Construction Techniques 10.1 Introduction.. 10.2 Swung Surfaces. 10.3 Skinned Surfaces 10.4 Swept Surfaces . 10.5 Interpolation of a Bidirectional Curve Network 10.6 Coons Surfaces ............. .

CHAPTER ELEVEN Shape Modification Tools 11.1 Introduction....... 11.2 Control Point Repositioning . . . . 11.3 Weight Modification ....... . 11.3.1 Modification of One Curve Weight 11.3.2 Modification of Two Neighboring Curve Weights. 11.3.3 Modification of One Surface Weight 11.4 Shape Operators 11.4.1 Warping. 11.4.2 Flattening 11.4.3 Bending 11.5 Constraint-based Curve and Surface Shaping 11.5.1 Constraint-based Curve Modification . 11.5.2 Constraint-based Surface Modification .

CHAPTER TWELVE Standards and Data Exchange 12.1 Introduction....... 12.2 Knot Vectors . . . . . . . 12.3 Nurbs Within the Standards

373 376 382 382 388 392 395 399 405 410 413 419 424 437 438 441 452

455 455 457 472 485 496

509 511 518 520 526 531 533 533 542 547 555 555 562

571 571 580

Page 12: Monographs in Visual Communications - Springer978-3-642-59223...To generate the graphical illustrations and to build Nlib, we wrote exactly (not counting the hundreds of test programs)

xiv Contents

IGES. STEP PRIGS

12.3.1 12.3.2 12.3.3 12.4 Data Exchange to and from a NURBS System

CHAPTER THIRTEEN B-spline Programming Concepts

580 583 585 586

13.1 Introduction . . . . . . . 593 13.2 Data Types and Portability 594 13.3 Data Structures 596 13.4 Memory Allocation 601 13.5 Error Control 607 13.6 Utility Routines 613 13.7 Arithmetic Routines. 616 13.8 Example Programs . 618 13.9 Additional Structures 623 13.10 System Structure 626

References 629

Index . . 641