Exemple #1
0
    bool CheckWithoutJobs(Connection c, List <Connection> foundC)
    {
        if (foundC.Count > 0)
        {
            foreach (Connection _c in foundC)
            {
                if (_c.Pln.Parent != null && RuleActive(_c, c))
                {
                    distAngle = Vector3.Distance(c.Pln.Origin, _c.Pln.Origin);
                    if (distAngle > lastDistAngle || distAngle > connectionThreshold)
                    {
                        continue;
                    }

                    angle      = AlignPlane.BuildAngle(c.Pln.ZVector, _c.Pln.ZVector, true);
                    distAngle += AngleTightening(angle);
                    if (distAngle > lastDistAngle || distAngle > connectionThreshold)
                    {
                        continue;
                    }

                    rot        = AlignPlane.BuildAngle(c.Pln.XVector, _c.Pln.XVector, false) * 10 * connectionThreshold;
                    distAngle += rot / 1000 * connectionThreshold;


                    if (distAngle < lastDistAngle && _c.CheckForRule(c) != -1)
                    {
                        closestConnection = _c;
                        bestOnPart        = c;
                        lastDistAngle     = distAngle;
                        if (lastDistAngle < connectionThreshold / 5)
                        {
                            return(true);
                        }
                    }
                }
            }
        }
        return(false);
    }
Exemple #2
0
    //methods
    #region
    private void CheckForCloseConnections()
    {
        distAngle     = 100;
        lastDistAngle = 1000;
        rot           = 1000;
        foreach (Connection c in connections)
        {
            foundC = ConnectionVoxelContainer.RevealConnections(c);

            if (foundC.Count > 0)
            {
                foreach (Connection _c in foundC)
                {
                    if (_c.Pln.Parent != null)
                    {
                        dist      = Vector3.Distance(c.Pln.Origin, _c.Pln.Origin);
                        angle     = AlignPlane.BuildAngle(c.Pln.LocalZVector, _c.Pln.LocalZVector, true);
                        rot       = AlignPlane.BuildAngle(c.Pln.XVector, _c.Pln.XVector, false) * 10 * connectionThreshold;
                        distAngle = dist + AngleTightening(angle) + rot / 1000 * connectionThreshold;

                        string grammer = _c.ConType + ">" + c.ConType;
                        if (distAngle < lastDistAngle && _c.CheckForRule(c) != -1 && RuleActive(grammer))
                        {
                            closestConnection = _c;
                            bestOnPart        = c;
                            lastDistAngle     = distAngle;
                            if (lastDistAngle < connectionThreshold / 5)
                            {
                                return;
                            }
                        }
                    }
                }
            }
        }
    }