📄 develop.cpp
字号:
// Develop.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Develop.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDevelopApp
BEGIN_MESSAGE_MAP(CDevelopApp, CWinApp)
//{{AFX_MSG_MAP(CDevelopApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDevelopApp construction
CDevelopApp::CDevelopApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDevelopApp object
CDevelopApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CDevelopApp initialization
#include <fstream>
using namespace std ;
#include <JMath.h>
#include "JStewartIter.h"
BOOL CDevelopApp::InitInstance()
{
double Pd[20][3] = { 7.25, 4.33, 0,
6.56, 5.63, 0,
5.04, 5.65, 0,
4.26, 4.28, 0,
5.02, 3.04, 0,
6.54, 3.01, 0,
6.00, 5.00, 0,
5.00, 5.00, 0,
} ;
double Qd[20][3] = { 6.95, 4.26, 0,
6.39, 5.36, 0,
5.19, 5.29, 0,
4.64, 4.33, 0,
5.17, 3.27, 0,
6.39, 3.27, 0,
6.02, 5.09, 0,
5.03, 5.01, 0,
} ;
int i, j ;
const int NL = 8 ;
JVector P[ NL ] ;
JVector Q[ NL ] ;
for ( i=0 ; i<NL ; i++ )
{
for ( j=0 ; j<3 ; j++ )
{
P[i][j] = Pd[i][j] ;
Q[i][j] = Qd[i][j] ;
}
}
double x[7] = { 5.74, 4.36, 1,
9.961946980917456e-001, 2.329335204653890e-002,
4.658670409307780e-002, 6.988005613961669e-002 } ;
double x2[7] ;
for ( i=0 ; i<7 ; i++ ) x2[i] = x[i] ;
double L[ NL ] ;
JRotation rot( x+3 ) ;
JVector r( x[0], x[1], x[2] ) ;
JVector v ;
for ( i=0 ; i<NL ; i++ )
{
v = r + rot * Q[i] - P[i] ;
L[i] = v.GetLength() ;
}
x[0] *= 1.05 ;
x[1] *= 1.05 ;
x[3] *= 1.00 ;
x[6] *= 1.01 ;
//int flag = JStewart6( P, Q, L, x, 100, 1E-10 ) ;
int flag = JStewartN( P, Q, L, 6, x, 100, 1E-10 ) ;
double dx[7] ;
for ( i=0 ; i<7 ; i++ ) dx[i] = x[i] - x2[i] ;
ofstream outf( "output.txt" ) ;
outf.precision( 20 ) ;
outf<< " flag " << flag << endl << endl ;
outf<< " x " << endl ;
for ( i=0 ; i<7 ; i++ )
outf<< x[i] << endl ;
outf<< endl << endl ;
outf<< " dx " << endl ;
for ( i=0 ; i<7 ; i++ )
outf<< dx[i] << endl ;
outf.close() ;
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
// create and load the frame with its resources
pFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);
// The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CDevelopApp message handlers
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CDevelopApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CDevelopApp message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -