beisaer.rar

  • Willis123
    了解作者
  • C/C++
    开发工具
  • 1.9MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 2
    下载次数
  • 2021-04-26 16:43
    上传日期
详细源码讲解如何计算贝塞尔曲线,可以实现曲线的平滑算法
beisaer.rar
  • 贝塞尔曲线
  • Debug
  • vc60.pdb
    356KB
  • vc60.idb
    201KB
  • Bezier.pch
    5.3MB
  • Bezier.obj
    12.7KB
  • Bezier.ilk
    189.9KB
  • Bezier.pdb
    353KB
  • StdAfx.obj
    103.2KB
  • Bezier.res
    2.3KB
  • BezierDlg.obj
    26.3KB
  • Bezier.exe
    108.1KB
  • Release
  • Bezier.obj
    8.6KB
  • StdAfx.obj
    768B
  • Bezier.res
    2.3KB
  • BezierDlg.obj
    18.6KB
  • Bezier.exe
    24KB
  • res
  • Bezier.ico
    1.1KB
  • Bezier.rc2
    398B
  • BezierDlg.h
    1.8KB
  • BezierDlg.cpp
    6.7KB
  • StdAfx.cpp
    208B
  • resource.h
    730B
  • Bezier.plg
    1.4KB
  • Bezier.dsp
    4.1KB
  • Bezier.clw
    864B
  • StdAfx.h
    1KB
  • Bezier.aps
    19.7KB
  • Bezier.h
    1.3KB
  • Bezier.opt
    258.5KB
  • Bezier.dsw
    535B
  • Bezier.cpp
    2KB
  • Bezier.rc
    5KB
  • Bezier.ncb
    89KB
内容介绍
// BezierDlg.cpp : implementation file // #include "stdafx.h" #include "Bezier.h" #include "BezierDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CBezierDlg dialog CBezierDlg::CBezierDlg(CWnd* pParent /*=NULL*/) : CDialog(CBezierDlg::IDD, pParent) { //{{AFX_DATA_INIT(CBezierDlg) //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CBezierDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBezierDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CBezierDlg, CDialog) //{{AFX_MSG_MAP(CBezierDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_MOUSEMOVE() ON_BN_CLICKED(IDC_RADIO1, OnAdd) ON_BN_CLICKED(IDC_RADIO2, OnMove) ON_WM_RBUTTONDOWN() ON_WM_RBUTTONUP() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBezierDlg message handlers BOOL CBezierDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here pointmax = -1; current2 = -1; current = -1; AddorMove =1; memset(lut,0,sizeof(lut)); return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CBezierDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { pDC = new CPaintDC(this); if(pointmax>=0) { pDC->MoveTo( (int)points[0].x, (int)points[0].y); for(int i = 0; i<=pointmax; i++) { CPen penStroke(PS_SOLID,1,0x007700); CPen *ppenPrevious=pDC->SelectObject(&penStroke); pDC->LineTo((int)points[i].x,(int)points[i].y); pDC->SelectObject(ppenPrevious); CPen penStroke2(PS_SOLID,1,0xff0000); CPen *ppenPrevious2=pDC->SelectObject(&penStroke2); pDC->Rectangle((int)points[i].x - 5, (int)points[i].y -5 ,(int)points[i].x + 5 ,(int)points[i].y + 5); pDC->SelectObject(ppenPrevious2); } DPOINT p[256]; memcpy(p, points, sizeof(p)); memcpy(pointnew, points, sizeof(pointnew)); memset(lut,0,sizeof(lut)); MyDraw(p);// for(i=0;i<1000;i++) { pDC->SetPixel(i,lut[i], RGB(255,0,255));//0x0000ff } /* double x,y; CPen redpen(PS_SOLID,1,0xff7700); pDC->MoveTo(0,0); for(i=0;i<300;i++) { x=i; y=1-x*x/2+x*x*x*x/64- x*x*x*x*x*x/2304; pDC->LineTo((int)x,(int)-y/10000000); } */ } CDialog::OnPaint(); delete pDC; } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CBezierDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CBezierDlg::MyDraw(DPOINT * p) { if (pointmax <= 0) return; if((p[pointmax].x < p[0].x+1) && (p[pointmax].x > p[0].x-1) && (p[pointmax].y < p[0].y+1) && (p[pointmax].y > p[0].y-1)) { // pDC->SetPixel((int)p[0].x, (int)p[0].y, 0x0000ff);//0x0000ff lut[(int)p[0].x] = (int)p[0].y; return; } DPOINT *p1; p1 = new DPOINT[pointmax+1]; int i, j; p1[0] = p[0]; for(i=1; i<=pointmax; i++) { for(j=0; j<=pointmax-i;j++) { p[j].x = (p[j].x + p[j+1].x)/2; p[j].y = (p[j].y + p[j+1].y)/2; } p1[i] = p[0]; } MyDraw(p); MyDraw(p1); delete p1; } void CBezierDlg::OnButton2() { // TODO: Add your control notification handler code here pointmax = -1; RedrawWindow(); } void CBezierDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default int xx[10]={0,1,2,3,4,5,6,7,8,9}; int yy[10]={100,120,160,250,300,210,200,100} ; if(AddorMove == 1) { if(pointmax>=256) { AfxMessageBox("Too many points."); return; } pointmax++; points[pointmax].x = point.x; points[pointmax].y = point.y; RedrawWindow(); } else if(AddorMove == -1) { double x, y; current = -1; double t=50; for(int i = 0; i <= pointmax; i++) { x = points[i].x - point.x, y = points[i].y - point.y; x*=x; y*=y; if(x + y < t) // {current = i; break;} { current = i; t=x+y; } } } CDialog::OnLButtonDown(nFlags, point); } void CBezierDlg::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default current = -1; CDialog::OnLButtonUp(nFlags, point); } void CBezierDlg::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(current >= 0 ) { points[current].x = point.x; points[current].y = point.y; RedrawWindow(); } if(current2 >= 0 ) { points[current2].x = point.x; points[current2].y = point.y; RedrawWindow(); } //CDialog::OnMouseMove(nFlags, point); CDialog::OnMouseMove(nFlags, point); } void CBezierDlg::OnAdd() { // TODO: Add your control notification handler code here AddorMove = 1; } void CBezierDlg::OnMove() { // TODO: Add your control notification handler code here AddorMove = -1; } void CBezierDlg::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(AddorMove == -1) { if(pointmax>=256) { AfxMessageBox("Too many points."); return; } pointmax++; points[pointmax].x = point.x; points[pointmax].y = point.y; RedrawWindow(); } else if(AddorMove == 1) { double x, y; double t=50; current2 = -1; for(int i = 0; i <= pointmax; i++) { x = points[i].x - point.x, y = points[i].y - point.y; x*=x; y*=y; if(x + y < t) {current2 = i; t=x+y;} } } CDialog::OnRButtonDown(nFlags, point); } void CBezierDlg::OnRButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default current2 = -1; CDialog::OnRButtonUp(nFlags, point); }
评论
    相关推荐
    • 贝塞尔曲线.zip
      演示贝塞尔曲线的形成过程,鼠标点击可移动关键点
    • 贝塞尔曲线网络
      关于贝塞尔曲线 贝塞尔曲线网络 该项目是使用版本10.1.2生成的。 开发服务器 为开发服务器运行ng serve 。 导航到http://localhost:4200/ 。 如果您更改任何源文件,该应用程序将自动重新加载。 代码脚手架 运行ng...
    • 贝塞尔曲线计算器
      一个小小的贝塞尔曲线计算器,可以根据控制点给出曲线参数方程并给出图形显示,也可以直接在图形上鼠标输入控制点得到参数方程,所见即所得。(需要装.net 3.5运行库)
    • 贝塞尔曲线
      NULL 博文链接:https://andydufresneone.iteye.com/blog/1179224
    • 贝塞尔曲线
      IOS 贝塞尔曲线 使用自定义控件实现贝塞尔曲线画图
    • 贝塞尔曲线demo
      由于工作的需要 做了一个贝塞尔曲线的demo,有需要的可以拿去看看。一个起始点跟一个终止点,两个控制点 实现的 ,而且是中间粗两头尖,在xcode4.3.3中编写的程序
    • 贝塞尔曲线
      贝塞尔曲线的用法,demo,将贝塞尔曲线和绘画,动画的结合使用
    • 贝塞尔曲线
      贝塞尔曲线以及算法
    • 贝塞尔曲线
      vs结合easyX实现贝塞尔曲线的绘制,并可以通过鼠标拖拽控制点实现曲线的变化
    • 贝塞尔曲线.zip
      贝塞尔曲线的形成过程,鼠标点击可移动关键点