Пример #1
0
 private static VAO CreateMesh(Shader shader)
 {
     Mesh mesh = new Mesh();
     mesh.Add(Meshes.CreateSphere(.9f));
     mesh.Add(Obj2Mesh.FromObj(Resourcen.suzanne));
     var vao = new VAO();
     vao.SetAttribute(shader.GetAttributeLocation("position"), mesh.positions.ToArray(), VertexAttribPointerType.Float, 3);
     vao.SetAttribute(shader.GetAttributeLocation("normal"), mesh.normals.ToArray(), VertexAttribPointerType.Float, 3);
     vao.SetID(mesh.ids.ToArray(), PrimitiveType.Triangles);
     return vao;
 }
Пример #2
0
        private AngularBisectorNetwork(IEnumerable <Point2D> points, bool closed)
        {
            queueDictionary = PriorityQueueDictionary <double, Intersection> .CreateLowFirstOut();

            // TODO: Throw an exception on duplicate points
            foreach (Point2D point in points)
            {
                skeleton.Add(new BisectorVertex(point));
            }

            // 1. Initialization
            //  a. Organize the given vertices into one double connected list of active vertices (LAV)
            //     stored in the SLAV. The vertices in LAV are all active at the moment.
            CircularLinkedList <Vertex> lav = CreateLav(closed);

            foreach (Point2D point in points)
            {
                lav.AddLast(new Vertex(point));
            }

            // b. For each vertex Vi in LAV add the pointer to to incident edges ei-1 = Vi-1 Vi
            //    band ei = Vi Vi+1 and compute the vertex angle bisector (ray) bi
            InitializeEdges(lav);
            InitalizeBisectors(lav);

            // c. For each vertex Vi compute the nearer intersection of the bisector bi with the adjacent
            //    vertex bisectors bi-1 and bi+1 starting at the neighbouring vertices Vi-1 Vi+1 and (if
            //    it exists) store it into a priority queue according to the distance to the line L(ei) which
            //    holds edge ei. For each intersection point store references to Va and Vb, the two origins of
            //    the bisectors which have created the intersection point.
            FindFirstIntersections(lav);

            // 2. While the priority queue with the intersection points is not empty process the intersection
            //    points to find futher intersections, until all intersecting bisectors have been processed.
            ProcessIntersections();

            // Add infinite rays from any unprocesseed points remaining
            // TODO: foreach lav in slav
            foreach (Vertex v in lav)
            {
                if (!v.processed)
                {
                    AddTerminalRay(v);
                }
            }
        }
Пример #3
0
        public void SingleIsolatedVertex()
        {
            VertexBase vA = new VertexBase();

            mesh.Add(vA);
            Assert.AreEqual(1, mesh.VertexCount);
            Assert.IsTrue(vA.IsIsolated);
        }