Engines/FlatRedBallXNA/FlatRedBall/Math/Geometry/Polygon.cs
/// <summary>
/// Returns whether two indexes are adjacent.  This considers wrapping and duplicate
/// points for closed polygons.
/// </summary>
/// <param name="firstIndex">The first index.</param>
/// <param name="secondIndex">The second index</param>
/// <returns>Whether the two points are adjacent.</returns>
Returns whether two indexes are adjacent.  This considers wrapping and duplicate
points for closed polygons.
Returns whether two indexes are adjacent . This considers wrapping and duplicate points for closed polygons .
public bool ArePointsAdjacent(int firstIndex, int secondIndex)
        {
            if(firstIndex == mPoints.Length -1)
            {
                firstIndex = 0;
            }
            if(secondIndex == mPoints.Length - 1)
            {
                secondIndex = 0;
            }
            int pointBeforeFirst = firstIndex - 1;
            if (pointBeforeFirst < 0)
            {
                pointBeforeFirst = mPoints.Length - 2;
            }
            int pointAfterFirst = (firstIndex + 1) % (mPoints.Length - 1);
            return secondIndex == pointBeforeFirst || secondIndex == pointAfterFirst;
        }
public bool ArePointsAdjacent ( int firstIndex , int secondIndex ) { if ( firstIndex == mPoints . Length - 1 ) { firstIndex = 0 ; } if ( secondIndex == mPoints . Length - 1 ) { secondIndex = 0 ; } int pointBeforeFirst = firstIndex - 1 ; if ( pointBeforeFirst < 0 ) { pointBeforeFirst = mPoints . Length - 2 ; } int pointAfterFirst = ( firstIndex + 1 ) % ( mPoints . Length - 1 ) ; return secondIndex == pointBeforeFirst || secondIndex == pointAfterFirst ; }
Returns whether two indexes are adjacent.
Returns whether two indexes are adjacent .
// If firstIndex or secondIndex are the last point, make them // 0 to make the rest of this method simpler
Whether the two points are adjacent.
Whether the two points are adjacent .
firstIndex
int
The first index.
The first index .
secondIndex
int
The second index
The second index