public bool define_B(G.Edge startEdge, G.Edge endEdge)
        {
            bool startSet = setEdges.Keys.Contains(startEdge);
            bool endSet   = setEdges.Keys.Contains(endEdge);

            double cover1 = _V_.X_CONCRETE_COVER_1;
            double cover2 = _V_.X_CONCRETE_COVER_1;

            double mainDist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
            double sideDist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;

            bool realCorner = G.Edge.haveSharedCorner(startEdge, endEdge);

            if (realCorner)
            {
                G.Corner cor = G.Edge.getSharedCorner(startEdge, endEdge);
                if (cor.Angle > Math.PI)
                {
                    return(false);
                }
            }

            if (startSet == true && endSet == true)
            {
                cover1 += _V_.Y_CONCRETE_COVER_DELTA;
                cover2 += _V_.Y_CONCRETE_COVER_DELTA;

                //mainDist == default
                //sideDist == default
            }
            else if (startSet == false && endSet == false)
            {
                double startLineLength = startEdge.Line.Length();
                double endLineLength   = endEdge.Line.Length();

                if (startLineLength > endLineLength)
                {
                    startSet = true;

                    cover1 += _V_.Y_CONCRETE_COVER_DELTA;
                    //cover2 == default

                    //mainDist == default
                    sideDist = endEdge.edgeOffset(cover1, cover1, cover2).Length();

                    if (endEdge.StartCorner.Angle > Math.PI)
                    {
                        sideDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                    }
                }
                else
                {
                    endSet = true;

                    //cover1 == default
                    cover2 += _V_.Y_CONCRETE_COVER_DELTA;

                    mainDist = startEdge.edgeOffset(cover1, cover1, cover2).Length();
                    //sideDist == default

                    if (startEdge.EndCorner.Angle > Math.PI)
                    {
                        mainDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                    }
                }

                if (startEdge.EndCorner.Angle > Math.PI)
                {
                    startLineLength += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }

                if (endEdge.StartCorner.Angle > Math.PI)
                {
                    endLineLength += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }
            }
            else if (startSet == false && endSet == true)
            {
                //cover1 == default
                cover2 += _V_.Y_CONCRETE_COVER_DELTA;

                mainDist = startEdge.edgeOffset(cover1, cover1, cover2).Length();
                //sideDist == default

                if (startEdge.EndCorner.Angle > Math.PI)
                {
                    mainDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }
            }
            else if (startSet == true && endSet == false)
            {
                cover1 += _V_.Y_CONCRETE_COVER_DELTA;
                //cover2 == defualt

                //mainDist == default
                sideDist = endEdge.edgeOffset(cover1, cover1, cover2).Length();

                if (endEdge.StartCorner.Angle > Math.PI)
                {
                    sideDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }
            }

            mainDist = Math.Max(mainDist, _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH);
            sideDist = Math.Max(sideDist, _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH);

            G.Corner sharedCorner = null;
            G.Point  IP           = getCornerPoint(startEdge, endEdge, cover1, cover2, ref sharedCorner);

            if (!realCorner)
            {
                if (startSet == false && endSet == true)
                {
                    G.Line  otherLine = startEdge.edgeOffset(cover1, cover1, cover2);
                    G.Point other     = IP.getClosePoint(otherLine.Start, otherLine.End);

                    double dist = other.distanceTo(IP);
                    mainDist += dist;
                }
                else if (startSet == true && endSet == false)
                {
                    G.Line  otherLine = endEdge.edgeOffset(cover1, cover1, cover2);
                    G.Point other     = IP.getClosePoint(otherLine.Start, otherLine.End);

                    double dist = other.distanceTo(IP);
                    sideDist += dist;
                }
            }

            G.Vector v1 = endEdge.Line.getOffsetVector();
            G.Vector v2 = startEdge.Line.getCoolVector(v1);

            G.Vector v3 = startEdge.Line.getOffsetVector();
            G.Vector v4 = endEdge.Line.getCoolVector(v3);

            G.Point mainEndPoint = IP.move(mainDist, v2);
            G.Point sidePoint    = IP.move(sideDist, v4);


            //A_handler_debug(IP, mainEndPoint);
            //A_handler_debug(sidePoint, IP);

            bool success = false;

            if (startSet == false)
            {
                success = B_vs_C_handler(IP, mainEndPoint, sidePoint, startEdge, sharedCorner);
            }
            else if (endSet == false)
            {
                success = B_vs_C_handler(IP, mainEndPoint, sidePoint, endEdge, sharedCorner);
            }
            else
            {
                success = B_vs_C_handler(IP, mainEndPoint, sidePoint, null, sharedCorner);
            }


            return(success);
        }
示例#2
0
        private G.Line trimLine_baseline(G.Line extendedLine, G.Line startLine, double offset, G.Edge e, ref G.Edge trimmer)
        {
            G.Line trimmedLine = extendedLine.Copy();

            foreach (G.Edge eg in allEdges)
            {
                if (eg.Line.getOffsetVector() == e.Line.getOffsetVector())
                {
                    continue;
                }
                if (e.StartCorner.getOtherEdge(e) == eg && e.StartCorner.Angle > Math.PI)
                {
                    continue;
                }
                if (e.EndCorner.getOtherEdge(e) == eg && e.EndCorner.Angle > Math.PI)
                {
                    continue;
                }
                if (trimmedLine.getDirectionVector() == eg.Line.getDirectionVector())
                {
                    continue;
                }
                if (trimmedLine.getDirectionVector() == (-1) * eg.Line.getDirectionVector())
                {
                    continue;
                }

                double o  = offset - _V_.X_TRIM_MINIMUM_DELTA;
                double so = _V_.X_CONCRETE_COVER_1 - _V_.X_TRIM_SIDE_MINIMUM_DELTA;

                if (e.StartCorner.getOtherEdge(e) == eg)
                {
                    o = _V_.X_CONCRETE_COVER_1 - _V_.X_TRIM_MINIMUM_DELTA;
                }
                ;
                if (e.EndCorner.getOtherEdge(e) == eg)
                {
                    o = _V_.X_CONCRETE_COVER_1 - _V_.X_TRIM_MINIMUM_DELTA;
                }
                ;

                G.Line offsetLine = eg.edgeTrimmer(o, so, so);

                if (G.Line.hasIntersection(trimmedLine, offsetLine))
                {
                    G.Point ip = G.Line.getIntersectionPoint(trimmedLine, offsetLine);

                    if (ip.distanceTo(extendedLine.Start) < ip.distanceTo(extendedLine.End))
                    {
                        trimmedLine = new G.Line(ip, trimmedLine.End);
                    }
                    else
                    {
                        trimmedLine = new G.Line(trimmedLine.Start, ip);
                    }

                    trimmer = eg;
                }
            }

            return(trimmedLine);
        }