ByChance.Levels2D.Context2D.IsAdjacentTo C# (CSharp) Method

IsAdjacentTo() public method

Checks whether this context is within offset to other in terms of the Euclidean norm.
Context to check the adjacency to is null. Context to check the adjacency to is not of type .
public IsAdjacentTo ( Context other, float offset ) : bool
other ByChance.Core.Context Context to check the adjacency to.
offset float Offset within this context is considered to be adjacent to .
return bool
        public override bool IsAdjacentTo(Context other, float offset)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            Context2D context2D = other as Context2D;

            if (context2D == null)
            {
                throw new ArgumentException("Passed context is not of type Context2D.", "other");
            }

            return context2D.AbsolutePosition.Distance(this.AbsolutePosition) <= offset;
        }