예제 #1
0
bool Map::wrongFinishLineIntersection(int xFirst, int yFirst, int xSecond, int ySecond) const {
	if( intersectFinishLine(xFirst, yFirst, xSecond, ySecond) ) {
		int normalVectorCoordinatesX = rightFinishPoint.first - leftFinishPoint.first;
		int normalVectorCoordinatesY = rightFinishPoint.second - leftFinishPoint.second;/*
		if( area( map.GetFinishLine().first, playersCoordinates, map.GetFinishLine().second ) *
			area( map.GetFinishLine().first, normalVectorCoordinates, map.GetFinishLine().second ) >= 0 &&
			area( map.GetFinishLine().first, playersPreviousCoordinates, map.GetFinishLine().second ) *
			area( map.GetFinishLine().first, normalVectorCoordinates, map.GetFinishLine().second ) < 0 )*/
		return !( orientedArea( leftFinishPoint.first, leftFinishPoint.second, xSecond, 
			ySecond, rightFinishPoint.first, rightFinishPoint.second )
			* orientedArea( leftFinishPoint.first, leftFinishPoint.second, normalVectorCoordinatesX,
			normalVectorCoordinatesY, rightFinishPoint.first, rightFinishPoint.second ) >= 0
			&& orientedArea( leftFinishPoint.first, leftFinishPoint.second, xFirst,
			yFirst, rightFinishPoint.first, rightFinishPoint.second )
			* orientedArea( leftFinishPoint.first, leftFinishPoint.second, normalVectorCoordinatesX,
			normalVectorCoordinatesY, rightFinishPoint.first, rightFinishPoint.second ) < 0);
	}

	return false;
	//if( intersectFinishLine( xFirst, yFirst, xSecond, ySecond ) ) {
	//	return orientedArea( xSecond, ySecond, leftFinishPoint.first, leftFinishPoint.second,
	//		rightFinishPoint.first, rightFinishPoint.second ) >= 0;
	//}

	//return false;
}
예제 #2
0
bool Map::wrongFinishLineIntersection(int xFirst, int yFirst, int xSecond, int ySecond) const {
    if (intersectFinishLine(xFirst, yFirst, xSecond, ySecond)) {
        return (orientedArea(xFirst, yFirst, leftFinishPoint.first, leftFinishPoint.second,
                             rightFinishPoint.first, rightFinishPoint.second) > 0);
    }

    return false;
}