huangyhg 发表于 2005-3-15 13:20:03

【发布】这个是约束控制的定义,约束控制的是自由度与自由度的关系

//这个是约束控制的定义,约束控制的是自由度与自由度的关系
// SObj
class KNLBASE_EXPORT SObj
{
public:
SObj();
virtual ~SObj();
};

class MATETRS_EXPORT SMateTRS : public SObj
{
public:
enum SMateTRSType
{
PP_distance = 1,
PL_distance = 2,
PS_distance = 3,
LL_distance = 4,
LL_angle = 5,
FF_coincide = 6,
};

private:
SMateTRSType m_type;

public:
    SMateTRS(SMateTRSType m_type) ;
    virtual~SMateTRS() ;

SMateTRSType GetType(){ return m_type; }

virtual int32 Transform(SFreeDom *pFree, SMatrix4 *mat)=0;

//以 0-360(度)为选择范围,使物体旋转,找到 满足target_value要求的点
// 注意:具体的target_value要求在 各个派生类中 由EvaluateFunc()函数定义
int32 FindRotateAngle(real64 target_value, real64 value_epson,
   real64 *rotAngle, real64 *cosa, real64 *sina);

//以 start_dis-end_dis为选择范围,使物体移动,找到 满足target_value要求的点
// 注意:(同上)
int32 FindMoveDistance(real64 target_value, real64 value_epson,
   real64 start_dis,real64 end_dis,real64 *moveDis);


// the follwing 2 is for solveusing bi-sec method
//
// find argument, which make a Fucntion equals to 'target_value'
int32 FindFitArgu(real64 argu_start, real64 argu_end,
   real64 argu_step, real64 argu_epson,
   real64 target_value, real64 value_epson,
   int32*res_total, real64 *res_argu);
virtual real64 EvaluateFunc(real64 argu);
} ;
typedef SMateTRS::SMateTRSType SMateTRSType;




/////////////////////////// 2. PSdistance ///////////////////////////////////////
/* 2000/11/4 wk
SMateTRS_PSdistance : fix P, move plane
*/
class MATETRS_EXPORT SMateTRS_PSdistance : public SMateTRS
{
private:
PNT3Dm_fixP;
LFRAME_DEF m_lf;// plane to move
real64m_distance;

// deriven value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_PSdistance(PNT3D* fixP, LFRAME_DEF *lf, real64 dis);
    ~SMateTRS_PSdistance();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64 EvaluateFunc(real64 argu);
} ;


/////////////////////////// 3. SPdistance ///////////////////////////////////
/* 2000/11/5 wk
SMateTRS_SPdistance : fix Plane, move P
*/
class MATETRS_EXPORT SMateTRS_SPdistance : public SMateTRS
{
private:
PNT3Dm_P;
LFRAME_DEF m_fixLF;// plane to move
real64m_distance;

// deriven value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_SPdistance(LFRAME_DEF *fixLF, PNT3D *P, real64 dis);
    ~SMateTRS_SPdistance();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64 EvaluateFunc(real64 argu);
} ;


/////////////////////////// 4. LLangle ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_LLangle : fix 1st line, rottate 2nd line
*/
class MATETRS_EXPORT SMateTRS_LLangle : public SMateTRS
{
private:
// input value
PNT3Dm_fixO, m_fixP;
PNT3Dm_O, m_P;
real64m_angle;

// deriven value
VEC3Dm_fixDir;
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_LLangle(PNT3D *fix_O, PNT3D *fix_P,
      PNT3D *O, PNT3D *P, real64 angle);
    ~SMateTRS_LLangle() ;
void SetAngle(real64 angle){ m_angle = angle; }

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64 EvaluateFunc(real64 argu);
} ;


/////////////////////////// 5. PLdistance ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_PLdistance : fix P, move line
*/
class MATETRS_EXPORT SMateTRS_PLdistance : public SMateTRS
{
private:
PNT3Dm_fixP;
PNT3Dm_L1, m_L2;// line to move
real64m_distance;

// temporary value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_PLdistance(PNT3D* fixP, PNT3D *L1,PNT3D *L2, real64 dis);
    ~SMateTRS_PLdistance();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64 EvaluateFunc(real64 argu);
} ;

/////////////////////////// 6. LPdistance ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_PLdistance : fix line, move p
*/
class MATETRS_EXPORT SMateTRS_LPdistance : public SMateTRS
{
private:
PNT3Dm_fixL1, m_fixL2;
PNT3Dm_P;   // point to move
real64m_distance;

// temporary value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

PNT3Dm_moveStartP;
VEC3Dm_moveDir;

public:
    SMateTRS_LPdistance(PNT3D* fixL1, PNT3D* fixL2, PNT3D *P,real64 dis);
    ~SMateTRS_LPdistance();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64EvaluateFunc(real64 rot_angle);
} ;


/////////////////////////// 7. PPdistance ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_PLdistance : fix point, move p
*/
class MATETRS_EXPORT SMateTRS_PPdistance : public SMateTRS
{
private:
PNT3Dm_fixP;
PNT3Dm_P;   // point to move
real64m_distance;

// temporary value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_PPdistance(PNT3D* fixP, PNT3D *P,real64 dis);
    ~SMateTRS_PPdistance();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64EvaluateFunc(real64 rot_angle);
} ;


/////////////////////////// 8. LLdistance ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_PLdistance : fix a line, move line
*/
class MATETRS_EXPORT SMateTRS_LLdistance : public SMateTRS
{
private:
PNT3Dm_fixL1, m_fixL2;
PNT3Dm_L1, m_L2;   // point to move
real64m_distance;

// temporary value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_LLdistance(PNT3D *fixL1,PNT3D *fixL2, PNT3D *L1,PNT3D *L2, real64 dis);
    ~SMateTRS_LLdistance();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64EvaluateFunc(real64 rot_angle);
} ;

/////////////////////////// 9. FFcoincide ///////////////////////////////////
/* 2001/12/27
SMateTRS_FFcoincide : fix a frame, move a frame
*/
class MATETRS_EXPORT SMateTRS_FFcoincide : public SMateTRS
{
private:
LFRAMEm_fixLF, m_moveLF;

// temporary value
PNT3Dm_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3Dm_rotAxisDir;

public:
    SMateTRS_FFcoincide( LFRAME_DEF *fixLF, LFRAME* moveLF );
    ~SMateTRS_FFcoincide();

// use current *pFree and 'm_distance' as input,
// to get mat, and change pFree
int32 Transform(SFreeDom *pFree, SMatrix4 *mat);

real64EvaluateFunc(real64 rot_angle);

static real64 CaculateFRMDelta( LFRAME& FRM1, LFRAME& FRM2 );
} ;
页: [1]
查看完整版本: 【发布】这个是约束控制的定义,约束控制的是自由度与自由度的关系