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

📄 graphicbase.h

📁 采用拉格朗日和泰勒展开的方法对SinX进行数值的函数拟合。本代码用VC++ .net进行显示
💻 H
字号:
#pragma once

namespace GP{
	using namespace System::Drawing;
	ref class Canvus
	{
	public:
		int  picWidth;
		int  picHeight;
		System::Drawing::Point ct;
		double yscale;
		double xscale;
	public:
		Canvus(int w,int h,Point c,double xs,double ys)
		{
			picWidth=w;
			picHeight=h;
			ct=c;
			xscale=xs;
			yscale=ys;
		}
		//int xtoX(double x)
		//{
		//	double X=(x*this->xscale)+this->ct.X;
		//	return X;
		//}
		//int ytoY(double y)
		//{
		//	double Y=(y*this->yscale)+this->ct.Y;
		//	return Y;
		//}
		double Xtox(int X)
		{
			double x=(X-this->ct.X)/this->xscale;
			return x;
		}
		double Ytoy(int Y)
		{
			double y=(this->ct.Y-Y)/this->yscale;
			return y;
		}

	};

	ref class GraphicPoint
	{
	public:
		static GraphicPoint^ From(double x,double y,Canvus^ cvs)
		{
			GraphicPoint^ g=gcnew GraphicPoint();
			g->x=x; g->y=y;
			g->cvs=cvs;
			return g;
		}
	public:

		double x;
		double y;
		Canvus ^ cvs;
	public:
		int  X()
		{
			double t=cvs->ct.X+x*cvs->xscale;
			return t;
		}
		int  Y()
		{	
			double t=cvs->ct.Y-y*cvs->yscale;
			return t;
		}


		Point P()
		{
			Point p=Point(X(),Y());
			return p;
		}
		void Set_xy(int X,int Y)
		{
			x=(X-cvs->ct.X)/cvs->xscale;
			y=(cvs->ct.Y-Y)/cvs->yscale;
		}
		void Set_xy(Point P )
		{
			x=(P.X-cvs->ct.X)/cvs->xscale;
			y=(cvs->ct.Y-P.Y)/cvs->yscale;
		}

	};
}

⌨️ 快捷键说明

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