Beispiel #1
0
 public Rib(WingSection parent, int index) : this()
 {
     if (parent != null)
     {
         parent.Ribs.Insert(index, this);
     }
 }
Beispiel #2
0
 public Rib(WingSection parent) : this()
 {
     if (parent != null)
     {
         parent.Ribs.Add(this);
     }
 }
Beispiel #3
0
        public void SectionAdd()
        {
            WingSection ws = new WingSection((Wing)Project.Plane.Wing.Value);

            if (PartWings.Count == 0)
            {
                ws.GlobalPos.Value = new Pos(0, 0, 0);
            }
            else
            {
                WingSection lastSection = (WingSection)PartWings[PartWings.Count - 1];
                ws.GlobalPos.Value = lastSection.GlobalPos.Value +
                                     new Pos(lastSection.Length.Value, 0, 0);
            }
            PartWings.Add(ws);
        }
Beispiel #4
0
 public Plank(WingSection parent) : this()
 {
     parent.Plank.Value = this;
 }
Beispiel #5
0
 public Stringer(WingSection parent, int index) : this()
 {
     parent.Stringers.Insert(index, this);
 }
Beispiel #6
0
 public Stringer(WingSection parent) : this()
 {
     parent.Stringers.Add(this);
 }
Beispiel #7
0
 public TrainingEdge(WingSection parent) : this()
 {
     parent.TrainingEdge.Value = this;
 }
Beispiel #8
0
        private List <Pos> HalfShape(List <Pos> shape, PriorityQueue <double, Stringer> stringers, double plankPos, AirfoilSide side)
        {
            var result = new List <Pos>();

            WingSection  partWing     = Parent.Value as WingSection;
            Plank        plank        = partWing.Plank.Value as Plank;
            TrainingEdge trainingEdge = partWing.TrainingEdge.Value as TrainingEdge;
            RibCap       ribCap       = RibCap.Value as RibCap;

            double endPos = Chord.Value - trainingEdge.TrainlingEdgeLength.Value;

            result.Add(new Pos(endPos, 0));
            //PlankとTrainingEdgeの位置をマークする
            for (int i = 0; i < shape.Count - 1; i++)
            {
                if (shape[i].x > endPos &&
                    endPos > shape[i + 1].x)
                {
                    Pos mark = new Pos(
                        endPos,
                        Cal.Lerp(shape[i], shape[i + 1], endPos)
                        );
                    result.Add(mark);
                }
                if (shape[i].x > plankPos * Chord.Value &&
                    plankPos * Chord.Value > shape[i + 1].x)
                {
                    Pos mark = new Pos(
                        plankPos * Chord.Value,
                        Cal.Lerp(shape[i], shape[i + 1], plankPos * Chord.Value)
                        );
                    shape.Insert(i + 1, mark);
                    break;
                }
            }

            double pos_x   = endPos;
            double reverse = (side == AirfoilSide.Upper) ? 1 : -1;

            for (int i = 1; i < shape.Count - 1; i++)
            {
                if (pos_x < shape[i].x)
                {
                    continue;
                }

                if (pos_x >= plankPos * Chord.Value)
                {
                    Pos mark = shape[i]
                               + reverse * ribCap.RibCapThin.Value * shape[i - 1].NormalUnitVector(shape[i + 1]);
                    result.Add(mark);
                }
                if (pos_x <= plankPos * Chord.Value)
                {
                    Pos mark = shape[i]
                               + reverse * plank.PlankThin.Value * shape[i - 1].NormalUnitVector(shape[i + 1]);
                    result.Add(mark);
                }

                pos_x = shape[i].x;
                while (stringers.Count() > 0 && stringers.PeekKey() > shape[i + 1].x)
                {
                    Stringer stringer  = stringers.Take();
                    double   initDepth = (stringer.StringerPos.Value <= plankPos) ?
                                         plank.PlankThin.Value : ribCap.RibCapThin.Value;

                    //1点目、ストリンガーのx座標まで移動してマークする
                    Pos mark = new Pos(
                        stringer.StringerPos.Value * Chord.Value,
                        Cal.Lerp(shape[i], shape[i + 1], stringer.StringerPos.Value * Chord.Value),
                        0
                        ) + reverse * initDepth * shape[i].NormalUnitVector(shape[i + 1]);

                    //2点目
                    Pos digDepth = mark
                                   + reverse * stringer.StringerHeight.Value * shape[i].NormalUnitVector(shape[i + 1]);

                    Pos forward = digDepth
                                  + stringer.StringerWidth.Value * shape[i].DirectionUnitVector(shape[i + 1]);

                    Pos merge = forward
                                - reverse * stringer.StringerHeight.Value * shape[i].NormalUnitVector(shape[i + 1]);
                    pos_x = (merge - reverse * initDepth * shape[i].NormalUnitVector(shape[i + 1])).x;

                    result.Add(mark);
                    result.Add(digDepth);
                    result.Add(forward);
                    result.Add(merge);
                }
            }

            result.Add(new Pos(plank.PlankThin.Value, 0));
            return(result);
        }