Esempio n. 1
0
bool CRectangle::in_hot_point(CPoint m_point)
{
    CPoint t_point1;
    CPoint t_point2;
    t_point1.x=(point1.x+point2.x)/2-5;
    t_point1.y=point1.y-10;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect1(t_point1,t_point2);
    if(crect1.PtInRect(m_point)) return true;
    t_point1.y=(point1.y+point2.y)/2-5;
    t_point1.x=point1.x-10;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect2(t_point1,t_point2);
    if(crect2.PtInRect(m_point)) return true;
    t_point1.y=(point1.y+point2.y)/2-5;
    t_point1.x=point2.x;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect3(t_point1,t_point2);
    if(crect3.PtInRect(m_point)) return true;
    t_point1.x=(point1.x+point2.x)/2-5;
    t_point1.y=point2.y;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect4(t_point1,t_point2);
    if(crect4.PtInRect(m_point)) return true;
    return false;
}
Esempio n. 2
0
bool CLine::Check_Out_Rect(CPoint c_point1,CPoint c_point2)
{
	CRect crect1(c_point1,c_point2);
	if((crect1.PtInRect(point1)&&crect1.PtInRect(point2))||CheckRect(c_point1))
		return TRUE;
	else
		return FALSE;
}
Esempio n. 3
0
bool CRectangle::Check_Out_Rect(CPoint c_point1,CPoint c_point2)
{
    CRect crect1(c_point1,c_point2);
    CRect crect2(point1,point2);
    if((crect1.PtInRect(point1)&&crect1.PtInRect(point2))||crect2.PtInRect(c_point1))
        return TRUE;
    else
        return FALSE;
}
Esempio n. 4
0
bool CRectangle::CheckRect(CPoint c_point)
{
    CRect crect1(point1,point2);
    CRect crect2(point2,point1);
    if(crect1.PtInRect(c_point)||crect2.PtInRect(c_point))
        return TRUE;
    else
        return FALSE;
}
Esempio n. 5
0
void CRectangle::Zoom(CPoint m_point1, CPoint m_point2)
{
    CPoint t_point1;
    CPoint t_point2;
    t_point1.x=(point1.x+point2.x)/2-5;
    t_point1.y=point1.y-10;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect1(t_point1,t_point2);
    if(crect1.PtInRect(m_point1))
    {
        point1.y=m_point2.y;
        return;
    }
    t_point1.y=(point1.y+point2.y)/2-5;
    t_point1.x=point1.x-10;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect2(t_point1,t_point2);
    if(crect2.PtInRect(m_point1))
    {
        point1.x=m_point2.x;
        return;
    }
    t_point1.y=(point1.y+point2.y)/2-5;
    t_point1.x=point2.x;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect3(t_point1,t_point2);
    if(crect3.PtInRect(m_point1))
    {
        point2.x=m_point2.x;
        return;
    }
    t_point1.x=(point1.x+point2.x)/2-5;
    t_point1.y=point2.y;
    t_point2.x=t_point1.x+10;
    t_point2.y=t_point1.y+10;
    CRect crect4(t_point1,t_point2);
    if(crect4.PtInRect(m_point1))
    {
        point2.y=m_point2.y;
        return;
    }
}
Esempio n. 6
0
bool CLine::CheckRect(CPoint c_point)
{
	CPoint t_point1,t_point2;
	if((pow((float)point1.x,2)+pow((float)point1.y,2))>(pow((float)mpoint1.x,2)+pow((float)mpoint1.y,2))) 
	{
		t_point1.x=mpoint1.x-10;
		t_point1.y=mpoint1.y-10;
		t_point2.x=point1.x+10;
		t_point2.y=point1.y;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	}
	else if((pow((float)point1.x,2)+pow((float)point1.y,2))<(pow((float)mpoint1.x,2)+pow((float)mpoint1.y,2))) 
	{
		t_point2.x=mpoint1.x+10;
		t_point2.y=mpoint1.y+10;
		t_point1.x=point1.x-10;
		t_point1.y=point1.y;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	}
	if((pow((float)mpoint2.x,2)+pow((float)mpoint2.y,2))>(pow((float)mpoint1.x,2)+pow((float)mpoint1.y,2))) 
	{
		t_point1.x=mpoint1.x-10;
		t_point1.y=mpoint1.y-10;
		t_point2.x=mpoint2.x+10;
		t_point2.y=mpoint2.y+10;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	}
	else if((pow((float)mpoint2.x,2)+pow((float)mpoint2.y,2))<(pow((float)mpoint1.x,2)+pow((float)mpoint1.y,2))) 
	{
		t_point2.x=mpoint1.x+10;
		t_point2.y=mpoint1.y+10;
		t_point1.x=mpoint2.x-10;
		t_point1.y=mpoint2.y-10;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) 
			return true;
	}
	if((pow((float)mpoint2.x,2)+pow((float)mpoint2.y,2))>(pow((float)mpoint3.x,2)+pow((float)mpoint3.y,2))) 
	{
		t_point1.x=mpoint3.x-10;
		t_point1.y=mpoint3.y-10;
		t_point2.x=mpoint2.x+10;
		t_point2.y=mpoint2.y+10;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) 
			return true;
	}
	else if((pow((float)mpoint2.x,2)+pow((float)mpoint2.y,2))<(pow((float)mpoint3.x,2)+pow((float)mpoint3.y,2))) 
	{
		t_point2.x=mpoint3.x+10;
		t_point2.y=mpoint3.y+10;
		t_point1.x=mpoint2.x-10;
		t_point1.y=mpoint2.y-10;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) 
			return true;
	}
	if((pow((float)mpoint3.x,2)+pow((float)mpoint3.y,2))>(pow((float)mpoint4.x,2)+pow((float)mpoint4.y,2))) 
	{
		t_point1.x=mpoint4.x-10;
		t_point1.y=mpoint4.y-10;
		t_point2.x=mpoint3.x+10;
		t_point2.y=mpoint3.y+10;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	}
	else if((pow((float)mpoint3.x,2)+pow((float)mpoint3.y,2))<(pow((float)mpoint4.x,2)+pow((float)mpoint4.y,2))) 
	{
		t_point2.x=mpoint4.x+10;
		t_point2.y=mpoint4.y+10;
		t_point1.x=mpoint3.x-10;
		t_point1.y=mpoint3.y-10;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	}
	if((pow((float)point2.x,2)+pow((float)point2.y,2))>(pow((float)mpoint4.x,2)+pow((float)mpoint4.y,2))) 
	{
		t_point1.x=mpoint4.x-10;
		t_point1.y=mpoint4.y-10;
		t_point2.x=point2.x+10;
		t_point2.y=point2.y;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	}
	else if((pow((float)point2.x,2)+pow((float)point2.y,2))<(pow((float)mpoint4.x,2)+pow((float)mpoint4.y,2))) 
	{
		t_point2.x=mpoint4.x+10;
		t_point2.y=mpoint4.y+10;
		t_point1.x=point2.x-10;
		t_point1.y=point2.y;
		CRect crect1(t_point1,t_point2);
		if(crect1.PtInRect(c_point)) return true;
	} 
		return FALSE;
}