From 1d9db12d7e115f2b8994f014e37f1086c17e90fd Mon Sep 17 00:00:00 2001 From: mwturvey Date: Fri, 10 Mar 2017 12:44:10 -0700 Subject: Cleanup & torus updates --- redist/linmath.c | 147 ------------------------------------------------------- 1 file changed, 147 deletions(-) (limited to 'redist') diff --git a/redist/linmath.c b/redist/linmath.c index 1c5c25b..dec7d64 100644 --- a/redist/linmath.c +++ b/redist/linmath.c @@ -481,150 +481,3 @@ void quatfrom2vectors(FLT *q, const FLT *src, const FLT *dest) } -///////////////////////////////////////Matrix Rotations//////////////////////////////////// -////Originally from Stack Overflow -////Under cc by-sa 3.0 -//// http://stackoverflow.com/questions/23166898/efficient-way-to-calculate-a-3x3-rotation-matrix-from-the-rotation-defined-by-tw -//// Copyright 2014 by Campbell Barton -//// Copyright 2017 by Michael Turvey -// -///** -//* Calculate a rotation matrix from 2 normalized vectors. -//* -//* v1 and v2 must be unit length. -//*/ -//void rotation_between_vecs_to_mat3(FLT m[3][3], const FLT v1[3], const FLT v2[3]) -//{ -// FLT axis[3]; -// /* avoid calculating the angle */ -// FLT angle_sin; -// FLT angle_cos; -// -// cross3d(axis, v1, v2); -// -// angle_sin = normalize_v3(axis); -// angle_cos = dot3d(v1, v2); -// -// if (angle_sin > FLT_EPSILON) { -// axis_calc: -// axis_angle_normalized_to_mat3_ex(m, axis, angle_sin, angle_cos); -// } -// else { -// /* Degenerate (co-linear) vectors */ -// if (angle_cos > 0.0f) { -// /* Same vectors, zero rotation... */ -// unit_m3(m); -// } -// else { -// /* Colinear but opposed vectors, 180 rotation... */ -// get_orthogonal_vector(axis, v1); -// normalize_v3(axis); -// angle_sin = 0.0f; /* sin(M_PI) */ -// angle_cos = -1.0f; /* cos(M_PI) */ -// goto axis_calc; -// } -// } -//} - -//void get_orthogonal_vector(FLT out[3], const FLT in[3]) -//{ -//#ifdef USE_DOUBLE -// const FLT x = fabs(in[0]); -// const FLT y = fabs(in[1]); -// const FLT z = fabs(in[2]); -//#else -// const FLT x = fabsf(in[0]); -// const FLT y = fabsf(in[1]); -// const FLT z = fabsf(in[2]); -//#endif -// -// if (x > y && x > z) -// { -// // x is dominant -// out[0] = -in[1] - in[2]; -// out[1] = in[0]; -// out[2] = in[0]; -// } -// else if (y > z) -// { -// // y is dominant -// out[0] = in[1]; -// out[1] = -in[0] - in[2]; -// out[2] = in[1]; -// } -// else -// { -// // z is dominant -// out[0] = in[2]; -// out[1] = in[2]; -// out[2] = -in[0] - in[1]; -// } -//} -// -//void unit_m3(FLT mat[3][3]) -//{ -// mat[0][0] = 1; -// mat[0][1] = 0; -// mat[0][2] = 0; -// mat[1][0] = 0; -// mat[1][1] = 1; -// mat[1][2] = 0; -// mat[2][0] = 0; -// mat[2][1] = 0; -// mat[2][2] = 1; -//} - - -//FLT normalize_v3(FLT vect[3]) -//{ -// FLT distance = dot3d(vect, vect); -// -// if (distance < 1.0e-35f) -// { -// // distance is too short, just go to zero. -// vect[0] = 0; -// vect[1] = 0; -// vect[2] = 0; -// distance = 0; -// } -// else -// { -// distance = FLT_SQRT((FLT)distance); -// scale3d(vect, vect, 1.0f / distance); -// } -// -// return distance; -//} - -///* axis must be unit length */ -//void axis_angle_normalized_to_mat3_ex( -// FLT mat[3][3], const FLT axis[3], -// const FLT angle_sin, const FLT angle_cos) -//{ -// FLT nsi[3], ico; -// FLT n_00, n_01, n_11, n_02, n_12, n_22; -// -// ico = (1.0f - angle_cos); -// nsi[0] = axis[0] * angle_sin; -// nsi[1] = axis[1] * angle_sin; -// nsi[2] = axis[2] * angle_sin; -// -// n_00 = (axis[0] * axis[0]) * ico; -// n_01 = (axis[0] * axis[1]) * ico; -// n_11 = (axis[1] * axis[1]) * ico; -// n_02 = (axis[0] * axis[2]) * ico; -// n_12 = (axis[1] * axis[2]) * ico; -// n_22 = (axis[2] * axis[2]) * ico; -// -// mat[0][0] = n_00 + angle_cos; -// mat[0][1] = n_01 + nsi[2]; -// mat[0][2] = n_02 - nsi[1]; -// mat[1][0] = n_01 - nsi[2]; -// mat[1][1] = n_11 + angle_cos; -// mat[1][2] = n_12 + nsi[0]; -// mat[2][0] = n_02 + nsi[1]; -// mat[2][1] = n_12 - nsi[0]; -// mat[2][2] = n_22 + angle_cos; -//} - - -- cgit v1.2.3