public SerializableBulkhead(Bulkhead bulkhead) { transom_angle = bulkhead.TransomAngle; bulkheadType = bulkhead.type; isValid = bulkhead.IsValid; points = new Point3DCollection(); if (isValid) { points = bulkhead.m_points.Clone(); } }
public Bulkhead(Point3DCollection points, BulkheadType type, bool flatBottomed, bool closedTop) { m_points = new Point3DCollection(); this.Type = type; IsFlatBottomed = flatBottomed; HasClosedTop = closedTop; if (Math.Abs(points[points.Count - 1].X) < NEAR_ZERO) { HasClosedTop = true; } if (!flatBottomed) { // Bottom is on center-line for (int ii = points.Count - 1; ii > 0; ii--) { m_points.Add(points[ii]); } // Force center to zero m_points.Add(new Point3D(0, points[0].Y, points[0].Z)); // Insert other half of hull for (int ii = 1; ii < points.Count; ii++) { Point3D point = new Point3D(-points[ii].X, points[ii].Y, points[ii].Z); m_points.Add(point); } } else { // flat floor: bottom is not on center-line for (int ii = points.Count - 1; ii >= 0; ii--) { m_points.Add(points[ii]); } // Insert other half of hull for (int ii = 0; ii < points.Count; ii++) { Point3D point = new Point3D(-points[ii].X, points[ii].Y, points[ii].Z); m_points.Add(point); } } ComputeAngle(); StraightenBulkhead(); CheckCenterlines(); }
public void LoadFromHullFile(StreamReader file, int numChines, BulkheadType type) { m_IsValid = false; this.type = type; m_points = new Point3DCollection(); string line; for (int chine = 0; chine < numChines; chine++) { Point3D point = new Point3D(); double value; line = file.ReadLine(); if (!double.TryParse(line, out value)) { throw new Exception("Unable to read bulkhead X value"); } point.X = value; line = file.ReadLine(); if (!double.TryParse(line, out value)) { throw new Exception("Unable to read bulkhead Y value"); } point.Y = value; line = file.ReadLine(); if (!double.TryParse(line, out value)) { throw new Exception("Unable to read bulkhead Z value"); } point.Z = value; m_points.Add(point); } ComputeAngle(); StraightenBulkhead(); m_IsValid = true; Notify("Bulkhead"); }
public Bulkhead(Point3DCollection points, BulkheadType type) { m_points = new Point3DCollection(); this.Type = type; if (Math.Abs(points[0].X) < NEAR_ZERO) { // Bottom is on center-line for (int ii = points.Count - 1; ii > 0; ii--) { m_points.Add(points[ii]); } // Force center to zero m_points.Add(new Point3D(0, points[0].Y, points[0].Z)); // Insert other half of hull for (int ii = 1; ii < points.Count; ii++) { Point3D point = new Point3D(-points[ii].X, points[ii].Y, points[ii].Z); m_points.Add(point); } } else { // flat floor: bottom is not on center-line for (int ii = points.Count - 1; ii >= 0; ii--) { m_points.Add(points[ii]); } // Insert other half of hull for (int ii = 1; ii < points.Count; ii++) { Point3D point = new Point3D(-points[ii].X, points[ii].Y, points[ii].Z); m_points.Add(point); } } ComputeAngle(); StraightenBulkhead(); }
// Create a bulkhead from a Carlson HUL file public Bulkhead(StreamReader file, int numChines, BulkheadType type) { this.Type = type; m_points = new Point3DCollection(); string line; Point3DCollection temp_points = new Point3DCollection(); for (int chine = 0; chine < numChines; chine++) { Point3D point = new Point3D(); double value; line = file.ReadLine(); if (!double.TryParse(line, out value)) { throw new Exception("Unable to read bulkhead X value"); } if (type == BulkheadType.BOW && Math.Abs(value) < NEAR_ZERO) { value = 0; } point.X = value; line = file.ReadLine(); if (!double.TryParse(line, out value)) { throw new Exception("Unable to read bulkhead Y value"); } point.Y = value; line = file.ReadLine(); if (!double.TryParse(line, out value)) { throw new Exception("Unable to read bulkhead Z value"); } point.Z = value; temp_points.Add(point); } if (Math.Abs(temp_points[temp_points.Count - 1].X) < NEAR_ZERO) { HasClosedTop = true; } if (Math.Abs(temp_points[0].X) < NEAR_ZERO) { // Bottom is on center-line IsFlatBottomed = false; for (int ii = temp_points.Count - 1; ii > 0; ii--) { m_points.Add(temp_points[ii]); } // Force center to zero m_points.Add(new Point3D(0, temp_points[0].Y, temp_points[0].Z)); // Insert other half of hull for (int ii = 1; ii < temp_points.Count; ii++) { Point3D point = new Point3D(-temp_points[ii].X, temp_points[ii].Y, temp_points[ii].Z); m_points.Add(point); } } else { IsFlatBottomed = true; // flat floor: bottom is not on center-line for (int ii = temp_points.Count - 1; ii >= 0; ii--) { m_points.Add(temp_points[ii]); } // Insert other half of hull for (int ii = 1; ii < temp_points.Count; ii++) { Point3D point = new Point3D(-temp_points[ii].X, temp_points[ii].Y, temp_points[ii].Z); m_points.Add(point); } } ComputeAngle(); StraightenBulkhead(); }