PtInCircle (C++)

From RAD Studio Code Examples
Jump to: navigation, search


The following code example returns whether a given TPoint belongs to the area of a circle. This is done with the help of PtInCircle routine.


#include <System.Types.hpp>

int _tmain(int argc, _TCHAR* argv[]) {
	int CircleRadius = 5;
	TPoint* CenterOfCircle, aPoint;
	CenterOfCircle = new TPoint(12,15);
	aPoint = new TPoint (5, 6);

	if (PtInCircle(aPoint, CenterOfCircle, CircleRadius))
		printf("The point appears to be on the surface of the circle!");
		printf("The point does not belong to the surface of the circle");
		//The PtInCircle function returns a bool value. In this particular case, Point is not in the circle area.
	return 0;