Ejemplo n.º 1
0
void testModelOnly() {
	MODEL* model = createModel();
	printf("\n\nstart tests...\n");
	// Wenn Unittest fehlschl�gt, kontrollieren, dass die Werte f�r die Auslenkungen
	// �berhaupt m�glich sind (wegen zus�tzlichen Checks).
	testElongation(model, 0.17, -0.11, 1.1663910358789642, 0.996819364056);
	testElongation(model, -0.09,   0.02, 1.092014967456264, 1.1819679808191124);
	testAngle(model, 1.1, 1.05, 0.04886921905584121, -0.13264502315156887);
	testAngle(model, 1.15, 1.3, -0.15126186850617515, 0.26761715197246383);
	printf("tests finished.\n");
	return;
}
Ejemplo n.º 2
0
///////////////////////////////////////////////////////////////////////////////
// test
//
void Zone::compare
(	float const	x1,
	float const	y1,
	float const	x2,
	float const	y2,
	ezr &		result,
	ezm const	mode			//= ezmode::NORMAL
)	const
{	float		enterImpactX;
	float		enterImpactY;
	float		exitImpactX;
	float		exitImpactY;

	// Test if this move entered the zone
	if(Math::calcSegmentIntersectCircle
	(	x1, y1,
		x2, y2,
		_x, _y,
		_enterRadius,
		enterImpactX, enterImpactY,
		true	// Enter impact point
	) == true
	// If it didn't enter during init, is the start point already inside?
	|| mode == ezmode::INITIALIZE
	&& isInside(x1, y1, _enterRadius) == true)
		// If normal mode, must test that the impact point was on angle
		if(mode == ezmode::NORMAL)
			if(testAngle
			(	enterImpactX,
				enterImpactY,
				_enterAngle,
				_enterArc
			) == true)
				result = ezresult::ENTERED;
			else
				// If it didn't enter the correct angle, it just didn't enter
				//	so it's a no change, rather than an erro
				result = ezresult::NOCHANGE;
		// If initalise mode, it's entered
		else
			result = ezresult::ENTERED;
	else
		result = ezresult::NOCHANGE;

	// Test if this move exited the zone. But only do the test if the zone has
	//	been entered before
	if((result & ezresult::ENTERED) == ezresult::ENTERED)
		if(Math::calcSegmentIntersectCircle
		(	x1, y1,
			x2, y2,
			_x, _y,
			_exitRadius,
			exitImpactX, exitImpactY,
			false	// Exit impact point
		) == true)
			// Must always exit correctly regardless of mode
			if(testAngle
			(	exitImpactX,
				exitImpactX,
				_exitAngle,
				_exitArc
			) == true)
				// If it exited, include the exited information
				result = ezresult::PASSED;
			else
				// If it exited at a bad angle, it's an error, 
				result = ezresult::FAILED;

}
Ejemplo n.º 3
0
Matrix TWCThread::getInterpolatedTensor( int &id, float &inx, float &iny, float &inz, float &dirX, float &dirY, float &dirZ )
{
    float x = inx / m_dx;
    float y = iny / m_dy;
    float z = inz / m_dz;

    int x0 = (int) x;
    int y0 = (int) y;
    int z0 = (int) z;

    float xd = x - x0;
    float yd = y - y0;
    float zd = z - z0;

    int id_x0y0z0 = id;
    int id_x1y0z0 = min( m_blockSize - 1, id + 1 );
    int id_x0y1z0 = min( m_blockSize - 1, id + m_nx );
    int id_x1y1z0 = min( m_blockSize - 1, id + m_nx + 1 );
    int id_x0y0z1 = min( m_blockSize - 1, id + m_nx * m_ny );
    int id_x1y0z1 = min( m_blockSize - 1, id + m_nx * m_ny + 1 );
    int id_x0y1z1 = min( m_blockSize - 1, id + m_nx * m_ny + m_nx );
    int id_x1y1z1 = min( m_blockSize - 1, id + m_nx * m_ny + m_nx + 1 );

    QVector<Matrix>* lt_x0y0z0 = testAngle( id_x0y0z0, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x1y0z0 = testAngle( id_x1y0z0, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x0y1z0 = testAngle( id_x0y1z0, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x1y1z0 = testAngle( id_x1y1z0, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x0y0z1 = testAngle( id_x0y0z1, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x1y0z1 = testAngle( id_x1y0z1, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x0y1z1 = testAngle( id_x0y1z1, dirX, dirY, dirZ );
    QVector<Matrix>* lt_x1y1z1 = testAngle( id_x1y1z1, dirX, dirY, dirZ );

    Matrix i1( 3, 3 );
    Matrix i2( 3, 3 );
    Matrix j1( 3, 3 );
    Matrix j2( 3, 3 );
    Matrix w1( 3, 3 );
    Matrix w2( 3, 3 );
    Matrix iv( 3, 3 );

    for( int i = 1; i < 4; ++i )
    {
        for ( int j = 1; j < 4; ++j )
        {
            i1( i, j ) = lt_x0y0z0->at( id_x0y0z0 )( i, j ) * ( 1.0 - zd ) + lt_x0y0z1->at( id_x0y0z1 )( i, j ) * zd;
            i2( i, j ) = lt_x0y1z0->at( id_x0y1z0 )( i, j ) * ( 1.0 - zd ) + lt_x0y1z1->at( id_x0y1z1 )( i, j ) * zd;
            j1( i, j ) = lt_x1y0z0->at( id_x1y0z0 )( i, j ) * ( 1.0 - zd ) + lt_x1y0z1->at( id_x1y0z1 )( i, j ) * zd;
            j2( i, j ) = lt_x1y1z0->at( id_x1y1z0 )( i, j ) * ( 1.0 - zd ) + lt_x1y1z1->at( id_x1y1z1 )( i, j ) * zd;
        }
    }

    for( int i = 1; i < 4; ++i )
    {
        for ( int j = 1; j < 4; ++j )
        {
            w1( i, j ) = i1( i, j ) * ( 1.0 - yd ) + i2( i, j ) * yd;
            w2( i, j ) = j1( i, j ) * ( 1.0 - yd ) + j2( i, j ) * yd;
        }
    }

    for( int i = 1; i < 4; ++i )
    {
        for ( int j = 1; j < 4; ++j )
        {
            iv( i, j ) = w1( i, j ) * ( 1.0 - xd ) + w2( i, j ) * xd;
        }
    }

    return FMath::expT( iv );
}