Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi...

10

Transcript of Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi...

Page 1: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied
Page 2: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

Introduction to 3D Modeling

Page 3: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied
Page 4: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

Introduction to 3D Modeling

Pavel Solin, Alberto Paoluzzi

Revision October 12, 2018

Page 5: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

About the Authors

Dr. Pavel Solin is Professor of Applied and Computational Mathematics at the Uni-versity of Nevada, Reno. He is an expert in scientific computing and the author of sixmonographs and many research articles in international journals.

Dr. Alberto Paoluzzi is Professor of Computer Graphics and CAD Design at theUniversity of Rome in Italy, leader of the PLaSM project, and author of the famousmonograph Geometric Programming for Computer Aided Design, Wiley, 2003.

Acknowledgment

We would like to thank many teachers for class-testing the course, and for provid-ing useful feedback that helps us improve the textbook, the self-paced course, and thePLaSM language itself.

Copyright:

Copyright (c) 2018 NCLab. All Rights Reserved.

Page 6: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

Preface

This course introduces the reader to 3D visualization, RGB colors, 2D and 3D shapes,geometrical transformations, and Boolean operations with geometrical objects. Its sec-ond and more advanced part introduces reference domains, reference maps, and para-metric curves and surfaces.

The course is based on PLaSM (Programming Language of Solid Modeling) – asimple and elegant language based on Python where all objects, transformations, andoperations are expressed simple commands. While progressing through the course, thereader also learns how to utilize more advanced elements of computer programmingto simplify and automate the creation of 3D designs. The combination of geometry andprogramming is extremely powerful and rewarding. The PLaSM language is very in-tuitive and there is no need for prior knowledge of computer programming.

Good luck!

Pavel and Alberto

Page 7: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied
Page 8: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

Table of Contents

1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Solid Modeling and PLaSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Launching PLaSM and running the demo script . . . . . . . . . . . . . . . . . . . . . . . . 11.3 3D printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 3D visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.5 RGB colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 Library of Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.1 Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2 Coloring objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.3 Planar square . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.4 Square as thin 3D solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.5 Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.6 Planar rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.7 Rectangle as thin 3D solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.8 Tetrahedron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.9 Planar triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.10 Triangle as thin 3D solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.11 Sphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.12 Planar circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.13 Circle as thin 3D solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.14 Approximation of curved surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.15 Prism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.16 Cylinder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.17 Tube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.18 Cone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.19 Truncated cone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.20 Torus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.21 Convex hull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322.22 Dodecahedron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.23 Icosahedron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.24 Extrusion of 2D objects to 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.25 Grid and Cartesian product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

3 First Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.1 Aquarium stand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.2 Water molecule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Page 9: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

3.3 Coffee table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493.4 Geometry labs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543.5 3D puzzle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

4 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744.1 XOR of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744.2 More on scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754.3 Commands TOP and BOTTOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774.4 Measuring dimensions and printing out information . . . . . . . . . . . . . . . . . . . . 784.5 Boolean operations – doing it the wrong way, doing it the right way . . . . . 79

5 Primer in Python Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835.1 Defining and using variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835.2 The Numpy library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855.3 Python lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855.4 Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865.5 Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865.6 Example 1 - programming a polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875.7 Example 2 - programming a cone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895.8 Example 3 - programming arrays of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

6 Advanced Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926.1 Carrousel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926.2 Temple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946.3 Sierpinski fractals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006.4 3D gear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

7 Curves and Curved Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1127.1 Reference domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1127.2 Mapping curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1137.3 Mapping surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1157.4 Three ways to map a sphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1187.5 Primer on Bézier curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1217.6 Drawing Bezier curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1217.7 2D object with one straight and one curved Bézier edges . . . . . . . . . . . . . . . . 1237.8 2D object with two curved Bézier edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1257.9 3D surface defined via four Bézier curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267.10 Coons patch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267.11 Rotational surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1277.12 Solidifying a surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1287.13 Rotational solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1287.14 Ruled surface - an introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1307.15 Ruled surface - spiral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

Page 10: Introduction to 3D Modeling - NCLab...Introduction to 3D Modeling Pavel Solin, Alberto Paoluzzi Revision October 12, 2018 About the Authors Dr. Pavel Solin is Professor of Applied

Full text is available upon enrollment.