// This may look like C code, but it is really -*- C++ -*- // Point3DfTest.cc // (C) 1995 Bill Lenhart #include "Point3Df.h" int main(void) { // Try out some operations Point3Df p1(2.3,2.3,2.3), p2(1,2,3); cout << p1 << "+" << p2 << " = " << p1 + p2 << endl; cout << p1 << "-" << p2 << " = " << p1 - p2 << endl; cout << p1 << "*" << p2 << " = " << p1 * p2 << endl; cout << p1 << "dot" << p2 << " = " << p1.dot(p2) << endl; cout << "The norm of " << p2 << " = " << p2.norm() << endl; cout << "Normalizing p2 gives " << p2.normalize() << endl; cout << "p2 = " << p2 << endl; Point3Df q = (p1 * 3) - (p2 * 2); cout << "p1 = " << p1 << endl; cout << "p2 = " << p2 << endl; cout << "q = " << q << endl; // Trivia question: why did I split this output into two lines of code? cout << " p1+=p2 = "; cout << (p1+=p2) << endl; cout << " p1-=p2 = "; cout << (p1-=p2) << endl; cout << " p1*=p2 = "; cout << (p1*=p2) << endl; cout << "Changing x-coordinate of p2 to 11: "; p2.x = 11; cout << p2 << endl; }