private IEnumerable <SubmapInfoAndHeightmapArray> getLeftNeighbours(SubmapInfo info, List <SubmapInfoAndHeightmapArray> heightmaps) { return((from heightmap in heightmaps where heightmap.SubmapInfo.DownLeftX + heightmap.SubmapInfo.Width == info.DownLeftX && MathHelp.SegmentsHaveCommonElement(heightmap.SubmapInfo.DownRightPoint.Y, heightmap.SubmapInfo.TopRightPoint.Y, info.DownLeftPoint.Y, info.TopLeftPoint.Y) select heightmap).ToList()); }
public bool HaveCommonElementWith(MarginPosition position) { if (!((IsVertical && position.IsVertical) || (IsHorizontal && position.IsHorizontal))) { return(false); } if (IsVertical) { if (StartPoint.X != position.StartPoint.X) { return(false); } else { return(MathHelp.SegmentsHaveCommonElement(StartPoint.Y, EndPoint.Y, position.StartPoint.Y, position.EndPoint.Y)); } } else { if (StartPoint.Y != position.StartPoint.Y) { return(false); } else { return(MathHelp.SegmentsHaveCommonElement(StartPoint.X, EndPoint.X, position.StartPoint.X, position.EndPoint.X)); } } }