예제 #1
0
            private VFLst m_vfLst;       //the list of virtual face containing this vvert

            #endregion "data"

            #region "public method"
            // public method

            public VVert(int rvidx)
            {
                m_rvLst       = new RVLst();
                m_veLst       = new VELst();
                m_activeVELst = new VELst();
                m_vfLst       = new VFLst();

                AddRVert(rvidx); //make sure we VVert is not empty
            }
예제 #2
0
 private bool _HasIntersect(VFLst lhs, VFLst rhs)
 {
     for (int i = 0; i < rhs.Count; ++i)
     {
         VFace vf = rhs[i];
         if (lhs.Contains(vf))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #3
0
        // "edge"

        #endregion "edge"

        #region "tri"
        // "tri"

        #endregion "tri"

        public void Clear()
        {
            if (m_Verts.Data.Count > 0)
            {
                RVLst emptyLst = new RVLst();
                m_Verts.SetData(emptyLst, true, "Clear selection");
                Dirty = true;//SetDirty
            }
            else if (m_Edges.Data.Count > 0)
            {
                VELst emptyLst = new VELst();
                m_Edges.SetData(emptyLst, true, "Clear selection");
                Dirty = true;//SetDirty
            }
            else if (m_Tris.Data.Count > 0)
            {
                VFLst emptyLst = new VFLst();
                m_Tris.SetData(emptyLst, true, "Clear selection");
                Dirty = true;//SetDirty
            }
        }
예제 #4
0
            /// <summary>
            /// rTriIdx might be degraded rtri, but we can get the VFace to which it belongs anyway
            /// </summary>
            public VFace GetVFaceFromRTri(int rTriIdx, RaycastHit hit)
            {
                VFace vf = null;

                if (m_VFaceCont.TryGetValue(rTriIdx, out vf))
                {
                    return(vf);
                }
                else
                {
                    Dbg.Assert(m_DegRTriCont.Contains(rTriIdx), "VMesh.GetVFaceFromRTri: not in m_VFaceCont or degradedTriCont!?");

                    m_tmpVVLst.Clear();
                    GetVVertsFromRTri(rTriIdx, m_tmpVVLst);

                    float minDist = float.MaxValue;
                    VVert retVV   = null;
                    for (int i = 0; i < m_tmpVVLst.Count; ++i)
                    {
                        VVert vv   = m_tmpVVLst[i];
                        float dist = Vector3.Distance(hit.point, vv.GetWorldPos());
                        if (dist < minDist)
                        {
                            minDist = dist;
                            retVV   = vv;
                        }
                    }

                    Dbg.Assert(retVV != null, "VMesh.GetVFaceFromRTri: no VVert for given rtri!? {0}", rTriIdx);

                    VFLst vfLst = retVV.GetAllVFaces();
                    Dbg.Assert(vfLst.Count > 0, "VMesh.GetVFaceFromRTri: the vvert has no VFace, {0}", retVV);

                    return(vfLst[0]);
                }
            }