Waitrud Weber’s blog

things and reminders for memories

3d: WindowsAPI: windows-make: Giving Copy of class:

Giving Copy of class.

20191227
We've changed specifications of vScreen which can calculate screen points( x, y ) on the screen in 3D.
But, even now, we think, giving values as pointer is better still.
---
.\Main.cpp  Fri Dec 27 13:02:26 2019

  1 :#include "vPoint.h"
  2 :#include "vLine.h"
  3 :#include "vCalculation.h"
  4 :#include "vTriangle.h"
  5 :#include "vIntersection.h"
  6 :#include "vScreen.h"
  7 :
  8 :vScreen* screen = nullptr;
  9 :
 10 :int main () {
 11 :
 12 :	vPoint up, eye, lookat;
 13 :	vPoint freep;
 14 :	float x, y;
 15 :
 16 :	up.setPoint( 0.0f, 1.0f, 0.0f );
 17 :	eye.setPoint( 50.0f, 50.0f, 50.0f );
 18 :	lookat.setPoint( 0.0f, 0.0f, 0.0f );
 19 :	freep.setPoint( 25.0f, 25.0f, 25.0f );
 20 :
 21 :	screen = new vScreen();
 22 :	screen->setEye( eye );
 23 :	screen->LookAt( lookat );
 24 :	screen->setHeight( 360 );
 25 :	screen->setWidth( 640 );
 26 :	screen->put_Up( up );
 27 :	screen->calculation_up_UV();
 28 :	screen->get_coordinate_on_screen( freep, &x , &y );
 29 :
 30 :	return 0;
 31 :}
 32 :
---
> .\winmain_001.exe
this->eye= p( 50.000000, 50.000000, 50.000000)
lookat= p( 0.000000, 0.000000, 0.000000)
n_howfar= p( -0.577350, -0.577350, -0.577350)
howfar= p( -0.000000, -0.000000, -0.000000)
up= p( 0.000000, 1.000000, 0.000000)
u= p( -0.707107, 0.000000, 0.707107)
U= p( -452.548340, 0.000000, 452.548340)
V= p( -146.969376, 293.938751, -146.969376)
this->C= p( 349.758850, -96.969376, -102.789482)
eye= p( 50.000000, 50.000000, 50.000000)
ray= p( -0.577350, -0.577350, -0.577350)
depth=-0.000013
intersection = p( 50.000008, 50.000008, 50.000008)
result = p( -299.758850, 146.969391, 152.789490)
 x, y = 204800.000000 , 64799.994344
 x, y = 320.000000 , 179.999989
 x, y = 320.000000 , 180.000015 height 360.000000
---