public Polygon3D Vs_polygon_clip_3df(Polygon3D poly) { Polygon3D s = new Polygon3D(); Polygon3D r = new Polygon3D(); s.SetPol(poly); double zmin = s.ZMin(); double zmax = s.ZMax(); if (zmax < 0.10000000000000001D) { return(r); } if (zmin >= 0.10000000000000001D) { r.SetPol(poly); return(r); } for (int i = 0; i < s.NVertex(); i++) { int j; if (i == s.NVertex() - 1) { j = 0; } else { j = i + 1; } double xi = s.GetVertex(i).x; double yi = s.GetVertex(i).y; double zi = s.GetVertex(i).z; double xj = s.GetVertex(j).x; double yj = s.GetVertex(j).y; double zj = s.GetVertex(j).z; if (zi >= 0.10000000000000001D) { r.AddVertex(new Vector3D(xi, yi, zi)); if (zj < 0.10000000000000001D) { double t = (0.10000000000000001D - zi) / (zj - zi); r.AddVertex(new Vector3D(xi + (xj - xi) * t, yi + (yj - yi) * t, 0.10000000000000001D)); } } else if (zj >= 0.10000000000000001D) { double t_0 = (0.10000000000000001D - zi) / (zj - zi); r.AddVertex(new Vector3D(xi + (xj - xi) * t_0, yi + (yj - yi) * t_0, 0.10000000000000001D)); } } return(r); }
public virtual double Depth() { return(pol.ZMax()); }