几何尺寸与公差论坛

 找回密码
 注册
查看: 2154|回复: 0

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

[复制链接]
发表于 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 solve  using 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:
PNT3D  m_fixP;
LFRAME_DEF m_lf;  // plane to move
real64  m_distance;

// deriven value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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:
PNT3D  m_P;
LFRAME_DEF m_fixLF;  // plane to move
real64  m_distance;

// deriven value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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
PNT3D  m_fixO, m_fixP;
PNT3D  m_O, m_P;
real64  m_angle;

// deriven value
VEC3D  m_fixDir;
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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:
PNT3D  m_fixP;
PNT3D  m_L1, m_L2;  // line to move
real64  m_distance;

// temporary value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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:
PNT3D  m_fixL1, m_fixL2;  
PNT3D  m_P;   // point to move
real64  m_distance;

// temporary value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_rotAxisDir;

PNT3D  m_moveStartP;
VEC3D  m_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);

real64  EvaluateFunc(real64 rot_angle);
} ;


/////////////////////////// 7. PPdistance ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_PLdistance : fix point, move p
*/
class MATETRS_EXPORT SMateTRS_PPdistance : public SMateTRS
{
private:
PNT3D  m_fixP;  
PNT3D  m_P;   // point to move
real64  m_distance;

// temporary value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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);

real64  EvaluateFunc(real64 rot_angle);
} ;


/////////////////////////// 8. LLdistance ///////////////////////////////////
/* 2000/11/1 wk
SMateTRS_PLdistance : fix a line, move line
*/
class MATETRS_EXPORT SMateTRS_LLdistance : public SMateTRS
{
private:
PNT3D  m_fixL1, m_fixL2;  
PNT3D  m_L1, m_L2;   // point to move
real64  m_distance;

// temporary value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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);

real64  EvaluateFunc(real64 rot_angle);
} ;

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

// temporary value
PNT3D  m_rotPivotP, m_rotAxisP;// pivot, and A point on the rot axis
VEC3D  m_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);

real64  EvaluateFunc(real64 rot_angle);

static real64 CaculateFRMDelta( LFRAME& FRM1, LFRAME& FRM2 );
} ;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-5-2 05:19 , Processed in 0.036061 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表