Esempio n. 1
0
        internal void CopyInto(PlanktonVertexList clone)
        {
            int min = Math.Min(this._list.Count, clone._list.Count);

            for (int i = 0; i < min; i++)
            {
                clone._list[i].X                = this._list[i].X;
                clone._list[i].Y                = this._list[i].Y;
                clone._list[i].Z                = this._list[i].Z;
                clone._list[i].data             = this._list[i].data;
                clone._list[i].OutgoingHalfedge = this._list[i].OutgoingHalfedge;
            }
            if (clone._list.Count < this._list.Count)
            {
                for (int i = min; i < this._list.Count; i++)
                {
                    var v = new PlanktonVertex(this._list[i].X, this._list[i].Y, this._list[i].Z, this._list[i].data);
                    v.OutgoingHalfedge = this._list[i].OutgoingHalfedge;
                    clone._list.Add(v);
                }
            }
            else if (clone._list.Count > this._list.Count)
            {
                int marker = this._list.Count;
                clone._list.RemoveRange(marker, clone._list.Count - marker);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Adds a new vertex to the end of the Vertex list.
 /// </summary>
 /// <param name="vertex">Location of new vertex.</param>
 /// <returns>The index of the newly added vertex.</returns>
 public static int Add(this PlanktonVertexList vertexList, Point3d vertex)
 {
     return(vertexList.Add(vertex.X, vertex.Y, vertex.Z));
 }
Esempio n. 3
0
 /// <summary>
 /// <para>Sets or adds a vertex to the Vertex List.</para>
 /// <para>If [index] is less than [Count], the existing vertex at [index] will be modified.</para>
 /// <para>If [index] equals [Count], a new vertex is appended to the end of the vertex list.</para>
 /// <para>If [index] is larger than [Count], the function will return false.</para>
 /// </summary>
 /// <param name="index">Index of vertex to set.</param>
 /// <param name="vertex">Vertex location.</param>
 /// <returns><c>true</c> on success, <c>false</c> on failure.</returns>
 public static bool SetVertex(this PlanktonVertexList vertexList, int index, Point3d vertex)
 {
     return(vertexList.SetVertex(index, vertex.X, vertex.Y, vertex.Z));
 }
Esempio n. 4
0
 /// <summary>
 /// <para>Moves a vertex by a vector.</para>
 /// </summary>
 /// <param name="index">Index of vertex to move.</param>
 /// <param name="vector">Vector to move by.</param>
 /// <returns><c>true</c> on success, <c>false</c> on failure.</returns>
 public static bool MoveVertex(this PlanktonVertexList vertexList, int index, Vector3d vector)
 {
     return(vertexList.SetVertex(index, vertexList[index].X + vector.X, vertexList[index].Y + vector.Y, vertexList[index].Z + vector.Z));
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new (empty) instance of the <see cref="PlanktonMesh"/> class.
 /// </summary>
 public PlanktonMesh()
 {
     _vertices  = new PlanktonVertexList(this);
     _halfedges = new PlanktonHalfEdgeList(this);
     _faces     = new PlanktonFaceList(this);
 }