Esempio n. 1
0
float det3x3(float a1,float a2,float a3,
			 float b1,float b2,float b3,
			 float c1,float c2,float c3) {
	return a1 * det2x2( b2, b3, c2, c3 ) - 
		   b1 * det2x2( a2, a3, c2, c3 ) + 
		   c1 * det2x2( a2, a3, b2, b3 );
}
Esempio n. 2
0
static inline double det3x3(double m00, double m01, double m02,
                            double m10, double m11, double m12,
                            double m20, double m21, double m22) {
    return  m00 * det2x2(m11, m12, m21, m22) -
    m10 * det2x2(m01, m02, m21, m22) +
    m20 * det2x2(m01, m02, m11, m12);
}
Esempio n. 3
0
static inline double det3x3(double a1, double a2, double a3,
                            double b1, double b2, double b3,
                            double c1, double c2, double c3)
{
    return a1 * det2x2(b2, b3, c2, c3)
         - b1 * det2x2(a2, a3, c2, c3)
         + c1 * det2x2(a2, a3, b2, b3);
}
Esempio n. 4
0
static RtFloat det3x3(RtFloat a1, RtFloat a2, RtFloat a3,
                       RtFloat b1, RtFloat b2, RtFloat b3,
                       RtFloat c1, RtFloat c2, RtFloat c3)
{
    return a1 * det2x2(b2, b3, c2, c3) -
           b1 * det2x2(a2, a3, c2, c3) +
           c1 * det2x2(a2, a3, b2, b3);
}
Esempio n. 5
0
double det3x3( double a1, double a2, double a3, double b1, 
	double b2, double b3, double c1, double c2, double c3 )
{
    double ans;

    ans = a1 * det2x2( b2, b3, c2, c3 )
        - b1 * det2x2( a2, a3, c2, c3 )
        + c1 * det2x2( a2, a3, b2, b3 );
    return ans;
}
Esempio n. 6
0
static void adjoint(
double out[3][3],
double in[3][3]
) {
    double a1, a2, a3, b1, b2, b3, c1, c2, c3;

    /* assign to individual variable names to aid  */
    /* selecting correct values  */

	a1 = in[0][0]; b1 = in[0][1]; c1 = in[0][2];
	a2 = in[1][0]; b2 = in[1][1]; c2 = in[1][2];
	a3 = in[2][0]; b3 = in[2][1]; c3 = in[2][2];

    /* row column labeling reversed since we transpose rows & columns */

    out[0][0]  =   det2x2(b2, b3, c2, c3);
    out[1][0]  = - det2x2(a2, a3, c2, c3);
    out[2][0]  =   det2x2(a2, a3, b2, b3);
        
    out[0][1]  = - det2x2(b1, b3, c1, c3);
    out[1][1]  =   det2x2(a1, a3, c1, c3);
    out[2][1]  = - det2x2(a1, a3, b1, b3);
        
    out[0][2]  =   det2x2(b1, b2, c1, c2);
    out[1][2]  = - det2x2(a1, a2, c1, c2);
    out[2][2]  =   det2x2(a1, a2, b1, b2);
}
Esempio n. 7
0
static Lib3dsFloat
det3x3(
  Lib3dsFloat a1, Lib3dsFloat a2, Lib3dsFloat a3,
  Lib3dsFloat b1, Lib3dsFloat b2, Lib3dsFloat b3,
  Lib3dsFloat c1, Lib3dsFloat c2, Lib3dsFloat c3)
{
  return(
    a1*det2x2(b2,b3,c2,c3)-
    b1*det2x2(a2,a3,c2,c3)+
    c1*det2x2(a2,a3,b2,b3)
  );
}
Esempio n. 8
0
static double sa_Det3x3(double in[3][3]) {
    double a1, a2, a3, b1, b2, b3, c1, c2, c3;
    double ans;

	a1 = in[0][0]; b1 = in[0][1]; c1 = in[0][2];
	a2 = in[1][0]; b2 = in[1][1]; c2 = in[1][2];
	a3 = in[2][0]; b3 = in[2][1]; c3 = in[2][2];

    ans = a1 * det2x2(b2, b3, c2, c3)
        - b1 * det2x2(a2, a3, c2, c3)
        + c1 * det2x2(a2, a3, b2, b3);
    return ans;
}
Esempio n. 9
0
 void DenseMatImpl::myDet(RingElem& d) const
 {
   if (myNumRows()==2)
   { det2x2(d, ConstMatrixView(this)); return; }
   if (myNumRows()==3)      
   { det3x3(d, ConstMatrixView(this)); return; }
   if (IsField(myR))
   { DetByGauss(d, ConstMatrixView(this)); return; }
   if (IsIntegralDomain(myR))
   { d = DetByBareiss(ConstMatrixView(this)); return; }
   CoCoA_ERROR(ERR::NYI, "det for non integral domain");
 }
Esempio n. 10
0
static SkFloat3x3 invert(const SkFloat3x3& m) {
    double d = det(m);
    SkASSERT(SkFloatIsFinite((float)d));
    double scale = 1 / d;
    SkASSERT(SkFloatIsFinite((float)scale));

    return {{
        (float)(scale * det2x2(m, 4, 8, 5, 7)),
        (float)(scale * det2x2(m, 7, 2, 8, 1)),
        (float)(scale * det2x2(m, 1, 5, 2, 4)),

        (float)(scale * det2x2(m, 6, 5, 8, 3)),
        (float)(scale * det2x2(m, 0, 8, 2, 6)),
        (float)(scale * det2x2(m, 3, 2, 5, 0)),

        (float)(scale * det2x2(m, 3, 7, 4, 6)),
        (float)(scale * det2x2(m, 6, 1, 7, 0)),
        (float)(scale * det2x2(m, 0, 4, 1, 3)),
    }};
}
std::vector<double>  computeInterpolationWeights2d(const GenericPoint&  thepoint, 
                                                   const Container&     pt_v) 
{
   if (pt_v.size() !=3)
   {
      std::cout << " Compute interpolation weights.. error.. wrong number of points: " << pt_v.size() << std::endl;
      return std::vector<double>();
   }
   double  c1[2], c2[2];

   c1[0] = pt_v[1][0] - pt_v[0][0];
   c1[1] = pt_v[1][1] - pt_v[0][1];
        
   c2[0] = pt_v[2][0] - pt_v[0][0];
   c2[1] = pt_v[2][1] - pt_v[0][1];
                
   double  det(det2x2(c1, c2));

   if (det == 0.0)
   {
      throw gsse::numerical_calculation_error(":: interpolation :: 2D :: coefficients.. determinant to small.. ");
   }
        
   double  rhs[2];
   std::vector<double> weights(3);
        
   rhs[0] = thepoint[0] - pt_v[0][0];
   rhs[1] = thepoint[1] - pt_v[0][1];

   weights[1] = det2x2(rhs, c2)  / det;
   weights[2] = det2x2(c1,  rhs) / det;
   weights[0] = 1.0 - weights[1] - weights[2];

   return weights;   // here .. copy constructor // think about it.. [RH]

}
Esempio n. 12
0
// Returns the inverse of this matrix
FMMatrix33 FMMatrix33::Inverted() const
{
	FMMatrix33 b;

	b.m[0][0] =  det2x2(m[1][1], m[1][2], m[2][1], m[2][2]);
	b.m[0][1] = -det2x2(m[0][1], m[0][2], m[2][1], m[2][2]);
	b.m[0][2] =  det2x2(m[0][1], m[0][2], m[1][1], m[1][2]);

	b.m[1][0] = -det2x2(m[1][0], m[1][2], m[2][0], m[2][2]);
	b.m[1][1] =  det2x2(m[0][0], m[0][2], m[2][0], m[2][2]);
	b.m[1][2] = -det2x2(m[0][0], m[0][2], m[1][0], m[1][2]);

	b.m[2][0] =  det2x2(m[1][0], m[1][1], m[2][0], m[2][1]);
	b.m[2][1] = -det2x2(m[0][0], m[0][1], m[2][0], m[2][1]);
	b.m[2][2] =  det2x2(m[0][0], m[0][1], m[1][0], m[1][1]);

	float det = (m[0][0] * b.m[0][0]) + (m[1][0] * b.m[0][1]) + (m[2][0] * b.m[0][2]);

	// We should consider throwing an exception if det < eps.
	if (IsEquivalent(det, 0.0f)) det = 0.01f;
	float oodet = 1.0f / det;

	b.m[0][0] *= oodet;
	b.m[0][1] *= oodet;
	b.m[0][2] *= oodet;

	b.m[1][0] *= oodet;
	b.m[1][1] *= oodet;
	b.m[1][2] *= oodet;

	b.m[2][0] *= oodet;
	b.m[2][1] *= oodet;
	b.m[2][2] *= oodet;

	return b;
}
Esempio n. 13
0
static double vp(vec x, vec y, vec z) {
    z[0] = det2x2(x[1], x[2], y[1], y[2]);
    z[1] = det2x2(x[2], x[0], y[2], y[0]);
    z[2] = det2x2(x[0], x[1], y[0], y[1]);
    return sqrt(dot(z,z));
}
Esempio n. 14
0
/*
    calculate the determinent of a 3x3 matrix in the from

    | a1 a2 a3 |
    | b1 b2 b3 |
    | c1 c2 c3 |

*/
nv_scalar det3x3(nv_scalar a1, nv_scalar a2, nv_scalar a3, 
                         nv_scalar b1, nv_scalar b2, nv_scalar b3, 
                         nv_scalar c1, nv_scalar c2, nv_scalar c3)
{
    return a1 * det2x2(b2, b3, c2, c3) - b1 * det2x2(a2, a3, c2, c3) + c1 * det2x2(a2, a3, b2, b3);
}
Esempio n. 15
0
inline scalar_t det3x3(scalar_t a1, scalar_t a2, scalar_t a3, scalar_t b1, scalar_t b2, scalar_t b3,
                       scalar_t c1, scalar_t c2, scalar_t c3)
{
    return a1 * det2x2(b2, b3, c2, c3) - b1 * det2x2(a2, a3, c2, c3) + c1 * det2x2(a2, a3, b2, b3);
}