We recognise that we could not display the line on the screen on the way of the below.
1. Put "exit(-1);" just after print of converting a line.
2. Take out of the "exit(-1);" and compiled the file.
---
002 x, y = 213.666626 , 160.192415
003 x, y = 213.666626 , 319.807587 height 480.000000
get_cooordinate_on_screen ends. 001
get_cooordinate_on_screen ends. 002
vLine* to_screen_line( vLine* ll ) ends.
void GamePaint_011(HDC hDC, vLine* line ) starts.
Draw Line API starts.
Draw Line API ends.
Draw Text API starts.
Draw Text API ends.
void GamePaint_011(HDC hDC, vLine* line ) ends.
GamePaint_011: llines: p( 213.515106, 319.895081, 0.000000)
p( 213.666626, 319.807587, 0.000000)
---
Very simple and we can ensure that the source code is right on the code of text.
After compiled it, we think usually windows thread can not display the line.
---
https://github.com/WaitrudWeber/source_zip/blob/master/display-20210220-001.zip
From p1 to p2 on the line, which should be just a Point.
---
1 | - | screen->calculation_up_UV(); | qualified: 2/22 |
2 | vLine* to_screen_line(vLine* d3dline); | qualified: 2/22 | |
3 | int get_cooordinate_on_screen ( vPoint lp, float* lx, float* ly ) | qualified: 2/22 |
---
(20210221: )
We do not want to qualify the converting 3d-point on the screen.
1. u is the right vector on the screen.
2. v is the up vector on the screen.
We could imagine up if we see U so that we could misunderstand typically.
---
vPoint vCalculation::add: returns |0057B3F0|.
depth=1.049812
intersection_001 = p( 999.552979, 999.552979, -999.161865)
int vCalculation::subtract starts p1|0028FE40| p2|00570FDC| p3|0028FE14|
p1->x 999.552979
vCalculation::subtract:111 starts.
|0028FDC4|0028FDC8|0028FDCC|
|999.552979|999.552979|-999.161865|1038.488770|699.077576|-1260.701538|
|0028FDC4|0028FDC8|0028FDCC|
|0028FDC4|=-38.935791 |0028FDC8|=300.475403 |0028FDCC|=261.539673
vCalculation::subtract:111 ends.
int vCalculation::subtract ends and set |0028FE14| return 0.
result_001 = p( -38.935791, 300.475403, 261.539673)
001 x, y = 205004.375000 , 115199.979225
002 x, y = 320.319336 , 239.999951
003 x, y = 320.319336 , 240.000046 height 480.000000
get_cooordinate_on_screen ends. 001
get_cooordinate_on_screen ends. 002
vLine* to_screen_line( vLine* ll ) ends.
print the line:
p( 320.088348, 240.000046, 200.000000)
p( 320.319336, 240.000046, -250.000000)
print Screen:
eye: p( 1000.000000, 1000.000000, -1000.000000)
lookat: p( 0.000000, 0.000000, 0.000000)
U: p( 261.278900, 261.278900, 522.557800)
V: p( -339.411255, 339.411255, 0.000000)
Center C: main ends.
---
(20210222)
We think up is good, so there is another reason that we can not display line and convert it well.
---
p( 320.319336, 240.000046, -250.000000)
print Screen:
eye: p( 1000.000000, 1000.000000, -1000.000000)
lookat: p( 0.000000, 0.000000, 0.000000)
up: p( -0.707107, 0.707107, 0.000000)
U: p( 261.278900, 261.278900, 522.557800)
V: p( -339.411255, 339.411255, 0.000000)
Center C: main ends.
---
(20210222)
We can calculate the screen parameters well.
So, we can not belive screen points calculation was wrong because points on the axes are calculated easily.
---
vLine* d3dline = new vLine( memorizevPoint( 0.0, 0.0, 200.0 ), memorizevPoint( 600.0, 600.0, -250.0 ) ); vLine* d2dline = to_screen_line(d3dline); printf("print the 3dline:\r\n"); d3dline->print(); printf("print the line on the screen:\r\n"); d2dline->print();
---
get_cooordinate_on_screen ends. 001
get_cooordinate_on_screen ends. 002
vLine* to_screen_line( vLine* ll ) ends.
print the 3dline:
p( 320.088348, 240.000046, 200.000000)
p( 320.319336, 240.000046, -250.000000)
print the line on the screen:
p( 320.088348, 240.000046, 200.000000)
p( 320.319336, 240.000046, -250.000000)
print Screen:
eye: p( 1000.000000, 1000.000000, -1000.000000)
lookat: p( 0.000000, 0.000000, 0.000000)
up: p( -0.707107, 0.707107, 0.000000)
U: p( 261.278900, 261.278900, 522.557800)
V: p( -339.411255, 339.411255, 0.000000)
Center C: p( 1038.488770, 699.077576, -1260.701538)
main ends.
---
print the 3dline:
p( 0.000000, 0.000000, 200.000000)
p( 600.000000, 600.000000, -250.000000)
print the line on the screen:
p( 483.174408, 240.000046, 200.000000)
p( 605.777771, 240.000046, -250.000000)
---
// // // // // 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(lp.x, lp.y, lp.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\r\n"); return 0; }