Ejemplo n.º 1
0
        private static Vertex CreateOrFindVertex(float3 pointCoord, out bool isOldVertex, int handle)
        {
            int    vertHandle;
            Vertex vert;

            //Check if a Vertex already exists and assign it to the HalfEdge instead of creating a new.
            if (_geometry.DictVertices.Count != 0)
            {
                foreach (var v in _geometry.GetAllVertices())
                {
                    if (!pointCoord.Equals(v.VertData.Pos))
                    {
                        continue;
                    }
                    isOldVertex = true;
                    return(v);
                }

                //Create Vertice and VertHandle.
                vertHandle = handle;
                vert       = new Vertex(vertHandle, pointCoord);
            }
            else
            {
                //Create Vertices and VertHandle.
                vertHandle = handle;
                vert       = new Vertex(vertHandle, pointCoord);
            }
            isOldVertex = false;
            return(vert);
        }