Ejemplo n.º 1
0
void Simulation::createDivergenceCleanupInternalEquation(int i) {

	if(i == 0){
		divergenceCleanUpMatrix[i][0].push_back(MatrixElement(1, i, 0));
		divergenceCleanUpRightPart[i][0] = 0;
		return;
	}

	int prevI = i - 1;
	if(prevI < 0) {
		prevI = xnumber - 1;
	}
	int nextI = i + 1;
	if(nextI >= xnumber) {
		nextI = 0;
	}

	//div for x
	double element = -2/deltaX2;
	divergenceCleanUpMatrix[i][0].push_back(MatrixElement(element, i, 0));

	element = 1/deltaX2;
	divergenceCleanUpMatrix[i][0].push_back(MatrixElement(element, nextI, 0));
	divergenceCleanUpMatrix[i][0].push_back(MatrixElement(element, prevI, 0));

	divergenceCleanUpRightPart[i][0] = -cleanUpRightPart(i);

}
Ejemplo n.º 2
0
void TIEMatrix4x4LoadTranspose(M3DMatrix44f transposed, M3DMatrix44f src) {
	
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			MatrixElement(transposed, i, j) = MatrixElement(src, j, i);
		}
	}
	
}
Ejemplo n.º 3
0
void TIESetRotationZ(float* m4x4, float radians) {
	
	m3dLoadIdentity44f(m4x4);
	
    float s		= sinf(radians); 
    float c		= cosf(radians);	
	
	// This is from my render system. Read the matrix as m[columns][rows]
	float xform[3][3];
	
    xform[0][0] =  c;	xform[0][1] = s;	xform[0][2] = 0;
    xform[1][0] = -s;	xform[1][1] = c;	xform[1][2] = 0;
    xform[2][0] =  0;	xform[2][1] = 0;	xform[2][2] = 1;
	
	// Stuff the matrix into my format
	MatrixElement(m4x4, 0, 0) = xform[0][0];
	MatrixElement(m4x4, 0, 1) = xform[1][0];
	MatrixElement(m4x4, 0, 2) = xform[2][0];
	
	MatrixElement(m4x4, 1, 0) = xform[0][1];
	MatrixElement(m4x4, 1, 1) = xform[1][1];
	MatrixElement(m4x4, 1, 2) = xform[2][1];
	
	MatrixElement(m4x4, 2, 0) = xform[0][2];
	MatrixElement(m4x4, 2, 1) = xform[1][2];
	MatrixElement(m4x4, 2, 2) = xform[2][2];
	
}
Ejemplo n.º 4
0
void EISMatrix4x4SetZRotationUsingRadians(EISMatrix4x4 matrix, float rad) {
	
	EISMatrix4x4SetIdentity(matrix);
	
    float s		= sinf(rad); 
    float c		= cosf(rad);	
	
	// This is from my render system. Read the matrix as m[columns][rows]
	float xform[3][3];
	
    xform[0][0] =  c;	xform[0][1] = s;	xform[0][2] = 0;
    xform[1][0] = -s;	xform[1][1] = c;	xform[1][2] = 0;
    xform[2][0] =  0;	xform[2][1] = 0;	xform[2][2] = 1;
	
	// Stuff the matrix into my format
	MatrixElement(matrix, 0, 0) = xform[0][0];
	MatrixElement(matrix, 0, 1) = xform[1][0];
	MatrixElement(matrix, 0, 2) = xform[2][0];
	
	MatrixElement(matrix, 1, 0) = xform[0][1];
	MatrixElement(matrix, 1, 1) = xform[1][1];
	MatrixElement(matrix, 1, 2) = xform[2][1];
	
	MatrixElement(matrix, 2, 0) = xform[0][2];
	MatrixElement(matrix, 2, 1) = xform[1][2];
	MatrixElement(matrix, 2, 2) = xform[2][2];
	
}
Ejemplo n.º 5
0
double Exhume::DiPhoton::SubProcess(){
  double m_elem_sq = MatrixElement();
  double _Sigma = MatFact*(m_elem_sq)/sHat;
  _Sigma = _Sigma*AlphaS(SqrtsHat/2)*AlphaS(SqrtsHat/2)*AlphaEw*AlphaEw;
  return(Gev2fb*_Sigma);

}
Ejemplo n.º 6
0
void TIEMatrix4x4MulPoint3(M3DMatrix44f m4x4, M3DVector3f point) {

	// This is from my render system. Read the matrix as m[columns][rows]
	float xform[4][3];
	
	// Stuff the matrix into my format
	xform[0][0] = MatrixElement(m4x4, 0, 0);
	xform[1][0] = MatrixElement(m4x4, 0, 1);
	xform[2][0] = MatrixElement(m4x4, 0, 2);
	xform[3][0] = MatrixElement(m4x4, 0, 3);
	
	xform[0][1] = MatrixElement(m4x4, 1, 0);
	xform[1][1] = MatrixElement(m4x4, 1, 1);
	xform[2][1] = MatrixElement(m4x4, 1, 2);
	xform[3][1] = MatrixElement(m4x4, 1, 3);
	
	xform[0][2] = MatrixElement(m4x4, 2, 0);
	xform[1][2] = MatrixElement(m4x4, 2, 1);
	xform[2][2] = MatrixElement(m4x4, 2, 2);
	xform[3][2] = MatrixElement(m4x4, 2, 3);
	
	float dst[3];
	TIEAffineTransform(&point[0], &xform[0][0], &dst[0], 1, 3, 3);
	
	point[0] = dst[0];
	point[1] = dst[1];
	point[2] = dst[2];
}
Ejemplo n.º 7
0
void EISMatrix4x4MultiplyEISVector3D(EISMatrix4x4 m4x4, EISVector3D point) {
	
	// This is from my render system. Read the matrix as m[columns][rows]
	float xform[4][3];
	
	// Stuff the matrix into my format
	xform[0][0] = MatrixElement(m4x4, 0, 0);
	xform[1][0] = MatrixElement(m4x4, 0, 1);
	xform[2][0] = MatrixElement(m4x4, 0, 2);
	xform[3][0] = MatrixElement(m4x4, 0, 3);
	
	xform[0][1] = MatrixElement(m4x4, 1, 0);
	xform[1][1] = MatrixElement(m4x4, 1, 1);
	xform[2][1] = MatrixElement(m4x4, 1, 2);
	xform[3][1] = MatrixElement(m4x4, 1, 3);
	
	xform[0][2] = MatrixElement(m4x4, 2, 0);
	xform[1][2] = MatrixElement(m4x4, 2, 1);
	xform[2][2] = MatrixElement(m4x4, 2, 2);
	xform[3][2] = MatrixElement(m4x4, 2, 3);
	
	float dst[3];
	EISAffineTransform(&point[0], &xform[0][0], &dst[0], 1, 3, 3);
	
	point[0] = dst[0];
	point[1] = dst[1];
	point[2] = dst[2];
}