FarseerPhysics.Common.PolygonCreationAssistance.IsSolid C# (CSharp) Method

IsSolid() public method

public IsSolid ( Vector2 pixel ) : bool
pixel Vector2
return bool
        public bool IsSolid(Vector2 pixel)
        {
            return IsSolid((int) pixel.X, (int) pixel.Y);
        }

Same methods

PolygonCreationAssistance::IsSolid ( int index ) : bool
PolygonCreationAssistance::IsSolid ( int x, int y ) : bool

Usage Example

        private static bool GetNextHullPoint(PolygonCreationAssistance pca, ref Vector2 last, ref Vector2 current,
                                             out Vector2 next)
        {
            int x;
            int y;

            int indexOfFirstPixelToCheck = GetIndexOfFirstPixelToCheck(last, current);
            int indexOfPixelToCheck;

            const int pixelsToCheck = 8; // _closePixels.Length;

            for (int i = 0; i < pixelsToCheck; i++)
            {
                indexOfPixelToCheck = (indexOfFirstPixelToCheck + i) % pixelsToCheck;

                x = (int)current.X + ClosePixels[indexOfPixelToCheck, 0];
                y = (int)current.Y + ClosePixels[indexOfPixelToCheck, 1];

                if (x >= 0 && x < pca.Width && y >= 0 && y <= pca.Height)
                {
                    if (pca.IsSolid(x, y)) //todo
                    {
                        next = new Vector2(x, y);
                        return(true);
                    }
                }
            }

            next = Vector2.Zero;
            return(false);
        }
All Usage Examples Of FarseerPhysics.Common.PolygonCreationAssistance::IsSolid