Esempio n. 1
0
 public void Load(ConfigNode node)
 {
     ConfigNode[] crossSections = node.GetNodes("CROSS_SECTION");
     for (int i = 0; i < crossSections.Length; i++)
     {
         CrossSection section = new CrossSection();
         section.Load(crossSections[i]);
         this.AddCrossSection(section);
     }
 }
Esempio n. 2
0
        public void AddCrossSection(CrossSection section)
        {
            crossSectionsTree.Insert(section);

            if (section.station > maxStation)
            {
                maxStation = section.station;
            }
            else if (section.station < minStation)
            {
                minStation = section.station;
            }

            crossSectionList = null;
        }
Esempio n. 3
0
        public CrossSection GetCrossSectionAtStation(double station)
        {
            CrossSection section = new CrossSection();

            section.station = station;

            CrossSection lowerSection, upperSection;

            crossSectionsTree.FindNearestData(section, out lowerSection, out upperSection);

            section.centroid.x   = FARMathUtil.Lerp(lowerSection.station, upperSection.station, lowerSection.centroid.x, upperSection.centroid.x, station);
            section.centroid.y   = FARMathUtil.Lerp(lowerSection.station, upperSection.station, lowerSection.centroid.y, upperSection.centroid.y, station);
            section.lengths.x    = FARMathUtil.Lerp(lowerSection.station, upperSection.station, lowerSection.lengths.x, upperSection.lengths.x, station);
            section.lengths.y    = FARMathUtil.Lerp(lowerSection.station, upperSection.station, lowerSection.lengths.y, upperSection.lengths.y, station);
            section.areaFraction = FARMathUtil.Lerp(lowerSection.station, upperSection.station, lowerSection.areaFraction, upperSection.areaFraction, station);

            return(section);
        }