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

📄 dlgknot.cpp

📁 Hi guys, I have a B-spline curve algorithm by using Genetic algorithm. Any interested?
💻 CPP
字号:
// dlgKnot.cpp : implementation file
//

#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "matrix.h"
#include "stdafx.h"
#include "GA.h"
#include "dlgKnot.h"
#include "dlgPlotting.h"
#include "dlgFittingProcess.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define data 900
#define Draw 1000
/////////////////////////////////////////////////////////////////////////////

extern float knotgen[500];
extern int IndividualLoop,generation;
/////////////////////////////////////////////////////////////////////////////
// CdlgKnot dialog


CdlgKnot::CdlgKnot(CWnd* pParent /*=NULL*/)
	: CDialog(CdlgKnot::IDD, pParent)
{
	//{{AFX_DATA_INIT(CdlgKnot)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}


void CdlgKnot::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);

	//{{AFX_DATA_MAP(CdlgKnot)
	DDX_Control(pDX, IDC_STATIC_PICTURE, m_linePicture);
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CdlgKnot, CDialog)
	//{{AFX_MSG_MAP(CdlgKnot)
	ON_WM_PAINT()
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CdlgKnot message handlers

void CdlgKnot::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	CDC *pDC=m_linePicture.GetDC();
	CRect picrect;
	m_linePicture.GetClientRect(&picrect);
	DrawYZAxis(pDC,&picrect);
}

void CdlgKnot::DrawYZAxis(CDC *dc, CRect rect)
{
    CPen pen,*oldpen;
	dc->Rectangle(&rect);
	pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
	oldpen=dc->SelectObject(&pen);
	dc->SetMapMode(MM_LOMETRIC);
	CPoint b1=dc->SetViewportOrg(rect.Width()/2,rect.Height()/2);
    dc->SetTextColor(RGB(0,0,0));
// for drawing Y - AXIS
	dc->MoveTo(-rect.right-150,rect.bottom-800);
	dc->LineTo(rect.right+150,rect.bottom-800);
// for drawing z - AXIS
	dc->MoveTo(-rect.right-150,rect.bottom-800);
	dc->LineTo(-rect.right-150,rect.bottom+100);
// for drawing Knot
	dc->MoveTo(-rect.right-150,knotgen[0]*100-300);
	for (int i=1;i<=generation;i++){
		dc->LineTo(-rect.right-150+6*i,knotgen[i]*100-300);	
	}

	dc->SelectObject(oldpen);
	pen.DeleteObject();
}

BOOL CdlgKnot::OnInitDialog()
{
	CDialog::OnInitDialog();
   	return TRUE;
}


HCURSOR CdlgKnot::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

⌨️ 快捷键说明

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