Graphics Reference
In-Depth Information
Vec3 ma = -a;
ma.Print( “-a = “ );
Vec3 e = a + b;
e.Print( “e =” );
e *= 3.;
e.Print( “e =” );
float f = ( a + b ).Length( );
fprintf( stderr, “f = %8.3f\n”, f );
float g = a.Dot( (b+c).Unit( ) );
fprintf( stderr, “g = %8.3f\n”, g );
Vec3 h = a.Cross(b);
h.Print( “axb =” );
float i = c.Dot( a.Cross(b) );
fprintf( stderr, “c.(axb) = %8.3f\n”, i );
Point3 Q( 1., 2., 0. );
Point3 R( 5., 3., 0. );
Point3 S( 3., 6., 0. );
Vec3 normal = ( R-Q ).Cross( S-Q );
normal.Print( “normal = “ );
float area = normal.Length( ) / 2.;
fprintf( stderr, “triangle area = %8.3f\n”, area );
Search WWH ::




Custom Search