// This function appears to be the use case of the mathematical functions, which when using the IEEE path - causes the compiler assertion error. __device__ unsigned int poseFromThreePoints( const float3 (&vertices)[SAMPLE_SIZE], const float2 (&projected)[SAMPLE_SIZE], EuclideanTransform3f (&solutions)[MAX_SOLUTIONS]) { float3x3 reconstructed_points[MAX_SOLUTIONS]; const unsigned int reconstructed_points_size = 0;/*reconstructThreePoints(vertices, projected, reconstructed_points); if(reconstructed_points_size == 0) { return 0; }*/ const float3 g_model_mean = (vertices[0]+vertices[1]+vertices[2]) / 3.0f; float3x3 modelR; modelR.rows[0] = vertices[0] - g_model_mean; modelR.rows[1] = crossProduct(modelR.rows[0], vertices[1] - g_model_mean); if(magnitudeSquared(modelR.rows[0]) < FLT_EPSILON || magnitudeSquared(modelR.rows[1]) < FLT_EPSILON) { // Return with nothing added to the vector of poses return 0; } unify(modelR.rows[0]); unify(modelR.rows[1]); modelR.rows[2] = crossProduct(modelR.rows[0], modelR.rows[1]); unsigned int successful_results = 0; for(unsigned int i = 0; i < reconstructed_points_size; ++i) { EuclideanTransform3f &RT = solutions[successful_results]; float3x3 &c_points = reconstructed_points[i]; const float3 c_points_mean = (c_points.rows[0]+c_points.rows[1]+c_points.rows[2])*(-1.0/3.0); c_points.rows[0] += c_points_mean; c_points.rows[1] += c_points_mean; c_points.rows[2] += c_points_mean; float3x3 pointsR; pointsR.rows[0] = normalize(c_points.rows[0]); pointsR.rows[1] = normalize(crossProduct(c_points.rows[0], c_points.rows[1])); pointsR.rows[2] = crossProduct(pointsR.rows[0], pointsR.rows[1]); // RT.R() = pointsR.transpose()*modelR; inverse_mul(pointsR, modelR, RT.R); // RT.T() = -RT.R()*g_model_mean+c_points_mean; RT.T = transform(RT.R, g_model_mean) + c_points_mean; RT.T.x = -RT.T.x; RT.T.y = -RT.T.y; RT.T.z = -RT.T.z; // Check for NAN, INF // If the solution is 'valid' (eg: zero/denormal/normal, NOT nan/infinite), iterate to next solution if(isfinite(magnitudeSquared(RT.R.rows[0])) && isfinite(magnitudeSquared(RT.R.rows[1])) && isfinite(magnitudeSquared(RT.R.rows[2])) && isfinite(magnitudeSquared(RT.T))) { ++successful_results; } } return successful_results; }