Waitrud Weber’s blog

things and reminders for memories

3D: Use Arrows

Pointer of class doesn't allow asterisk(*) but does arrow(->). So, I'm going to make all function parameters pointer reference like Java and we could obvisously understand the codes.

//
// copy all points and would like to refer to points at 20190213
//
// vLine* vCalculation::Lines_from_Mesh ( vPoint* points, int** numbering) {
vLine** vCalculation::Lines_from_Mesh ( vPoint* points, int** numbering, int num_patches, int base_num_patches) {
	vLine** p_result = nullptr;
	vLine** result = nullptr;
	//20180214
	// int c = sizeof( numbering ) / sizeof( int** );
	int c = num_patches;
	int d_number = 0;
	vPoint* end_to_start;

	// int num_patches = 0;
	// int base_num_patches = 0;
	// int num_patch_lines = 0;

	printf("num_patches %d base_num_patches %d\r\n", num_patches, base_num_patches);

	for( int i=0; i<c; i++ ) {
		int* num_p = *( numbering + i );
		//20180214
//		int d = sizeof( num_p ) / sizeof( int* );
		int d = base_num_patches;

		p_result = ( vLine** ) malloc ( sizeof(vLine**) * d );
		d_number += d;
		result = ( vLine** ) realloc ( result, sizeof( vLine** ) * d_number );

		for( int j=0; j<d; j++ ) {
			int number = *( num_p + j );
			vLine* p_line = *( p_result + j );
			put_point( p_line->p1, points + number );

			if ( j == 0 ) {
				end_to_start = points + number;
			} else {
				put_point( p_line->p2, points + number - 1 );
			}
		}

		int e = 0;
		vLine* last = *( p_result + d - 1 );
		put_point( last->p2, end_to_start );

		for( int j= d_number - d; j<d_number; j++ ) {
			put_line( *(result + j), *(p_result + j - d_number + d) );
		}
	}

	Print_Lines ( result, d_number );

	printf("end of Lines_from_Mesh d_number %d\r\n", d_number);
//	exit(-1);

	return result;
}

//
//
//
//
//
void vCalculation::put_point( vPoint* lp1, vPoint* points_number ) {
	printf( "start of put_point\r\n" );
	points_number->print();
	lp1 = points_number;
	lp1->print();
	printf( "end of put_point\r\n" );
	// exit(-1);
}