コード例 #1
0
        public TopoTriangle(TopoModel model, TopoVertex v1, TopoVertex v2, TopoVertex v3)
        {
            vertices[0] = v1;
            vertices[1] = v2;
            vertices[2] = v3;
            RecomputeNormal();
            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);

            /*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);*/
        }
コード例 #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);*/
        }