Exemplo n.º 1
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan NoCornersPlan(StadiaParameters parameters)
        {
            TheatronPlan plan = new TheatronPlan();

            NoCornerPlanSetUp(ref plan, parameters.PitchLength, parameters.PitchWidth, parameters.EndBound, parameters.StructBayWidth, parameters.SideBound);
            return(plan);
        }
Exemplo n.º 2
0
        public static TheatronGeometry TheatronGeometry(TheatronPlan planFull, TheatronFullProfile profile, StadiaParameters sParams, List <ProfileParameters> pParams)
        {
            if (planFull == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create theatron geometry will a null theatron plan.");
                return(null);
            }

            if (profile == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create theatron geometry will a null profile.");
                return(null);
            }

            if (sParams == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create theatron geometry from a null set of stadia parameters.");
                return(null);
            }

            var theatron = CreateGeometry(planFull, profile, pParams, sParams.TypeOfBowl);

            CopyGeneratorBlocks(ref theatron, planFull, sParams.TypeOfBowl);

            return(theatron);
        }
Exemplo n.º 3
0
        public static TheatronPlan PlanGeometry(StadiaParameters parameters)
        {
            //assuming its a full stadium
            TheatronPlan planGeometry = new TheatronPlan();

            switch (parameters.TypeOfBowl)
            {
            case StadiaType.Circular:
                planGeometry = CircularPlan(parameters);
                break;

            case StadiaType.NoCorners:
                planGeometry = NoCornersPlan(parameters);
                break;

            case StadiaType.Orthogonal:
                planGeometry = OrthogonalPlan(parameters);
                break;

            case StadiaType.EightArc:
                planGeometry = EightArcPlan(parameters);
                break;

            case StadiaType.FourArc:
                planGeometry = FourArcPlan(parameters);
                break;
            }
            planGeometry.ActivityArea = parameters.ActivityArea;
            planGeometry.FocalCurve   = planGeometry.ActivityArea.PlayingArea;
            setPlanes(ref planGeometry);

            return(planGeometry);
        }
Exemplo n.º 4
0
        public static TheatronGeometry TheatronGeometry(TheatronPlan planPart, TheatronFullProfile profile, List <ProfileParameters> pParams)
        {
            if (planPart == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create theatron geometry will a null theatron plan.");
                return(null);
            }

            if (profile == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create theatron geometry will a null profile.");
                return(null);
            }

            if (pParams == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create theatron geometry from a null collection of profile parameters.");
                return(null);
            }

            var theatron = CreateGeometry(planPart, profile, pParams, StadiaType.Undefined);

            theatron.Tiers3d.ForEach(t => t.Generatorblocks.ForEach(g => { t.TierBlocks.Add(g); theatron.Audience.Add(g.Audience); }));
            return(theatron);
        }
Exemplo n.º 5
0
        public static TheatronGeometry TheatronGeometry(TheatronPlan planPart, TheatronFullProfile profile, List <ProfileParameters> pParams)
        {
            var theatron = CreateGeometry(planPart, profile, pParams, StadiaType.Undefined);

            theatron.Tiers3d.ForEach(t => t.Generatorblocks.ForEach(g => { t.TierBlocks.Add(g); theatron.Audience.Add(g.Audience); }));
            return(theatron);
        }
Exemplo n.º 6
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan CircularPlan(StadiaParameters parameters)
        {
            TheatronPlan plan = new TheatronPlan();

            CircularPlaneSetUp(ref plan, parameters.TheatronRadius, parameters.StructBayWidth);
            return(plan);
        }
Exemplo n.º 7
0
        public static TheatronGeometry TheatronGeometry(TheatronPlan planFull, TheatronFullProfile profile, StadiaParameters sParams, List <ProfileParameters> pParams)
        {
            var theatron = CreateGeometry(planFull, profile, pParams, sParams.TypeOfBowl);

            CopyGeneratorBlocks(ref theatron, planFull, sParams.TypeOfBowl);

            return(theatron);
        }
Exemplo n.º 8
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan OrthogonalPlan(StadiaParameters parameters)
        {
            TheatronPlan plan = new TheatronPlan();

            orthoPlanSetUp(ref plan, parameters.PitchLength, parameters.PitchWidth, parameters.EndBound, parameters.SideBound,
                           parameters.CornerRadius, parameters.StructBayWidth, parameters.NumCornerBays);
            return(plan);
        }
Exemplo n.º 9
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan EightArcPlan(StadiaParameters parameters)
        {
            TheatronPlan plan = new TheatronPlan();

            RadialPlanSetUp(ref plan, parameters.PitchLength, parameters.PitchWidth, parameters.SideBound, parameters.SideRadius,
                            parameters.EndBound, parameters.EndRadius, parameters.CornerRadius, parameters.NumCornerBays, parameters.StructBayWidth,
                            parameters.CornerFraction);
            return(plan);
        }
Exemplo n.º 10
0
 /***************************************************/
 /**** Private Methods                           ****/
 /***************************************************/
 private static void setPlanes(ref TheatronPlan planGeometry)
 {
     planGeometry.TheatronFront   = setFront(planGeometry.SectionOrigins);
     planGeometry.VomitoryOrigins = setVomitories(planGeometry.SectionOrigins);
     planGeometry.CombinedOrigins = combinedPlanes(planGeometry.SectionOrigins, planGeometry.VomitoryOrigins);
     if (planGeometry.FocalCurve != null)
     {
         findClosestSection(ref planGeometry);
     }
 }
Exemplo n.º 11
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        private static TheatronGeometry CreateGeometry(TheatronPlan plan, TheatronFullProfile profile, List <ProfileParameters> pParams, StadiaType stadiaType)
        {
            var theatron = new TheatronGeometry();

            theatron.TotalTiers = profile.MappedProfiles.Count;
            SetGeneratorblocks(ref theatron, profile, plan, stadiaType, pParams);
            SetFloorMeshes(ref theatron, pParams);
            SetGeneratorEyes(ref theatron);

            return(theatron);
        }
Exemplo n.º 12
0
        public static TheatronPlan PlanGeometry(List <ProfileOrigin> structuralSections, Polyline focalPolyline)
        {
            var planGeometry = new TheatronPlan
            {
                SectionOrigins = structuralSections,

                FocalCurve = focalPolyline,
            };

            planGeometry.SectionOrigins.ForEach(x => planGeometry.StructBayType.Add(BayType.Undefined));
            setPlanes(ref planGeometry);
            return(planGeometry);
        }
Exemplo n.º 13
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan NoCornersPlan(StadiaParameters parameters)
        {
            if (parameters == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a no corners plan from a null set of stadia parameters.");
                return(null);
            }

            TheatronPlan plan = new TheatronPlan();

            NoCornerPlanSetUp(ref plan, parameters.PitchLength, parameters.PitchWidth, parameters.EndBound, parameters.StructBayWidth, parameters.SideBound);
            return(plan);
        }
Exemplo n.º 14
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan CircularPlan(StadiaParameters parameters)
        {
            if (parameters == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a theatron plan from a null set of stadia parameters.");
                return(null);
            }

            TheatronPlan plan = new TheatronPlan();

            CircularPlaneSetUp(ref plan, parameters.TheatronRadius, parameters.StructBayWidth);
            return(plan);
        }
Exemplo n.º 15
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static TheatronPlan EightArcPlan(StadiaParameters parameters)
        {
            if (parameters == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create an eight arc plan from a null set of stadia parameters.");
                return(null);
            }

            TheatronPlan plan = new TheatronPlan();

            RadialPlanSetUp(ref plan, parameters.PitchLength, parameters.PitchWidth, parameters.SideBound, parameters.SideRadius,
                            parameters.EndBound, parameters.EndRadius, parameters.CornerRadius, parameters.NumCornerBays, parameters.StructBayWidth,
                            parameters.CornerFraction);
            return(plan);
        }
Exemplo n.º 16
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private static void CircularPlaneSetUp(ref TheatronPlan plan, double radius, double structBayW)
        {
            plan.SectionOrigins = new List <ProfileOrigin>();

            int    numBays      = (int)(Math.Floor(Math.PI * radius * 2 / structBayW));
            double theta        = 2 * Math.PI / numBays;
            bool   halfbayStart = false;

            plan.SectionOrigins = ArcSweepBay(0, 0, theta, 0, radius, numBays, halfbayStart, 1.0);
            BayType bayType = BayType.Side;

            for (int i = 0; i < plan.SectionOrigins.Count; i++)
            {
                plan.StructBayType.Add(bayType);
            }
        }
Exemplo n.º 17
0
        /***************************************************/


        private static void CopyGeneratorBlocks(ref TheatronGeometry theatron, TheatronPlan bp, StadiaType stadiatype)
        {
            for (int i = 0; i < theatron.TotalTiers; i++)
            {
                BayType current, next;
                int cornerCount = -1;
                for (int j = 0; j < bp.SectionOrigins.Count; j++)
                {
                    current = bp.StructBayType[j];
                    if (j == bp.SectionOrigins.Count - 1)
                    {
                        next = bp.StructBayType[0];
                    }
                    else
                    {
                        next = bp.StructBayType[j + 1];
                    }
                    if (stadiatype == StadiaType.NoCorners && current != next)
                    {
                        continue;                                                       //no corner bowl corner position
                    }
                    SeatingBlockType bt = DetermineBlockToCopy(current, next, stadiatype, cornerCount);

                    if (current == BayType.Corner)
                    {
                        cornerCount++;
                    }
                    else
                    {
                        cornerCount = -1;
                    }

                    SeatingBlock blockToCopy = theatron.Tiers3d[i].Generatorblocks.Find(b => b.TypeOfSeatingBlock == bt).DeepClone();
                    double angle             = Geometry.Query.Angle(blockToCopy.Start.Direction, bp.SectionOrigins[j].Direction, Plane.XY);
                    SeatingBlock copy        = TransformSeatingBlock(blockToCopy, blockToCopy.Start.Origin, bp.SectionOrigins[j].Origin, angle);
                    theatron.Tiers3d[i].TierBlocks.Add(copy);
                    theatron.Audience.Add(copy.Audience);
                }
            }
        }
Exemplo n.º 18
0
        public static TheatronPlan PlanGeometry(StadiaParameters parameters)
        {
            if (parameters == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a theatron plan from a null set of stadia parameters.");
                return(null);
            }

            //assuming its a full stadium
            TheatronPlan planGeometry = new TheatronPlan();

            switch (parameters.TypeOfBowl)
            {
            case StadiaType.Circular:
                planGeometry = CircularPlan(parameters);
                break;

            case StadiaType.NoCorners:
                planGeometry = NoCornersPlan(parameters);
                break;

            case StadiaType.Orthogonal:
                planGeometry = OrthogonalPlan(parameters);
                break;

            case StadiaType.EightArc:
                planGeometry = EightArcPlan(parameters);
                break;

            case StadiaType.FourArc:
                planGeometry = FourArcPlan(parameters);
                break;
            }
            planGeometry.ActivityArea = parameters.ActivityArea;
            planGeometry.FocalCurve   = planGeometry.ActivityArea.PlayingArea;
            SetPlanes(ref planGeometry);

            return(planGeometry);
        }
Exemplo n.º 19
0
        public static TheatronPlan PlanGeometry(List <ProfileOrigin> structuralSections, Polyline focalPolyline)
        {
            if (structuralSections == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a theatron plan from a null collection of structural sections.");
                return(null);
            }

            if (focalPolyline == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a theatron plan from a null focal polyline.");
                return(null);
            }

            var planGeometry = new TheatronPlan
            {
                SectionOrigins = structuralSections,
                FocalCurve     = focalPolyline,
            };

            planGeometry.SectionOrigins.ForEach(x => planGeometry.StructBayType.Add(BayType.Undefined));
            SetPlanes(ref planGeometry);
            return(planGeometry);
        }
Exemplo n.º 20
0
        /***************************************************/
        private static void findClosestSection(ref TheatronPlan plan)
        {
            //this needs to be implmented on ICurve as the focal curve
            double shortestDist = double.PositiveInfinity;

            List <Point> allFocalPoints = new List <Point>();
            int          index          = 0;
            Point        closestP       = new Point();

            for (int i = 0; i < plan.VomitoryOrigins.Count; i++)
            {
                var    p    = Geometry.Query.ClosestPoint(plan.FocalCurve, plan.VomitoryOrigins[i].Origin);
                double dist = Geometry.Query.Distance(p, plan.VomitoryOrigins[i].Origin);
                if (dist < shortestDist)
                {
                    closestP     = p;
                    shortestDist = dist;
                    index        = i;
                }
            }
            plan.CValueFocalPoint           = closestP;
            plan.MinDistToFocalCurve        = shortestDist;
            plan.SectionClosestToFocalCurve = plan.VomitoryOrigins[index];
        }
Exemplo n.º 21
0
        /***************************************************/
        private static void SetGeneratorblocks(ref TheatronGeometry theatronGeom, TheatronFullProfile fullprofile, TheatronPlan theatronPlan, StadiaType stadiatype, List <ProfileParameters> profileParameters)
        {
            //this defines the geometry of the seating blocks from which all others are created

            TierProfile tierToMap;

            for (int i = 0; i < theatronGeom.TotalTiers; i++)
            {
                tierToMap = fullprofile.BaseTierProfiles[i];
                theatronGeom.Tiers3d.Add(new Tier());
                var SectionBlock = GetBlockStartIndexes(theatronPlan, stadiatype);
                foreach (var pair in SectionBlock)
                {
                    int index = pair.Key;
                    SeatingBlockType blockType = pair.Value;

                    var block = SeatingBlock(theatronPlan.SectionOrigins[index], theatronPlan.VomitoryOrigins[index],
                                             theatronPlan.SectionOrigins[index + 1], blockType, profileParameters[i].SeatWidth, profileParameters[i].VomitoryParameters.VomitoryWidth);

                    theatronGeom.Tiers3d[i].Generatorblocks.Add(block);
                    if (block.TypeOfSeatingBlock == SeatingBlockType.Transition1 || block.TypeOfSeatingBlock == SeatingBlockType.Transition2)
                    {
                        //cannot use vomitory location to define profile scaling
                        SetTransitionProfiles(ref block, tierToMap, fullprofile.FullProfileOrigin, theatronPlan.VomitoryOrigins[index - 1], theatronPlan.VomitoryOrigins[index + 1]);
                    }
                    else
                    {
                        SetBlockProfiles(ref block, tierToMap, fullprofile.FullProfileOrigin);
                    }
                }
                if (stadiatype == StadiaType.EightArc || stadiatype == StadiaType.Orthogonal)
                {
                    SetOtherBlockTypes(ref theatronGeom, i, fullprofile);//only needed for radial and othogonal
                }
            }
        }
Exemplo n.º 22
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        private static void orthoPlanSetUp(ref TheatronPlan plan, double length, double width, double endBound, double sideBound, double cornerR, double structBayW, int nCornerBays)
        {
            int nSideBays = (int)(Math.Floor(((length + endBound) / 2 - cornerR) / structBayW) * 2);
            int nEndBays  = (int)(Math.Floor(((width + sideBound) / 2 - cornerR) / structBayW) * 2);

            plan.SectionOrigins = new List <ProfileOrigin>();

            double        cornA = Math.PI / 2 / (nCornerBays + 1);
            double        trueR = cornerR / Math.Cos(cornA / 2);
            double        xMin;
            double        yMin;
            double        oX, oY, dX, dY;
            int           count      = 0;
            Point         origin     = new Point();
            Vector        xdir       = new Vector();
            Vector        ydir       = Vector.ZAxis;
            Vector        normal     = new Vector();
            ProfileOrigin tempOrigin = new ProfileOrigin();
            BayType       bayType    = 0; //0 = side, 1= end, 2 =corner

            for (int i = 0; i < 8; i++)
            {
                if (i == 0 || i == 4)//side bay
                {
                    bayType = 0;
                    for (int d = 0; d <= nSideBays; d++)
                    {
                        plan.StructBayType.Add(bayType);
                        if (i == 0)//right side
                        {
                            yMin = (nSideBays * structBayW) / -2;
                            //origin xyz
                            oX = ((width + sideBound) / 2);
                            oY = yMin + (structBayW * d);
                            dX = 1;
                            dY = 0;
                        }
                        else//left side
                        {
                            yMin = (nSideBays * structBayW) / 2;
                            //origin xyz
                            oX = -((width + sideBound) / 2);
                            oY = yMin - (structBayW * d);
                            dX = -1;
                            dY = 0;
                        }
                        origin     = Geometry.Create.Point(oX, oY, 0);
                        xdir       = Geometry.Create.Vector(dX, dY, 0);
                        tempOrigin = Create.ProfileOrigin(origin, xdir);
                        plan.SectionOrigins.Add(tempOrigin);
                        count++;
                    }
                }
                else
                {
                    if (i == 2 || i == 6)//end bay
                    {
                        bayType = BayType.End;
                        xMin    = (nEndBays * structBayW) / 2;
                        //
                        for (int d = 0; d <= nEndBays; d++)
                        {
                            plan.StructBayType.Add(bayType);
                            if (i == 2)// northEnd
                            {
                                //origin xyz
                                oX = xMin - (structBayW * d);
                                oY = ((length + endBound) / 2);
                                dX = 0;
                                dY = 1;
                            }
                            else
                            {
                                //origin xyz
                                oX = -xMin + (structBayW * d);
                                oY = -((length + endBound) / 2);

                                dX = 0;
                                dY = -1;
                            }
                            origin     = Geometry.Create.Point(oX, oY, 0);
                            xdir       = Geometry.Create.Vector(dX, dY, 0);
                            tempOrigin = Create.ProfileOrigin(origin, xdir);
                            plan.SectionOrigins.Add(tempOrigin);
                            count++;
                        }
                    }
                    else//corners
                    {
                        //local centres cs at fillets
                        bayType = BayType.Corner;
                        double centreX    = (width + sideBound) / 2 - cornerR;
                        double centreY    = (length + endBound) / 2 - cornerR;
                        double startAngle = 0;
                        if (i == 1) //NE++
                        {
                        }
                        if (i == 3) //NW-+
                        {
                            centreX    = -centreX;
                            startAngle = Math.PI / 2;
                        }
                        if (i == 5) //SW--
                        {
                            centreY    = -centreY;
                            centreX    = -centreX;
                            startAngle = Math.PI;
                        }
                        if (i == 7) //SE+-
                        {
                            centreY    = -1 * centreY;
                            startAngle = Math.PI * 1.5;
                        }

                        //
                        for (int d = 0; d <= nCornerBays; d++)
                        {
                            plan.StructBayType.Add(bayType);
                            if (d == 0)//half bay on first
                            {
                                oX = centreX + trueR * Math.Cos(startAngle + cornA / 2);
                                oY = centreY + trueR * Math.Sin(startAngle + cornA / 2);
                                dX = trueR * Math.Cos(startAngle + cornA / 2);
                                dY = trueR * Math.Sin(startAngle + cornA / 2);
                            }
                            else
                            {
                                oX = centreX + trueR * Math.Cos(startAngle + (cornA * d + cornA / 2));
                                oY = centreY + trueR * Math.Sin(startAngle + (cornA * d + cornA / 2));
                                dX = trueR * Math.Cos(startAngle + (cornA * d + cornA / 2));
                                dY = trueR * Math.Sin(startAngle + (cornA * d + cornA / 2));
                            }
                            origin     = Geometry.Create.Point(oX, oY, 0);
                            xdir       = Geometry.Create.Vector(dX, dY, 0);
                            tempOrigin = Create.ProfileOrigin(origin, xdir);
                            plan.SectionOrigins.Add(tempOrigin);
                            count++;
                        }
                    }
                }
            }
        }
Exemplo n.º 23
0
        public static TheatronFullProfile TheatronFullProfile(List <ProfileParameters> parameters, TheatronPlan planGeometry)
        {
            if (parameters == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a theatron full profile from a null collection of profile parameters.");
                return(null);
            }

            if (planGeometry == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot create a theatron full profile from a null theatron plan.");
                return(null);
            }

            TheatronFullProfile fullProfile = new TheatronFullProfile();

            GenerateMapProfiles(ref fullProfile, parameters.DeepClone(), planGeometry.MinDistToFocalCurve, planGeometry.SectionClosestToFocalCurve);

            return(fullProfile);
        }
Exemplo n.º 24
0
        /***************************************************/

        private static Dictionary <int, SeatingBlockType> GetBlockStartIndexes(TheatronPlan bp, StadiaType bowltype)
        {
            //gets a dictionary where key is index of SectionOrigin and value is the SeatingBlockType
            Dictionary <int, SeatingBlockType> dict = new Dictionary <int, SeatingBlockType>();
            BayType current, next;

            if (bowltype == StadiaType.EightArc || bowltype == StadiaType.Orthogonal)
            {
                //radial and ortho
                for (int j = 0; j < bp.SectionOrigins.Count; j++)
                {
                    current = bp.StructBayType[j];
                    if (j == bp.SectionOrigins.Count - 1)
                    {
                        next = bp.StructBayType[0];
                    }
                    else
                    {
                        next = bp.StructBayType[j + 1];
                    }
                    if (!dict.ContainsValue(SeatingBlockType.Side))
                    {
                        if (current == 0 && next == 0)
                        {
                            dict.Add(j, SeatingBlockType.Side);                                                                       //side standard
                        }
                    }
                    if (!dict.ContainsValue(SeatingBlockType.End))
                    {
                        if (current == BayType.End && next == BayType.End)
                        {
                            dict.Add(j, SeatingBlockType.End);                                                                                          //end standard
                        }
                    }
                    if (!dict.ContainsValue(SeatingBlockType.Corner))
                    {
                        if (current == BayType.Corner && next == BayType.Corner)
                        {
                            dict.Add(j, SeatingBlockType.Corner);                                                                                                   //corner standard
                        }
                    }
                    if (!dict.ContainsValue(SeatingBlockType.Transition1))
                    {
                        if (current == 0 && next == BayType.Corner)
                        {
                            dict.Add(j, SeatingBlockType.Transition1);                                                                                           //side to corner transition
                        }
                    }
                    if (!dict.ContainsValue(SeatingBlockType.Transition2))
                    {
                        if (current == BayType.Corner && next == BayType.End)
                        {
                            dict.Add(j, SeatingBlockType.Transition2);                                                                                                     //corner to end transition
                        }
                    }
                }
            }
            if (bowltype == StadiaType.NoCorners)//no corner
            {
                for (int j = 0; j < bp.SectionOrigins.Count; j++)
                {
                    current = bp.StructBayType[j];
                    if (j == bp.SectionOrigins.Count - 1)
                    {
                        next = bp.StructBayType[0];
                    }
                    else
                    {
                        next = bp.StructBayType[j + 1];
                    }
                    if (!dict.ContainsValue(SeatingBlockType.Side))
                    {
                        if (current == 0 && next == 0)
                        {
                            dict.Add(j, SeatingBlockType.Side);                                                                       //side standard
                        }
                    }
                    if (!dict.ContainsValue(SeatingBlockType.End))
                    {
                        if (current == BayType.End && next == BayType.End)
                        {
                            dict.Add(j, SeatingBlockType.End);                                                                                          //end standard
                        }
                    }
                }
            }
            if (bowltype == StadiaType.Circular)    //circular
            {
                dict.Add(0, SeatingBlockType.Side); //side standard
            }
            if (bowltype == StadiaType.Undefined)
            {
                for (int j = 0; j < bp.SectionOrigins.Count - 1; j++)
                {
                    dict.Add(j, SeatingBlockType.Undefined);
                }
            }
            var sortedDict = dict.OrderBy(x => x.Value).ToDictionary(pair => pair.Key, pair => pair.Value);
            return(sortedDict);
        }
Exemplo n.º 25
0
        public static TheatronFullProfile TheatronFullProfile(List <ProfileParameters> parameters, TheatronPlan planGeometry)
        {
            TheatronFullProfile fullProfile = new TheatronFullProfile();

            GenerateMapProfiles(ref fullProfile, parameters.DeepClone(), planGeometry.MinDistToFocalCurve, planGeometry.SectionClosestToFocalCurve);

            return(fullProfile);
        }
Exemplo n.º 26
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        private static void RadialPlanSetUp(ref TheatronPlan plan, double length, double width, double sideBound, double sideRadius, double endBound, double endRadius, double cornerR, int nCornerBays, double structBayW, double cornerFraction)
        {
            plan.SectionOrigins = new List <ProfileOrigin>();

            int    count       = 0;
            double sidecentreX = width / 2 + sideBound - sideRadius;
            double sidecentreY = 0;
            double endcentreX  = 0;
            double endcentreY  = length / 2 + endBound - endRadius;
            Point  intersect   = IntersectCircles(sidecentreX, sidecentreY, sideRadius - cornerR, endcentreX, endcentreY, endRadius - cornerR);
            double centreX     = intersect.X;
            double centreY     = intersect.Y;

            double sweepAngleSide = 2 * Math.Atan(centreY / (centreX - sidecentreX));
            double sweepSideBay   = 2 * Math.Asin(structBayW / 2 / sideRadius);

            int nSideBays = (int)(Math.Floor(sweepAngleSide / sweepSideBay));

            double sweepAngleEnd = 2 * Math.Atan(centreX / (centreY - endcentreY));
            double sweepEndBay   = 2 * Math.Asin(structBayW / 2 / endRadius);
            int    nEndBays      = (int)(Math.Floor(sweepAngleEnd / sweepEndBay));


            Vector endArc  = Geometry.Create.Vector(centreX, centreY - endcentreY, 0);
            Vector sideArc = Geometry.Create.Vector(centreX - sidecentreX, centreY, 0);

            double  cornerSweep = Geometry.Query.Angle(sideArc, endArc);//*Math.PI/180;
            double  cornA = cornerSweep / (nCornerBays + 2 * cornerFraction);
            double  trueR = cornerR / Math.Cos(cornA / 2);
            double  theta = 1, startAngle = 1, radius = 1;
            int     numBays          = 1;
            bool    fractionbayStart = false;
            BayType bayType          = BayType.Side; //0 = side, 1= end, 2 =corner

            for (int i = 0; i < 8; i++)
            {
                switch (i)
                {
                case 0:    //side right
                    centreX          = sidecentreX;
                    centreY          = 0;
                    theta            = sweepSideBay;
                    numBays          = nSideBays;
                    startAngle       = (numBays * theta) / -2;
                    radius           = sideRadius;
                    fractionbayStart = false;
                    bayType          = BayType.Side;
                    break;

                case 1:    //top right corner
                    centreX          = intersect.X;
                    centreY          = intersect.Y;
                    theta            = cornA;
                    startAngle       = sweepAngleSide / 2;
                    radius           = cornerR;
                    numBays          = nCornerBays;
                    fractionbayStart = true;
                    bayType          = BayType.Corner;
                    break;

                case 2:    //north end
                    centreX          = 0;
                    centreY          = endcentreY;
                    theta            = sweepEndBay;
                    numBays          = nEndBays;
                    startAngle       = Math.PI / 2 - numBays * theta / 2;
                    radius           = endRadius;
                    fractionbayStart = false;
                    bayType          = BayType.End;
                    break;

                case 3:    //north west corner
                    centreX          = -intersect.X;
                    centreY          = intersect.Y;
                    theta            = cornA;
                    startAngle       = Math.PI / 2 + sweepAngleEnd / 2;
                    radius           = cornerR;
                    numBays          = nCornerBays;
                    fractionbayStart = true;
                    bayType          = BayType.Corner;
                    break;

                case 4:    //west side
                    centreX          = -sidecentreX;
                    centreY          = 0;
                    theta            = sweepSideBay;
                    numBays          = nSideBays;
                    startAngle       = Math.PI - (numBays * theta) / 2;
                    radius           = sideRadius;
                    fractionbayStart = false;
                    bayType          = BayType.Side;
                    break;

                case 5:    //south west conrer
                    centreX          = -intersect.X;
                    centreY          = -intersect.Y;
                    theta            = cornA;
                    startAngle       = Math.PI + sweepAngleSide / 2;
                    radius           = cornerR;
                    numBays          = nCornerBays;
                    fractionbayStart = true;
                    bayType          = BayType.Corner;
                    break;

                case 6:    // south end
                    centreX          = 0;
                    centreY          = -endcentreY;
                    theta            = sweepEndBay;
                    numBays          = nEndBays;
                    startAngle       = 1.5 * Math.PI - numBays * theta / 2;
                    radius           = endRadius;
                    fractionbayStart = false;
                    bayType          = BayType.End;
                    break;

                case 7:    //south east corner
                    centreX          = intersect.X;
                    centreY          = -intersect.Y;
                    theta            = cornA;
                    startAngle       = 1.5 * Math.PI + sweepAngleEnd / 2;
                    radius           = cornerR;
                    numBays          = nCornerBays;
                    fractionbayStart = true;
                    bayType          = BayType.Corner;
                    break;
                }
                List <ProfileOrigin> partPlanes = ArcSweepBay(centreX, centreY, theta, startAngle, radius, numBays, fractionbayStart, cornerFraction);
                for (int p = 0; p < partPlanes.Count; p++)
                {
                    plan.SectionOrigins.Add(partPlanes[p]);

                    plan.StructBayType.Add(bayType);
                    count++;
                }
            }
        }
Exemplo n.º 27
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        private static void NoCornerPlanSetUp(ref TheatronPlan plan, double length, double width, double endBound, double structBayW, double sideBound)
        {
            int nSideBays = (int)(Math.Floor(((length + endBound) / 2) / structBayW) * 2);
            int nEndBays  = (int)(Math.Floor(((width + sideBound) / 2) / structBayW) * 2);

            plan.SectionOrigins = new List <ProfileOrigin>();

            double actualBayW;
            double xMin;
            double yMin;
            double oX, oY, dX, dY;
            int    count  = 0;
            Point  origin = new Point();
            Vector xdir   = new Vector();

            ProfileOrigin tempPlane = new ProfileOrigin();
            BayType       bayType   = BayType.Side;//0 = side, 1= end, 2 =corner

            for (int i = 0; i < 4; i++)
            {
                if (i % 2 == 0)//side bay
                {
                    bayType    = 0;
                    actualBayW = (length + endBound) / nSideBays;
                    for (int d = 0; d <= nSideBays; d++)
                    {
                        plan.StructBayType.Add(bayType);
                        if (i == 0)//right side
                        {
                            yMin = (nSideBays * actualBayW) / -2;
                            //origin xyz
                            oX = ((width + sideBound) / 2);
                            oY = yMin + (actualBayW * d);
                            dX = 1;
                            dY = 0;
                        }
                        else//left side
                        {
                            yMin = (nSideBays * actualBayW) / 2;
                            //origin xyz
                            oX = -((width + sideBound) / 2);
                            oY = yMin - (actualBayW * d);
                            dX = -1;
                            dY = 0;
                        }
                        origin    = Geometry.Create.Point(oX, oY, 0);
                        xdir      = Geometry.Create.Vector(dX, dY, 0);
                        tempPlane = Create.ProfileOrigin(origin, xdir);
                        plan.SectionOrigins.Add(tempPlane);
                        count++;
                    }
                }

                else
                {
                    bayType    = BayType.End;
                    actualBayW = (width + sideBound) / nEndBays;
                    xMin       = (nEndBays * actualBayW) / 2;
                    //
                    for (int d = 0; d <= nEndBays; d++)
                    {
                        plan.StructBayType.Add(bayType);
                        if (i == 1)// northEnd
                        {
                            //origin xyz
                            oX = xMin - (actualBayW * d);
                            oY = ((length + endBound) / 2);

                            dX = 0;
                            dY = 1;// 0;
                        }
                        else
                        {
                            //origin xyz
                            oX = -xMin + (actualBayW * d);
                            oY = -((length + endBound) / 2);
                            dX = 0;
                            dY = -1;
                        }
                        origin    = Geometry.Create.Point(oX, oY, 0);
                        xdir      = Geometry.Create.Vector(dX, dY, 0);
                        tempPlane = Create.ProfileOrigin(origin, xdir);
                        plan.SectionOrigins.Add(tempPlane);
                        count++;
                    }
                }
            }
        }
Exemplo n.º 28
0
 public TheatronGeometry TestPartialBowl(TheatronPlan plan, TheatronFullProfile profile, List <ProfileParameters> pParams)
 {
     //profileorigins are taken from a full bowl layout here
     return(BH.Engine.Architecture.Theatron.Create.TheatronGeometry(plan.SectionOrigins.GetRange(0, 10), profile, pParams));
 }