/**
 *	This method returns the height of the ground under pos, doing only
 *  one-sided collisions tests.
 *
 *	@param pos				The position from which to drop.
 *	@param dropDistance		The distance over which the drop is checked.
 *  @param oneSided         If true then only consider collisions where 
 *                          the collision triangle is pointing up.
 *
 *	@return The height of the ground found. If no ground was found within the
 *			dropDistance from the position supplied, 
 *          RompCollider::NO_GROUND_COLLISION is returned.
 */
float ChunkRompCollider::ground( const Vector3 &pos, float dropDistance, bool oneSided )
{
	BW_GUARD;
	Vector3 lowestPoint( pos.x, pos.y - dropDistance, pos.z );

	float dist = -1.f;
	ChunkSpace * pCS = &*ChunkManager::instance().cameraSpace();
	if (pCS != NULL)
    {
        dist = 
            pCS->collide
            ( 
                pos, 
                lowestPoint, 
                ClosestObstacleEx
                (
                    oneSided, 
                    Vector3(0.0f, -1.0f, 0.0f)
                )
            );
    }
	if (dist < 0.0f) return RompCollider::NO_GROUND_COLLISION;

	return pos.y - dist;
}
Пример #2
0
int main()
{

 struct Point points[20];
 int numPoints = readPoints(points);
 struct Point lowPoint = lowestPoint(points,numPoints);
 printf("lowest point: ");
 displayPoint(lowPoint);
 return 0;



}