Пример #1
0
  void ICollisionSystem::ProjectOntoAxis(const sf::Shape& theShape, const sf::Vector2f& theAxis, float& theMin, float& theMax)
	{
    sf::Vector2f anPoint=theShape.getTransform().transformPoint(theShape.getPoint(0));
  	GQE::Uint32 anPointCount=theShape.getPointCount();
		theMin = (anPoint.x*theAxis.x+anPoint.y*theAxis.y);
		theMax = theMin;
		for (int j = 1; j<anPointCount; j++)
		{
			anPoint=theShape.getTransform().transformPoint(theShape.getPoint(j));
			float Projection = (anPoint.x*theAxis.x+anPoint.y*theAxis.y);

			if (Projection<theMin)
				theMin=Projection;
			if (Projection>theMax)
				theMax=Projection;
		}
	}
Пример #2
0
void TEALShow::OrientedBox( sf::Shape &s, sf::Color col)
{
	AddTransformedRectanglePoints( s.getLocalBounds(), s.getTransform(), col );
}
Пример #3
0
bool TrackChunk::collidesWith(const sf::Shape &shape) const{
    bg::model::ring<sf::Vector2f> ring;
    for (std::size_t i=0; i<shape.getPointCount(); ++i)
        bg::append(ring, shape.getTransform().transformPoint(shape.getPoint(i)));
    return bg::intersects(ring, m_points);
}