Waitrud Weber’s blog

things and reminders for memories

3d: WindowsAPI: modification: creation: step works 005 : error: subtract

message means that subtract doesn't work well.

20191120
g:20 p_evt->uMsg: 6551900 &uMsg: 6551900
WM_PAINT 002: 15 *(p_evt->uMsg):20 uMsg: 15
WM_MESSG 003: 15 *(p_evt->uMsg):20
wButtonController::Process: 20 / 15<-WM_PAINT wParam 167845005 lParam 0 this->event->uMsg:6551900 *(this->event->uMsg)=20
wButtonController::WM_PAINT:
this->event->main_mode = 2
default:
void wButtonController::drawButtons ( HDC hdc ): Starts
AryButton 0 = 0
AryButton 1 = 0
AryButton 2 = 1
AryButton 3 = 0
AryButton 4 = 0
AryButton 5 = 0
AryButton 6 = 0
AryButton 7 = 0
AryButton 8 = 0
void wButtonController::drawButtons ( HDC hdc ): Ends
wmpaint_display_threeD_proc_002:
memorized_CurveLines=1
Allocation of local lines: 0 6
001: i=0 / 5
002: i=0 / 5

---

// Q
//
//
//
//
void vCircle::calculation( vPoint set_up, vPoint right_x ) {

	vPoint* next = nullptr;
	vPoint* base_xaxis = nullptr;
	vPoint* up = nullptr;
	vPoint* depth = nullptr;
	vPoint* right = nullptr;
	vPoint* start = nullptr;
	vCalculation* calc = nullptr;

	vPoint* Depth = nullptr;

	float PI = 3.141592f;
	float exact_length = this->R*PI;
	float length = 0.0f;
	const float c_length = 5.0f;

	// set memory indxex.

	this->max_pixel = 5;
	calc = new vCalculation ();

	depth = new vPoint();
	right = new vPoint();
	up = &set_up;
	base_xaxis = &right_x;
	calc->cross( up , base_xaxis, depth );
	calc->cross( depth , up, right );
	calc->normal( up );
	calc->normal( right );
	calc->normal( depth );

	start = new vPoint();
	put_memories( start ); // Book memory-administration.
	calc->scale( depth, this->R, start );

	// malloc
	this->pixels = (vPoint**) malloc( sizeof(vPoint*) * this->max_pixel );
	for ( int i=0; imax_pixel; i++ ) {

		printf("001: i=%d / %d \r\n", i, this->max_pixel );

		if ( i >= this->max_pixel ) {
			//realloc
			this->pixels = (vPoint**) realloc( this->pixels, sizeof(vPoint*) * this->max_pixel );
			this->max_pixel *= 2;
		}
		this->pixels[i] = new vPoint();

		printf("002: i=%d / %d \r\n", i, this->max_pixel );

		// calculation of next.
		Depth = calc->subtract( start, this->Center );
		printf("003: i=%d / %d \r\n", i, this->max_pixel );
		calc->cross( Depth, up, next);
		printf("004: i=%d / %d \r\n", i, this->max_pixel );
		calc->normal( next );
		next = calc->scalize ( next, c_length ); // specialized.
		printf("005: i=%d / %d \r\n", i, this->max_pixel );

		this->pixels[i] = (vPoint*) next;

		// finish the next calculation.
		length += c_length;
		if ( length > exact_length ) { 
			index_pixel =i;
			break;
		}

	}

	// flush memories to last indxex.

	printf( "max_pixel= %d index_pixel=%d \r\n", this->max_pixel, this->index_pixel );

	printf(" vCircle::calculation ends\r\n");
}

//
//
//
//
vPoint* vCalculation::subtract ( vPoint* p1, vPoint* p2) {

	vPoint* result = nullptr;
	result = new vPoint ();
	subtract( p1->x, p1->y, p1->z, p2->x, p2->y, p2->z, &result->x, &result->y, &result->z );

	put_memories ( (vPoint*)result );

	return result;
}