⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysdopenglview.h

📁 机器人运动学动力学及控制的一个小程序,供有兴趣的人参考
💻 H
字号:
// MySDOpenGLView.h : interface of the CMySDOpenGLView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MYSDOPENGLVIEW_H__F38010B4_559E_437C_B073_3F3EAB8F2BDA__INCLUDED_)
#define AFX_MYSDOPENGLVIEW_H__F38010B4_559E_437C_B073_3F3EAB8F2BDA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MySDOpenGLDoc.h"
#include "Matrix.h"
#include "Vector3.h"
#include "modelcontext.h"
#include "OBJFileRead.h"
//#include "Screws.h"
//#include "Rigid.h"
#include "SDDynamics.h"
#include "Control.h"
#include "DrawPropertyFrame.h"

enum{
	 POLYGONS,
	 LINE_POLYGON,
	 LINE_LOOP,
	 LINE_INDEPENDENT,
	 LINE_STRIPS,

};

enum{
      RENDER,
      SELECT
};
class CMySDOpenGLView : public CView
{
protected: // create from serialization only
	CMySDOpenGLView();
	DECLARE_DYNCREATE(CMySDOpenGLView)

// Attributes
public:
	
	CMySDOpenGLDoc* GetDocument();
    
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMySDOpenGLView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
//	void OnProperties();
	virtual ~CMySDOpenGLView();
	BOOL RenderScence();
	BOOL SetupPixelFormat(void);
	void SetLogicalPalette(void);
	BOOL initializeOpenGL(CDC* pDC);
    void init(int Width, int Height);
    void DrawAxisArrow(void);
    void setColor(const GLfloat *ambient,const GLfloat *diffuse,const GLfloat *specular,
              const GLfloat shininess,const GLboolean stereo);
    void DawObj(ModelContext *model);
	void DawCylinder(GLUquadric*cylinder_obj,double x,double y,double z,double angle,double vx, double vy,double vz, double base,double top,double height);
	void Animation(double Angle1, double Angle2); 
	void Animation1(double Angle1, double Angle2, double Angle3,double Angle4); 
	void DrawBase(void);
	void DrawArm(GLfloat bl);
	void DrawPoint(GLfloat x,GLfloat y,GLfloat z,GLfloat size);
	void MakeSE3(void);
	void CoumpterFKinematics(CMatrix g);
	void DrawFKinematics(void);
	BOOL InverseKinematics1(CVector3 *p,CVector3 *q,CVector3 *r,CVector3 *axle,double *Angle);
	BOOL InverseKinematics2(CVector3 *p,CVector3 *q,CVector3 *r,CVector3 *axle1,CVector3 *axle2,int *NOfAngle,double *Angle1,double *Angle2);
	BOOL InverseKinematics3(CVector3 *p,CVector3 *q,CVector3 *r,CVector3 *axle,double *delta,int *NOfAngle,double *Angle);
	BOOL CoumpterIKinematics(CMatrix g);

    void mouse_select(int x,int y);
	void get_xyz(int x,int y);
    void drawRect(float x,float y,float z,float size);
	GLdouble object_x,object_y,object_z;
	GLdouble near_x,near_y,near_z;
	GLdouble far_x,far_y,far_z;
    void drawLine(GLdouble o_x,GLdouble o_y,GLdouble o_z,GLdouble d_x,GLdouble d_y,GLdouble d_z);


   CMatrix Vector3ToMatrix41(CVector3 *vc,int point);
   CVector3 MatrixToVector3(int num,int col,CMatrix m);
   CMatrix	Makeg1(double cAngle1);
   CMatrix	Makeg2(double cAngle2);
   CMatrix	Makeg3(double cAngle3);
   CMatrix	Makeg4(double cAngle4);
   CMatrix	Makeg(CVector3 *x,CVector3 *y,CVector3 *z,CVector3 *p);

//   CSDDynamics  xx;
//   CMatrix theta;

	BOOL m_objloaded;
	COBJFileRead *m_objRead;
	HGLRC m_hRC;
	HPALETTE m_hPalette;
	CDC* m_pDC;
    CPoint MouseDownPoint;
    double X_Angle;
	double Y_Angle;

    double Angle1,Angle2,Angle3,Angle4;
    double deltaAngle1,deltaAngle2,deltaAngle3,deltaAngle4;
    double inputAngle1,inputAngle2,inputAngle3,inputAngle4;
	CMatrix g;
    CVector3 vectorx,vectory,vector,vectorp;
    double A1,A2,m[16];
	CMatrix ig1,ig2,ig3,ig4,igst0;
    CVector3 q1,q2,q3;
    CVector3 omiga1,omiga2,omiga3,omiga4;
	double l0,l1,l2,l3;
    double IAngle1[4],IAngle2[4],IAngle3[4],IAngle4[4];

	CTransport Transport;

    GLUquadricObj* cylinder_obj;
    GLUquadricObj* cylinder_obj1;
	
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
//	CDrawPropertyFrame* m_pPropFrame;
	//{{AFX_MSG(CMySDOpenGLView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnTxSet();
	afx_msg void OnUpdateMode(CCmdUI* pCmdUI);
	afx_msg void OnMode();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in MySDOpenGLView.cpp
inline CMySDOpenGLDoc* CMySDOpenGLView::GetDocument()
   { return (CMySDOpenGLDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYSDOPENGLVIEW_H__F38010B4_559E_437C_B073_3F3EAB8F2BDA__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -