 #define RANSAC_MAX_MATCHES 15
 #define RANSAC_MAX_ATTEMPTS 100
 
-#define RANSAC_ANGLE_EPSILON 0.5 /* radians */
-#define RANSAC_ANGLE_THRESHOLD 0.75 /* percentage success */
-
-#define RANSAC_TRANS_EPSILON 1
-#define RANSAC_TRANS_THRESHOLD 0.90 /* percentage success */
-
 #define RANSAC_EPSILON 0.90
 #define RANSAC_THRESHOLD 0.75
 
-#define RANSAC_NO_ANGLE_FOUND 123456789.123456678
-#define RANSAC_NO_TRANS_FOUND 987654321.123456789
+#define RANSAC_CHARACTERISTIC_THRESHOLD 1
 
 #define TRANSFORM_DEFAULT_VALUE 6893
-
-__host__ void ransac_translation(double (*vectors)[VECTOR_LENGTH], int length, double *result){
-	double trans_running_count_x = 0;
-	double trans_running_count_y = 0;
-	double trans_x[RANSAC_MAX_MATCHES];
-	double trans_y[RANSAC_MAX_MATCHES];
-
-	/* Use difference between base coordinates.  Eliminates need to rotate */
-	for(int i = 0; i < length; ++i){
-		trans_running_count_x += (trans_x[i] = vectors[i][4] - vectors[i][0]);
-		trans_running_count_y += (trans_y[i] = vectors[i][5] - vectors[i][1]);
-	}
-
-	double trans_x_avg = trans_running_count_x / (double) length;
-	double trans_y_avg = trans_running_count_y / (double) length;
-	int threshold = RANSAC_TRANS_THRESHOLD*(length - 1) + 1;
-	printf("x avg: %f; y avg: %f; threshold: %d; length: %d\n", trans_x_avg, trans_y_avg, threshold, length);
-
-	int count_within_epsilon = 0;
-	for(int i = 0; count_within_epsilon < threshold && i < length; ++i){
-		if(abs(trans_x[i] - trans_x_avg) < RANSAC_TRANS_EPSILON && 
-				abs(trans_y[i] - trans_y_avg) < RANSAC_TRANS_EPSILON){
-			count_within_epsilon++;
-		}
-	}
-
-	if (count_within_epsilon >= threshold){
-		result[0] = trans_x_avg;
-		result[1] = trans_y_avg;
-	} else {
-		result[0] = RANSAC_NO_TRANS_FOUND;
-		result[1] = RANSAC_NO_TRANS_FOUND;
-	}
-}
-
-__host__ double ransac_angle(double (*vectors)[VECTOR_LENGTH], int length){
-	double toRet = RANSAC_NO_ANGLE_FOUND;
-
-	double angle_running_count = 0;
-	double theta[RANSAC_MAX_MATCHES];
-
-	for(int i = 0; i < length; ++i){
-		double *current = vectors[i];
-		double tmp[VECTOR_LENGTH];
-
-		/* make copy with v1, v2 starting at origin */
-		tmp[0] = current[0] - current[0];
-		tmp[1] = current[1] - current[1];
-		tmp[2] = current[2] - current[0];
-		tmp[3] = current[3] - current[1];
-		tmp[4] = current[4] - current[4];
-		tmp[5] = current[5] - current[5];
-		tmp[6] = current[6] - current[4];
-		tmp[7] = current[7] - current[5];
-
-		/* length of vector */
-		double l = sqrt((tmp[2] - tmp[0]) * (tmp[2] - tmp[0]) +
-			(tmp[3] - tmp[1]) * (tmp[3] - tmp[1]));
-
-		double d = sqrt((tmp[2] - tmp[6]) * (tmp[2] - tmp[6]) +
-			(tmp[3] - tmp[7]) * (tmp[3] - tmp[7]));
-
-		angle_running_count += (theta[i] = 2 * asin(d / (2*l)));
-	}
-
-	double theta_avg = angle_running_count / (double) length;
-	int threshold = RANSAC_ANGLE_THRESHOLD*(length - 1) + 1;
-	int count_within_epsilon = 0;
-	for(int i = 0; count_within_epsilon < threshold && i < length; ++i){
-		if (abs(theta[i] - theta_avg) < RANSAC_ANGLE_EPSILON)
-			count_within_epsilon++;
-	}
-
-	if (count_within_epsilon >= threshold)
-		toRet = theta_avg;
-
-	return toRet;
-}
 
 __host__ void transform(double *pt_before, double (*matrix)[3], double *pt_after){
 	for (int i = 0; i < 3; ++i){

	if (count_within_epsilon < threshold)
		return;

	/*double	theta_avg	= theta_running / length,
					t1_avg 		= t1_running / length,
					t2_avg 		= t2_running / length;

	printf("T: %f; 1: %f; 2: %f\n", theta_avg, t1_avg, t2_avg);
	int threshold_theta = RANSAC_ANGLE_THRESHOLD*(length - 1) + 1,
			threshold_t1		= RANSAC_TRANS_THRESHOLD*(length - 1) + 1,
			threshold_t2		= threshold_t1;
*/
	/* check thetas agree */
	/*int count_within_epsilon = 0;
	for(int i = 0; count_within_epsilon < threshold_theta && i < length; ++i){
		if (abs(theta[i] - theta_avg) < RANSAC_ANGLE_EPSILON)
			count_within_epsilon++;
	}

	if (count_within_epsilon < threshold_theta)
		return;
	*/
	/* check t1 agree */
	/*count_within_epsilon = 0;
	for(int i = 0; count_within_epsilon < threshold_t1 && i < length; ++i){
		if (abs(t1[i] - t1_avg) < RANSAC_TRANS_EPSILON)
			count_within_epsilon++;
	}

	if (count_within_epsilon < threshold_t1)
		return;
	*/
	/* check t2 agree */
	/*count_within_epsilon = 0;
	for(int i = 0; count_within_epsilon < threshold_t2 && i < length; ++i){
		if (abs(t2[i] - t2_avg) < RANSAC_TRANS_EPSILON)
			count_within_epsilon++;
	}

	if (count_within_epsilon < threshold_t2)
		return;
*/

	/* SUCCESS! */
	for (int i = 0; i < 9; i++){

__host__ void ransac_full(double(*vectors)[VECTOR_LENGTH], int length, double *result){
	assert(length <= RANSAC_MAX_MATCHES);

	/* get local copy of vector pointers */
	double **local_vectors = (double **) malloc(sizeof(double*) * length);

