Example #1
0
            private static List <Polyline> RemoveOverlapSeg(Polyline trimmee, Polyline trimmer)
            {
                List <Polyline> trimmed      = new List <Polyline>();
                List <Curve>    memberToJoin = new List <Curve>();

                Curve        trimmerCrv = trimmer.ToNurbsCurve();
                List <Curve> trimmeeSeg = trimmee.ToNurbsCurve().DuplicateSegments().ToList();

                foreach (Curve i in trimmeeSeg)
                {
                    if (!CurveTools.IsOverlap(i, trimmerCrv, 0.005))
                    {
                        memberToJoin.Add(i);
                    }
                }

                List <Curve> joinedCrvs = Curve.JoinCurves(memberToJoin, 0.5, true).ToList();

                foreach (Curve i in joinedCrvs)
                {
                    trimmed.Add(CurveTools.ToPolyline(i));
                }

                if (trimmed.Count == 0)
                {
                    return(new List <Polyline>());
                }

                return(trimmed);
            }
Example #2
0
            private static List <List <RoomLine> > LabelUnionSeg(List <Polyline> trimmedUnion, Core core, List <Polyline> corridor)
            {
                List <List <RoomLine> > labeledCore = new List <List <RoomLine> >();

                //label decider setting
                Curve        coreCrv     = core.Outline.ToNurbsCurve();
                List <Curve> corridorCrv = new List <Curve>();

                corridorCrv.Add(core.Landing.ToNurbsCurve());
                foreach (Polyline i in corridor)
                {
                    corridorCrv.Add(i.ToNurbsCurve());
                }

                //label
                foreach (Polyline i in trimmedUnion)
                {
                    List <Line>     unlabeledSeg      = i.GetSegments().ToList();
                    List <RoomLine> currentPolyLabels = new List <RoomLine>();

                    foreach (Line j in unlabeledSeg)
                    {
                        Curve jCrv = j.ToNurbsCurve();

                        if (CurveTools.IsOverlap(jCrv, corridorCrv, 0.005))
                        {
                            currentPolyLabels.Add(new RoomLine(j, LineType.Corridor));
                        }
                        else if (CurveTools.IsOverlap(jCrv, coreCrv, 0.005))
                        {
                            currentPolyLabels.Add(new RoomLine(j, LineType.Core));
                        }
                    }

                    labeledCore.Add(currentPolyLabels);
                }

                return(labeledCore);
            }