示例#1
0
        public void MakeShellsFromDiffs(List <TelescopeParameters> diffs)
        {
            initNumShells = diffs.Count;
            parameters    = diffs;
            shells        = new List <TelescopeShell>();
            initialDirection.Normalize();

            // Compute the absolute parameter values from the list of diffs we are given.
            List <TelescopeParameters> concreteParams = new List <TelescopeParameters>();
            TelescopeParameters        theParams      = diffs[0];

            concreteParams.Add(new TelescopeParameters(diffs[0]));
            for (int i = 1; i < initNumShells; i++)
            {
                if (diffs[i].radius > -wallThickness)
                {
                    diffs[i].radius = -wallThickness;
                }
                theParams         = theParams + diffs[i];
                theParams.length -= 0; // wallThickness;
                //theParams.radius -= wallThickness;
                concreteParams.Add(theParams);
            }

            // Make sure the final shell is greater than the minimum possible width.
            if (concreteParams[concreteParams.Count - 1].radius < wallThickness)
            {
                concreteParams[concreteParams.Count - 1].radius = wallThickness;
            }

            // Make sure that all the shells fit inside each other.
            TelescopeUtils.growChainToFit(concreteParams);

            MakeShellsFromFinalList(concreteParams);
        }
示例#2
0
        public void MakeShellsFromConcrete(List <TelescopeParameters> concreteParams)
        {
            initNumShells = concreteParams.Count;
            shells        = new List <TelescopeShell>();
            initialDirection.Normalize();

            // Make sure that all the shells fit inside each other.
            TelescopeUtils.growChainToFit(concreteParams);

            MakeShellsFromFinalList(concreteParams);
        }
 public void ShrinkToFit()
 {
     if (selected)
     {
         TelescopeSegment           segment   = selected.containingSegment;
         List <TelescopeParameters> allParams = segment.getParamList();
         TelescopeUtils.growChainToFit(allParams, shrinkFit: true);
         segment.MakeAllShells(allParams);
         segment.SetShellExtensions(1);
         selected = null;
     }
 }