Beispiel #1
0
 public XSection(XSection startingProfile)
 {
     Origin   = startingProfile.Origin;
     MeshSize = startingProfile.MeshSize;
     Width    = startingProfile.Width;
     foreach (var pt in startingProfile)
     {
         Add(new Vector2(pt.X, pt.Y));
     }
     SortByX();
 }
Beispiel #2
0
        public void AddProfile(XSection profile)
        {
            int maxCount = Math.Min(Count, profile.Count);

            if (profile.MeshSize > MeshSize)
            {
                var indexList = new List <int>();
                for (int i = 0; i < profile.Count - 1; i++)
                {
                    double x1 = profile[i].X;
                    double x2 = profile[i + 1].X;
                    double y1 = profile[i].Y;
                    double y2 = profile[i + 1].Y;
                    double m  = (y2 - y1) / (x2 - x1);
                    double x  = x1;
                    while (x < x2)
                    {
                        int j = GetIndex(x);
                        if (CheckIndex(j) && !indexList.Contains(j))
                        {
                            double y = (x - x1) * m + y1;
                            this[j].Y += y;
                            indexList.Add(j);
                        }
                        x += MeshSize;
                    }
                }
            }
            else
            {
                foreach (var pt in profile)
                {
                    int i = GetIndex(pt.X);
                    if (CheckIndex(i))
                    {
                        this[i].Y += pt.Y;
                    }
                }
            }
        }