Skeleton.h

Go to the documentation of this file.
00001 /*
00002 ** Skeleton.h
00003 ** 
00004 ** Made by damien
00005 ** Login   <damien@ortie>
00006 ** 
00007 ** Started on  Sun Jan 27 10:27:01 2008 damien
00008 ** Last update Sun Jan 27 10:27:01 2008 damien
00009 */
00010 
00011 #ifndef         SKELETON_H_
00012 # define        SKELETON_H_
00013 
00014 
00015 #include <stdlib.h>
00016 #include <iostream>
00017 #include <cmath>
00018 #include <string>
00019 #include <errno.h>
00020 #include <stdio.h>
00021 
00022 #include <vector>
00023 using namespace std;
00024 
00025 
00026 #include <Joint.h>
00027 #include <Animation_transformation.h>
00028 #include <V_3D.h>
00029 #include <string.h>
00030 
00031 
00032 class Skeleton
00033 {
00034  public:
00035   Skeleton();
00036   Skeleton(const Skeleton&);
00037   ~Skeleton();
00038 
00039 
00040   /*   int load_skeleton(const char *filename); */
00041   int get_N_joint();
00042   Joint *get_root();
00043   
00044   int add_joint_number();
00045   int read_reccursive_joint(Joint *current,int *k_joint,Joint **T_joint);
00046 
00047   int load_bind_name(int N_name,char **name_bind_pose);
00048   char *get_bone_name(int k_name);
00049 
00050   int look_for_bone_index(char *name_bone);
00051   
00052   int set_size_time(int k_bone,int size);
00053   int get_size_time(int k_bone);
00054   int set_time(int k_bone,int k_time,double val);
00055   int set_angle(int k_bone,int k_time,int k_axis,double val);
00056   int set_translate(int k_bone,int k_time,double tx,double ty,double tz);
00057   int set_anim_matrix(int k_bone,int k_time,int k_dim,double value);
00058   
00059   double get_angle(int k_bone,int k_time,int k_axis);
00060   
00061   int deform_skeleton(double t,Skeleton *output);
00062   int deform_reccursive_joint(Joint *current,double t,Joint *to_deform);
00063   
00064   int init_time();
00065   
00066   int fix_init_bind_pose();
00067   int precalculate_matrix();
00068   
00069   int add_new_joint(double x,double y,double z,int father_number);
00070   int read_anim();
00071 
00072   int cout_skeleton();
00073   int read_skeleton();
00074   int create_list_name();
00075   int reccursive_list_name_fill(Joint *current, int *k_bone);
00076   Matrix get_rotation_animation(int k_bone,double t);
00077 
00078   int fill_bones_number();
00079 
00080   int translate(double tx,double ty,double tz);
00081   int translate(double *t);
00082   int scale(double sx,double sy,double sz);
00083   int scale(double *s);
00084   int scale(double s);
00085 
00086   Skeleton& operator=(const Skeleton& skeleton);
00087 
00088   Joint *get_joint(int k_bone);
00089   Matrix get_position(int k_bone);
00090 
00091 
00092   int change_father(int k_bone);
00093   int new_father(double x,double y,double z);
00094 
00095   int subsample_skeleton();
00096 
00097 
00098   int find_closest_joint(double x,double y,double z,double radius);
00099   
00100   V_3D get_world_position_of_bone(int k_bone);
00101   
00102 
00103   int reccursive_destroy();
00104 
00105   //look in name AND weight_name for new collada version
00106   int get_access_number_of_joint_named(std::string &name_joint);
00107   int get_access_number_of_joint_named(const char* name_joint);
00108 
00109   int init_time_animation();
00110 
00111   int is_animated_section(int k_bone);
00112   double get_first_anim_time(int k_bone);
00113   double get_last_anim_time(int k_bone);
00114 
00115   int unitize_time_variation();
00116   int add_anim_angle(int index_bone,int axis,double offset_angle);
00117 
00118  private:
00119 
00120   int destroy();
00121   int copy_reccursive_joint(Joint *current,Joint *to_copy);
00122   int read_reccursive_joint_cout(Joint *current,Joint *father,int *count,int *access_number);
00123   int reccursive_fill_bones_access_number(Joint *current,int *count);
00124 
00125   int reccursive_bone_looking_for(Joint *current,int *counter,Joint **joint,int k_bone);
00126   int reccursive_bone_looking_for_position(Joint *current,Matrix M,int *counter,int k_bone,Matrix *P);
00127 
00128   int recursive_bind_pose_fixing(Matrix D,Joint *current);
00129 
00130   int reccursive_matrix_precalculation(Matrix D,Joint *current);
00131 
00132 
00133   int reccursive_set_name_access_number(Joint *current);
00134   int reccursive_look_for_new_father(int k_bone,Joint *current,Joint **new_root,Matrix temp_D,Matrix *D_init,int *is_good);
00135 
00136   int add_reccursive_child(Joint *new_joint,Joint *old_joint,int forbidden_index);
00137 
00138   int reccursive_destroy(Joint **current);
00139 
00140 
00141   int cout_reccursive_joint(Joint *current,Joint *father,int *level,int *access_number);
00142 
00143   int reccursive_subsample_skeleton(int k_delete,Joint **current);
00144   
00145   int reccursive_scale(Joint *current,double *s);
00146 
00147   int fill_joint_vector();//fill vector of joint* for fast access
00148   int reccursive_fill_joint_vector(Joint *current);
00149 
00150 
00151 
00152 
00153 
00154 
00155   int N_joint;
00156   Joint *joint_root;
00157 
00158   int N_list_bones;
00159 
00160 
00161   std::vector <Animation_transformation> anim;
00162   std::vector <Joint*> joint_access;
00163 
00164 };
00165 
00166 
00167 #endif      /* !SKELETON_H_ */

Generated on Mon Mar 30 16:55:54 2009 by  doxygen 1.5.6