circleToPolygon() public static method

public static circleToPolygon ( Circle circle, Polygon polygon, CollisionResult &result ) : bool
circle Circle
polygon Polygon
result CollisionResult
return bool
コード例 #1
0
ファイル: Polygon.cs プロジェクト: fusspawn/Nez
        public override bool collidesWithShape(Shape other, out CollisionResult result)
        {
            if (other is Polygon)
            {
                return(ShapeCollisions.polygonToPolygon(this, other as Polygon, out result));
            }

            if (other is Circle && ShapeCollisions.circleToPolygon(other as Circle, this, out result))
            {
                result.invertResult();
                return(true);
            }

            throw new NotImplementedException(string.Format("overlaps of Polygon to {0} are not supported", other));
        }
コード例 #2
0
ファイル: Polygon.cs プロジェクト: fusspawn/Nez
        public override bool overlaps(Shape other)
        {
            CollisionResult result;

            if (other is Polygon)
            {
                return(ShapeCollisions.polygonToPolygon(this, other as Polygon, out result));
            }

            if (other is Circle)
            {
                ShapeCollisions.circleToPolygon(other as Circle, this, out result);
            }

            throw new NotImplementedException(string.Format("overlaps of Polygon to {0} are not supported", other));
        }
コード例 #3
0
ファイル: Polygon.cs プロジェクト: Pyxlre/Nez
        public override bool collidesWithShape(Shape other, out CollisionResult result)
        {
            if (other is Polygon)
            {
                return(ShapeCollisions.polygonToPolygon(this, other as Polygon, out result));
            }

            if (other is Circle && ShapeCollisions.circleToPolygon(other as Circle, this, out result))
            {
                // TODO: flip the result since the colliding objects are reversed
                throw new NotImplementedException("ShapeCollisionResult will probably be wrong due to the result needing to be flipped. TODO");
                //return true;
            }

            throw new NotImplementedException(string.Format("overlaps of Polygon to {0} are not supported", other));
        }
コード例 #4
0
        public override bool collidesWithShape(Shape other, out CollisionResult result)
        {
            if (other is Box && (other as Box).isUnrotated)
            {
                return(ShapeCollisions.circleToBox(this, other as Box, out result));
            }

            if (other is Circle)
            {
                return(ShapeCollisions.circleToCircle(this, other as Circle, out result));
            }

            if (other is Polygon)
            {
                return(ShapeCollisions.circleToPolygon(this, other as Polygon, out result));
            }

            throw new NotImplementedException(string.Format("Collisions of Circle to {0} are not supported", other));
        }
コード例 #5
0
        public override bool overlaps(Shape other)
        {
            CollisionResult result;

            if (other is Box)
            {
                return(Collisions.rectToCircle(ref other.bounds, position, radius));
            }

            if (other is Circle)
            {
                return(Collisions.circleToCircle(position, radius, other.position, (other as Circle).radius));
            }

            if (other is Polygon)
            {
                return(ShapeCollisions.circleToPolygon(this, other as Polygon, out result));
            }

            throw new NotImplementedException(string.Format("overlaps of Circle to {0} are not supported", other));
        }