Exemplo n.º 1
0
 public void AddTriangle(TopoTriangle triangle)
 {
     if (left == null && triangles == null)
     {
         triangles = new HashSet <TopoTriangle>();
     }
     if (triangles != null)
     {
         triangles.Add(triangle);
         box.Add(triangle.boundingBox);
         if (triangles.Count > nextTrySplit)
         {
             TrySplit();
         }
     }
     else
     {
         if (triangle.boundingBox.maxPoint[dimension] < middlePosition)
         {
             left.AddTriangle(triangle);
         }
         else if (triangle.boundingBox.minPoint[dimension] > middlePosition)
         {
             right.AddTriangle(triangle);
         }
         else
         {
             middle.AddTriangle(triangle);
         }
     }
 }
Exemplo n.º 2
0
        public TopoTriangle(TopoModel model, TopoVertex v1, TopoVertex v2, TopoVertex v3, double nx, double ny, double nz)
        {
            vertices[0] = v1;
            vertices[1] = v2;
            vertices[2] = v3;
            RHVector3 normalTest = new RHVector3(nx, ny, nz);

            //normal.NormalizeSafe();
            edges[0] = model.getOrCreateEdgeBetween(v1, v2);
            edges[1] = model.getOrCreateEdgeBetween(v2, v3);
            edges[2] = model.getOrCreateEdgeBetween(v3, v1);
            edges[0].connectFace(this);
            edges[1].connectFace(this);
            edges[2].connectFace(this);
            v1.connectFace(this);
            v2.connectFace(this);
            v3.connectFace(this);
            boundingBox.Add(v1.pos);
            boundingBox.Add(v2.pos);
            boundingBox.Add(v3.pos);
            RecomputeNormal();
            if (normalTest.ScalarProduct(normal) < 0)
            {
                FlipDirection();
            }

            /* double d1 = edges[0].EdgeLength;
             * double d2 = edges[1].EdgeLength;
             * double d3 = edges[2].EdgeLength;
             * if (d1 < epsilonZero || d2 < epsilonZero || d3 < epsilonZero)
             *   Console.WriteLine("Df:" + this);*/
        }
Exemplo n.º 3
0
 public void Add(TopoVertex vertex)
 {
     vertices.Add(vertex);
     box.Add(vertex.pos);
 }