Esempio n. 1
0
 public void UpdateLoop(EdgeLoop loop)
 {
     InputLoop    = loop;
     OutputLoop   = null;
     CurrentLoopE = new List <int>(loop.Edges);
     CurrentLoopV = new List <int>(loop.Vertices);
 }
Esempio n. 2
0
        public EdgeLoopRemesher(NGonsCore.geometry3Sharp.mesh.DMesh3 m, EdgeLoop loop) : base(m)
        {
            UpdateLoop(loop);

            EnableFlips = false;

            CustomSmoothF = loop_smooth_vertex;
        }
Esempio n. 3
0
 public EdgeLoop(EdgeLoop copy)
 {
     Mesh     = copy.Mesh;
     Vertices = new int[copy.Vertices.Length];
     Array.Copy(copy.Vertices, Vertices, Vertices.Length);
     Edges = new int[copy.Edges.Length];
     Array.Copy(copy.Edges, Edges, Edges.Length);
     BowtieVertices = new int[copy.BowtieVertices.Length];
     Array.Copy(copy.BowtieVertices, BowtieVertices, BowtieVertices.Length);
 }
Esempio n. 4
0
        // Check if Loop2 is the same set of positions on another mesh.
        // Does not require the indexing to be the same
        // Currently doesn't handle loop-reversal
        public bool IsSameLoop(EdgeLoop Loop2, bool bReverse2 = false, double tolerance = math.MathUtil.ZeroTolerance)
        {
            // find a duplicate starting vertex
            int N  = Vertices.Length;
            int N2 = Loop2.Vertices.Length;

            if (N != N2)
            {
                return(false);
            }

            NGonsCore.geometry3Sharp.mesh.DMesh3 Mesh2 = Loop2.Mesh;

            int start_i = 0, start_j = -1;

            // try to find a unique same-vertex on each loop. Do not
            // use vertices that have duplicate positions.
            bool bFoundGoodStart = false;

            while (!bFoundGoodStart && start_i < N)
            {
                Vector3D start_v = Mesh.GetVertex(start_i);
                int      count   = Loop2.CountWithinTolerance(start_v, tolerance, out start_j);
                if (count == 1)
                {
                    bFoundGoodStart = true;
                }
                else
                {
                    start_i++;
                }
            }
            if (!bFoundGoodStart)
            {
                return(false);       // no within-tolerance duplicate vtx to start at
            }
            for (int ii = 0; ii < N; ++ii)
            {
                int i = (start_i + ii) % N;
                int j = (bReverse2) ?
                        math.MathUtil.WrapSignedIndex(start_j - ii, N2)
                    : (start_j + ii) % N2;
                Vector3D v  = Mesh.GetVertex(Vertices[i]);
                Vector3D v2 = Mesh2.GetVertex(Loop2.Vertices[j]);
                if (v.Distance(v2) > tolerance)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 5
0
 protected override void end_pass()
 {
     OutputLoop = new EdgeLoop(mesh, CurrentLoopV.ToArray(), CurrentLoopE.ToArray(), false);
 }