コード例 #1
0
bool isTriangleInCircle(Triangle& trig, Circle& circ) 
{
	if(circ.isPointInsideFigure(trig.getFstEdge()) && circ.isPointInsideFigure(trig.getSndEdge()) && circ.isPointInsideFigure(trig.getThrdEdge()))
		return true;

	return false;
}
コード例 #2
0
bool isRectangleInCircle(Rectangle& rect, Circle& circ) 
{
	
	Point Br(rect.getBottomCorner().x, rect.getUpperCorner().y);
	Point Dr(rect.getUpperCorner().x, rect.getBottomCorner().y);


	if(circ.isPointInsideFigure(rect.getUpperCorner()) && circ.isPointInsideFigure(Br) && circ.isPointInsideFigure(rect.getBottomCorner()) && circ.isPointInsideFigure(Dr))
		return true;
		
	return false;
	
}
コード例 #3
0
bool isCircleInCircle(Circle& circ1, Circle& circ2) 
{
	if(!circ2.isPointInsideFigure(circ1.getCenter()))
		return false;
		
	if(!circ1.isPointInsideFigure(circ2.getCenter()))
		return false;
		
		
	Point OA(circ1.getCenter().x, circ1.getCenter().y + circ1.getRadius());
	Point OB (circ1.getCenter().x + circ1.getRadius(), circ1.getCenter().y);
	Point OC(circ1.getCenter().x, circ1.getCenter().y - circ1.getRadius());
	Point OD(circ1.getCenter().x - circ1.getRadius(), circ1.getCenter().y);

	if(circ2.isPointInsideFigure(OA) && circ2.isPointInsideFigure(OB) && circ2.isPointInsideFigure(OC) && circ2.isPointInsideFigure(OD))
		return true;
				
	
	Point OA2(circ2.getCenter().x, circ2.getCenter().y + circ2.getRadius());
	Point OB2(circ2.getCenter().x + circ2.getRadius(), circ2.getCenter().y);
	Point OC2(circ2.getCenter().x, circ2.getCenter().y - circ2.getRadius());
	Point OD2(circ2.getCenter().x - circ2.getRadius(), circ2.getCenter().y);
	
	
	
	if(circ1.isPointInsideFigure(OA2) && circ1.isPointInsideFigure(OB2) && circ1.isPointInsideFigure(OC2) && circ1.isPointInsideFigure(OD2))
		return true;
		
	return false;
		
		
}