void Line2D::compute_normal(const NodesT& nodes , CoordsT& result) { /// @bug this normal is a P1 approximation result[XX] = 0.5*( nodes(1, YY) - nodes(0, YY)); result[YY] = 0.5*(-nodes(1, XX) + nodes(0, XX)); result.normalize(); }
void Quad3D::compute_normal(const NodesT& nodes , CoordsT& normal) { JacobianT jac = jacobian(MappedCoordsT::Zero(), nodes); normal[XX] = jac(KSI,YY)*jac(ETA,ZZ) - jac(KSI,ZZ)*jac(ETA,YY); normal[YY] = jac(KSI,ZZ)*jac(ETA,XX) - jac(KSI,XX)*jac(ETA,ZZ); normal[ZZ] = jac(KSI,XX)*jac(ETA,YY) - jac(KSI,YY)*jac(ETA,XX); normal.normalize(); }
void Triag3D::compute_normal(const NodesT& nodes, CoordsT& result) { /// @todo this could be simpler for this application /// Jacobian could be avoided JacobianT jac = jacobian(MappedCoordsT::Zero(),nodes); result[XX] = jac(KSI,YY)*jac(ETA,ZZ) - jac(KSI,ZZ)*jac(ETA,YY); result[YY] = jac(KSI,ZZ)*jac(ETA,XX) - jac(KSI,XX)*jac(ETA,ZZ); result[ZZ] = jac(KSI,XX)*jac(ETA,YY) - jac(KSI,YY)*jac(ETA,XX); // turn into unit vector result.normalize(); }