Esempio n. 1
0
// http://en.wikipedia.org/wiki/Inertia_tensor_of_triangle
Matrix3r woo::Volumetric::triangleInertia(const Vector3r& v0, const Vector3r& v1, const Vector3r& v2){
	Matrix3r V; V<<v0.transpose(),v1.transpose(),v2.transpose(); // rows!
	Real a=((v1-v0).cross(v2-v0)).norm(); // twice the triangle area
	Matrix3r S; S<<2,1,1, 1,2,1, 1,1,2; S*=(1/24.);
	Matrix3r C=a*V.transpose()*S*V;
	return Matrix3r::Identity()*C.trace()-C;
};
Esempio n. 2
0
Matrix3r MeasureCapStress::matBp_BodyGlob(Real alpha,Real wettAngle, Real radius,Vector3r vecN){ // matrix B prime (the surface tension coefficient excepted), defined at body scale (see (3.49) p.65), expressed in global framework
    Matrix3r Bp_BodyGlob ;
    Bp_BodyGlob << - pow(sin(alpha),2) * cos(alpha+wettAngle) , 0 , 0 ,
                   0 , - pow(sin(alpha),2) * cos(alpha+wettAngle) , 0 ,
                   0 , 0 , sin(2*alpha) * sin(alpha+wettAngle);
    Bp_BodyGlob *= Mathr::PI * pow(radius,2.0);
    Matrix3r globToLocRet = matGlobToLoc(vecN);
    return globToLocRet * Bp_BodyGlob * globToLocRet.transpose() ;    
}
Esempio n. 3
0
Matrix3r MeasureCapStress::matLG_bridgeGlob(Real nn11,Real nn33, Vector3r vecN){
        Matrix3r LG_bridgeGlob ;
        
        LG_bridgeGlob << nn11 + nn33 , 0 , 0 , // useless to write lgArea - nn11 = 2*nn11 + nn33 - nn11
        0 , nn11 + nn33 , 0 ,
        0 , 0 , 2*nn11; // trace = 2*(2*nn11 + nn33) = 2*lgArea
        
        Matrix3r globToLocRet = matGlobToLoc(vecN);
        return globToLocRet * LG_bridgeGlob * globToLocRet.transpose() ;
}
Esempio n. 4
0
Matrix3r MeasureCapStress::matA_BodyGlob(Real alpha,Real radius,Vector3r vecN){
    Matrix3r A_BodyGlob ;
    
    A_BodyGlob << pow( 1 - cos(alpha),2) * (2 + cos(alpha)) , 0 , 0 ,
                  0 , pow( 1 - cos(alpha),2) * (2 + cos(alpha)) , 0 ,
                  0 , 0 , 2 * ( 1-pow(cos(alpha),3) );
                  
    A_BodyGlob *= Mathr::PI * pow(radius,3.0)/3.0;
    Matrix3r globToLocRet = matGlobToLoc(vecN);
    return globToLocRet * A_BodyGlob * globToLocRet.transpose() ;
}
Esempio n. 5
0
/*! @brief Recalculate body's inertia tensor in rotated coordinates.
 *
 * @param I inertia tensor in old coordinates
 * @param T rotation matrix from old to new coordinates
 * @return inertia tensor in new coordinates
 */
Matrix3r woo::Volumetric::inertiaTensorRotate(const Matrix3r& I,const Matrix3r& T){
	/* [http://www.kwon3d.com/theory/moi/triten.html] */
	return T.transpose()*I*T;
}
Esempio n. 6
0
		Matrix3r inertiaRotate(const Matrix3r& I, const Matrix3r& T){
			return T.transpose()*I*T;
		}