Appendix

This appendix contains definitions for the vector and matrix classes necessary to compile the code fragments in Chapters 1 and 2. I have included only those functions actually used in the examples. A complete implementation would require quite a few more operations.

Vector3

class Vector3

{

 float v[3];

public:

//Constructor

 Vector3();

//Element access

 float& operator[](int i);

 float operator[] (int i) const;

//Assignment operators

 Vector3&: operator-= (const Vector3&);

 Vector3& operator*=(const float&);

};

//Vector sum and scalar product

const Vector3 operator- (const Vector3&, const Vector3&);

const Vector3 operator*(const float&, const Vector3&);

Matrix33

class Matrix33

{

Vector3 rows[3]; // vector of rows

public:

//Constructor

 Matrix33();

 Matrix33 (float ...

Get Jim Blinn's Corner: Notation, Notation, Notation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.