Esempio n. 1
0
            public CockpitFuselage(Nose nose, float length, float baseScale, float bend)
            {
                Fuselage = Extrusion.Extrude <V, P> (false, false, nose.XSection,
                                                     nose.XSection.Transform(Mat.Translation <Mat4> (0f, 0, -length) *
                                                                             Mat.Scaling <Mat4> (1f, baseScale, baseScale)));

                Fuselage = Composite.Create(Stacking.StackBackward(nose.Cone, Fuselage));
                XSection = Path <P, Vec3> .FromVecs(
                    from v in Fuselage.Vertices.Furthest (Dir3D.Back)
                    where v.position.Y >= -0.2f
                    select v.position).Close();

                var pivotPoint = XSection.Vertices.Furthest(Dir3D.Up).First().position;

                Fuselage = Fuselage.ManipulateVertices(
                    Manipulators.Transform <V> (Mat.RotationX <Mat4> (bend.Radians()).RelativeTo(pivotPoint))
                    .Where(v => v.position.Z > pivotPoint.Z), true)
                           .Color(_color);

                XSectionStart = XSection.Vertices.Furthest(Dir3D.Down + Dir3D.Left).Single();
                XSection      = XSection.RenumberNodes(XSection.Vertices.IndexOf(XSectionStart)).Open();
            }