Waitrud Weber’s blog

things and reminders for memories

3d: windows-make: Calculation itself sometimes is not so O.K.

We are on the task which is the assemble and coordination of window-toolkit and meet the error and we must solve it on the more light way if we can.
Of course, in the main program for only the print parameter and result for the test, which we are going to prepare is able to remain confirmed. That is better for development even if we don't consider the time of that solution.

1. compilation once.
2. comment out debug messages.
3. compilation for differences of debug messages.

is more speedy in this case for the case of detection of which calculation is going to problem.

In 1, the calculation length is len=30.000004.

(+000004) is a problem as a fraction(*2) and wondering because the value is usually round down on the calculation(*1).

*

The affection of round down is sqrt(3) if you round down at (n.0), which is called one decimal place.

After the decimal point:
(1) Round the answer off to three decimal places.
(2) 3.76 rounded off to one decimal place is 3.8.

https://ejje.weblio.jp/sentence/content/%E5%B0%8F%E6%95%B0%E7%82%B9%E4%BB%A5%E4%B8%8B

(*1)

A float fraction is going can be (+000004).

 

Expression in html:
square root in html in mathematic.
√

https://www.calculators.org/math/html-math.php

√3

In 2, the calculation length is len=30.000004.

len=40.115987 is on the screen.
Near side line is displayed bigger in perspective view.
However, in this case, the screen is fixed in the world axex like 640x360(*3).
So, we can not believe that more length than 30.0f is on the screen.

(*2)
a fracton:
In mathematical, it is called ...

(*3)
the world axex:
It is called global axex(axcies), which doesn't matter.


---
int vCalculation::subtract starts p1|003F11C0| p2|003F11D8| p3|0028F
p1->x 200.000000
vCalculation::subtract:111 starts.
|0028FAF0|0028FAF4|0028FAF8|
|200.000000|100.000000|0.000000|229.851120|100.000000|-2.985112|
|0028FAF0|0028FAF4|0028FAF8|
|0028FAF0|=-29.851120 |0028FAF4|=0.000000 |0028FAF8|=2.985112
vCalculation::subtract:111 ends.
int vCalculation::subtract ends and set |0028FB40| return 0.
len=30.000004
p|003F11C0|( 200.000000, 100.000000, 0.000000)
p|003F11D8|( 229.851120, 100.000000, -2.985112)
 is more 30.0f length in l_lines 3.
---
int vCalculation::subtract starts p1|004FA6D8| p2|004FA6A8| p3|0028FC00|
p1->x 442.474457
vCalculation::subtract:111 starts.
|0028FB30|0028FB34|0028FB38|
|442.474457|310.710724|0.000000|470.862000|304.861877|27.735010|
|0028FB30|0028FB34|0028FB38|
|0028FB30|=-28.387543 |0028FB34|=5.848846 |0028FB38|=-27.735010
vCalculation::subtract:111 ends.
int vCalculation::subtract ends and set |0028FC00| return 0.
len=40.115987
p|004FA6D8|( 442.474457, 310.710724, 0.000000)
p|004FA6A8|( 470.862000, 304.861877, 27.735010)
 is more 30.0f length in l_lines_2D 5.
---

 

	int b = convert_model_lines_002( lines_001, lines_2D_001, 3, line_index ) ;
	int c = check_lines_002( lines_001, lines_2D_001, 3, line_index ) ;
//
int check_lines_002 ( vLine *l_lines, vLine *l_lines_2D, int l_line_index, int max_num ) {
	vCalculation calc;
	vPoint vp;
	double len;
	int a;
	printf("int check_lines_002( vLine **l_lines, vLine **l_lines_2D, int *line_index, int max_num ) starts.\r\n");

	// convertion
	for ( int i = l_line_index; i<max_num; i++ ) {
		/*a = calc.subtract( (vPoint*)l_lines[i].p1, (vPoint*)l_lines[i].p2, &vp );
		if ( ( len = calc.length( &vp) ) > 30.0 ) {
			printf("len=%f\r\n", len);
			l_lines[i].p1->print();
			l_lines[i].p2->print();
			printf(" is more 30.0f length in l_lines %d.\r\n", i );
			exit(-1);
		}*/
		a = calc.subtract( (vPoint*)l_lines_2D[i].p1, (vPoint*)l_lines_2D[i].p2, &vp );
		if ( ( len = calc.length( &vp) ) > 30.0 ) {
			printf("len=%f\r\n", len);
			l_lines_2D[i].p1->print();
			l_lines_2D[i].p2->print();
			printf(" is more 30.0f length in l_lines_2D %d.\r\n", i );
			exit(-1);
		}
	}

	printf("int check_lines_002( vLine **l_lines, vLine **l_lines_2D, int *line_index, int max_num ) ends. from %d to %d \r\n", line_index, max_num );
	return 1;
}