Waitrud Weber’s blog

things and reminders for memories

3d: windows-make: out of the screen, we should be missing.

eye( 1000.000000, 1000.000000, -1000.000000)
C( 1038.488770, 699.077576, -1260.701538)

The point ( 200.000000, 0.000000, 100.000000) is not on the other side from eye but out of the screen obviously.

---
|482.851715|381.033752|0.000000|488.091736|401.836334|0.000000|
|0028FAE0|0028FAE4|0028FAE8|
|0028FAE0|=-5.240021 |0028FAE4|=-20.802582 |0028FAE8|=0.000000
vCalculation::subtract:111 ends.
int vCalculation::subtract ends and set |0028FB30| return 0.
int vCalculation::subtract starts p1|0058A990| p2|0058A9F0| p3|0028FB30|
p1->x 482.851715
vCalculation::subtract:111 starts.
|0028FAE0|0028FAE4|0028FAE8|
|482.851715|381.033752|0.000000|491.335449|360.200470|0.000000|
|0028FAE0|0028FAE4|0028FAE8|
|0028FAE0|=-8.483734 |0028FAE4|=20.833282 |0028FAE8|=0.000000
vCalculation::subtract:111 ends.
int vCalculation::subtract ends and set |0028FB30| return 0.
int vCalculation::subtract starts p1|0058AA08| p2|0058AA20| p3|0028FB30|
p1->x 482.851715
vCalculation::subtract:111 starts.
|0028FAE0|0028FAE4|0028FAE8|
|482.851715|381.033752|0.000000|516.455811|386.666687|0.000000|
|0028FAE0|0028FAE4|0028FAE8|
|0028FAE0|=-33.604095 |0028FAE4|=-5.632935 |0028FAE8|=0.000000
vCalculation::subtract:111 ends.
int vCalculation::subtract ends and set |0028FB30| return 0.
len=34.072939
p|0058AA08|( 482.851715, 381.033752, 0.000000)
p|0058AA20|( 516.455811, 386.666687, 0.000000)
 is more 30.0f length in l_lines_2D 11 otherside=0.
screen->C: p|03955C1C|( 1038.488770, 699.077576, -1260.701538)
screen->eye: p|03955C40|( 1000.000000, 1000.000000, -1000.000000)
line_3D: p|00589D68|( 200.000000, 0.000000, 100.000000)
p|00589DF8|( 208.466492, 5.644325, 128.221619)
---

*
sorry for spelling: get_cooordinate_on_screen

I modified the bold dummy screen as screen_tri scaling for the calculation of intersection.

//
int get_cooordinate_on_screen ( vPoint lp, float* lx, float* ly ) {
	vCalculation calc;
//	vTriangle screen_tri;

	printf("get_cooordinate_on_screen starts.\r\n");

	if ( screen == nullptr ) {
		printf ("We can not memory screen params so that the program could exit in get_cooordinate_on_screen.\r\n");
		display_threeD_screen_initialize ();
		Sleep(100);
		printf ("We can memory screen params.\r\n");
//		exit(-1);
	}

	calc.subtract( &lp, &(screen->eye), &ray);
	calc.normal( &ray );
	// if ( ray.x == 0 && ray.y == 0 && ray.z == 0 ) return -1;

	screen_tri.p1.setPoint(screen->C.x, screen->C.y, screen->C.z );
	calc.add( &(screen->C), &(screen->U), &(screen_tri.p2) );
	calc.add( &(screen->C), &(screen->V), &(screen_tri.p3) );

	vIntersection* intersection = nullptr;
	intersection = new vIntersection ();
	vPoint* point_intersection = intersection->Intersect( screen_tri, screen->eye, ray );

	printf("intersection_001 = ");
	point_intersection->print();
//
//	vPoint result;
//	screen->setPoint(lp);
//	screen->OntheScreen( lp, &result );

	int result = screen->OntheScreen( *point_intersection, lx, ly );
	printf("get_cooordinate_on_screen ends. 001\r\n");

	delete ( point_intersection );

	printf("get_cooordinate_on_screen ends. 002 OtherSide=%d\r\n", intersection->OtherSide);

	if ( intersection->OtherSide == 1) return 1;

	return 0;
}