Bezier曲线 算法 程序

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 23:46:43
Bezier曲线 算法 程序
xVOFWNAjä)6,*ĐNUe%#—LմNQM¤biej'FA8$8 4mC8{_?{o>"M_wNBW߷/Ԓ#ݵXGfA~7/~|yeXs=:c__p~t~9<}; Z'[iXz̤%aq˫7KF\6Bm$+fU o/?mΎ R6)AY=tVC&EKp;|z>xxv-( Յ,(2)G7?G[cfX.+%+'Y8֠C4]g03KT%=4t1B ,H敌tW"/cH)e. )BrNr,HדwLan#Ԭ.LKˠ&pI tK3|jAԬBb2 ߨ05cy2iZ h>G+jTun!v!I {E*$*abUnT"A.[j>'=sZЊb 0h^We4PT AqT%\v>m)٨h@J J^iY,@d Q5ak ӭRASm 2]7,8;K4%HŤ88;.C Yk2C7-~8I?+*/VKQG̈sieBmf;0Ć#K.q"@a@z ܍&CnJ6e duL@vC:CFm:aF-1]Ȗw<^ M̤ղ_j錢K&Eu'GC*` KJ.@weAxe6478>vw* Uf70) <yw)l"N n5Ȟ V9p1^",V{alq|e`R<|q*XvXc%G7 H,fMKJ{`$" 91=yEiB܁^8(O2!5+ vc"h5!.E?} ]v:3|%

Bezier曲线 算法 程序
Bezier曲线 算法 程序

Bezier曲线 算法 程序
看一下下面的Bezier曲线绘制程序,没有错误提示,但是绘制不出Bezier曲线#include "stdafx.h"#include "Test.h"#include "TestDoc.h"#include "TestView.h"#include "math.h"//包含数学头文件#define N_MAX_POINT 10//控制多边形的最大顶点数#define ROUND(a) int(a+0.5)//四舍五入#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CTestViewIMPLEMENT_DYNCREATE(CTestView, CView)BEGIN_MESSAGE_MAP(CTestView, CView) //{{AFX_MSG_MAP(CTestView) ON_COMMAND(ID_MENUBezierCurve, OnMENUBezierCurve) ON_WM_LBUTTONDOWN() ON_WM_RBUTTONDOWN() //}}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/destructionCTestView::CTestView(){ // TODO: add construction code here Flag=false;}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 drawingvoid CTestView::OnDraw(CDC* pDC){ CTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here}/////////////////////////////////////////////////////////////////////////////// CTestView printingBOOL 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 _DEBUGvoid 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 handlersvoid CTestView::OnMENUBezierCurve()//菜单函数{ // TODO: Add your command handler code here RedrawWindow(); AfxGetMainWnd()->SetWindowText("曲线和曲面:Bezier曲线");//显示标题 MessageBox("单击左键绘制控制多边形,单击右键绘制曲线","提示",MB_OK); pt=new CPoint[N_MAX_POINT]; Flag=true;CtrlPoint=0;}void CTestView::DrawBezier()//绘制Bezier曲线{ CClientDC dc(this); double x,y; int rate=800,n; n=CtrlPoint-1; for(double t=0;t