1) CutView.cpp:

// CutView.cpp : implementation of the CCutView class
//

#include "stdafx.h"
#include "Cut.h"
#include "global.h"
#include "LB_Clipping.h"
#include "CyrusBeck.h"

#include "CutDoc.h"
#include "CutView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCutView

IMPLEMENT_DYNCREATE(CCutView, CView)

BEGIN_MESSAGE_MAP(CCutView, CView)
	//{{AFX_MSG_MAP(CCutView)
	ON_WM_LBUTTONDOWN()
	ON_WM_RBUTTONDOWN()
	ON_WM_MOUSEMOVE()
	ON_COMMAND(ID_START, OnStart)
	ON_COMMAND(ID_WINDOW, OnWindow)
	ON_UPDATE_COMMAND_UI(ID_WINDOW, OnUpdateWindow)
	ON_UPDATE_COMMAND_UI(ID_PolygonClip, OnUpdatePolygonClip)
	ON_UPDATE_COMMAND_UI(ID_Parameter, OnUpdateParameter)
	ON_UPDATE_COMMAND_UI(ID_LB_Clipping, OnUpdateLBClipping)
	ON_COMMAND(ID_PolygonClip, OnPolygonClip)
	ON_COMMAND(ID_Parameter, OnParameter)
	ON_COMMAND(ID_LB_Clipping, OnLBClipping)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCutView construction/destruction

CCutView::CCutView()
{
	// TODO: add construction code here
	m_iStep=0;//0Σ1ü2ü
	m_iWindowPoint=0;
	count=0;

	m_iDrawType=2;
}

CCutView::~CCutView()
{
	//ͷſռ
	POSITION pos;			
	for(pos=m_PointList.GetHeadPosition();pos;)
	{
		Point2f *p=(Point2f *)m_PointList.GetNext(pos);
		delete p;
	}
	m_PointList.RemoveAll();
}

BOOL CCutView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCutView drawing

void CCutView::OnDraw(CDC* pDC)
{
	CCutDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(m_iDrawType == 2)
		pDoc->SetTitle("ˮ߲ü㷨");
	else if(m_iDrawType == 0)
		pDoc->SetTitle("Liang-Bü㷨");
	else
		pDoc->SetTitle("ü㷨");

	CPen *pOldPen;
	CPen PointPen(PS_SOLID,2,RGB(150,100,0));
	CPen BluePen(PS_SOLID,1,RGB(0,0,255));
	CPen RedPen(PS_SOLID,1,RGB(255,0,0));
	CPen CyanPen(PS_SOLID,1,RGB(0,255,255));
	
	pOldPen=pDC->SelectObject(&PointPen);
	// TODO: add draw code for native data here

	//ʾϢ
	CString strHint="";
	if(m_iStep ==0)
	{
		if(m_iDrawType == 1)
			strHint="һһ͹ΣΪü򡣵Ҽ";
		else if(m_iDrawType == 2)
			strHint="һһ͹ΣҼ";
	}
	else if(m_iStep == 1)
	{
		if(m_iDrawType == 0)
			strHint="һü";
		else if(m_iDrawType == 2)
			strHint="ڶü";
	}
	else if(m_iStep == 2)
	{
		if(m_iDrawType == 2)
		{
			strHint.Format("%d Ρ",count);
			strHint="ԭΣɫü򣨺ɫΣɫ"+strHint+"Ҽ¶ü";
		}
		else 
		{
			strHint="ڶѡȡüֱߡ";
		}
	}
	else if(m_iStep == 3)
	{
		strHint="ֱߣɫüΣɫֱߣɫҼֱߡ";
	}
	pDC->SetTextColor(RGB(255,0,0));
	pDC->TextOut(10,10,strHint);

	Point2f *p,*q;	

	if(m_iDrawType == 2 || m_iDrawType == 1)
	{
		//ʼ
		POSITION pos;
		for(pos=m_PointList.GetHeadPosition();pos;)
		{
			p=(Point2f *)m_PointList.GetNext(pos);
			int x,y;
			x=(int)(p->x+0.5);
			y=(int)(p->y+0.5);
			Point(pDC,x,y);			
		}

		//
		if(m_iDrawType == 2)
			pDC->SelectObject(&BluePen);
		else
			pDC->SelectObject(&RedPen);
		int cnt=0;		
		for(pos=m_PointList.GetHeadPosition();pos;)
		{
			p=(Point2f *)m_PointList.GetNext(pos);
			if(cnt == 0)
			{
				q=p;
				pDC->MoveTo((int)(p->x+0.5),(int)(p->y+0.5));
			}
			else
			{
				pDC->LineTo((int)(p->x+0.5),(int)(p->y+0.5));
			}
			cnt++;		
		}
		if(m_iStep > 0)
			pDC->LineTo((int)(q->x+0.5),(int)(q->y+0.5));
		else if(m_PointList.GetCount() > 0)
			pDC->LineTo(m_MousePos.x,m_MousePos.y);
	}

	if(m_iDrawType == 2)
	{
		//ü
		pDC->SelectObject(&RedPen);
		if(m_iStep >= 1)
		{
			if(m_iWindowPoint == 1)
			{
				int Minx,Miny,Maxx,Maxy;
				Minx=min(wMin.x,wMax.x);
				Miny=min(wMin.y,wMax.y);
				Maxx=max(wMin.x,wMax.x);
				Maxy=max(wMin.y,wMax.y);

				pDC->MoveTo(Minx,Miny);
				pDC->LineTo(Minx,Maxy); 
				pDC->LineTo(Maxx,Maxy);
				pDC->LineTo(Maxx,Miny);
				pDC->LineTo(Minx,Miny);
			}
			else if(m_iWindowPoint == 2)
			{
				pDC->MoveTo(wMin.x,wMin.y);
				pDC->LineTo(wMin.x,wMax.y); 
				pDC->LineTo(wMax.x,wMax.y);
				pDC->LineTo(wMax.x,wMin.y);
				pDC->LineTo(wMin.x,wMin.y);
			}
				
		}

		//	
		if(m_iStep == 2)
		{
			if(count > 0)
			{
				pDC->SelectObject(&PointPen);
				for(int i=0;i<count;i++)
				{
					int x=(int)(pOut[i].x+0.5), y=(int)(pOut[i].y+0.5);
					CrossPoint(pDC, x, y);
				}

				pDC->SelectObject(&CyanPen);
				pDC->MoveTo((int)(pOut[0].x+0.5),(int)(pOut[0].y+0.5));
				for(i=1;i<count;i++)
					pDC->LineTo((int)(pOut[i].x+0.5),(int)(pOut[i].y+0.5));
				pDC->LineTo((int)(pOut[0].x+0.5),(int)(pOut[0].y+0.5));

			}
		}
	}
	else
	{
		if(m_iDrawType == 0)//LB_Clipping
		{
			//ü
			pDC->SelectObject(&RedPen);
			if(m_iStep >= 1)
			{
				if(m_iWindowPoint == 1)
				{
					int Minx,Miny,Maxx,Maxy;
					Minx=min(wMin.x,wMax.x);
					Miny=min(wMin.y,wMax.y);
					Maxx=max(wMin.x,wMax.x);
					Maxy=max(wMin.y,wMax.y);

					pDC->MoveTo(Minx,Miny);
					pDC->LineTo(Minx,Maxy); 
					pDC->LineTo(Maxx,Maxy);
					pDC->LineTo(Maxx,Miny);
					pDC->LineTo(Minx,Miny);
				}
				else if(m_iWindowPoint == 2)
				{
					pDC->MoveTo(wMin.x,wMin.y);
					pDC->LineTo(wMin.x,wMax.y); 
					pDC->LineTo(wMax.x,wMax.y);
					pDC->LineTo(wMax.x,wMin.y);
					pDC->LineTo(wMin.x,wMin.y);
				}					
			}			
		}

		//ֱ
		if(m_iStep > 1)
		{
			pDC->SelectObject(&PointPen);
			for(int i=0;i<count;i++)
				Point(pDC,(int)(pOut[i].x+0.5),(int)(pOut[i].y+0.5));
		}

		pDC->SelectObject(&BluePen);
		if(m_iStep > 1 && count > 0)
		{
			pDC->MoveTo((int)(pOut[0].x+0.5),(int)(pOut[0].y+0.5));

			if(count == 2)
				pDC->LineTo((int)(pOut[1].x+0.5),(int)(pOut[1].y+0.5));
			else
				pDC->LineTo(m_MousePos.x,m_MousePos.y);
		}

		//ֱ
		if(m_iStep == 3)
		{			
			if(visible)
			{
				pDC->SelectObject(&PointPen);
				for(int i=2;i<4;i++)
					CrossPoint(pDC,(int)(pOut[i].x+0.5),(int)(pOut[i].y+0.5));

				pDC->SelectObject(&CyanPen);
				pDC->MoveTo((int)(pOut[2].x+0.5),(int)(pOut[2].y+0.5));
				pDC->LineTo((int)(pOut[3].x+0.5),(int)(pOut[3].y+0.5));
			}
		}
	}
	pDC->SelectObject(pOldPen);
}

void CCutView::Point(CDC *pDC,int x,int y)
{
	pDC->Ellipse(x-6,y-6,x+6,y+6);
}

void CCutView::CrossPoint(CDC *pDC,int x,int y)
{
	pDC->MoveTo(x,y-7);
	pDC->LineTo(x,y+7);

	pDC->MoveTo(x-7,y);
	pDC->LineTo(x+7,y);
}
/////////////////////////////////////////////////////////////////////////////
// CCutView diagnostics

#ifdef _DEBUG
void CCutView::AssertValid() const
{
	CView::AssertValid();
}

void CCutView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CCutDoc* CCutView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCutDoc)));
	return (CCutDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCutView message handlers

void CCutView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if(m_iStep == 0)
	{
		if(m_PointList.GetCount() == 0)
		{
			m_MousePos.x=point.x;
			m_MousePos.y=point.y;
		}

		Point2f *p=new Point2f;
		p->x=(float)(point.x);
		p->y=(float)(point.y);
		m_PointList.AddTail(p);

		OnUpdate(NULL,0,NULL);
	}
	else if(m_iStep == 1 && m_iWindowPoint < 2)
	{		
		if(m_iWindowPoint == 0)
		{
			wMin.x=point.x;
			wMin.y=point.y ;
			m_iWindowPoint++;
		}
		else if(m_iWindowPoint == 1)
		{
			int x,y;
			x=wMin.x;
			y=wMin.y;

			wMin.x=min(x,point.x);
			wMin.y=min(y,point.y);
			wMax.x=max(x,point.x);
			wMax.y=max(y,point.y);
			
			m_iWindowPoint=2;

			if(m_iDrawType == 2)
			{
			//ü
			int n=m_PointList.GetCount();
			Point2f *pIn=new Point2f[n];
			POSITION pos;
			int i=0;
			for(pos=m_PointList.GetHeadPosition();pos;)
			{
				Point2f *p=(Point2f *)m_PointList.GetNext(pos);
				pIn[i].x=p->x;
				pIn[i].y=p->y;
				i++;
			}			
			count=clipPolygon(wMin,wMax,n,pIn,pOut);
			delete[] pIn;
			}
			m_iStep=2;
			
			OnUpdate(NULL,0,NULL);
		}
	}
	else if(m_iStep == 2)
	{
		if(m_iDrawType < 2)
		{
			pOut[count].x=(float)point.x;
			pOut[count].y=(float)point.y;
			count++;
			
			if(count == 1)
			{
				m_MousePos.x=point.x;
				m_MousePos.y=point.y;
			}
			else if(count == 2)//ü
			{
				//
				pOut[2]=pOut[0];
				pOut[3]=pOut[1];
				if(m_iDrawType == 0)
					visible=LB_LineClip((float)wMin.x, (float)wMax.x, (float)wMin.y, (float)wMax.y,
						pOut[2].x, pOut[2].y, pOut[3].x, pOut[3].y);
				else if(m_iDrawType == 1)//==1
					visible=CyrusBeck(&m_PointList,pOut);
				m_iStep++;
				OnUpdate(NULL,0,NULL);
			}
		}
	}
		

	CView::OnLButtonDown(nFlags, point);
}

void CCutView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if(m_iStep == 0)
	{
		if(m_PointList.GetCount() < 3)
		{
			MessageBox("㲻ѡ");
		}
		else
		{			
			m_iStep=1;
			if(m_iDrawType == 1)
				m_iStep=2;
			OnUpdate(NULL,0,NULL);
		}
	}	
	else if(m_iStep == 2)
	{
		if(m_iDrawType == 2)
			OnWindow();
	}
	else if(m_iStep == 1 && m_iWindowPoint == 1)
	{
			//ǰһ
			int x,y;
			x=wMin.x;
			y=wMin.y;

			wMin.x=min(x,point.x);
			wMin.y=min(y,point.y);
			wMax.x=max(x,point.x);
			wMax.y=max(y,point.y);
			
			m_iWindowPoint=2;

			if(m_iDrawType == 2)
			{
			//ü
			int n=m_PointList.GetCount();
			Point2f *pIn=new Point2f[n];
			POSITION pos;
			int i=0;
			for(pos=m_PointList.GetHeadPosition();pos;)
			{
				Point2f *p=(Point2f *)m_PointList.GetNext(pos);
				pIn[i].x=p->x;
				pIn[i].y=p->y;
				i++;
			}			
			count=clipPolygon(wMin,wMax,n,pIn,pOut);
			delete[] pIn;
			}
			m_iStep=2;
			
			OnUpdate(NULL,0,NULL);
	}
	else if(m_iDrawType < 2 && m_iStep == 3)
	{
		m_iStep=2;
		count=0;
		OnUpdate(NULL,0,NULL);
	}

	CView::OnRButtonDown(nFlags, point);
}

void CCutView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if(m_iStep == 1 && m_iWindowPoint == 1)
	{
		wMax.x = point.x;
		wMax.y = point.y;
		OnUpdate(NULL,0,NULL);
	}
	else if(m_iStep == 0 && m_PointList.GetCount() > 0)
	{
		m_MousePos.x=point.x;
		m_MousePos.y=point.y;
		OnUpdate(NULL,0,NULL);
	}
	else if(m_iStep == 2 && m_iDrawType < 2)
	{
		if(count == 1)
		{
			m_MousePos.x=point.x;
			m_MousePos.y=point.y;
			OnUpdate(NULL,0,NULL);
		}
	}

	CView::OnMouseMove(nFlags, point);
}

void CCutView::OnStart()//¿ʼ
{
	// TODO: Add your command handler code here
	if(m_iDrawType == 2 || m_iDrawType == 1)
	{
		m_iStep=0;//0Σ1ü2ü(m_iDrawType == 2)
				  //0Σ2ֱߣ  3ü(m_iDrawType == 1)
		m_iWindowPoint=0;
		count=0;

		//ͷſռ
		POSITION pos;			
		for(pos=m_PointList.GetHeadPosition();pos;)
		{
			Point2f *p=(Point2f *)m_PointList.GetNext(pos);
			delete p;
		}
		m_PointList.RemoveAll();

		OnUpdate(NULL,0,NULL);
	}
	else if(m_iDrawType == 0)
	{
		m_iStep=1;//1:ü,2ֱ,3

		count=0;//ֱߵĶ˵ѾĿ
	
		m_iWindowPoint=0;//ü

		OnUpdate(NULL,0,NULL);
	}
}

void CCutView::OnWindow()//ٶü
{
	// TODO: Add your command handler code here
	if(m_iDrawType == 2)
	{
		m_iStep=1;
		m_iWindowPoint=0;
		count=0;
	}
	else
	{
		m_iStep=2;
		count=0;
	}
	OnUpdate(NULL,0,NULL);
}

void CCutView::OnUpdateWindow(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	if(m_iDrawType == 2)
	{
		pCmdUI->SetText("¶ü");
		pCmdUI->Enable(m_iStep);
	}
	else 
	{
		pCmdUI->SetText("¶屻üֱ");
		pCmdUI->Enable(m_iStep >= 2);
	}	
}

void CCutView::OnUpdatePolygonClip(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->SetCheck(m_iDrawType == 2);
}

void CCutView::OnUpdateParameter(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->SetCheck(m_iDrawType == 1);
}

void CCutView::OnUpdateLBClipping(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->SetCheck(m_iDrawType == 0);
}

void CCutView::OnPolygonClip() 
{
	// TODO: Add your command handler code here
	m_iDrawType=2;
	OnStart();
}

void CCutView::OnParameter() 
{
	// TODO: Add your command handler code here
	//ηm_PointList
	//üֱ߷pOut
	m_iDrawType=1;
	OnStart();
}

void CCutView::OnLBClipping() 
{
	// TODO: Add your command handler code here
	m_iDrawType=0;	
	OnStart();	
}



2) CutDoc.cpp
//

#include "stdafx.h"
#include "Cut.h"

#include "CutDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCutDoc

IMPLEMENT_DYNCREATE(CCutDoc, CDocument)

BEGIN_MESSAGE_MAP(CCutDoc, CDocument)
	//{{AFX_MSG_MAP(CCutDoc)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CCutDoc construction/destruction

CCutDoc::CCutDoc()
{
	// TODO: add one-time construction code here

}

CCutDoc::~CCutDoc()
{
}

BOOL CCutDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CCutDoc serialization

void CCutDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CCutDoc diagnostics

#ifdef _DEBUG
void CCutDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CCutDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCutDoc commands

3) MainFrm.cpp:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "Cut.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_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	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


4) Cut.h
// Cut.h : main header file for the CUT application
//

#if !defined(AFX_CUT_H__72555F85_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)
#define AFX_CUT_H__72555F85_C63D_11D5_8918_0080C8F0A9C1__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

/////////////////////////////////////////////////////////////////////////////
// CCutApp:
// See Cut.cpp for the implementation of this class
//

class CCutApp : public CWinApp
{
public:
	CCutApp();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCutApp)
	public:
	virtual BOOL InitInstance();
	//}}AFX_VIRTUAL

// Implementation
	//{{AFX_MSG(CCutApp)
	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_CUT_H__72555F85_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)

5) CutDoc.h
// CutDoc.h : interface of the CCutDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_CUTDOC_H__72555F8B_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)
#define AFX_CUTDOC_H__72555F8B_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CCutDoc : public CDocument
{
protected: // create from serialization only
	CCutDoc();
	DECLARE_DYNCREATE(CCutDoc)

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCutDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CCutDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CCutDoc)
		// 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_CUTDOC_H__72555F8B_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)

6) CutView.h
// CutView.h : interface of the CCutView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_CUTVIEW_H__72555F8D_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)
#define AFX_CUTVIEW_H__72555F8D_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "global.h"

class CCutView : public CView
{
protected: // create from serialization only
	CCutView();
	DECLARE_DYNCREATE(CCutView)

// Attributes
public:
	CCutDoc* GetDocument();

	int m_iDrawType;//0LB,1ü2αü

	int m_iStep;
	CPtrList m_PointList;

	Point2i wMin;
	Point2i wMax;
	int m_iWindowPoint;
	Point2i m_MousePos;

	Point2f pOut[MAXOUTPUT];
	int count;

	void Point(CDC *pDC,int x,int y);//һ
	void CrossPoint(CDC *pDC,int x,int y);//ʮֲһ 

	//LB_Clipping
	
	//Cyrus-Beck
	bool visible;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCutView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CCutView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CCutView)
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnStart();
	afx_msg void OnWindow();
	afx_msg void OnUpdateWindow(CCmdUI* pCmdUI);
	afx_msg void OnUpdatePolygonClip(CCmdUI* pCmdUI);
	afx_msg void OnUpdateParameter(CCmdUI* pCmdUI);
	afx_msg void OnUpdateLBClipping(CCmdUI* pCmdUI);
	afx_msg void OnPolygonClip();
	afx_msg void OnParameter();
	afx_msg void OnLBClipping();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in CutView.cpp
inline CCutDoc* CCutView::GetDocument()
   { return (CCutDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CUTVIEW_H__72555F8D_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)

7) LB_CLIPPING_H
#if !defined(AFX_LB_CLIPPING_H)
#define AFX_LB_CLIPPING_H

bool LB_LineClip(float XL, float XR, float YB, float YT,
				float &x1, float &y1, float &x2, float &y2);

#endif

7) MainFrm.h
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__72555F89_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)
#define AFX_MAINFRM_H__72555F89_C63D_11D5_8918_0080C8F0A9C1__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;

// 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__72555F89_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)


8) resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Cut.rc
//
#define IDD_ABOUTBOX                    100
#define IDR_MAINFRAME                   128
#define IDR_CUTTYPE                     129
#define ID_START                        32771
#define ID_WINDOW                       32772
#define ID_MENUITEM32773                32773
#define ID_LB_Clipping                  32775
#define ID_Parameter                    32776
#define ID_PolygonClip                  32778

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS                     1
#define _APS_NEXT_RESOURCE_VALUE        130
#define _APS_NEXT_COMMAND_VALUE         32779
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

9) stdafx.h
// 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__72555F87_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)
#define AFX_STDAFX_H__72555F87_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers

#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>			// MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__72555F87_C63D_11D5_8918_0080C8F0A9C1__INCLUDED_)
