00001 #ifndef JOINTH
00002 #define JOINTH
00003
00004 #include "interval.h"
00005 #include "link.h"
00006 #include "boolean.h"
00007 #include "cuiksystem.h"
00008 #include "color.h"
00009 #include "htransform.h"
00010
00011 #include <stdlib.h>
00012
00013
00023
00031 #define FREE_JOINT 0
00032
00042 #define FIX_JOINT 1
00043
00050 #define REV_JOINT 2
00051
00058 #define UNV_JOINT 3
00059
00066 #define SPH_JOINT 4
00067
00082 #define SPH_SPH_JOINT 5
00083
00090 #define PRS_JOINT 6
00091
00105 #define IN_PATCH_JOINT 7
00106
00107
00108
00129 typedef struct {
00130 unsigned int t;
00133 unsigned int id;
00138 unsigned int linkID[2];
00139 Tlink *link[2];
00141 double points[6][3];
00155 double normals[3][3];
00161 Tinterval normRange;
00164 boolean hasLimits;
00165 boolean avoidLimits;
00167 double avoidLimitsWeight;
00169 Tinterval range;
00170 Tinterval range2;
00172 double vrange[2][3];
00175 unsigned int obj3d;
00178 double rad;
00180 double length;
00182 Tcolor color;
00184 THTransform trs;
00185 } Tjoint;
00186
00207 void NewFreeJoint(unsigned int id,
00208 unsigned int linkID1,Tlink *link1,
00209 unsigned int linkID2,Tlink *link2,
00210 Tjoint *j);
00211
00229 void NewFixJoint(unsigned int id,
00230 unsigned int linkID1,Tlink *link1,
00231 unsigned int linkID2,Tlink *link2,
00232 THTransform *t,
00233 Tjoint *j);
00274 void NewRevoluteJoint(unsigned int id,
00275 unsigned int linkID1,Tlink *link1,
00276 unsigned int linkID2,Tlink *link2,
00277 double **points,
00278 boolean hasLimits,Tinterval *range,double **rPoints,
00279 boolean avoidLimits,double avoidLimitsWeight,
00280 Tjoint *j);
00314 void NewUniversalJoint(unsigned int id,
00315 unsigned int linkID1,Tlink *link1,
00316 unsigned int linkID2,Tlink *link2,
00317 double **points,
00318 boolean hasLimits,Tinterval *range1,Tinterval *range2,double **rPoints,
00319 boolean avoidLimits,double avoidLimitsWeight,
00320 Tjoint *j);
00321
00355 void NewSphericalJoint(unsigned int id,
00356 unsigned int linkID1,Tlink *link1,
00357 unsigned int linkID2,Tlink *link2,
00358 double **points,
00359 boolean hasLimits,double range,double **rPoints,
00360 boolean avoidLimits,double avoidLimitsWeight,
00361 Tjoint *j);
00362
00387 void NewPrismaticJoint(unsigned int id,
00388 unsigned int linkID1,Tlink *link1,
00389 unsigned int linkID2,Tlink *link2,
00390 double **points,
00391 Tinterval *range,
00392 boolean avoidLimits,double avoidLimitsWeight,
00393 Tjoint *j);
00416 void NewSphSphJoint(unsigned int id,
00417 unsigned int linkID1,Tlink *link1,
00418 unsigned int linkID2,Tlink *link2,
00419 double **points,
00420 double l,double r,
00421 Tcolor *color,
00422 Tjoint *j);
00423
00453 void NewInPatchJoint(unsigned int id,
00454 unsigned int linkID1,Tlink *link1,
00455 unsigned int linkID2,Tlink *link2,
00456 double **points,
00457 double **patch,
00458 boolean avoidLimits,double avoidLimitsWeight,
00459 Tjoint *j);
00460
00469 void CopyJoint(Tjoint *j_dst,Tjoint *j_src);
00470
00480 unsigned int GetJointType(Tjoint *j);
00481
00491 unsigned int GetJointID(Tjoint *j);
00492
00502 unsigned int JointFromID(Tjoint *j);
00503
00513 Tlink *JointFrom(Tjoint *j);
00514
00524 unsigned int JointToID(Tjoint *j);
00525
00526
00536 Tlink *JointTo(Tjoint *j);
00537
00552 void GetJointPoint(unsigned int link,unsigned int point,double *p,Tjoint *j);
00553
00554
00564 boolean LimitedJoint(Tjoint *j);
00565
00566
00577 Tinterval *GetJointRange(Tjoint *j);
00578
00591 Tinterval *GetJointSecondRange(Tjoint *j);
00592
00604 signed int GetJointDOF(Tjoint *j);
00605
00618 double GetJointLength(Tjoint *j);
00619
00631 THTransform *GetJointTransform(Tjoint *j);
00632
00649 void GenerateJointRangeEquations(Tparameters *p,TCuikSystem *cs,Tjoint *j);
00650
00651
00674 void GenerateJointEquationsInBranch(double s,TCuikSystem *cs,
00675 Tequation *eq,Tjoint *j);
00676
00690 void GenerateJointEquations(Tparameters *p,double maxCoord,
00691 TCuikSystem *cs,Tjoint *j);
00692
00693
00714 void RegenerateJointSolution(TCuikSystem *cs,double *sol,Tjoint *j);
00715
00729 double GetJointMaxCoordinate(Tjoint *j);
00730
00741 void PlotJoint(Tplot3d *pt,Tjoint *j);
00742
00771 void MoveJoint(Tplot3d *pt,TCuikSystem *cs,double *sol,
00772 double **r,Tjoint *j);
00773
00774
00782 void DeleteJoint(Tjoint *j);
00783
00784 #endif