// for a forward edge index is the source vertex; for a backward edge index is the target vertex public HorizontalEdge(VerticalPrismalSurface parent, int index, BaseSide baseSide, Direction direction = Direction.Forward) { _parent = parent; _index = index; _baseSide = baseSide; _direction = direction; }
public Prism() { baseSide = 0; height = 0; numberOfEdges = 0; ID = BaseSide.GetHashCode() + Height.GetHashCode() + NumberOfEdges.GetHashCode(); numberOfInstances++; }
public Prism() { baseSide = 0; height = 0; numberOfEdges = 0; ID = BaseSide.GetHashCode() + Height.GetHashCode() + NumberOfEdges.GetHashCode(); totalCount++; }
public override double GetSurfaceArea() { if (BaseSide is Circle) { // Sp + Spl = π r^2 + π r √(r^2 + v^2) return(BaseSide.GetSurfaceArea() + Math.PI * ((Circle)BaseSide).Radius * Math.Sqrt(Math.Pow(((Circle)BaseSide).Radius, 2.0) + Math.Pow(V, 2.0))); } else if (BaseSide is Triangle) { // vp = 2 * Sp / x double vpa = BaseSide.GetSurfaceArea() * 2.0 / ((Triangle)BaseSide).A, vpb = BaseSide.GetSurfaceArea() * 2.0 / ((Triangle)BaseSide).B, vpc = BaseSide.GetSurfaceArea() * 2.0 / ((Triangle)BaseSide).C; // vpl = √((vp/3)^2 + v^2) double vpla = Math.Sqrt(Math.Pow(vpa / 3.0, 2.0) + Math.Pow(V, 2.0)), vplb = Math.Sqrt(Math.Pow(vpb / 3.0, 2.0) + Math.Pow(V, 2.0)), vplc = Math.Sqrt(Math.Pow(vpc / 3.0, 2.0) + Math.Pow(V, 2.0)); // Sp + Spla + Splb + Splc = HV + (A * vpla / 2.0) + (B * vplb / 2.0) + (C * vplc / 2.0) return(BaseSide.GetSurfaceArea() + ((Triangle)BaseSide).A * vpla / 2.0 + ((Triangle)BaseSide).B * vplb / 2.0 + ((Triangle)BaseSide).C * vplc / 2.0); } else if (BaseSide is Rectangle) { // vpl = √((x/2)^2 + v^2) double vpla = Math.Sqrt(Math.Pow(((Rectangle)BaseSide).A / 2.0, 2.0) + Math.Pow(V, 2.0)), vplb = Math.Sqrt(Math.Pow(((Rectangle)BaseSide).B / 2.0, 2.0) + Math.Pow(V, 2.0)); // Sp + 2 (Spla + Splb) = a b + 2 (a vpla / 2 + b vplb / 2) return(BaseSide.GetSurfaceArea() + 2.0 * (((Rectangle)BaseSide).A * vpla / 2.0 + ((Rectangle)BaseSide).B * vplb / 2.0)); } else { throw new ArgumentException("Unsupported base type."); } }
public override double GetObjectVolume() { return(BaseSide.GetSurfaceArea() * V / 3.0); }
public override int GetHashCode() { return BaseSide.GetHashCode() + Height.GetHashCode() + NumberOfEdges.GetHashCode(); }
public HorizontalFace(VerticalPrismalSurface parent, BaseSide side) { _parent = parent; _side = side; }
public Vertex(VerticalPrismalSurface parent, int index, BaseSide baseFace) { _parent = parent; _index = index; _baseFace = baseFace; }
public IPolysurfaceFace GetHorizontalFace(BaseSide baseSide) { return(new HorizontalFace(this, baseSide)); }
public IPolysurfaceVertex GetVertex(int index, BaseSide baseSide) { ArgAssert.ValidEnum(baseSide, "baseFace"); return(new Vertex(this, index, baseSide)); }