int main(int argc, char* argv[]) { int matrix4[10][10] = { {1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1} }; int matrix5[10][10] = { {1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 4, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 7, 0, 0, 0, 0, 1} }; int matrix6[10][10] = { {1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 4, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; printf("%d\n", is_identity_matrix(matrix4)); printf("%d\n", is_identity_matrix(matrix5)); printf("%d\n", is_identity_matrix(matrix6)); return 1; }
void mark_rigid_bones(const struct aiScene *scene) { int i, k; for (i = 0; i < numbones; i++) { struct aiNode *node = bonelist[i].node; for (k = 0; k < node->mNumMeshes; k++) { struct aiMesh *mesh = scene->mMeshes[node->mMeshes[k]]; if (mesh->mNumBones == 0 && !is_identity_matrix(&node->mTransformation)) { bonelist[i].isrigid = 1; } } if (bonelist[i].isrigid) { bonelist[i].reason = "rigid"; bonelist[i].isbone = 1; } } }
LOCAL void rotate_interface( INTERFACE *intfc, double *origin, double **Q) { BOND *b; CURVE **c; NODE **n; POINT *p; int dim = intfc->dim; if (is_identity_matrix(Q,dim) == YES) return; for (n = intfc->nodes; *n; n++) { p = (*n)->posn; rotate_point(origin,Coords(p),Q,Coords(p),dim); } for (c = intfc->curves; *c; c++) { for (b = (*c)->first; b != (*c)->last; b = b->next) { p = b->end; rotate_point(origin,Coords(p),Q,Coords(p),dim); } } if (dim == 3) { /* TODO */ screen("ERROR in rotate_interface(), 3D code needed\n"); clean_up(ERROR); } } /*end rotate_interface*/
int build_bone_list(const struct aiScene *scene) { int number; int i; build_bone_list_from_nodes(scene->mRootNode, -1, "SCENE"); if (dohips) fix_hips(0); // we always need the bind pose if (doanim || domesh || dorigid) mark_skinned_bones(scene); if (doanim || save_all_bones) mark_animated_bones(scene); if (dorigid) mark_rigid_bones(scene); mark_tags(); // mark special bones named on command line as "tags" to attach stuff unmark_tags(); // remove named bones from list // select all parents of selected bones for (i = 0; i < numbones; i++) { if (bonelist[i].isbone) mark_bone_parents(i); } // select all otherwise 'dead' children of selected bones if (save_all_bones) { for (i = 0; i < numbones; i++) { if (!bonelist[i].isbone) if (bonelist[i].parent >= 0 && bonelist[bonelist[i].parent].isbone) bonelist[i].isbone = 1; } } if (save_all_bones > 1) { for (i = 0; i < numbones; i++) { bonelist[i].reason = "useless"; bonelist[i].isbone = 1; } } // skip root node if it has 1 child and identity transform int count = 0; for (i = 0; i < numbones; i++) if (bonelist[i].isbone && bonelist[i].parent == 0) count++; if (count == 1 && is_identity_matrix(&bonelist[0].node->mTransformation)) { bonelist[0].reason = "useless root node"; bonelist[0].isbone = 0; bonelist[0].number = -1; } if (verbose) for (i = 0; i < numbones; i++) if (bonelist[i].isbone) fprintf(stderr, "selecting %s bone %s\n", bonelist[i].reason, bonelist[i].clean_name); // assign IQE numbers to bones number = 0; for (i = 0; i < numbones; i++) if (bonelist[i].isbone) bonelist[i].number = number++; if (dohips) unfix_hips(); calc_bind_pose(); return number; }