diff --git a/B-spline/MainFrm.cpp b/B-spline/MainFrm.cpp new file mode 100644 index 0000000..4b8fbd9 --- /dev/null +++ b/B-spline/MainFrm.cpp @@ -0,0 +1,107 @@ +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "Test.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) + //{{AFX_MSG_MAP(CMainFrame) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code ! + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here + +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP + | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + if( !CFrameWnd::PreCreateWindow(cs) ) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + diff --git a/B-spline/MainFrm.h b/B-spline/MainFrm.h new file mode 100644 index 0000000..a52d77a --- /dev/null +++ b/B-spline/MainFrm.h @@ -0,0 +1,58 @@ +// MainFrm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__7BDF38E2_1C35_4E15_804B_2AB491FCC818__INCLUDED_) +#define AFX_MAINFRM_H__7BDF38E2_1C35_4E15_804B_2AB491FCC818__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CMainFrame : public CFrameWnd +{ + +protected: // create from serialization only + CMainFrame(); + DECLARE_DYNCREATE(CMainFrame) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__7BDF38E2_1C35_4E15_804B_2AB491FCC818__INCLUDED_) diff --git a/B-spline/ReadMe.txt b/B-spline/ReadMe.txt new file mode 100644 index 0000000..a7f11b9 --- /dev/null +++ b/B-spline/ReadMe.txt @@ -0,0 +1,105 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : Test +======================================================================== + + +AppWizard has created this Test application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your Test application. + +Test.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +Test.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CTestApp application class. + +Test.cpp + This is the main application source file that contains the application + class CTestApp. + +Test.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +Test.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +res\Test.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file Test.rc. + +res\Test.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + + +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CFrameWnd and controls all SDI frame features. + +res\Toolbar.bmp + This bitmap file is used to create tiled images for the toolbar. + The initial toolbar and status bar are constructed in the CMainFrame + class. Edit this toolbar bitmap using the resource editor, and + update the IDR_MAINFRAME TOOLBAR array in Test.rc to add + toolbar buttons. +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one document type and one view: + +TestDoc.h, TestDoc.cpp - the document + These files contain your CTestDoc class. Edit these files to + add your special document data and to implement file saving and loading + (via CTestDoc::Serialize). + +TestView.h, TestView.cpp - the view of the document + These files contain your CTestView class. + CTestView objects are used to view CTestDoc objects. + + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Test.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC42XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC42DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/B-spline/StdAfx.cpp b/B-spline/StdAfx.cpp new file mode 100644 index 0000000..0f878dd --- /dev/null +++ b/B-spline/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Test.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/B-spline/StdAfx.h b/B-spline/StdAfx.h new file mode 100644 index 0000000..227ba92 --- /dev/null +++ b/B-spline/StdAfx.h @@ -0,0 +1,33 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__40591CFA_4C1D_4FD7_8414_6EA0BBACA787__INCLUDED_) +#define AFX_STDAFX_H__40591CFA_4C1D_4FD7_8414_6EA0BBACA787__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC Automation classes +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT +// 版权所有(2013) +// Copyright(2013) +// 编写者: 孔令德 +// Author: Kong Lingde +// 网址:www.klingde.com +// QQ:997796978 +// 地址:太原工业学院 计算机工程系 + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__40591CFA_4C1D_4FD7_8414_6EA0BBACA787__INCLUDED_) diff --git a/B-spline/Test.aps b/B-spline/Test.aps new file mode 100644 index 0000000..9d70aae Binary files /dev/null and b/B-spline/Test.aps differ diff --git a/B-spline/Test.clw b/B-spline/Test.clw new file mode 100644 index 0000000..85407b9 --- /dev/null +++ b/B-spline/Test.clw @@ -0,0 +1,101 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CTestView +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "Test.h" +LastPage=0 + +ClassCount=5 +Class1=CTestApp +Class2=CTestDoc +Class3=CTestView +Class4=CMainFrame + +ResourceCount=2 +Resource1=IDR_MAINFRAME +Class5=CAboutDlg +Resource2=IDD_ABOUTBOX + +[CLS:CTestApp] +Type=0 +HeaderFile=Test.h +ImplementationFile=Test.cpp +Filter=N + +[CLS:CTestDoc] +Type=0 +HeaderFile=TestDoc.h +ImplementationFile=TestDoc.cpp +Filter=N + +[CLS:CTestView] +Type=0 +HeaderFile=TestView.h +ImplementationFile=TestView.cpp +Filter=C +BaseClass=CView +VirtualFilter=VWC +LastObject=CTestView + + +[CLS:CMainFrame] +Type=0 +HeaderFile=MainFrm.h +ImplementationFile=MainFrm.cpp +Filter=T +LastObject=IDM_DRAWPIC + + + + +[CLS:CAboutDlg] +Type=0 +HeaderFile=Test.cpp +ImplementationFile=Test.cpp +Filter=D + +[DLG:IDD_ABOUTBOX] +Type=1 +Class=CAboutDlg +ControlCount=2 +Control1=IDOK,button,1342373889 +Control2=IDC_STATIC,static,1342177294 + +[MNU:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_APP_EXIT +Command2=IDM_DRAWPIC +Command3=ID_APP_ABOUT +CommandCount=3 + +[ACL:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_FILE_PRINT +Command5=ID_EDIT_UNDO +Command6=ID_EDIT_CUT +Command7=ID_EDIT_COPY +Command8=ID_EDIT_PASTE +Command9=ID_EDIT_UNDO +Command10=ID_EDIT_CUT +Command11=ID_EDIT_COPY +Command12=ID_EDIT_PASTE +Command13=ID_NEXT_PANE +Command14=ID_PREV_PANE +CommandCount=14 + +[TB:IDR_MAINFRAME] +Type=1 +Class=? +Command1=ID_APP_EXIT +Command2=IDM_DRAWPIC +Command3=ID_APP_ABOUT +CommandCount=3 + diff --git a/B-spline/Test.cpp b/B-spline/Test.cpp new file mode 100644 index 0000000..1b2ae3e --- /dev/null +++ b/B-spline/Test.cpp @@ -0,0 +1,154 @@ +// Test.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "Test.h" + +#include "MainFrm.h" +#include "TestDoc.h" +#include "TestView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestApp + +BEGIN_MESSAGE_MAP(CTestApp, CWinApp) + //{{AFX_MSG_MAP(CTestApp) + 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 + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) + // Standard print setup command + ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestApp construction + +CTestApp::CTestApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CTestApp object + +CTestApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CTestApp initialization + +BOOL CTestApp::InitInstance() +{ + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Change the registry key under which our settings are stored. + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CSingleDocTemplate* pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + IDR_MAINFRAME, + RUNTIME_CLASS(CTestDoc), + RUNTIME_CLASS(CMainFrame), // main SDI frame window + RUNTIME_CLASS(CTestView)); + AddDocTemplate(pDocTemplate); + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The one and only window has been initialized, so show and update it. + m_pMainWnd->ShowWindow(SW_MAXIMIZE); + m_pMainWnd->SetWindowText("案例23:三次B样条曲线"); + m_pMainWnd->UpdateWindow(); + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////////// +// 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 CTestApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestApp message handlers + diff --git a/B-spline/Test.dsp b/B-spline/Test.dsp new file mode 100644 index 0000000..6df59b6 --- /dev/null +++ b/B-spline/Test.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="Test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=Test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Test.mak" CFG="Test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Test - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Test - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Test - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "Test - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "Test - Win32 Release" +# Name "Test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\MainFrm.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\Test.cpp +# End Source File +# Begin Source File + +SOURCE=.\Test.rc +# End Source File +# Begin Source File + +SOURCE=.\TestDoc.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestView.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\MainFrm.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\Test.h +# End Source File +# Begin Source File + +SOURCE=.\TestDoc.h +# End Source File +# Begin Source File + +SOURCE=.\TestView.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\about.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\app.ico +# End Source File +# Begin Source File + +SOURCE=.\res\bc.cur +# End Source File +# Begin Source File + +SOURCE=.\res\draw.ico +# End Source File +# Begin Source File + +SOURCE=.\res\exit.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Help.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Test.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Test.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\TestDoc.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Toolbar.bmp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/B-spline/Test.dsw b/B-spline/Test.dsw new file mode 100644 index 0000000..d4e2b94 --- /dev/null +++ b/B-spline/Test.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Test"=.\Test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/B-spline/Test.h b/B-spline/Test.h new file mode 100644 index 0000000..15c93e0 --- /dev/null +++ b/B-spline/Test.h @@ -0,0 +1,49 @@ +// Test.h : main header file for the TEST application +// + +#if !defined(AFX_TEST_H__687EC7D4_477F_4BD3_BCC6_BD41AD64322D__INCLUDED_) +#define AFX_TEST_H__687EC7D4_477F_4BD3_BCC6_BD41AD64322D__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CTestApp: +// See Test.cpp for the implementation of this class +// + +class CTestApp : public CWinApp +{ +public: + CTestApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + //{{AFX_MSG(CTestApp) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TEST_H__687EC7D4_477F_4BD3_BCC6_BD41AD64322D__INCLUDED_) diff --git a/B-spline/Test.ncb b/B-spline/Test.ncb new file mode 100644 index 0000000..fd07816 Binary files /dev/null and b/B-spline/Test.ncb differ diff --git a/B-spline/Test.opensdf b/B-spline/Test.opensdf new file mode 100644 index 0000000..65181ac Binary files /dev/null and b/B-spline/Test.opensdf differ diff --git a/B-spline/Test.opt b/B-spline/Test.opt new file mode 100644 index 0000000..f7e87fd Binary files /dev/null and b/B-spline/Test.opt differ diff --git a/B-spline/Test.plg b/B-spline/Test.plg new file mode 100644 index 0000000..eb6869d --- /dev/null +++ b/B-spline/Test.plg @@ -0,0 +1,54 @@ + + +
+

Build Log

+

+--------------------Configuration: Test - Win32 Debug-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x804 /fo"Debug/Test.res" /d "_DEBUG" /d "_AFXDLL" "D:\计算机图形学\计算机图形学实践教程源码\案例23-三次B样条曲线\Test.rc"" +Creating temporary file "C:\Users\csq-n\AppData\Local\Temp\RSPC516.tmp" with contents +[ +/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/Test.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"D:\计算机图形学\计算机图形学实践教程源码\案例23-三次B样条曲线\MainFrm.cpp" +"D:\计算机图形学\计算机图形学实践教程源码\案例23-三次B样条曲线\Test.cpp" +"D:\计算机图形学\计算机图形学实践教程源码\案例23-三次B样条曲线\TestDoc.cpp" +"D:\计算机图形学\计算机图形学实践教程源码\案例23-三次B样条曲线\TestView.cpp" +] +Creating command line "cl.exe @"C:\Users\csq-n\AppData\Local\Temp\RSPC516.tmp"" +Creating temporary file "C:\Users\csq-n\AppData\Local\Temp\RSPC517.tmp" with contents +[ +/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/Test.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"D:\计算机图形学\计算机图形学实践教程源码\案例23-三次B样条曲线\StdAfx.cpp" +] +Creating command line "cl.exe @"C:\Users\csq-n\AppData\Local\Temp\RSPC517.tmp"" +Creating temporary file "C:\Users\csq-n\AppData\Local\Temp\RSPC518.tmp" with contents +[ +/nologo /subsystem:windows /incremental:yes /pdb:"Debug/Test.pdb" /debug /machine:I386 /out:"Debug/Test.exe" /pdbtype:sept +".\Debug\MainFrm.obj" +".\Debug\StdAfx.obj" +".\Debug\Test.obj" +".\Debug\TestDoc.obj" +".\Debug\TestView.obj" +".\Debug\Test.res" +] +Creating command line "link.exe @"C:\Users\csq-n\AppData\Local\Temp\RSPC518.tmp"" +

Output Window

+Compiling resources... +Compiling... +StdAfx.cpp +Compiling... +MainFrm.cpp +Test.cpp +TestDoc.cpp +TestView.cpp +Generating Code... +Linking... + + + +

Results

+Test.exe - 0 error(s), 0 warning(s) +
+ + diff --git a/B-spline/Test.rc b/B-spline/Test.rc new file mode 100644 index 0000000..a2d852f --- /dev/null +++ b/B-spline/Test.rc @@ -0,0 +1,375 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Chinese (P.R.C.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +#pragma code_page(936) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 4, 2\r\n" + "#pragma code_page(936)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\Test.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""l.chs\\afxres.rc"" // Standard components\r\n" + "#include ""l.chs\\afxprint.rc"" // printing/print preview resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\Test.ico" +IDR_TESTTYPE ICON DISCARDABLE "res\\TestDoc.ico" +IDI_ICON1 ICON DISCARDABLE "res\\Help.ico" +IDI_ICON2 ICON DISCARDABLE "res\\app.ico" +IDI_ICON3 ICON DISCARDABLE "res\\draw.ico" +IDI_ICON4 ICON DISCARDABLE "res\\exit.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" +IDB_ABOUT BITMAP DISCARDABLE "res\\about.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR DISCARDABLE 32, 32 +BEGIN + BUTTON ID_APP_EXIT + BUTTON IDM_DRAWPIC + BUTTON ID_APP_ABOUT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "退出(&X)", ID_APP_EXIT + END + POPUP "绘图(&D)" + BEGIN + MENUITEM "绘图", IDM_DRAWPIC + END + POPUP "帮助(&H)" + BEGIN + MENUITEM "关于 Test(&A)...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "N", ID_FILE_NEW, VIRTKEY, CONTROL + "O", ID_FILE_OPEN, VIRTKEY, CONTROL + "S", ID_FILE_SAVE, VIRTKEY, CONTROL + "P", ID_FILE_PRINT, VIRTKEY, CONTROL + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL + "X", ID_EDIT_CUT, VIRTKEY, CONTROL + "C", ID_EDIT_COPY, VIRTKEY, CONTROL + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT + VK_F6, ID_NEXT_PANE, VIRTKEY + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 216, 180 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "关于 Test" +FONT 9, "宋体" +BEGIN + DEFPUSHBUTTON "确定",IDOK,85,159,50,14,WS_GROUP + CONTROL 134,IDC_STATIC,"Static",SS_BITMAP,7,7,200,150 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080404b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Test Microsoft 基础类应用程序\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Test\0" + VALUE "LegalCopyright", "版权所有 (C) 2006\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "Test.EXE\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Test 应用程序\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x804, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 209 + TOPMARGIN, 7 + BOTTOMMARGIN, 173 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "Test\n\nTest\n\n\nTest.Document\nTest Document" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "Test" + AFX_IDS_IDLEMESSAGE "就绪" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "扩展名" + ID_INDICATOR_CAPS "大写" + ID_INDICATOR_NUM "数字" + ID_INDICATOR_SCRL "滚动" + ID_INDICATOR_OVR "改写" + ID_INDICATOR_REC "记录" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "建立新文档\n新建" + ID_FILE_OPEN "打开一个现有文档\n打开" + ID_FILE_CLOSE "关闭活动文档\n关闭" + ID_FILE_SAVE "保存活动文档\n保存" + ID_FILE_SAVE_AS "将活动文档以一个新文件名保存\n另存为" + ID_FILE_PAGE_SETUP "改变打印选项\n页面设置" + ID_FILE_PRINT_SETUP "改变打印机及打印选项\n打印设置" + ID_FILE_PRINT "打印活动文档\n打印" + ID_FILE_PRINT_PREVIEW "显示整页\n打印预览" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "开发人员信息\n关于" + ID_APP_EXIT "退出应用程序\n退出" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "打开该文档" + ID_FILE_MRU_FILE2 "打开该文档" + ID_FILE_MRU_FILE3 "打开该文档" + ID_FILE_MRU_FILE4 "打开该文档" + ID_FILE_MRU_FILE5 "打开该文档" + ID_FILE_MRU_FILE6 "打开该文档" + ID_FILE_MRU_FILE7 "打开该文档" + ID_FILE_MRU_FILE8 "打开该文档" + ID_FILE_MRU_FILE9 "打开该文档" + ID_FILE_MRU_FILE10 "打开该文档" + ID_FILE_MRU_FILE11 "打开该文档" + ID_FILE_MRU_FILE12 "打开该文档" + ID_FILE_MRU_FILE13 "打开该文档" + ID_FILE_MRU_FILE14 "打开该文档" + ID_FILE_MRU_FILE15 "打开该文档" + ID_FILE_MRU_FILE16 "打开该文档" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "切换到下一个窗格\n下一窗格" + ID_PREV_PANE "切换回前一个窗格\n前一窗格" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_SPLIT "将活动的窗口分隔成窗格\n分隔" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "删除被选对象\n删除" + ID_EDIT_CLEAR_ALL "全部删除\n全部删除" + ID_EDIT_COPY "复制被选对象并将其置于剪贴板上\n复制" + ID_EDIT_CUT "剪切被选对象并将其置于剪贴板上\n剪切" + ID_EDIT_FIND "查找指定的正文\n查找" + ID_EDIT_PASTE "插入剪贴板内容\n粘贴" + ID_EDIT_REPEAT "重复上一步操作\n重复" + ID_EDIT_REPLACE "用不同的正文替换指定的正文\n替换" + ID_EDIT_SELECT_ALL "选择整个文档\n选择全部" + ID_EDIT_UNDO "撤消最后一步操作\n撤消" + ID_EDIT_REDO "重新执行先前已撤消的操作\n重新执行" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_TOOLBAR "显示或隐藏工具栏\n显隐工具栏" + ID_VIEW_STATUS_BAR "显示或隐藏状态栏\n显隐状态栏" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "改变窗口大小" + AFX_IDS_SCMOVE "改变窗口位置" + AFX_IDS_SCMINIMIZE "将窗口缩小成图标" + AFX_IDS_SCMAXIMIZE "把窗口放大到最大尺寸" + AFX_IDS_SCNEXTWINDOW "切换到下一个文档窗口" + AFX_IDS_SCPREVWINDOW "切换到先前的文档窗口" + AFX_IDS_SCCLOSE "关闭活动的窗口并提示保存所有文档" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "把窗口恢复到正常大小" + AFX_IDS_SCTASKLIST "激活任务表" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_PREVIEW_CLOSE "关闭打印预览模式\n取消预阅" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_DRAWPIC "绘制B样条曲线\nB样条曲线" +END + +#endif // Chinese (P.R.C.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE 4, 2 +#pragma code_page(936) +#endif //_WIN32 +#include "res\Test.rc2" // non-Microsoft Visual C++ edited resources +#include "l.chs\afxres.rc" // Standard components +#include "l.chs\afxprint.rc" // printing/print preview resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/B-spline/Test.sdf b/B-spline/Test.sdf new file mode 100644 index 0000000..b50acb6 Binary files /dev/null and b/B-spline/Test.sdf differ diff --git a/B-spline/Test.sln b/B-spline/Test.sln new file mode 100644 index 0000000..fc1f265 --- /dev/null +++ b/B-spline/Test.sln @@ -0,0 +1,20 @@ +锘� +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcxproj", "{69DD198E-A050-A42B-53D6-12F6E4E3E50C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69DD198E-A050-A42B-53D6-12F6E4E3E50C}.Debug|Win32.ActiveCfg = Debug|Win32 + {69DD198E-A050-A42B-53D6-12F6E4E3E50C}.Debug|Win32.Build.0 = Debug|Win32 + {69DD198E-A050-A42B-53D6-12F6E4E3E50C}.Release|Win32.ActiveCfg = Release|Win32 + {69DD198E-A050-A42B-53D6-12F6E4E3E50C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/B-spline/Test.suo b/B-spline/Test.suo new file mode 100644 index 0000000..995cc83 Binary files /dev/null and b/B-spline/Test.suo differ diff --git a/B-spline/Test.vcxproj b/B-spline/Test.vcxproj new file mode 100644 index 0000000..4210937 --- /dev/null +++ b/B-spline/Test.vcxproj @@ -0,0 +1,176 @@ +锘� + + + + Debug + Win32 + + + Release + Win32 + + + + + + MFCProj + {69DD198E-A050-A42B-53D6-12F6E4E3E50C} + 10.0 + + + + Application + Dynamic + MultiByte + v143 + + + Application + Dynamic + MultiByte + v143 + + + + + + + + + + + + + + + .\Release\ + .\Release\ + false + + + .\Debug\ + .\Debug\ + true + + + + MultiThreadedDLL + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Release\ + .\Release\Test.pch + Use + stdafx.h + .\Release\ + .\Release\ + + + true + NDEBUG;%(PreprocessorDefinitions) + .\Release\Test.tlb + true + Win32 + + + 0x0804 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\Test.bsc + + + true + Windows + .\Release\Test.exe + + + + + MultiThreadedDebugDLL + Default + true + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Debug\ + true + .\Debug\Test.pch + Use + stdafx.h + .\Debug\ + .\Debug\ + EnableFastChecks + + + true + _DEBUG;%(PreprocessorDefinitions) + .\Debug\Test.tlb + true + Win32 + + + 0x0804 + _DEBUG;%(PreprocessorDefinitions) + + + true + .\Debug\Test.bsc + + + true + true + Windows + .\Debug\Test.exe + + + + + + Create + stdafx.h + Create + stdafx.h + + + + + + + + + + + + + + + + + + + + + + + + + + RC + + + + + + + + + \ No newline at end of file diff --git a/B-spline/Test.vcxproj.filters b/B-spline/Test.vcxproj.filters new file mode 100644 index 0000000..c5eb5c1 --- /dev/null +++ b/B-spline/Test.vcxproj.filters @@ -0,0 +1,92 @@ +锘� + + + + {59b33173-56ee-43cc-a6f5-13a86ae771f1} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {8a203a8b-0efa-45b0-b3ab-0fa9453c3a7e} + h;hpp;hxx;hm;inl + + + {304cf707-60fe-453d-9917-9173865722ea} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + + \ No newline at end of file diff --git a/B-spline/Test.vcxproj.user b/B-spline/Test.vcxproj.user new file mode 100644 index 0000000..ace9a86 --- /dev/null +++ b/B-spline/Test.vcxproj.user @@ -0,0 +1,3 @@ +锘� + + \ No newline at end of file diff --git a/B-spline/TestDoc.cpp b/B-spline/TestDoc.cpp new file mode 100644 index 0000000..b35f16f --- /dev/null +++ b/B-spline/TestDoc.cpp @@ -0,0 +1,84 @@ +// TestDoc.cpp : implementation of the CTestDoc class +// + +#include "stdafx.h" +#include "Test.h" + +#include "TestDoc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc + +IMPLEMENT_DYNCREATE(CTestDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTestDoc, CDocument) + //{{AFX_MSG_MAP(CTestDoc) + // 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() + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc construction/destruction + +CTestDoc::CTestDoc() +{ + // TODO: add one-time construction code here + +} + +CTestDoc::~CTestDoc() +{ +} + +BOOL CTestDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc serialization + +void CTestDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc diagnostics + +#ifdef _DEBUG +void CTestDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTestDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc commands diff --git a/B-spline/TestDoc.h b/B-spline/TestDoc.h new file mode 100644 index 0000000..2638266 --- /dev/null +++ b/B-spline/TestDoc.h @@ -0,0 +1,57 @@ +// TestDoc.h : interface of the CTestDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TESTDOC_H__72DBD624_92AB_462A_B0FD_D3F54BA45097__INCLUDED_) +#define AFX_TESTDOC_H__72DBD624_92AB_462A_B0FD_D3F54BA45097__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +class CTestDoc : public CDocument +{ +protected: // create from serialization only + CTestDoc(); + DECLARE_DYNCREATE(CTestDoc) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTestDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CTestDoc) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTDOC_H__72DBD624_92AB_462A_B0FD_D3F54BA45097__INCLUDED_) diff --git a/B-spline/TestView.cpp b/B-spline/TestView.cpp new file mode 100644 index 0000000..02280a1 --- /dev/null +++ b/B-spline/TestView.cpp @@ -0,0 +1,236 @@ +// TestView.cpp : implementation of the CTestView class +// + +#include "stdafx.h" +#include "Test.h" +#include "math.h" //数学头文件 +#define Round(d) int(floor(d + 0.5)) // 四舍五入宏定义 +#include "TestDoc.h" +#include "TestView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestView + +IMPLEMENT_DYNCREATE(CTestView, CView) + +BEGIN_MESSAGE_MAP(CTestView, CView) +//{{AFX_MSG_MAP(CTestView) +ON_WM_MOUSEMOVE() +ON_WM_LBUTTONDOWN() +ON_WM_LBUTTONUP() +ON_COMMAND(IDM_DRAWPIC, OnDrawpic) +//}}AFX_MSG_MAP +// Standard printing commands +ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestView construction/destruction +CTestView::CTestView() +{ + // TODO: add construction code here + m_AbleToLeftBtn = FALSE; + m_AbleToMove = FALSE; + m_i = -1; + + P[0] = CPoint(900, 150); + P[1] = CPoint(960, 300); + P[2] = CPoint(1050, 450); + P[3] = CPoint(900, 600); + P[4] = CPoint(750, 450); + P[5] = CPoint(840, 300); + P[6] = CPoint(900, 150); +} + +CTestView::~CTestView() +{ +} + +BOOL CTestView::PreCreateWindow(CREATESTRUCT &cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestView drawing + +void CTestView::OnDraw(CDC *pDC) +{ + CTestDoc *pDoc = GetDocument(); + ASSERT_VALID(pDoc); + // TODO: add draw code for native data here + CRect rect; // 定义客户区 + GetClientRect(&rect); // 获得客户区的大小 + CDC MemDC; // 内存DC + CBitmap NewBitmap, *pOldBitmap; // 内存中承载图像的临时位图 + MemDC.CreateCompatibleDC(pDC); // 建立与屏幕pDC兼容的MemDC + NewBitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height()); // 创建兼容位图 + pOldBitmap = MemDC.SelectObject(&NewBitmap); // 将兼容位图选入MemDC + MemDC.FillSolidRect(rect, pDC->GetBkColor()); // 按原来背景填充客户区,否则是黑色 + CPen NewPen, *pOldPen; + NewPen.CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); + pOldPen = MemDC.SelectObject(&NewPen); + MemDC.MoveTo(P[0]); + MemDC.Ellipse(P[0].x - 2, P[0].y - 2, P[0].x + 2, P[0].y + 2); // 绘制控制多边形顶点 + for (int i = 1; i < 7; i++) + { + MemDC.LineTo(P[i]); + MemDC.Ellipse(P[i].x - 2, P[i].y - 2, P[i].x + 2, P[i].y + 2); + } + if (m_i != -1) + { + CString str; + str.Format("x=%d,y=%d", P[m_i].x, P[m_i].y); + MemDC.TextOut(P[m_i].x + 5, P[m_i].y + 5, str); + } + B3Curves(P, &MemDC); + pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &MemDC, 0, 0, SRCCOPY); // 将内存位图拷贝到屏幕 + MemDC.SelectObject(pOldPen); + NewPen.DeleteObject(); + MemDC.SelectObject(pOldBitmap); // 恢复位图 + NewBitmap.DeleteObject(); // 删除位图 + MemDC.DeleteDC(); // 删除MemDC +} + +///////////////////////////////////////////////////////////////////////////// +// CTestView printing + +BOOL CTestView::OnPreparePrinting(CPrintInfo *pInfo) +{ + // default preparation + return DoPreparePrinting(pInfo); +} + +void CTestView::OnBeginPrinting(CDC * /*pDC*/, CPrintInfo * /*pInfo*/) +{ + // TODO: add extra initialization before printing +} + +void CTestView::OnEndPrinting(CDC * /*pDC*/, CPrintInfo * /*pInfo*/) +{ + // TODO: add cleanup after printing +} + +///////////////////////////////////////////////////////////////////////////// +// CTestView diagnostics + +#ifdef _DEBUG +void CTestView::AssertValid() const +{ + CView::AssertValid(); +} + +void CTestView::Dump(CDumpContext &dc) const +{ + CView::Dump(dc); +} + +CTestDoc *CTestView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestDoc))); + return (CTestDoc *)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTestView message handlers +void CTestView::B3Curves(CPoint q[], CDC *pDC) +{ + CPoint p; + double F03, F13, F23, F33; + + // 设置起点 + p.x = Round((q[0].x + 4.0 * q[1].x + q[2].x) / 6.0); + p.y = Round((q[0].y + 4.0 * q[1].y + q[2].y) / 6.0); + pDC->MoveTo(p); + + // 使用红色画笔 + CPen NewPen(PS_SOLID, 2, RGB(255, 0, 0)); + CPen *pOldPen = pDC->SelectObject(&NewPen); + + // 计算B样条曲线点 + for (int i = 0; i < 7; i++) + { + for (double t = 0; t <= 1.0; t += 0.05) + { + // B样条基函数 + F03 = (-t * t * t + 3 * t * t - 3 * t + 1) / 6.0; + F13 = (3 * t * t * t - 6 * t * t + 4) / 6.0; + F23 = (-3 * t * t * t + 3 * t * t + 3 * t + 1) / 6.0; + F33 = t * t * t / 6.0; + + // 计算曲线上的点 + int j = i % 7; // 循环索引确保首尾相连 + int j1 = (i + 1) % 7; + int j2 = (i + 2) % 7; + int j3 = (i + 3) % 7; + + p.x = Round(q[j].x * F03 + q[j1].x * F13 + q[j2].x * F23 + q[j3].x * F33); + p.y = Round(q[j].y * F03 + q[j1].y * F13 + q[j2].y * F23 + q[j3].y * F33); + + pDC->LineTo(p); + } + } + + pDC->SelectObject(pOldPen); + NewPen.DeleteObject(); +} + +void CTestView::OnMouseMove(UINT nFlags, CPoint point) // 鼠标移动函数 +{ + // TODO: Add your message handler code here and/or call default + if (TRUE == m_AbleToMove) + P[m_i] = point; + m_i = -1; + int i; + for (i = 0; i < 7; i++) + { + if ((point.x - P[i].x) * (point.x - P[i].x) + (point.y - P[i].y) * (point.y - P[i].y) < 50) + { + m_i = i; + m_AbleToLeftBtn = TRUE; + SetCursor(LoadCursor(NULL, IDC_SIZEALL)); // 改变为十字箭头光标 + break; + } + } + if (10 == i) + { + m_i = -1; + } + Invalidate(FALSE); + CView::OnMouseMove(nFlags, point); +} + +void CTestView::OnLButtonDown(UINT nFlags, CPoint point) // 鼠标左键按下函数 +{ + // TODO: Add your message handler code here and/or call default + if (m_AbleToLeftBtn == TRUE) + m_AbleToMove = TRUE; + CView::OnLButtonDown(nFlags, point); +} + +void CTestView::OnLButtonUp(UINT nFlags, CPoint point) // 鼠标左键弹起函数 +{ + // TODO: Add your message handler code here and/or call default + m_AbleToLeftBtn = FALSE; + m_AbleToMove = FALSE; + m_i = 0; + CView::OnLButtonUp(nFlags, point); +} + +void CTestView::OnDrawpic() +{ + // TODO: Add your command handler code here + MessageBox("请直接拖动控制多边形顶点观察效果!", "信息", MB_ICONINFORMATION | MB_OK); +} diff --git a/B-spline/TestView.h b/B-spline/TestView.h new file mode 100644 index 0000000..5bf3901 --- /dev/null +++ b/B-spline/TestView.h @@ -0,0 +1,71 @@ +// TestView.h : interface of the CTestView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_) +#define AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +class CTestView : public CView +{ +protected: // create from serialization only + CTestView(); + DECLARE_DYNCREATE(CTestView) +// Attributes +public: + CTestDoc* GetDocument(); + +// Operations +public: + void B3Curves(CPoint q[],CDC *pDC);//绘制B样条曲线 +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestView) + 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: + virtual ~CTestView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + BOOL m_AbleToLeftBtn;//鼠标左键有效 + BOOL m_AbleToMove;//鼠标移动点有效 + int m_i;//控制点坐标编号 + CPoint P[7];//鼠标点 +// Generated message map functions +protected: + //{{AFX_MSG(CTestView) + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + afx_msg void OnDrawpic(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in TestView.cpp +inline CTestDoc* CTestView::GetDocument() + { return (CTestDoc*)m_pDocument; } +#endif + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_) diff --git a/B-spline/res/Help.ico b/B-spline/res/Help.ico new file mode 100644 index 0000000..b1aaffa Binary files /dev/null and b/B-spline/res/Help.ico differ diff --git a/B-spline/res/Test.ico b/B-spline/res/Test.ico new file mode 100644 index 0000000..168ef77 Binary files /dev/null and b/B-spline/res/Test.ico differ diff --git a/B-spline/res/Test.rc2 b/B-spline/res/Test.rc2 new file mode 100644 index 0000000..f3b43e0 --- /dev/null +++ b/B-spline/res/Test.rc2 @@ -0,0 +1,13 @@ +// +// TEST.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/B-spline/res/TestDoc.ico b/B-spline/res/TestDoc.ico new file mode 100644 index 0000000..2a1f1ae Binary files /dev/null and b/B-spline/res/TestDoc.ico differ diff --git a/B-spline/res/Thumbs.db b/B-spline/res/Thumbs.db new file mode 100644 index 0000000..b535e92 Binary files /dev/null and b/B-spline/res/Thumbs.db differ diff --git a/B-spline/res/Toolbar.bmp b/B-spline/res/Toolbar.bmp new file mode 100644 index 0000000..738aa37 Binary files /dev/null and b/B-spline/res/Toolbar.bmp differ diff --git a/B-spline/res/about.bmp b/B-spline/res/about.bmp new file mode 100644 index 0000000..a9d3f73 Binary files /dev/null and b/B-spline/res/about.bmp differ diff --git a/B-spline/res/app.ico b/B-spline/res/app.ico new file mode 100644 index 0000000..ff42f3e Binary files /dev/null and b/B-spline/res/app.ico differ diff --git a/B-spline/res/draw.ico b/B-spline/res/draw.ico new file mode 100644 index 0000000..911bdce Binary files /dev/null and b/B-spline/res/draw.ico differ diff --git a/B-spline/res/exit.ico b/B-spline/res/exit.ico new file mode 100644 index 0000000..a2fcaed Binary files /dev/null and b/B-spline/res/exit.ico differ diff --git a/B-spline/resource.h b/B-spline/resource.h new file mode 100644 index 0000000..07afce7 --- /dev/null +++ b/B-spline/resource.h @@ -0,0 +1,31 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Test.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_TESTTYPE 129 +#define IDI_ICON1 130 +#define IDI_ICON2 131 +#define IDI_ICON3 132 +#define IDI_ICON4 133 +#define IDB_BITMAP1 134 +#define IDB_ABOUT 134 +#define IDB_BITMAP2 135 +#define IDB_BITMAP3 136 +#define IDC_CURSOR1 137 +#define ID_MENUAntiliasing 32774 +#define ID_MENU_B 32775 +#define IDM_DRAWPIC 32776 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 142 +#define _APS_NEXT_COMMAND_VALUE 32778 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif