Example #1
0
bool Field::qcanBeatBR(const Cell *arg)
{
    if( arg == NULL || !arg->getFigure().isQueen() )
    {
        string exep = "ERROR! qcanBeatBR function cannot take not queen, or arg is NULL\n";
        throw exep;
    }

    unsigned char tmpcol = arg->getFigure().getColor();
    bool was_token = false;

    Cell* temp = getBottomRight(arg);                          // Bottom Right element

    while( temp != NULL )                                   // while it's not an end of field
    {
        if( temp->isEmpty() )                               // if it's empty cell
        {
            if( was_token )                                 // and we beated some figure
            {
                temp->setCanMove(true);                     // then we can move on this
            }
            temp = getBottomRight(temp);                       // set checking on next top right cell
        }

        else                                                // if it's not empty cell
        {
            if( temp->getFigure().getColor() == tmpcol )    // if it's friendly figure
            {
                break;
            }
            else                                            // !!! if it's an empty cell
            {
                if( was_token )                             // we can beat only 1 time per move!
                {
                    break;
                }

                // !!! not token
                if( getBottomRight(temp)->isEmpty() )          // if next one is empty
                {
                    was_token = true;                       // we beated!
                    temp = getBottomRight(temp);               // move to that pozition
                    temp->setCanMove(true);
                }
            }
        }
    }
    return was_token;
}
Example #2
0
bool Cell::isInside(Point point, Point* subCell, bool strict){
	if(point.x >= upperLeft.x && point.y >= upperLeft.y && point.x < getBottomRight().x && point.y < getBottomRight().y){
		if(subCell != nullptr){
			subCell->setIsValid(false);
		}

		if(settings->numOfSubCells == 1){
			if(subCell != nullptr){
			    subCell->x = 0;
			    subCell->y = 0;
				subCell->setIsValid(true);
			}
			return true;
		}
		
		int div = settings->subCellSizes[settings->posnum -1]*2 + settings->distSub;// Consider if is convex
		int x = (point.x - upperLeft.x) / div;
		int y = (point.y - upperLeft.y) / div;
		if(subCells[y][x].isInside(point, strict)){
			if(subCell != nullptr){
			    subCell->x = x;
			    subCell->y = y;
		    	subCell->setIsValid(true);
			}
		}

		return true;
	}
	if(subCell != nullptr){
	    subCell->x = -1;
	    subCell->y = -1;
        subCell->setIsValid(false);
	}
	return false;
}
Example #3
0
bool glmRectangle::clip( glm::vec3& _p0, glm::vec3& _p1) const {
    
    glm::vec3 topLeft     = getTopLeft();
    glm::vec3 topRight    = getTopRight();
    glm::vec3 bottomRight = getBottomRight();
    glm::vec3 bottomLeft  = getBottomLeft();
    
    if (!inside(_p0)) {
        glm::vec3 r;
        if (LineSegmentIntersection(_p0, _p1, topLeft,     topRight,    r)){
            _p0 = r;
        } else if (LineSegmentIntersection(_p0, _p1, topRight,    bottomRight, r)){
            _p0 = r;
        } else if (LineSegmentIntersection(_p0, _p1, bottomRight, bottomLeft,  r)){
            _p0 = r;
        } else if (LineSegmentIntersection(_p0, _p1, bottomLeft,  topLeft,     r)){
            _p0 = r;
        }
    }
    
    if (!inside(_p1)) {
        glm::vec3 r;
        if (LineSegmentIntersection(_p1, _p0, topLeft,     topRight,    r)){
            _p1 = r;
        } else if (LineSegmentIntersection(_p1, _p0, topRight,    bottomRight, r)){
            _p1 = r;
        } else if (LineSegmentIntersection(_p1, _p0, bottomRight, bottomLeft,  r)){
            _p1 = r;
        } else if (LineSegmentIntersection(_p1, _p0, bottomLeft,  topLeft,     r)){
            _p1 = r;
        }
    }
}
Example #4
0
void Menu::display(){
	CRect rect(openedUpperLeft.x, openedUpperLeft.y, getBottomRight().x, getBottomRight().y); 

	Graphics::createMemDc(&rect);

	openButton.display();

	CPen pen(0,1,style->getBGColorRGB());
	CBrush brush(style->getBGColorRGB());

	CPen bgPen(0,1,GlobalSettings::backgroundClr.getRGB());
	CBrush bgBrush(GlobalSettings::backgroundClr.getRGB());

	CPen lblPen(0,1,style->labelBGColor.getRGB());
	CBrush lblBrush(style->labelBGColor.getRGB());

	Graphics::drawRectangle(nullptr, openedUpperLeft.x, openedUpperLeft.y, upperLeft.x, getBottomRight().y, &bgBrush, &bgPen, true, true, true);

	Graphics::drawRectangle(nullptr,this->openButton.getBottomRight().x, this->upperLeft.y, this->getBottomRight().x, this->getBottomRight().y,
		                    &brush, &pen, true, true, true);

	if(!style->labelBGTransparent){
		Graphics::drawRectangle(nullptr,openButton.getBottomRight().x, upperLeft.y, getBottomRight().x, upperLeft.y + style->labelHeight,
		                    &lblBrush, &lblPen, true, true, true);
	}

	Graphics::drawText(nullptr, openButton.getBottomRight().x, upperLeft.y, getBottomRight().x, 
		               upperLeft.y + style->labelHeight, font, label, style->labelColor, true);

	this->navigationButton.display();

	Graphics::drawRectangle(nullptr,openButton.getBottomRight().x, navigationButton.getBottomRight().y, getBottomRight().x, navigationButton.getBottomRight().y + style->panelWidthUnderNavButton,
		                    &lblBrush, &lblPen, true, true, true);

	vector<ControlElement*>* list = &elements[menuIndex]; 

	for(size_t i = 0; i < list->size(); i++){
		ControlElement* elem = list->at(i);
		elem->display();
	}

	Graphics::deleteMemDc();
	displayedAfterMove = true;
}
Example #5
0
bool Field::canBeatBR(const Cell *arg)
{
    Cell* temp = getBottomRight(arg);
    Cell* tempTR = getBottomRight(temp);

    if( tempTR != NULL && !arg->isEmpty() )    // getTopRight checks arg for NULL value
    {
        if( !temp->isEmpty() )
        {
            if( arg->getFigure().getColor() == temp->getFigure().getColor() )
            {
                return false;
            }
            if( tempTR->isEmpty() )
            {
                tempTR->setCanMove(true);
            }
         }
    }
    return false;
}
Example #6
0
// ok, laeuft perfekt.
std::list<Rect> Rect::withoutRect(const Rect& rect) const
{

	// Schnittmenge:
	std::list<Rect> rects;
	if(rect == *this) {
		return rects;
	}

	Rect cut = commonRect(rect);

	// Schnitt ist gleich dem Rechteck
	if(cut == *this) {
		return rects;
	} else if(cut.getWidth() == 0 || cut.getHeight() == 0) {
		rects.push_back(*this);
		return rects;
	} else
	{
		// Sonst: bis zu 4 rectangles:
		// Rechteck mit vollstaendiger Breite, wenn cut im unteren Teil stattgefunden hat
		if(cut.getTop() > getTop()) {
			Rect r(getTopLeft(), Point(getRight(), cut.getTop()));
			if(r.getWidth() > 0 && r.getHeight() > 0) {
				rects.push_back(r);
			}
		}
		// links
		if(cut.getLeft() > getLeft()) {
			Rect r(Point(getLeft(), cut.getTop()), cut.getBottomLeft());
			if(r.getWidth() > 0 && r.getHeight() > 0) {
				rects.push_back(r);
			}
		}
		// rechts
		if(cut.getRight() < getRight()) {
			Rect r(cut.getTopRight(), Point(getRight(), cut.getBottom()));
			if(r.getWidth() > 0 && r.getHeight() > 0) {
				rects.push_back(r);
			}
		}
		// unten
		// Rechteck mit vollstaendiger Breite, wenn unter dem cut Recht noch Platz ist
		if(cut.getBottom() < getBottom()) {
			Rect r(Point(getLeft(), cut.getBottom()), getBottomRight());
			if(r.getWidth() > 0 && r.getHeight() > 0) {
				rects.push_back(r);
			}
		}
	}
	return rects;
}
Example #7
0
bool OccArea::isFreeBuilding() const
{
  if ( m_occupant || !hasFreeFloor() )
  {
    return false;
  }
  for (int a = getTopLeft().x - 1; a < getBottomRight().x + 1; a++)
  {
    if (!equiv(Field::current()->getItem(Coord(a, getTopLeft().y - 1)), WALL))
      return false;
    if (!equiv(Field::current()->getItem(Coord(a, getBottomRight().y)), WALL))
      return false;
  }
  for (int b = getTopLeft().y;b < getBottomRight().y; b++)
  {
    if (!equiv(Field::current()->getItem(Coord(getTopLeft().x - 1, b)), WALL))
      return false;
    if (!equiv(Field::current()->getItem(Coord(getBottomRight().x, b)), WALL))
      return false;
  }
  return true;
}
Example #8
0
// Schnitt
const Rect Rect::commonRect(const Rect& rect) const
{
	if(!this->isTouched(rect)) {
		return Rect();
	}

	eTouchType k = getTouchType(rect);
	switch(k)
	{
	case TOUCHES_NO_TOUCH:
		{
			if(rect.getTouchType(*this) == TOUCHES_IS_COMPLETELY_INSIDE)
				return *this;
			else return Rect();
		}break;				
	case TOUCHES_IS_COMPLETELY_INSIDE:return rect;break;
	case TOUCHES_CROSSES_RIGHT_BORDER:return Rect(rect.getTopLeft(), Point(getRight(), rect.getBottom()));break;
	case TOUCHES_CROSSES_LOWER_BORDER:return Rect(rect.getTopLeft(), Point(rect.getRight(), getBottom()));break;
	case TOUCHES_CROSSES_LEFT_BORDER:return Rect(Point(getLeft(), rect.getTop()), rect.getBottomRight());break;
	case TOUCHES_CROSSES_UPPER_BORDER:return Rect(Point(rect.getLeft(), getTop()), rect.getBottomRight());break;
	case TOUCHES_CROSSES_BOTTOM_RIGHT_CORNER:return Rect(rect.getTopLeft(), getBottomRight());break;
	case TOUCHES_CROSSES_BOTTOM_LEFT_CORNER:return Rect(Point(getLeft(), rect.getTop()), Point(rect.getRight(), getBottom()));break;
	case TOUCHES_CROSSES_TOP_LEFT_CORNER:return Rect(getTopLeft(), rect.getBottomRight());break;
	case TOUCHES_CROSSES_TOP_RIGHT_CORNER:return Rect(Point(rect.getLeft(), getTop()), Point(getRight(), rect.getBottom()));break;
	case TOUCHES_CROSSES_LEFT_AND_RIGHT_BORDER:return Rect(Point(getLeft(), rect.getTop()), Point(getRight(), rect.getBottom()));break;
	case TOUCHES_CROSSES_TOP_AND_BOTTOM_BORDER:return Rect(Point(rect.getLeft(), getTop()), Point(rect.getRight(), getBottom()));break;

	case TOUCHES_CROSSES_UPPER_AREA:return Rect(getTopLeft(), Point(getRight(), rect.getBottom()));break;
	case TOUCHES_CROSSES_RIGHT_AREA:return Rect(Point(rect.getLeft(), getTop()), getBottomRight());break;
	case TOUCHES_CROSSES_LOWER_AREA:return Rect(Point(getLeft(), rect.getTop()), getBottomRight());break;
	case TOUCHES_CROSSES_LEFT_AREA:return Rect(getTopLeft(), Point(rect.getRight(), getBottom()));break;
	case TOUCHES_UPPER_BORDER:
	case TOUCHES_LEFT_BORDER:
	case TOUCHES_LOWER_BORDER:
	case TOUCHES_RIGHT_BORDER:
	default:return Rect();break;
	}
}
//----------------------------------------------------------
bool ofRectangle::intersects(const ofPoint& p0, const ofPoint& p1) const {
    // check for a line intersection
    ofPoint p;

    ofPoint topLeft     = getTopLeft();
    ofPoint topRight    = getTopRight();
    ofPoint bottomRight = getBottomRight();
    ofPoint bottomLeft  = getBottomLeft();

    return inside(p0) || // check end inside
           inside(p1) || // check end inside
           ofLineSegmentIntersection(p0, p1, topLeft,     topRight,    p) || // cross top
           ofLineSegmentIntersection(p0, p1, topRight,    bottomRight, p) || // cross right
           ofLineSegmentIntersection(p0, p1, bottomRight, bottomLeft,  p) || // cross bottom
           ofLineSegmentIntersection(p0, p1, bottomLeft,  topLeft,     p);   // cross left
}
Example #10
0
//------------------------------------------------------------------------
Point& Rect::toPoint (Direction dir, Point& p) const
{
	switch (dir) {
	case kSouthWest:		return p = getBottomLeft ();
	case kWest:				return p = getLeftCenter ();
	case kNorthWest:		return p = getTopLeft ();
	case kNorth:			return p = getTopCenter ();
	case kNorthEast:		return p = getTopRight ();
	case kEast:				return p = getRightCenter ();
	case kSouthEast:		return p = getBottomRight ();
	case kSouth:			return p = getBottomCenter ();
	case kNoDirection:		return p = getCenter ();
	}

	return p;
}
Example #11
0
//----------------------------------------------------------
bool glmRectangle::intersects(const glm::vec3& p0, const glm::vec3& p1) const {
    // check for a line intersection
    glm::vec3 p;
    
    glm::vec3 topLeft     = getTopLeft();
    glm::vec3 topRight    = getTopRight();
    glm::vec3 bottomRight = getBottomRight();
    glm::vec3 bottomLeft  = getBottomLeft();
    
    return inside(p0) || // check end inside
    inside(p1) || // check end inside
    LineSegmentIntersection(p0, p1, topLeft,     topRight,    p) || // cross top
    LineSegmentIntersection(p0, p1, topRight,    bottomRight, p) || // cross right
    LineSegmentIntersection(p0, p1, bottomRight, bottomLeft,  p) || // cross bottom
    LineSegmentIntersection(p0, p1, bottomLeft,  topLeft,     p);   // cross left
}
Example #12
0
void Rect::unionRect(const Rect &rect)
{
    const Vector2 topLeft = getTopLeft(),
	          bottomRight = getBottomRight(),
	          unionTopLeft = rect.getTopLeft(),
	          unionBottomRight = rect.getBottomRight();
	
    const Vector2 newTopLeft = Vector2(
	std::min(topLeft.x, unionTopLeft.x),
	std::min(topLeft.y, unionTopLeft.y));
    const Vector2 newBottomRight = Vector2(
	std::max(bottomRight.x, unionBottomRight.x),
	std::max(bottomRight.y, unionBottomRight.y));

    pos = newTopLeft;
    diagonal = newBottomRight - newTopLeft;
}
Example #13
0
		//----------
		TextField::TextField(string caption) {
			this->setCaption(caption);
			this->setBounds(ofRectangle(5, 0, 100, 50));
			this->onDraw += [this](ofxCvGui::DrawArguments & args) {
				//draw caption
				auto & captionFont = ofxAssets::font(ofxCvGui::getDefaultTypeface(), 12);
				captionFont.drawString(this->caption + " : ", 0, 15);
				
				//draw underline
				ofPushStyle();
				{
					const auto textFieldBounds = this->textField->getBounds();
					ofSetColor(100);
					ofSetLineWidth(1.0f);
					ofDrawLine(textFieldBounds.getBottomLeft(), textFieldBounds.getBottomRight());
				}
				ofPopStyle();
				
				//draw side line
				ofPushStyle();
				{
					ofSetLineWidth(1.0f);
					ofDrawLine(this->getWidth(), 0, this->getWidth(), 20);
				}
				ofPopStyle();
			};
			
			this->textField = make_shared<Utils::TextField>();
			this->textField->addListenersToParent(this);
			this->textField->setFont(ofxAssets::font(ofxCvGui::getDefaultTypeface(), 12));
			
			this->onBoundsChange += [this](BoundsChangeArguments & args) {
				this->textField->setBounds(ofRectangle(10, 20, args.localBounds.width - 20, 20));
			};
			this->onMouse += [this](MouseArguments & args) {
				if(args.takeMousePress(this)) {
					//if we clicked in here
					this->textField->focus();
				} else if (this->textField->isFocused() && !args.isLocal()) {
					this->textField->defocus();
				}
			};
		}
Example #14
0
void Rect::clipRect(const Rect &rect)
{
    const Vector2 topLeft = getTopLeft(),
	          bottomRight = getBottomRight(),
	          clipTopLeft = rect.getTopLeft(),
	          clipBottomRight = rect.getBottomRight();
	
    const Vector2 newTopLeft = Vector2(
	std::max(topLeft.x, clipTopLeft.x),
	std::max(topLeft.y, clipTopLeft.y));
    const Vector2 newBottomRight = Vector2(
	std::min(bottomRight.x, clipBottomRight.x),
	std::min(bottomRight.y, clipBottomRight.y));

    pos = newTopLeft;
    diagonal = newBottomRight - newTopLeft;
    if (!isNormal())
	pos = diagonal = Vector2();
}
Example #15
0
Rectangle Rectangle::translate(Vec2 v) const {
  return Rectangle(getTopLeft() + v, getBottomRight() + v);
}
Example #16
0
ErrVal
PictureParameterSet::write( HeaderSymbolWriteIf* pcWriteIf ) const
{
  //===== NAL unit header =====
  ETRACE_DECLARE( Bool m_bTraceEnable = true );
  ETRACE_LAYER  ( 0 );
  ETRACE_HEADER ( "PICTURE PARAMETER SET" );
  RNOK  ( pcWriteIf->writeFlag( 0,                                        "NAL unit header: forbidden_zero_bit" ) );
  RNOK  ( pcWriteIf->writeCode( 3, 2,                                     "NAL unit header: nal_ref_idc" ) );
  RNOK  ( pcWriteIf->writeCode( m_eNalUnitType, 5,                        "NAL unit header: nal_unit_type" ) );

  //===== NAL unit payload =====
  RNOK( pcWriteIf->writeUvlc( getPicParameterSetId(),                     "PPS: pic_parameter_set_id" ) );
  RNOK( pcWriteIf->writeUvlc( getSeqParameterSetId(),                     "PPS: seq_parameter_set_id" ) );
  RNOK( pcWriteIf->writeFlag( getEntropyCodingModeFlag(),                 "PPS: entropy_coding_mode_flag" ) );
  RNOK( pcWriteIf->writeFlag( getPicOrderPresentFlag(),                   "PPS: pic_order_present_flag" ) );

  //--ICU/ETRI FMO Implementation : FMO stuff start
  Int iNumberBitsPerSliceGroupId;
  RNOK( pcWriteIf->writeUvlc( getNumSliceGroupsMinus1(),                         "PPS: num_slice_groups_minus1" ) );

  if(getNumSliceGroupsMinus1() > 0)
  {
    RNOK( pcWriteIf->writeUvlc( getSliceGroupMapType(),                             "PPS: slice_group_map_type" ) );
    if(getSliceGroupMapType() ==0)
    {
      for(UInt iSliceGroup=0;iSliceGroup<=getNumSliceGroupsMinus1();iSliceGroup++)
      {
        RNOK( pcWriteIf->writeUvlc( getRunLengthMinus1(iSliceGroup),                             "PPS: run_length_minus1 [iSliceGroup]" ) );
      }
    }
    else if (getSliceGroupMapType() ==2)
    {
      for(UInt iSliceGroup=0;iSliceGroup<getNumSliceGroupsMinus1();iSliceGroup++)
      {
        RNOK( pcWriteIf->writeUvlc( getTopLeft(iSliceGroup),                             "PPS: top_left [iSliceGroup]" ) );
        RNOK( pcWriteIf->writeUvlc( getBottomRight(iSliceGroup),                             "PPS: bottom_right [iSliceGroup]" ) );
      }
    }
    else if(getSliceGroupMapType() ==3 ||
      getSliceGroupMapType() ==4 ||
      getSliceGroupMapType() ==5)
    {
      RNOK( pcWriteIf->writeFlag( getSliceGroupChangeDirection_flag(),                      "PPS: slice_group_change_direction_flag" ) );
      RNOK( pcWriteIf->writeUvlc( getSliceGroupChangeRateMinus1(),                             "PPS: slice_group_change_rate_minus1" ) );
    }
    else if (getSliceGroupMapType() ==6)
    {
      if (getNumSliceGroupsMinus1()+1 >4)
        iNumberBitsPerSliceGroupId = 3;
      else if (getNumSliceGroupsMinus1()+1 > 2)
        iNumberBitsPerSliceGroupId = 2;
      else
        iNumberBitsPerSliceGroupId = 1;
      //! JVT-F078, exlicitly signal number of MBs in the map
      RNOK( pcWriteIf->writeUvlc( getNumSliceGroupMapUnitsMinus1(),                             "PPS: num_slice_group_map_units_minus1" ) );
      ROF ( getNumSliceGroupMapUnitsMinus1() < m_uiSliceGroupIdArraySize );
      for (UInt iSliceGroup=0; iSliceGroup<=getNumSliceGroupMapUnitsMinus1(); iSliceGroup++)
        RNOK( pcWriteIf->writeCode( getSliceGroupId(iSliceGroup), iNumberBitsPerSliceGroupId ,                                    "PPS: slice_group_id[iSliceGroup]" ) );
    }

  }
  //--ICU/ETRI FMO Implementation : FMO stuff end

  RNOK( pcWriteIf->writeUvlc( getNumRefIdxActive(LIST_0)-1,               "PPS: num_ref_idx_l0_active_minus1" ) );
  RNOK( pcWriteIf->writeUvlc( getNumRefIdxActive(LIST_1)-1,               "PPS: num_ref_idx_l1_active_minus1" ) );
  RNOK( pcWriteIf->writeFlag( m_bWeightedPredFlag,                        "PPS: weighted_pred_flag" ) );
  RNOK( pcWriteIf->writeCode( m_uiWeightedBiPredIdc, 2,                   "PPS: weighted_bipred_idc" ) );
  RNOK( pcWriteIf->writeSvlc( (Int)getPicInitQp() - 26,                   "PPS: pic_init_qp_minus26" ) );
  RNOK( pcWriteIf->writeSvlc( 0,                                          "PPS: pic_init_qs_minus26" ) );
  RNOK( pcWriteIf->writeSvlc( getChromaQpIndexOffset(),                   "PPS: chroma_qp_index_offset" ) );
  RNOK( pcWriteIf->writeFlag( getDeblockingFilterParametersPresentFlag(), "PPS: deblocking_filter_control_present_flag" ) ); //VB-JV 04/08
  RNOK( pcWriteIf->writeFlag( getConstrainedIntraPredFlag(),              "PPS: constrained_intra_pred_flag" ) );
  RNOK( pcWriteIf->writeFlag( getRedundantPicCntPresentFlag(),            "PPS: redundant_pic_cnt_present_flag" ) );  // JVT-Q054 Red. Picture

  if( getTransform8x8ModeFlag() || m_bPicScalingMatrixPresentFlag || m_iSecondChromaQpIndexOffset != m_iChromaQpIndexOffset )
  {
    RNOK( xWriteFrext( pcWriteIf ) );
  }

  return Err::m_nOK;
}
Example #17
0
bool Menu::isInside(Point pt) const{
	return pt.x >= upperLeft.x && pt.y >= upperLeft.y && 
		   pt.x < getBottomRight().x && pt.y < getBottomRight().y;
}
void LineUIDrawObject::draw(const GraphicsWeakPtr Graphics, Real32 Opacity) const
{
	Graphics->drawLine(getTopLeft(), getBottomRight(), getWidth(), getColor(), getOpacity()*Opacity);
}
void LineUIDrawObject::getBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
	TopLeft = getTopLeft();
	BottomRight = getBottomRight();
}
Example #20
0
// dieses Rect relativ zum anderen...
eTouchType Rect::getTouchType(const Rect& rect) const
{
	if(!isTouched(rect)) {
		return TOUCHES_NO_TOUCH;
	}

	// ist 'rect' innerhalb dieses Rects?
	if(isRectInside(rect)) {
		return TOUCHES_IS_COMPLETELY_INSIDE;
	} else if(isTopLeftCornerInside(rect.getTopLeft()) && isBottomLeftCornerInside(rect.getBottomLeft())) {
		return TOUCHES_CROSSES_RIGHT_BORDER;
	} else if(isTopLeftCornerInside(rect.getTopLeft()) && isTopRightCornerInside(rect.getTopRight())) {
		return TOUCHES_CROSSES_LOWER_BORDER;
	} else if(isTopRightCornerInside(rect.getTopRight()) && isBottomRightCornerInside(rect.getBottomRight())) {
		return TOUCHES_CROSSES_LEFT_BORDER;
	} else if(isBottomRightCornerInside(rect.getBottomRight()) && isBottomLeftCornerInside(rect.getBottomLeft())) {
		return TOUCHES_CROSSES_UPPER_BORDER;
	} else if(isTopLeftCornerInside(rect.getTopLeft())) {
		return TOUCHES_CROSSES_BOTTOM_RIGHT_CORNER;
	} else if(isTopRightCornerInside(rect.getTopRight())) {
		return TOUCHES_CROSSES_BOTTOM_LEFT_CORNER;
	} else if(isBottomRightCornerInside(rect.getBottomRight())) {
		return TOUCHES_CROSSES_TOP_LEFT_CORNER;
	} else if(isBottomLeftCornerInside(rect.getBottomLeft())) {
		return TOUCHES_CROSSES_TOP_RIGHT_CORNER;
	}

	else if((rect.getLeft() < getLeft()) && (rect.getRight() > getRight()) && (rect.getTop() >= getTop()) && (rect.getBottom() <= getBottom())) { // ? = 
		return TOUCHES_CROSSES_LEFT_AND_RIGHT_BORDER;
	} else if((rect.getTop() < getTop()) && (rect.getBottom() > getBottom()) && (rect.getLeft() >= getLeft()) && (rect.getRight() <= getRight())) {
		return TOUCHES_CROSSES_TOP_AND_BOTTOM_BORDER;
	}

	else if((rect.getLeft() == getRight()) && (rect.getTop() == getTop()) && (rect.getBottom() == getBottom())) {
		return TOUCHES_RIGHT_BORDER;
	} else if((rect.getTop() == getBottom()) && (rect.getLeft() == getLeft()) && (rect.getRight() == getRight())) {
		return TOUCHES_LOWER_BORDER;
	} else if((rect.getRight() == getLeft()) && (rect.getTop() == getTop()) && (rect.getBottom() == getBottom())) {
		return TOUCHES_LEFT_BORDER;
	} else if((rect.getBottom() == getTop()) && (rect.getLeft() == getLeft()) && (rect.getRight() == getRight())) {
		return TOUCHES_UPPER_BORDER;
	}

	else if((rect.isTopLeftCornerInside(getTopLeft())) && (rect.isTopRightCornerInside(getTopRight())) && (!rect.isBottomRightCornerInside(getBottomRight())) && (!rect.isBottomLeftCornerInside(getBottomLeft()))) {
		return TOUCHES_CROSSES_UPPER_AREA;
	} else if((!rect.isTopLeftCornerInside(getTopLeft())) && (rect.isTopRightCornerInside(getTopRight())) && (rect.isBottomRightCornerInside(getBottomRight())) && (!rect.isBottomLeftCornerInside(getBottomLeft()))) {
		return TOUCHES_CROSSES_RIGHT_AREA;
	} else if((!rect.isTopLeftCornerInside(getTopLeft())) && (!rect.isTopRightCornerInside(getTopRight())) && (rect.isBottomRightCornerInside(getBottomRight())) && (rect.isBottomLeftCornerInside(getBottomLeft()))) {
		return TOUCHES_CROSSES_LOWER_AREA;
	} else if((rect.isTopLeftCornerInside(getTopLeft())) && (!rect.isTopRightCornerInside(getTopRight())) && (!rect.isBottomRightCornerInside(getBottomRight())) && (rect.isBottomLeftCornerInside(getBottomLeft()))) {
		return TOUCHES_CROSSES_LEFT_AREA;
	}

	else { 
		return TOUCHES_NO_TOUCH;
	}
}
Example #21
0
	OrthogonalLine Rectangle::getRightLine() const
	{
		return OrthogonalLine(OrthogonalLine::Y_AXIS, getBottomRight(), size.y);
	}