An Algebraic System for Computer Games and Animation Geometric Algebra: an Algebraic System for Computer Games and Animation John Vince
Total Page:16
File Type:pdf, Size:1020Kb
John Vince Geometric Algebra: An Algebraic System for Computer Games and Animation Geometric Algebra: An Algebraic System for Computer Games and Animation John Vince Geometric Algebra: An Algebraic System for Computer Games and Animation Prof. John Vince, MTech, PhD, DSc, CEng, FBCS www.johnvince.co.uk ISBN 978-1-84882-378-5 e-ISBN 978-1-84882-379-2 DOI 10.1007/978-1-84882-379-2 Springer Dordrecht Heidelberg London New York British Library Cataloguing in Publication Data AcataloguerecordforthisbookisavailablefromtheBritishLibrary Library of Congress Control Number: 2009926270 c Springer-Verlag London Limited 2009 Apart⃝ from any fair dealing for the purposes of research or private study, or criticism or review, as permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced, stored or transmitted, in any form or by any means, with the prior permission in writing of the publishers, or in the case of reprographic reproduction in accordance with the terms of licenses issued by the Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sent to the publishers. The use of registered names, trademarks, etc., in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant laws and regulations and therefore free for general use. The publisher makes no representation, express or implied, with regard to the accuracy of the information contained in this book and cannot accept any legal responsibility or liability for any errors or omissions that may be made. Cover design: Boekhorst Design BV Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com) This book is affectionately dedicated to my family: Annie, Samantha, Anthony, Genny, Peter, Megan, Mia, Lucie and my dog Monty. Preface In my first book on geometric algebra in 2007 the preface described how I had been completely surprised by the existence of geometric algebra, especially after having recently completed a book on vector analysis where it was not even mentioned! So why am I writing a second book on the same subject?Well it’snot because I have nothing better to do with my time. There are many more books I have to write before going to the great library in the sky! When I started writing Geometric Algebra for Computer Graphics Iknewverylittleaboutthe subject and had to understand the concepts as I went along—which was extremely difficult. In retrospect, the year spent writing that book was like climbing a mountain, and after completing the chapter on conformal geometry I had effectively reached the summit and, in terms of my understanding, the view was compelling. But having reached the summit I then had to race down with my manuscript and send it to Springer. In the following weeks it was difficult to forget the previous year’s journey. Had I really under- stood geometric algebra? Had I really laid out the subject in a way that anyone could understand? Such questions bothered me on a daily basis, especially when walking my dog Monty. Such moments gave me the time to reflect upon what was really behind the algebra and what had gone on between Hamilton, Grassmann and Gibbs when thefoundationsofvectoranalysiswerebeing established a hundred and fifty years ago. Back in my office I started to explore vector products from a symbolic standpoint and realized that if two vectors are expanded algebraically,fourtermsresultfromtwo2Dvectorsandnine terms from two 3D vectors. Nothing new, or earth shattering. However, if these terms are divided into two sets, they give rise to the inner and outer products: ab a b a b = · + ∧ which is Clifford’s original geometric product. Ialsofoundthatwhensuchproductsareexpandedintabularform,andcolourisusedto highlight the inner and outer product terms, the difference between the two sets became strikingly obvious. I immediately asked Springer for permission to use colour throughout a new book on geometric algebra, which would hopefully would open up the subject to a wider audience. vii viii Preface Icontinuedtoapplythesamealgebraictreatmenttovectors,bivectorsandtrivectorsandthen discovered that I had been using something called dyads,whichhadbeenemployedbyGibbs in his work on vectors. Far from being disappointed, I continued in the knowledge that I was probably on the right track. The book’s structure emerged without too much effort: The first chapter, which was the last to be written, briefly explores the important role that axioms play in mathematics and how we have struggled during previous centuries to accept non-sensical ideas such as intersecting parallel lines, infinite sets and imaginary numbers. This is to prepare the reader for ideas such as multiplying a line by an area, squaring an area, or adding scalars, lines, areas and volumes to create a multivector. Itremindsmeof thetimeIwrotesomecodetoaddtheshapesof anelephantandseahorsetogether, or divide a circle by a triangle. Totally non-sensical, but very useful! The second chapter reviews the products of real algebra, complex numbers and quaternions using the same tables employed later for geometric algebra. The third chapter is on vector products and reviews the traditional scalar and vector products in tabular form. Dyadics are then introduced and lead onto a description of the outer product in 2D and 3D. Chapter four introduces the geometric product as the sum of the inner and outer products. Blades are defined and the chapter concludes by exploring the geometric product of various types of vectors. Having laid the foundations for geometric algebra in the first four chapters, chapter five describes features such as grades, pseudoscalars, multivectors, reversion, inversion, duality and the imaginary and rotational properties of bivectors. Next,chapter six coversall the possible products between vectors and bivectors in 2D. Similarly, chapter seven covers all the possible products between vectors, bivectors and trivectors in 3D. Tables and colour play an important role in revealing the natural patterns that result from these products. Chapter eight shows how powerful geometric algebra is when handling reflections and rotations, and at this point we discover that quaternions are a natural feature of geometric algebra. Chapter nine explores a wide range geometric problems encountered in computer games and computer animation problems. It is far from exhaustive, but provides strategies that can be employed in all sorts of similar problems. Finally, chapter ten draws the book to a conclusion. Having written these ten chapters I hope that I have finally found a straightforward way of describing geometric algebra that will enable it to be used by anyone working in computer graphics. Ishouldsaysomethingaboutthenotationemployedinthebook.Vectorsarenormallyshown in a bold typeface, to distinguish them from scalar quantities. But as virtually every equation refer- ences vectors, I have followed Chris Doran and Anthony Lasenby’s lead and left them untouched. There is no confusion between vectors and scalars, as you will discover. IwouldliketoacknowledgethatIcouldnothavewrittenthisbookwithouttheexistenceof Geometric Algebra for Physicists written by Chris Doran and Anthony Lasenby. It provides the most lucid introduction to geometric algebra. Similarly, Michael Crowe’s AHistoryofVectorAnalysisis the best book on the subject. Preface ix Once again, I am indebted to Beverley Ford, General Manager, Springer UK, and Helen Desmond, Assistant Editor for Computer Science, for their continual support throughout the development of this manuscript. Idohopeyouenjoyreadinganddiscoveringsomethingnewfromthisbook. Ringwood John Vince Contents Preface.............................................................................. vii Symbolsandnotation .............................................................. xvii 1Introduction.....................................................................1 1.1 Senseandnonsense.................................................................... 1 1.2 Geometricalgebra...................................................................... 2 2Products.........................................................................5 2.1 Introduction ............................................................................. 5 2.2 Realproducts............................................................................ 5 2.3 Complexproducts ...................................................................... 7 2.4 Quaternionproducts ................................................................... 8 2.5 Summary ................................................................................ 11 3VectorProducts.................................................................13 3.1 Introduction ............................................................................. 13 3.2 Thescalarproduct ...................................................................... 13 3.3 Thevectorproduct...................................................................... 14 3.4 Dyadics................................................................................... 16 3.5 Theouterproduct....................................................................... 20 3.5.1 Originsoftheouterproduct.................................................. 20 3.5.2 The geometric meaning of the outer product in 2D . 21 xi xii Contents 3.5.3 The geometric meaning of the outer product in 3D . 25 3.6 Summary ...............................................................................