TVector3DReflect (C++)
Description
This example illustrates how to use the Reflect method to return the reflection of the given 3D vector.
Code
#include <tchar.h>
#include <stdio.h>
#include <system.types.hpp>
int _tmain(int argc, _TCHAR* argv[])
{
TVector3D *aVector1=new TVector3D(1,-2,0,1);
printf("%2.2f %2.2f %2.2f\n",aVector1->X,aVector1->Y,aVector1->Z);
// The console will output: 1.00 -2.00 1.00, representing the coordinates for aVector1.
TVector3D *aVector2= new TVector3D(-7,5,3,1);
printf("%2.2f %2.2f %2.2f\n",aVector2->X,aVector2->Y,aVector2->Z);
// The console will output: -7.00 5.00 3.00, representing the coordinates for aVector2.
*aVector2= aVector2->Reflect(*aVector1);
printf("%2.2f %2.2f %2.2f\n",aVector2->X,aVector2->Y,aVector2->Z);
// The console will output: -21.00 33.00 -109.00, representing the coordinates for aVector2 as the reflection of aVector1.
return 0;
}