/// <summary> /// Initializes a new instance of the <see cref="Polygon"/> class using an array of coordinates. /// </summary> /// <param name="points">An <see cref="Vector3FArrayList"/> instance.</param> public Polygon(Vector3FArrayList points) { _points.AddRange(points); }
/// <summary> /// Initializes a new instance of the <see cref="Polygon"/> class using coordinates from another instance. /// </summary> /// <param name="polygon">A <see cref="Polygon"/> instance.</param> public Polygon(Polygon polygon) { _points = (Vector3FArrayList)polygon._points.Clone(); }
internal UniqueList(Vector3FArrayList collection) : base(Tag.Default) { this._collection = collection; }
public override void AddRange(Vector3FArrayList collection) { foreach (Vector3F value in collection) CheckUnique(value); this._collection.AddRange(collection); }
/// <summary> /// Returns a read-only wrapper for the specified <see cref="Vector3FArrayList"/>. /// </summary> /// <param name="collection">The <see cref="Vector3FArrayList"/> to wrap.</param> /// <returns>A read-only wrapper around <paramref name="collection"/>.</returns> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList.ReadOnly"/> for details.</remarks> public static Vector3FArrayList ReadOnly(Vector3FArrayList collection) { if (collection == null) throw new ArgumentNullException("collection"); return new ReadOnlyList(collection); }
public override void AddRange(Vector3FArrayList collection) { lock (this._root) this._collection.AddRange(collection); }
internal ReadOnlyList(Vector3FArrayList collection) : base(Tag.Default) { this._collection = collection; }
/// <summary> /// Transform the vectors in the given array and put the result in another array. /// </summary> /// <param name="vectors">An array of vectors to transform.</param> /// <param name="transformation">The transformation.</param> /// <param name="result">An array of vectors to put the transformation results in (should be empty).</param> public static void TransformArray(Vector3FArrayList vectors, Matrix4F transformation, Vector3FArrayList result) { for (int i = 0; i < vectors.Count; i++) { result.Add(Matrix4F.Transform(transformation, vectors[i])); } }
/// <summary> /// Creates a shallow copy of the <see cref="Vector3FArrayList"/>. /// </summary> /// <returns>A shallow copy of the <see cref="Vector3FArrayList"/>.</returns> /// <remarks>Please refer to <see cref="ArrayList.Clone"/> for details.</remarks> public virtual object Clone() { Vector3FArrayList collection = new Vector3FArrayList(this._count); Array.Copy(this._array, 0, collection._array, 0, this._count); collection._count = this._count; collection._version = this._version; return collection; }
internal Enumerator(Vector3FArrayList collection) { this._collection = collection; this._version = collection._version; this._index = -1; }
/// <overloads> /// Adds a range of elements to the end of the <see cref="Vector3FArrayList"/>. /// </overloads> /// <summary> /// Adds the elements of another collection to the end of the <see cref="Vector3FArrayList"/>. /// </summary> /// <param name="collection">The <see cref="Vector3FArrayList"/> whose elements /// should be added to the end of the current collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <exception cref="NotSupportedException"> /// <para>The <see cref="Vector3FArrayList"/> is read-only.</para> /// <para>-or-</para> /// <para>The <b>Vector3FArrayList</b> has a fixed size.</para> /// <para>-or-</para> /// <para>The <b>Vector3FArrayList</b> already contains one or more elements /// in the specified <paramref name="collection"/>, and the <b>Vector3FArrayList</b> /// ensures that all elements are unique.</para></exception> /// <remarks>Please refer to <see cref="ArrayList.AddRange"/> for details.</remarks> public virtual void AddRange(Vector3FArrayList collection) { if (collection == null) throw new ArgumentNullException("collection"); if (collection.Count == 0) return; if (this._count + collection.Count > this._array.Length) EnsureCapacity(this._count + collection.Count); ++this._version; Array.Copy(collection.InnerArray, 0, this._array, this._count, collection.Count); this._count += collection.Count; }
/// <summary> /// Returns a wrapper for the specified <see cref="Vector3FArrayList"/> /// ensuring that all elements are unique. /// </summary> /// <param name="collection">The <see cref="Vector3FArrayList"/> to wrap.</param> /// <returns> /// A wrapper around <paramref name="collection"/> ensuring that all elements are unique. /// </returns> /// <exception cref="ArgumentException"> /// <paramref name="collection"/> contains duplicate elements.</exception> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks><para> /// The <b>Unique</b> wrapper provides a set-like collection by ensuring /// that all elements in the <see cref="Vector3FArrayList"/> are unique. /// </para><para> /// <b>Unique</b> raises an <see cref="ArgumentException"/> if the specified /// <paramref name="collection"/> contains any duplicate elements. The returned /// wrapper raises a <see cref="NotSupportedException"/> whenever the user attempts /// to add an element that is already contained in the <b>Vector3FArrayList</b>. /// </para><para> /// <strong>Note:</strong> The <b>Unique</b> wrapper reflects any changes made /// to the underlying <paramref name="collection"/>, including the possible /// creation of duplicate elements. The uniqueness of all elements is therefore /// no longer assured if the underlying collection is manipulated directly. /// </para></remarks> public static Vector3FArrayList Unique(Vector3FArrayList collection) { if (collection == null) throw new ArgumentNullException("collection"); for (int i = collection.Count - 1; i > 0; i--) if (collection.IndexOf(collection[i]) < i) throw new ArgumentException("collection", "Argument cannot contain duplicate elements."); return new UniqueList(collection); }
/// <summary> /// Returns a synchronized (thread-safe) wrapper /// for the specified <see cref="Vector3FArrayList"/>. /// </summary> /// <param name="collection">The <see cref="Vector3FArrayList"/> to synchronize.</param> /// <returns> /// A synchronized (thread-safe) wrapper around <paramref name="collection"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList.Synchronized"/> for details.</remarks> public static Vector3FArrayList Synchronized(Vector3FArrayList collection) { if (collection == null) throw new ArgumentNullException("collection"); return new SyncList(collection); }
/// <summary> /// Initializes a new instance of the <see cref="Polygon"/> class with serialized data. /// </summary> /// <param name="info">The object that holds the serialized object data.</param> /// <param name="context">The contextual information about the source or destination.</param> protected Polygon(SerializationInfo info, StreamingContext context) { _points = (Vector3FArrayList)info.GetValue("Points", typeof(Vector3FArrayList)); }
public override void AddRange(Vector3FArrayList collection) { throw new NotSupportedException( "Read-only collections cannot be modified."); }
/// <summary> /// Transform the vectors in the given array. /// </summary> /// <param name="vectors">An array of vectors to transform.</param> /// <param name="transformation">The transformation.</param> /// <remarks> /// This method changes the vector values in the <paramref name="vectors"/> array. /// </remarks> public static void TransformArray(Vector3FArrayList vectors, Matrix4F transformation) { for (int i = 0; i < vectors.Count; i++) { vectors[i] = Matrix4F.Transform(transformation, vectors[i]); } }
internal SyncList(Vector3FArrayList collection) : base(Tag.Default) { this._root = collection.SyncRoot; this._collection = collection; }
public static Vector3FArrayList CreateRandomVector3FArray(int count, IFloatRandomNumberGenerator r) { Vector3FArrayList result = new Vector3FArrayList(count); for(int i = 0; i < count; i++) { result.Add(new Vector3F(r.NextFloat(),r.NextFloat(), r.NextFloat())); } return result; }
/// <summary> /// Initializes a new instance of the <see cref="Vector3FArrayList"/> class /// that contains elements copied from the specified collection and /// that has the same initial capacity as the number of elements copied. /// </summary> /// <param name="collection">The <see cref="Vector3FArrayList"/> /// whose elements are copied to the new collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="collection"/> is a null reference.</exception> /// <remarks>Please refer to <see cref="ArrayList(ICollection)"/> for details.</remarks> public Vector3FArrayList(Vector3FArrayList collection) { if (collection == null) throw new ArgumentNullException("collection"); this._array = new Vector3F[collection.Count]; AddRange(collection); }