Beispiel #1
0
        /// <summary>
        ///     TODO
        /// </summary>
        /// <param name="vtx"></param>
        /// <param name="owner"></param>
        /// <returns></returns>
        private List <EdgeExt> GetEdges(Vertex vtx, BoundaryLoop owner)
        {
            var eList = new List <EdgeExt>();

            try
            {
                foreach (var edge in vtx.Edges)
                {
                    var eInfo = new EdgeExt(edge, vtx, owner);

                    if (eInfo.IsNull)
                    {
                        continue;
                    }

                    eList.Add(eInfo);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                MailAgent.Report(e.Message);
            }

            return(eList);
        }
Beispiel #2
0
        //TODO
        public VertExt(Vertex vtx, BoundaryLoop owner)
        {
            VertPoint   = vtx.Point;
            XEdge       = new EdgeExt();
            YEdge       = new EdgeExt();
            ZEdge       = new EdgeExt();
            Normal      = new Vector3d();
            _vertAngle  = 0.0;
            _rightAngle = false;
            _rightCs    = false;

            foreach (var eInfo in GetEdges(vtx, owner))
            {
                var sTang = eInfo.Tangent;

                if (sTang.Length < SettingsUser.TolPoint)
                {
                    continue;
                }

                if (eInfo.OnLoop)
                {
                    if (XEdge.IsNull)
                    {
                        XEdge = eInfo;
                    }
                    else if (XEdge.Length >= eInfo.Length)
                    {
                        YEdge = eInfo;
                    }
                    else
                    {
                        YEdge = XEdge;
                        XEdge = eInfo;
                    }

                    if (!Normal.IsLessThanTol())
                    {
                        continue;
                    }

                    Normal = eInfo.Normal;
                }
                else
                {
                    ZEdge = eInfo;
                }
            }

            if (XEdge.Length < SettingsUser.TolPoint)
            {
                return;
            }

            if (YEdge.Length > SettingsUser.TolPoint)
            {
                _vertAngle = XEdge.Tangent.GetAngleTo(YEdge.Tangent);
                if (_vertAngle <= SettingsInternal.TolVector * 10 ||
                    _vertAngle >= 3.14159265358979 - SettingsInternal.TolVector * 10)
                {
                    YEdge = new EdgeExt();
                }
                else
                {
                    if (SettingsUser.PrioritizeRightAngles)
                    {
                        _rightAngle = Math.Abs(_vertAngle - 1.5707963267949) < SettingsInternal.TolVector;
                    }

                    if (Normal.IsLessThanTol())
                    {
                        Normal = XEdge.Tangent.CrossProduct(YEdge.Tangent);
                    }
                }
            }

            if (ZEdge.Length < SettingsUser.TolPoint)
            {
                return;
            }

            if (!Normal.IsLessThanTol())
            {
                if (Normal.GetAngleTo(ZEdge.Tangent) > 1.5707963267949)
                {
                    Normal = Normal.Negate();
                }

                if (YEdge.Length > SettingsUser.TolPoint)
                {
                    _rightCs = YEdge.Tangent.GetAngleTo(Normal.CrossProduct(XEdge.Tangent)) <
                               1.5707963267949;
                }
            }
        }