private MyMath.Point getCornerVertex(PointInt point, int dir) { MyMath.Point pointF = (MyMath.Point)point; MyMath.Point face = pointF + cornerPos[dir]; return(face); }
public void Add(MyMath.Point p) { Border.Add(p); }
private void calculateBounds(Edge edge, int direction, int[,] biomeMap) { Direction dir = new Direction(direction); var point = edge.touchPoint; MyMath.Point startFace = getFace(point, dir); int previousNeighbourBiome = biomeMap.getBorderValue(point, dir); dir.Increment(); if (holes.Any(x => x.Border.Any(y => y.Equal(startFace)))) { return; } Hole border = new Hole(edge.otherTouchPoint); PointInt currentPoint = point; while (true) { int newNeighbourBiome = biomeMap.getBorderValue(currentPoint, dir); if (!biomeMap.sameAsNeighbor(currentPoint, dir)) { if (!dir.Diagonal()) { if (previousNeighbourBiome != newNeighbourBiome) { border.Add(getCornerVertex(currentPoint, dir)); previousNeighbourBiome = newNeighbourBiome; } MyMath.Point face = getFace(currentPoint, dir); if (face.Equal(startFace)) { break; } else { border.Add(face); } } dir.Increment(); } else { currentPoint = currentPoint.Neighbor(dir); if (dir.Diagonal()) { dir.Decrement(); } dir.Decrement(); if (dir.Diagonal()) { dir.Decrement(); } } } if (border.Border.Count == 0) { throw new Exception(); } border.Add(startFace); holes.Add(border); }
private MyMath.Point getFace(PointInt point, int dir) { MyMath.Point pointF = (MyMath.Point)point; MyMath.Point face = pointF + facePos[dir]; return(face); }
public static Vertex getVertex(this MyMath.Point p, int m) { return(new Vertex(p.x, p.y, m)); }