public Polygon2D GenerateShadow(Polygon2D poly, float sunDirection) { Polygon2D convexHull = new Polygon2D(); foreach (Vector2D p in poly.pointsList) { Vector2D vA = p.Copy(); vA.Push(sunDirection, height); convexHull.pointsList.Add(vA); convexHull.pointsList.Add(p); } convexHull.pointsList = Math2D.GetConvexHull(convexHull.pointsList); return(convexHull); }
static public Polygon2 GenerateShadow(Polygon2 poly, float sunDirection, float height) { Polygon2D convexHull = new Polygon2D(); Vector2D vA; sunDirection = -sunDirection; foreach (Vector2 p in poly.points) { vA = new Vector2D(p); vA.Push(sunDirection, height); convexHull.pointsList.Add(vA); convexHull.pointsList.Add(new Vector2D(p)); } convexHull.pointsList = Math2D.GetConvexHull(convexHull.pointsList); return(new Polygon2(convexHull)); }