Essential Mathematics For Computational Design

Transcription

Essential Mathematics for Computational DesignEssential Mathematics for Computational Design, Third edition, by Robert McNeel &Associates, 2013 is licensed under a Creative Commons Attribution-Share Alike 3.0United States License.ii

Essential Mathematics for Computational DesignPrefaceEssential Mathematics for Computational Design introduces to design professionalsthe foundation mathematical concepts that are necessary for effective developmentof computational methods for 3-D modeling and computer graphics. This is notmeant to be a complete and comprehensive resource, but rather an overview of thebasic and most commonly used concepts.The material is directed towards designers who have little or no background inmathematics beyond high school. All concepts are explained visually usingGrasshopper (GH), the generative modeling environment for Rhinoceros (Rhino).For more information, go to www.rhino3d.com and www.grasshopper3d.com.The content is divided into three chapters. Chapter 1 discusses vector math includingvector representation, vector operation, and line and plane equations. Chapter 2reviews matrix operations and transformations. Chapter 3 includes an in-depthreview of parametric curves with special focus on NURBS curves and the concepts ofcontinuity and curvature. It also reviews NURBS surfaces and polysurfaces.I would like to acknowledge the excellent and thorough technical review by Dr. DaleLear of Robert McNeel & Associates. His valuable comments were instrumental inproducing this third edition. I would also like to acknowledge Ms. Margaret Becker ofRobert McNeel & Associates for reviewing the technical writing and formatting thedocument.Rajaa IssaRobert McNeel & Associatesiii

Essential Mathematics for Computational DesignTable of Contents1 Vector Mathematics .1Vector representation . 1Position vector . 2Vectors vs. points . 2Vector length . 3Unit vector. 3Vector operations . 4Vector scalar operation . 4Vector addition . 4Vector subtraction . 5Vector properties . 6Vector dot product . 7Vector dot product, lengths, and angles. 8Dot product properties . 9Vector cross product . 9Cross product and angle between vectors . 10Cross product properties. 11Vector equation of line . 11Vector equation of a plane . 13Tutorials . 14Face direction. 14Exploded box . 18Tangent spheres . 242 Matrices and Transformations .28Matrix operations. 28Matrix multiplication. 28Identity matrix . 29Transformation operations . 30Translation (move) transformation . 30Rotation transformation . 31Scale transformation . 33Shear transformation . 33Mirror or reflection transformation . 34Planar Projection transformation . 353 Parametric Curves and Surfaces .36Parametric curves . 37Curve parameter . 37Curve domain or interval . 38Curve evaluation . 39Tangent vector to a curve . 40Cubic polynomial curves . 40Evaluating cubic Bézier curves. 41NURBS curves . 42Degree . 42iv

Essential Mathematics for Computational DesignControl points . 42Weights of control points . 44Knots . 44Knots are parameter values . 44Evaluation rule . 46Characteristics of NURBS curves . 46Evaluating NURBS curves . 49Curve geometric continuity . 51Curve curvature . 51Parametric surfaces . 52Surface parameters . 52Surface domain . 54Surface evaluation . 55Tangent plane of a surface. 55Surface geometric continuity . 56Surface curvature . 57Principal curvatures . 57Gaussian curvature . 58Mean curvature . 58NURBS surfaces. 59Characteristics of NURBS surfaces . 60Singularity in NURBS surfaces . 62Trimmed NURBS surfaces . 62Polysurfaces. 63Tutorials . 65Continuity between curves . 65Surfaces with singularity. 71References .74Notes . 74v

Essential Mathematics for Computational Design1 Vector MathematicsA vector indicates a quantity, such as velocity or force, that has direction and length.Vectors in 3-D coordinate systems are represented with an ordered set of three realnumbers and look like:v a1, a2, a3 Vector representationIn this document, lower case bold letters will notate vectors. Vector components arealso enclosed in angle brackets. Upper case letters will notate points. Pointcoordinates will always be enclosed by parentheses.Using a coordinate system and any set of anchor points in that system, we canrepresent or visualize these vectors using a line-segment representation. Anarrowhead shows the vector direction.For example, if we have a vector that has a direction parallel to the x-axis of a given3-D coordinate system and a length of 5 units, we can write the vector as follows:v 5, 0, 0 To represent that vector, we need an anchor point in the coordinate system. Forexample, all of the arrows in the following figure are equal representations of thesame vector despite the fact that they are anchored at different locations.Figure (1): Vector representation in the 3-D coordinate system.Given a 3-D vector v a1, a2, a3 , all vector components a1, a2,a3 are real numbers. Also all line segments from a point A(x,y,z) topoint B(x a1, y a2, z a3) are equivalent representations of vector v.So, how do we define the end points of a line segment that represents a givenvector?Let us define an anchor point (A) so that:A (1, 2, 3)And a vector:v 5, 6, 7 The tip point (B) of the vector is calculated by adding the corresponding componentsfrom anchor point and vector v:B A vB (1 5, 2 6, 3 7)B (6, 8, 10)1

Essential Mathematics for Computational DesignFigure (2): The relationship between a vector, the vector anchor point, and the pointcoinciding with the vector tip location.Position vectorOne special vector representation uses the origin point (0,0,0) as the vector anchorpoint. The position vector v a1,a2,a3 is represented with a line segmentbetween two points, the origin and B, so that:Origin point (0,0,0)B (a1,a2,a3)Figure (3): Position vector. The tip point coordinates equal the corresponding vectorcomponents.A position vector for a given vector v a1,a2,a3 is a special linesegment representation from the origin point (0,0,0) to point(a1,a2,a3).Vectors vs. pointsDo not confuse vectors and points. They are very different concepts. Vectors, as wementioned, represent a quantity that has direction and length, while points indicate alocation. For example, the North direction is a vector, while the North Pole is alocation (point).If we have a vector and a point that have the same components, such as:v 3,1,0 P (3,1,0)We can draw the vector and the point as follows:Figure (4): A vector defines a direction and length. A point defines a location.2

Essential Mathematics for Computational DesignVector lengthAs mentioned before, vectors have length. We will use a to notate the length of agiven vector a. For example:a 4, 3, 0 a (42 32 02) a 5In general, the length of a vector a a1,a2,a3 is calculated as follows: a (a12 a22 a32)Figure (5): Vector length.Unit vectorA unit vector is a vector with a length equal to one unit. Unit vectors are commonlyused to compare the directions of vectors.A unit vector is a vector whose length is equal to one unit.To calculate a unit vector, we need to find the length of the given vector, and thendivide the vector components by the length. For example:a 4, 3, 0 a (42 32 02) a 5 unit lengthIf b unit vector of a, then:b 4/5, 3/5, 0/5 b 0.8, 0.6, 0 b (0.82 0.62 02) b (0.64 0.36 0) b (1) 1 unit lengthIn general:a a1, a2, a3 The unit vector of a a1/ a , a2/ a , a3/ a 3

Essential Mathematics for Computational DesignFigure (6): Unit vector equals one-unit length of the vector.Vector operationsVector scalar operationVector scalar operation involves multiplying a vector by a number. For example:a 4, 3, 0 2*a 2*4, 2*3, 2*0 2*a 8, 6, 0 Figure (7): Vector scalar operationIn general, given vector a a1, a2, a3 , and a real number tt*a t*a1, t*a2, t*a3 Vector additionVector addition takes two vectors and produces a third vector. We add vectors byadding their components.Vectors are added by adding their components.For example, if we have two vectors:a 1, 2, 0 b 4, 1, 3 a b 1 4, 2 1, 0 3 a b 5, 3, 3 4

Essential Mathematics for Computational DesignFigure (8): Vector addition.In general, vector addition of the two vectors a and b is calculated as follows:a a1, a2, a3 b b1, b2, b3 a b a1 b1, a2 b2, a3 b3 Vector addition is useful for finding the average direction of two or more vectors. Inthis case, we usually use same-length vectors. Here is an example that shows thedifference between using s

Chapter 1 discusses vector math including vector representation, vector operation, and line and plane equations. Chapter 2 reviews matrix operations and transformations. Chapter 3 includes an in-depth review of parametric curves with special focus on NURBS curves