Ejemplo n.º 1
0
 public void RecomputeNormal()
 {
     try
     {
         RHVector3 d1 = vertices[1].pos.Subtract(vertices[0].pos);
         RHVector3 d2 = vertices[2].pos.Subtract(vertices[1].pos);
         normal = d1.CrossProduct(d2);
         normal.NormalizeSafe();
     }
     catch (System.NullReferenceException)
     { }
 }
Ejemplo n.º 2
0
        public double alphaBeta; // Sum of dihedral angles to a virtual shared triangle

        public TopoEdgePair(TopoEdge _edgeA, TopoEdge _edgeB)
        {
            edgeA = _edgeA;
            edgeB = _edgeB;
            RHVector3 sharedPoint = null;
            RHVector3 p1 = null, p2 = null;

            if (edgeA.v1 == edgeB.v1)
            {
                sharedPoint = edgeA.v1.pos;
                p1          = edgeA.v2.pos;
                p2          = edgeB.v2.pos;
            }
            else if (edgeA.v1 == edgeB.v2)
            {
                sharedPoint = edgeA.v1.pos;
                p1          = edgeA.v2.pos;
                p2          = edgeB.v1.pos;
            }
            else if (edgeA.v2 == edgeB.v1)
            {
                sharedPoint = edgeA.v1.pos;
                p1          = edgeA.v1.pos;
                p2          = edgeB.v2.pos;
            }
            else if (edgeA.v2 == edgeB.v2)
            {
                sharedPoint = edgeA.v2.pos;
                p1          = edgeA.v1.pos;
                p2          = edgeB.v1.pos;
            }
            RHVector3 d1     = p1.Subtract(sharedPoint);
            RHVector3 d2     = p2.Subtract(sharedPoint);
            RHVector3 normal = d1.CrossProduct(d2);

            normal.NormalizeSafe();
            //alphaBeta = normal.AngleForNormalizedVectors(edgeA.faces.First.Value.normal) + normal.AngleForNormalizedVectors(edgeB.faces.First.Value.normal);
            //if (alphaBeta > Math.PI) // normal was wrong direction
            //alphaBeta = 2 * Math.PI - alphaBeta;
        }
Ejemplo n.º 3
0
 public TopoPlane(RHVector3 _normal, RHVector3 pointOnPlane)
 {
     normal = new RHVector3(_normal);
     normal.NormalizeSafe();
     d = pointOnPlane.ScalarProduct(normal);
 }