00001 #ifndef CT_CONTACT_SOLVER_H
00002 #define CT_CONTACT_SOLVER_H
00003
00004 #include "csphyzik/phyztype.h"
00005
00006 class ctContact;
00007 class ctMatrixN;
00008
00009 class ctContactSolver
00010 {
00011 public:
00012 virtual void compute_contact_forces ( ctContact *c_list, int c_num ) = 0;
00013
00014 protected:
00015 ctVector3 pt_velocity ( ctPhysicalEntity *body, ctVector3 p );
00016 ctVector3 compute_ndot ( ctContact *c );
00017 real compute_aij ( ctContact &ci, ctContact &cj );
00018
00019 void compute_contact_force_matrix
00020 ( ctContact contacts[], int ncontacts, ctMatrixN &a );
00021
00022 void compute_contact_force_b
00023 ( ctContact contacts[], int ncontacts, real b[] );
00024 };
00025
00026 class ctFastContactSolver : public ctContactSolver
00027 {
00028 public:
00029 virtual void compute_contact_forces ( ctContact *c_list, int c_num );
00030
00031 protected:
00032
00033 void rebalance_forces ( int row, int c_num, ctMatrixN
00034 &A, real *c_a, real *c_f, real *c_da, real *c_df,
00035 int *Czero_a, int *C_top, int *NCzero_f, int *NC_top );
00036
00037 void fdirection ( real *c_df, int row, int c_num, ctMatrixN &A,
00038 int *Czero_a, int C_top, int *NCzero_f, int NC_top );
00039
00040 real find_max_step ( int *max_step_row, int row, real *c_a, real *c_f,
00041 real *c_da, real *c_df, int *Czero_a, int C_top,
00042 int *NCzero_f, int NC_top );
00043
00044 };
00045
00046 #endif // CT_CONTACT_SOLVER_H
00047
00048