public static IBuffer<float> CreateVertexBuffer(double[] points, ref BoundingBox bounds)
        {
            int length = points.Length;

            var buffer = new VertexBuffer(length);

            bounds.Reset();

            var data = buffer.Data;

            float x, y;

            length = length >> 1;

            for (int i = 0; i < length; i++)
            {
                x = (float)points[2 * i];
                y = (float)points[2 * i + 1];

                data[2 * i] = x;
                data[2 * i + 1] = y;

                bounds.Update(x, y);
            }

            return buffer as IBuffer<float>;
        }
        public static IBuffer<float> CreateVertexBuffer(ICollection<Point> points, ref BoundingBox bounds)
        {
            var buffer = new VertexBuffer(2 * points.Count);

            bounds.Reset();

            var data = buffer.Data;

            float x, y;

            int i = 0;

            foreach (var p in points)
            {
                x = (float)p.X;
                y = (float)p.Y;

                data[2 * i] = x;
                data[2 * i + 1] = y;

                bounds.Update(x, y);

                i++;
            }

            return buffer as IBuffer<float>;
        }
Example #3
0
        /// <summary>
        /// Adds a point to the geometry.
        /// </summary>
        /// <param name="x">X coordinate.</param>
        /// <param name="y">Y coordinate.</param>
        /// <param name="boundary">Boundary marker.</param>
        public void AddPoint(double x, double y, int boundary)
        {
            points.Add(new Vertex(x, y, boundary));

            bounds.Update(x, y);
        }
Example #4
0
        /// <summary>
        /// Adds a point to the geometry.
        /// </summary>
        /// <param name="x">X coordinate.</param>
        /// <param name="y">Y coordinate.</param>
        /// <param name="boundary">Boundary marker.</param>
        public void AddPoint(float x, float y, int boundary)
        {
            points.Add(new Vertex(x, y, boundary));

            bounds.Update(x, y);
        }