void testTortureExecute (void) { #if 0 va1(4,pts[0],pts[1],pts[2],pts[3]); va2(4,ipts[0],ipts[1],ipts[2],ipts[3]); return; #endif }
void va_test() { int x = 4; char y[6] = "hello"; va1(&x, y, 1, 2, 3, 4); }
void ShapeFunctionTriangleSigned::calc() { // based on the answer in http://answers.unity3d.com/questions/383804/calculate-uv-coordinates-of-3d-point-on-plane-of-m.html // check out also: http://www.had2know.com/academics/triangle-area-perimeter-angle-3-coordinates.html lmx::Vector<double> f(dim), p1(dim), p2(dim), p3(dim); f.writeElement(gp->getX(),0); f.writeElement(gp->getY(),1); f.writeElement(gp->getZ(),2); p1.writeElement(gp->getSupportNodes()[0]->getX(), 0); p1.writeElement(gp->getSupportNodes()[0]->getY(), 1); p1.writeElement(gp->getSupportNodes()[0]->getZ(), 2); p2.writeElement(gp->getSupportNodes()[1]->getX(), 0); p1.writeElement(gp->getSupportNodes()[1]->getY(), 1); p1.writeElement(gp->getSupportNodes()[1]->getZ(), 2); p3.writeElement(gp->getSupportNodes()[2]->getX(), 0); p1.writeElement(gp->getSupportNodes()[2]->getY(), 1); p1.writeElement(gp->getSupportNodes()[2]->getZ(), 2); lmx::Vector<double> f1(dim), f2(dim), f3(dim); // calculate vectors from point f to vertices p1, p2 and p3: f1.subs( p1, f); f2.subs( p2, f); f3.subs( p3, f); lmx::Vector<double> va(dim), va1(dim), va2(dim), va3(dim); double a, a1, a2, a3; va.multElements(p1-p2, p1-p3); va1.multElements(f2, f3); va2.multElements(f3, f1); va3.multElements(f1, f2); lmx::Vector<double> vaa1(dim), vaa2(dim), vaa3(dim); a = va.norm2(); a1 = std::copysign( va1.norm2()/a, va*va1 ); a2 = std::copysign( va2.norm2()/a, va*va2 ); a3 = std::copysign( va3.norm2()/a, va*va3 ); phi.writeElement( a1, 0, 0 ); phi.writeElement( a2, 0, 0 ); phi.writeElement( a3, 0, 0 ); ////////////////////////////////////////////////////////////////// // FIRST DERIVATIVES: ////////////////////////////////////////////////////////////////// // phi.writeElement( // ( gp->supportNodes[1]->gety() - gp->supportNodes[2]->gety() ) // / ( 2*gp->jacobian ), 1, 0 ); // phi.writeElement( // ( gp->supportNodes[2]->getx() - gp->supportNodes[1]->getx() ) // / ( 2*gp->jacobian ), 2, 0 ); // ////////////////////////////////////////////////////////////////// // phi.writeElement( // ( gp->supportNodes[2]->gety() - gp->supportNodes[0]->gety() ) // / ( 2*gp->jacobian ), 1, 1 ); // phi.writeElement( // ( gp->supportNodes[0]->getx() - gp->supportNodes[2]->getx() ) // / ( 2*gp->jacobian ), 2, 1 ); // ////////////////////////////////////////////////////////////////// // phi.writeElement( // ( gp->supportNodes[0]->gety() - gp->supportNodes[1]->gety() ) // / ( 2*gp->jacobian ), 1, 2 ); // phi.writeElement( // ( gp->supportNodes[1]->getx() - gp->supportNodes[0]->getx() ) // / ( 2*gp->jacobian ), 2, 2 ); // cout << "phi = " << phi << endl; }