Exemple #1
0
        static SetOperation3D.IntersectResult StartTrace(Solid Solid1, Solid Solid2)
        {
            SetOperation3D.IntersectResult R = null;

            for (int i = 0; i < Solid1.FaceList.Count; i++)
            {
                for (int j = 0; j < Solid2.FaceList.Count; j++)
                {
                    CrossFaceListInfo CI = null;
                    if (Solid1.FaceList[i].Tag != null)
                    {
                        CI = (Solid1.FaceList[i].Tag as Hashtable)[Solid2.FaceList[j]] as CrossFaceListInfo;
                    }


                    if ((CI != null) &&
                        (CI.SortedParams.Count >= 4) &&
                        (System.Math.Abs(CI.SortedParams[1].Param2 - CI.SortedParams[2].Param2) > 0.000002) &&
                        (System.Math.Abs(CI.SortedParams[2].Param2 - CI.SortedParams[3].Param2) > 0.000002)
                        )
                    {
                        R = new SetOperation3D.IntersectResult();
                        if ((int)CI.SortedParams[1].Tag == 1)
                        {
                            R.Edge1ParamFrom = CI.SortedParams[1].Param1;
                        }
                        else
                        {
                            R.Edge2ParamFrom = CI.SortedParams[1].Param1;
                        }

                        if ((int)CI.SortedParams[2].Tag == 1)
                        {
                            R.Edge1ParamTo = CI.SortedParams[2].Param1;
                        }
                        else
                        {
                            R.Edge2ParamTo = CI.SortedParams[2].Param1;
                        }


                        R.SortedParams = CI.SortedParams;
                        R.Face1        = Solid1.FaceList[i] as Face;
                        R.Face2        = Solid2.FaceList[j] as Face;

                        R.TraceInfo = new TraceInfo(1, R.SortedParams, R.Face1, R.Face2);
                        return(R);
                    }
                }
            }
            return(null);
        }
Exemple #2
0
        static CrossFaceListInfo GetCrossInfo(Face Face1, Face Face2)
        {
            if (Face1 == null)
            {
                return(null);
            }
            if (Face2 == null)
            {
                return(null);
            }
            if (Face1.Tag as Hashtable == null)
            {
                return(null);
            }
            CrossFaceListInfo CI = ((Face1.Tag as Hashtable)[Face2] as CrossFaceListInfo);

            return(CI);
        }
Exemple #3
0
        /// <summary>
        /// intersect two <see cref="Face"/>s and writes a <see cref="CrossFaceListInfo"/> in a Hashtable in <see cref="Face.Tag"/> of <b>Face1</b> with <b>key</b>= <b>Face2</b>.
        /// </summary>
        /// <param name="Face1">First <see cref="Face"/></param>
        /// <param name="Face2">Second <see cref="Face"/></param>
        /// <returns><see cref="CrossFaceListInfo"/> of the cross between <b>Face1</b> and <b>Face2</b>.</returns>
        public static CrossFaceListInfo IntersectFaces(Face Face1, Face Face2)
        {
            // in the Tag of Face1 wil be puted a Hashtable. who contains as Key Fac2 and content crossfaceListInfo
            if (Face1.Tag == null)
            {
                Face1.Tag = new Hashtable();
            }
            CrossFaceListInfo CI = new CrossFaceListInfo(Face2, null);

            if (!(Face1.Tag as Hashtable).Contains(Face2))
            {
                (Face1.Tag as Hashtable).Add(Face2, CI);
            }
            CI.SortedParams = CreateSortedParams(Face1, Face2);

            if (CI.SortedParams == null)
            {
                CI.SortedParams = new List <CrossItem>();
            }
            return(CI);
        }