Exemplo n.º 1
0
        private List <Point3DCollection> PrepareChines(Hull hull, int points_per_chine)
        {
            int nChines = hull.Bulkheads[0].NumChines;
            List <Point3DCollection> chines = new List <Point3DCollection>();

            for (int chine = 0; chine < nChines; chine++)
            {
                Point3DCollection chine_data = new Point3DCollection(Bulkheads.Count);

                for (int bulkhead = 0; bulkhead < hull.Bulkheads.Count; bulkhead++)
                {
                    chine_data.Add(hull.Bulkheads[bulkhead].Points[chine]);
                }
                Splines           spline   = new Splines(chine_data, Splines.RELAXED);
                Point3DCollection newChine = spline.GetPoints(points_per_chine);
                chines.Add(newChine);
            }

            return(chines);
        }
Exemplo n.º 2
0
        public Bulkhead(Bulkhead original, int num_chines)
        {
            const int PRECISION = 10;

            m_points = new Point3DCollection();
            Point3DCollection tempPoints = new Point3DCollection();

            IsFlatBottomed = original.IsFlatBottomed;
            HasClosedTop   = original.HasClosedTop;

            if (!IsFlatBottomed)
            {
                // centerline bulkhead
                int useable_chines = original.NumChines / 2 + 1;

                for (int ii = 0; ii < useable_chines; ii++)
                {
                    tempPoints.Add(original.Points[ii]);
                }

                Splines           shape   = new Splines(tempPoints, Splines.RELAXED);
                Point3DCollection outline = shape.GetPoints((num_chines + 1) * PRECISION);

                int index = 0;
                for (int ii = 0; ii < num_chines; ii++)
                {
                    m_points.Add(outline[index]);
                    index += PRECISION;
                }

                // Add the center point
                m_points.Add(original.Points[original.NumChines / 2]);

                // Add the other half
                index = PRECISION * num_chines;
                for (int ii = 0; ii < num_chines; ii++)
                {
                    index -= PRECISION;
                    Point3D point = outline[index];
                    point.X = -point.X;
                    m_points.Add(point);
                }
            }
            else
            {
                // flat floor bulkhead
                int useable_chines = original.NumChines / 2;

                for (int ii = 0; ii < useable_chines; ii++)
                {
                    tempPoints.Add(original.Points[ii]);
                }

                Splines           shape   = new Splines(tempPoints, Splines.RELAXED);
                Point3DCollection outline = shape.GetPoints((num_chines + 1) * PRECISION);

                int index = 0;
                for (int ii = 0; ii < num_chines; ii++)
                {
                    m_points.Add(outline[index]);
                    index += PRECISION;
                }

                // Add the center point
                m_points.Add(original.Points[original.NumChines / 2]);

                // Add the other half
                index = PRECISION * num_chines;
                for (int ii = 0; ii < num_chines; ii++)
                {
                    index -= PRECISION;
                    Point3D point = outline[index];
                    point.X = -point.X;
                    m_points.Add(point);
                }
            }
        }