Subversion Repositories gelsvn

Rev

Rev 2 | Rev 113 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 5
Line 73... Line 73...
73
      
73
      
74
 
74
 
75
		if (!(is_tiny(this_mat[3][0]) && 
75
		if (!(is_tiny(this_mat[3][0]) && 
76
					is_tiny(this_mat[3][1]) && 
76
					is_tiny(this_mat[3][1]) && 
77
					is_tiny(this_mat[3][2]) && 
77
					is_tiny(this_mat[3][2]) && 
78
					is_tiny(this_mat[3][3]-1.0f)))
78
					is_tiny(this_mat[3][3]-1.0)))
79
			throw(Mat4x4fNotAffine("Can only invert affine matrices"));
79
			throw(Mat4x4fNotAffine("Can only invert affine matrices"));
80
    
80
    
81
#define ACCUMULATE if (temp >= 0.0) pos += temp; else neg += temp
81
#define ACCUMULATE if (temp >= 0.0) pos += temp; else neg += temp
82
  
82
  
83
		/*
83
		/*
Line 163... Line 163...
163
	}
163
	}
164
 
164
 
165
	template<class V, class M>
165
	template<class V, class M>
166
	M adjoint(const ArithSqMat4x4Float<V,M>& in)
166
	M adjoint(const ArithSqMat4x4Float<V,M>& in)
167
	{
167
	{
168
		float a1, a2, a3, a4, b1, b2, b3, b4;
168
		double a1, a2, a3, a4, b1, b2, b3, b4;
169
		float c1, c2, c3, c4, d1, d2, d3, d4;
169
		double c1, c2, c3, c4, d1, d2, d3, d4;
170
 
170
 
171
		/* assign to individual variable names to aid  */
171
		/* assign to individual variable names to aid  */
172
		/* selecting correct values  */
172
		/* selecting correct values  */
173
	
173
	
174
		a1 = in[0][0]; b1 = in[0][1]; 
174
		a1 = in[0][0]; b1 = in[0][1]; 
Line 212... Line 212...
212
 
212
 
213
 
213
 
214
	template<class V, class M>
214
	template<class V, class M>
215
	M invert(const ArithSqMat4x4Float<V,M>& in)
215
	M invert(const ArithSqMat4x4Float<V,M>& in)
216
	{
216
	{
217
		float det = determinant( in );
217
		double det = determinant( in );
218
		if (is_tiny(det)) 
218
		if (is_tiny(det)) 
219
			throw(Mat4x4fSingular("Tried to invert Singular matrix"));
219
			throw(Mat4x4fSingular("Tried to invert Singular matrix"));
220
		M out = adjoint(in);
220
		M out = adjoint(in);
221
		out/=det;
221
		out/=det;
222
		return out;
222
		return out;