Waitrud Weber’s blog

things and reminders for memories

3d: WindowsAPI: modification: creation: step works 002

We've already decided data structures as classes when we draw circles..

#ifndef _VCALCULATION_
#define _VCALCULATION_

class vCircle {

public:
	vPoint** pixels = nullptr;
	int max_pixel = 0;
	int index_pixel = 0;

private:
	float R = 0.0;
	vPoint* Center = nullptr;

public:
	void calculation ();

private:

};

#endif

---

#include "vPoint.h"
#include "vCircle.h"

void vCircle::calculation() {

	vPoint* next = nullptr;
	vPoint* base_xaxis = nullptr;
	vPoint* up = nullptr;

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

	// malloc
	for ( int i=0; imax_pixel; i++ ) {
		if ( i < this->max_pixel ) {
			//realloc

			this->max_pixel *= 2;
		}

		// finish the next calculation.
		length += 10000.0f;
		if ( length > exact_length ) { 
			break;
		}

	}

}