``
先上圖:
一圖勝千言:
帶“雙側法線”的運行過程:


下圖:帶單側法線的運行過程:

下圖:不帶法線的運行結果:

?改變顏色的目的,主要是為下一步做“頻數”統計做準備;
?即準備下一步的工作:即下一步需要統計每個點的光照頻數。
?**主要思路和部分代碼**:
?(全部代碼已經超出kancloud的允許長度)
?期間還試用了一些其它語言完成,當然效率比c++還是差一些;
?下次有機會(有時間)還可以優化,提高效率。改進方向包括:
?1、異步產生數據,最后統一繪圖顯示;
?2、用空間換時間;
?3、不再迭代…… 迭代和遞歸的優點當然是程序代碼清晰易懂、架構清晰、容易拓展、易調試、易修改;方便以后我們遷移、轉換到其它圖形比如:橢圓、比如 stadium(體育場等)型的圖形當中去……
用簡潔、可迭代、并且可替換的形狀和圖形去隨意替換軟件中已有的圖形……當然就有巨大優勢咯!
?(如果)不用迭代(的方式)架構軟件(程序),用存儲空間(數組或鏈表等)存儲、繪制數據……效率當然會更高、運行速度會更好些……
whatever... 這些C++(的代碼)在我的 macbookpro2011(I7cpu,8G內存)上面跑已經速度足夠(快)了。
```
再上核心代碼,代碼注釋應該比較詳細了:
```
#include "stdafx.h"
#include <iostream>
#include "Win32Project1light18digui181008d.h"
#include <iomanip>
using namespace std;
//pi= 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
#define PI18 3141592653589793238
#define PId 3.141592653589793238
#define MAX_LOADSTRING 100
// 全局變量:
long double PIld = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
//long
long IterativeAllTimes = 0;
int C1s_rightTimes = 0;
int C2s_leftTimes = 0;
unsigned __int64 halfPI_uint64_2 = 15707963267948966192;//157079632679489661923; (31415926535897932384) / 2;
unsigned __int64 hPi = 15707963267948966192;// halfPI=90度
int C1_200_R01 = 200;//左圓半徑(又稱1號圓半徑)
int C2_200_R02 = 200;//右圓半徑又稱2號圓
int c1Xpianyi_X1 = 0; //左圓用初始值-(圓心的偏移量橫坐標X為0
int c1Ypianyi_Y1 = 200;//左圓圓心位置-縱坐標
int c2Xpianyi_X2 = 300;//右圓圓心位置-橫坐標
int c2Ypianyi_Y2 = 200;//右圓圓心位置-縱坐標
int c1C2_Distance = 300;//兩圓圓心間距
//HDC hdc;
HINSTANCE hInst; // 當前實例
TCHAR szTitle[MAX_LOADSTRING]; // 標題欄文本
TCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口類名
// 此代碼模塊中包含的函數的前向聲明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: 在此放置代碼。
//調用Console控制臺
AllocConsole();
#pragma warning(disable:4996)
_tfreopen(TEXT("CONOUT$"), TEXT("w"), stdout);
_tfreopen(TEXT("CONOUT$"), TEXT("w"), stderr);
_tfreopen(TEXT("CONIN$"), TEXT("r"), stdin);
#pragma warning(default:4996)
_tsetlocale(LC_ALL, TEXT("chs"));
cout << "PIld:"<<PIld << endl;
MSG msg;
HACCEL hAccelTable;
// 初始化全局字符串
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_WIN32PROJECT1LIGHT18DIGUI181008D, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// 執行應用程序初始化:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WIN32PROJECT1LIGHT18DIGUI181008D));
// 主消息循環:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// 函數: MyRegisterClass()
//
// 目的: 注冊窗口類。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WIN32PROJECT1LIGHT18DIGUI181008D));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_WIN32PROJECT1LIGHT18DIGUI181008D);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
//
// 函數: InitInstance(HINSTANCE, int)
//
// 目的: 保存實例句柄并創建主窗口
//
// 注釋:
//
// 在此函數中,我們在全局變量中保存實例句柄并
// 創建和顯示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // 將實例句柄存儲在全局變量中
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
//下面自行定義“色域空間”當然目的是使得圖像顯示更清晰更干凈
COLORREF getColor1RGB1(int i) {
// if (-1 == i) return RGB(9, 9, 9); //黑灰
if (0 == i) return RGB(0, 0, 200); //藍
if (1 == i) return RGB(0, 180, 0); //綠(暗綠)
if (2 == i) return RGB(210, 0, 0); //紅
if (3 == i) return RGB(200, 0, 200); //品紫
if (4 == i) return RGB(0, 255, 0); //亮綠
if (5 == i) return RGB(0, 255, 255); //亮青
if (6 == i) return RGB(255, 255, 0); //黃
if (7 == i) return RGB(9, 9, 9);//黑灰
// if(i>=7)
return (200, 100, 100);//灰白
}
//
```
鏈接: https://pan.baidu.com/s/1Ilu2w91NGPdHOIn2_dQ57w 提取碼: hxg3 ,操作更方便哦!
```
//光線射入兩直線的粒子測試:
//Recursive iteration
//發光參數:// 參數 :0: hdc,1:which Circle 2:tt光線總長,3:入射弧度,4入射角度(廢棄...角度非弧度), 5(當前)光線入口x坐標x01;6當前光線入口Y坐標Y01;
int digui01DrawLine01light(HDC hdc , int whichCircle, long long tt, double incidenceAngle01Rad01, int rsjiaodu, int x01, int y01) //int digui01DrawLine01light( long long tt, int rsjiaodu, int x01, int y01)
{//int digui01andDrawlight112110
IterativeAllTimes++;
//這個在兩直線間震蕩的 部分不重要……程序太長了,需要的朋友再向我索取網盤地址:
```
```
//
//Recursive iteration
//發光參數:// 參數 :0: hdc,1:which Circle 2:tt光線總長,3:入射弧度,4入射角度(廢棄...角度非弧度), 5(當前)光線入口x坐標x01;6當前光線入口Y坐標Y01;
int recursion01Draw02Circle02light03(HDC hdc, int whichCircle, long long tt, double incidenceAngle01Rad01, int x01, int y01) //int recursion01Draw02Circle02light03(HDC hdc, int whichCircle, long long tt, double incidenceAngle01Rad01, int rsjiaodu, int x01, int y01)
{//int digui01andDrawlight112110
IterativeAllTimes++;
printf_s("\r\IterativeAllTimes:%ld", IterativeAllTimes);
// cout << "IterativeAllTimes:" << IterativeAllTimes << endl;
// printf_s("run112110Here!");
// cout << "run112110Here!" << endl;
if (tt <= 1) { cout << "[tt=1?" << tt << "]" << endl; return 1; }
cout << "入射01弧度:" << incidenceAngle01Rad01;// << endl;
cout << "{入射01角度度:" << incidenceAngle01Rad01*180/PId<<"}"<<endl;
// rsHudu01 = (double)rsjiaodu*3.1415926 / 180.0;
printf_s("_incidenceAngle01Rad01:=%f", incidenceAngle01Rad01);
cout << endl;
// cout << "rsHudu01:=" << rsHudu01 << endl;
long lightDuanlen01 = 0;//當前光線 線段長度
//
for (long long ii = 0; ii < tt; ++ii) {//for1110
++lightDuanlen01;
double singVectorX01 = cos(incidenceAngle01Rad01);
double singVectorY01 = sin(incidenceAngle01Rad01);
double originX001 = (double)lightDuanlen01*singVectorX01;
double originY001 = (double)lightDuanlen01*singVectorY01;
//
int RealX0001 = (double)originX001 + x01;
int RealY0001 = (double)originY001 + y01;
//根據真實 實際坐標,描點成線--…
// SetPixel(hdc, RealX0001, RealY0001, RGB(0, 0, 200)); //亮藍
//判斷:
// int C1s_rightTimes = 0;
// int C2s_leftTimes = 0;
//判斷真實點的軸距
//判斷 是否 撞過 C1 圓1:
//真實軸距離
long long realDistanceAxesBetweenXY00001andC1 = RealX0001 * RealX0001 + (RealY0001-200) * (RealY0001-200);
//RealX0001>=200 一定跑出了 圓1,所以是廢話(多重保險……
//2號圓的左側弧:
long long realDistanceAxesBetweenXY00001andC2 = (300 - RealX0001) * (300 - RealX0001) + (RealY0001 - 200) * (RealY0001 - 200);
if ((/*3*/realDistanceAxesBetweenXY00001andC1 >= 200 * 200 /*3*/) && (/*3*/realDistanceAxesBetweenXY00001andC2 >= (200 * 200) /*3*/)) { return 0; }
////注意這里是撞 左側大圓(1號圓)的右側弧!
if /*1*/ ( (/*2*/ 1==whichCircle/*2*/) && (/*2*/ (/*3*/realDistanceAxesBetweenXY00001andC1>= 200*200 /*3*/) || ( RealX0001 >= 200 ) /*2*/) )/*1*/ //if (/*1*/ 1 == whichCircle && RealX0001 >= 200 /*1*/)
{//if11a10
++C1s_rightTimes;
cout << "C1s_rightTimes:" << C1s_rightTimes << endl;
long long tt1new01 = tt - ii;
//算法線:
double faXian1Hudu01 = PId;// -0.1; //法線弧度初始設置為PI=π3.1415926...
// faXian1Hudu01 = atan((double)RealY0001-200) / (RealX0001 );
// faXian1Hudu01 = PId + asin((double)(200.0-RealY0001 ) / (200)); //OK1
faXian1Hudu01 = atan(((double) RealY0001-200) / (RealX0001) ); //測試這個圓心的比率就是 (法線的)角度
if (faXian1Hudu01 < (-1 * PId)) { faXian1Hudu01 += PId; }
cout << "[撞圓1的法線角(弧度:" << faXian1Hudu01 << "]";
//
//畫輔助線-法線
int x01x1 = RealX0001;
int y01y1 = RealY0001;
int x02x2 = -200 * cos((double)faXian1Hudu01)+RealX0001;
int y02y2 = (200 * sin( -1*(double)faXian1Hudu01)+RealY0001);
MoveToEx(hdc, RealX0001, RealY0001, NULL);
HPEN hPen;
hPen = CreatePen(PS_SOLID, 1, RGB(0,255, 0)); // 創建一個亮綠色的法線
SelectObject(hdc, hPen);
// LineTo(hdc, x02x2, y02y2); //畫(左圓)法線
double rusheHudu_faxianhudu = incidenceAngle01Rad01 - faXian1Hudu01;
rusheHudu_faxianhudu = faXian1Hudu01-incidenceAngle01Rad01;
cout << "[rusheHudu_faxianhudu:" << rusheHudu_faxianhudu << "]" << endl;
double rsNewHudu01 = faXian1Hudu01;// +little_cita; //faXian1Hudu01;
rsNewHudu01 = PId+ rusheHudu_faxianhudu + faXian1Hudu01;
// if ((-1.0*PId / 2) < rsNewHudu01 && rsNewHudu01<0 ) rsNewHudu01 = PId - rsNewHudu01;
// if ((PId ) < rsNewHudu01 && rsNewHudu01 < PId*2) rsNewHudu01 = rsNewHudu01-PId;
//PId - faXian1Hudu01;
//PId-faXian1Hudu01;//這是 正確方向的法線 向量;
//BigA2 - rsHuDu_BuJiao + 3.0/2*PId;
//(PId+faXian1Hudu01)-3.0/4*Pid; // littleCeta;
//3.0/4*PId+2*faXian1Hudu01 - incidenceAngle01Rad01;
// double rsNewHudu01 = faXian1Hudu01 + PId; //faXian1Hudu01; // PId - faXian1Hudu01;
//注意這里是撞 左側大圓(1號圓)的右側弧!
// int rsNewJiao1du = ceil(rsNewHudu01 * 180 / PId);
// if (rsNewJiao1du < 0) rsNewJiao1du += 360;
// if (rsNewJiao1du > 360) rsNewJiao1du -= 360;
lightDuanlen01 = 0;// 1;
if (IterativeAllTimes < 1900) {//if IterativeAllTimes < 1900
//判斷是否和第一個圓相撞,則切換到 第2號圓////切換 去第 1號圓的判斷(和Draw
recursion01Draw02Circle02light03(hdc, 2, (long long)tt1new01, rsNewHudu01, RealX0001, RealY0001); //digui01DrawLine01light(hdc, tt1new01, rsNewJiao1du, RealX0001, RealY0001);
}//if IterativeAllTimes < 1950//3000//1900
else {
return 2;
}
if (C1s_rightTimes > 2) return 1;
system("pause");
}//if11a10
//根據真實 實際坐標,描點成線--…
// SetPixel(hdc, RealX0001, RealY0001, RGB(0, 200, 0)); //亮綠
//判斷 是否 撞過 C2 圓2:
//真實軸距離
//2號圓的左側弧:
//long long
realDistanceAxesBetweenXY00001andC2 = (300-RealX0001) * (300-RealX0001) + (RealY0001-200) * (RealY0001-200);
if /*1*/ ( (/*2*/2 == whichCircle/*2*/) && (/*2*/ (/*3*/realDistanceAxesBetweenXY00001andC2 >= 200 * 200 /*3*/) || ( RealX0001 <= 100 ) /*2*/) )/*1*/ {//if11a10 //if (/*1*/ 2 == whichCircle && RealX0001 <= 100 /*1*/) {//if11a10
++C2s_leftTimes;
cout << "C2s_leftTimes:" << C2s_leftTimes << endl;
long long tt1new01 = tt - ii;
//算法線:
double faXian1Hudu01 = 0; // (double)-PId; //初始法線弧度為0!法線弧度為
// faXian1Hudu01 = atan((double)RealY0001-200.0) / (300.0-RealX0001 );
faXian1Hudu01 = asin( ((double)RealY0001 - 200.0) / 200 );
cout << "圓2號左側faXian1Hudu01:" << faXian1Hudu01 << endl;
//
//畫輔助線-法線
int x01x1 = RealX0001;
int y01y1 = RealY0001;
int x02x2 = 200 * cos((double)faXian1Hudu01) + RealX0001;
int y02y2 = (200 * sin(-1 * (double)faXian1Hudu01) + RealY0001);
MoveToEx(hdc, RealX0001, RealY0001, NULL);
HPEN hPen;
hPen = CreatePen(PS_SOLID, 1, RGB(0, 0,128)); // 創建一個藍色的法線
SelectObject(hdc, hPen);
// LineTo(hdc, x02x2, y02y2); //畫法線
double rusheHudu_faxianhudu = incidenceAngle01Rad01 - faXian1Hudu01;
rusheHudu_faxianhudu = faXian1Hudu01 - incidenceAngle01Rad01;
cout << "[rusheHudu_faxianhudu:" << rusheHudu_faxianhudu << "]" << endl;
//
// double rsNewHudu01 = -(double)faXian1Hudu01;// -incidenceAngle01Rad01 + PId;
// double rsNewHudu01 = -(double)faXian1Hudu01;// +(PId - incidenceAngle01Rad01); // -incidenceAngle01Rad01 + PId;
cout << "撞圓2時的入射角弧度:" << incidenceAngle01Rad01<<endl;
double rsNewHudu01 = -(double)faXian1Hudu01;// +getRs1Hudu_andFaxianJiajiao(faXian1Hudu01, incidenceAngle01Rad01);
// double rsNewHudu01 = PId-(incidenceAngle01Rad01 -2 * faXian1Hudu01);
rsNewHudu01 = -( faXian1Hudu01 - (PId - incidenceAngle01Rad01 - faXian1Hudu01)); //OK了
//;// +getHudu1bound180rad01(incidenceAngle01Rad01) - faXian1Hudu01;//;;// -getHudu1bound180rad01(incidenceAngle01Rad01);// +(PId - incidenceAngle01Rad01); // -incidenceAngle01Rad01 + PId;
int rsNewJiao1du = 0;//faXian1Hudu01;//廢棄
//ceil( (double)150 * PId / 180); ////rsNewHudu01 * 180 / PId;
// if (rsNewJiao1du < 0) rsNewJiao1du += 360;
// if (rsNewJiao1du > 360) rsNewJiao1du -= 360;
lightDuanlen01 = 0;// 1;
if (IterativeAllTimes < 1900) {//if IterativeAllTimes < 1900
lightDuanlen01 = 1;
//切去第 1號圓的判斷(和Draw
cout << "[22:rsNewHudu01" << rsNewHudu01 << "]" << endl;
//rsNewJiao1du廢棄
recursion01Draw02Circle02light03(hdc, 1, tt1new01, rsNewHudu01, RealX0001, RealY0001); //digui01DrawLine01light(hdc, 1, tt1new01, rsNewHudu01, rsNewJiao1du, RealX0001, RealY0001);
}//if IterativeAllTimes < 1950
if (C2s_leftTimes > 2) return 1;
system("pause");
}//if11a10
//根據真實 實際坐標,描點成線--…
COLORREF color01 = getColor1RGB1(IterativeAllTimes % 8);
SetPixel(hdc, RealX0001, RealY0001, RGB(GetRValue(color01), GetGValue(color01), GetBValue(color01) ) ); //RGB(200, 0, 0)); //亮紅
}//for1110
//
return 1;
}//int recursion01Draw02Circle02light03
//
//
int wm01paint01(HWND hWnd, PAINTSTRUCT ps, HDC hdc ) { //int wm01paint01(HWND hWnd, PAINTSTRUCT ps, HDC hdc) {
// int C1_200_R01 = 200;//左圓半徑(又稱1號圓半徑)
// 圓的參數在前面定義過了,為全局變量了,所以此處略……
int tt1chushi_R01 = 200;
int C1_R01 = 200;
int C2_R02 = 200;
//先畫兩豎線:
int line1x01 = c1C2_Distance - C2_200_R02;
int line2x02 = c1Xpianyi_X1 + C1_200_R01;
MoveToEx(hdc, line1x01, 0, NULL); LineTo(hdc, line1x01, 2 * C1_200_R01);
MoveToEx(hdc, line2x02, 0, NULL); LineTo(hdc, line2x02, 2 * C1_200_R01);
//c1i01為角度變化,弧度需要計算 *π/180
//畫兩個圓
//
double test1rad1 = double(hPi / 900 * 180) / 1000000000000000000;
cout << "_PI=:" << setprecision(90) << test1rad1 << endl;
//圓1號:
for (int i1 = 0; i1 < 361; ++i1) {//fori100
double c1_rad1 = double(hPi / 900 * i1) / 1000000000000000000; //10^18 倍的(PI);hPi 是 1 / 2 PI(π)//注釋:先除后乘以免 uint64存儲溢出
// cout << endl;
// cout << "c1_rad1:" << fixed << setprecision(30) << c1_rad1;// << endl;
int c1_x001 = C1_200_R01 * cos(c1_rad1);
int c1_y001 = C1_200_R01 * sin(c1_rad1);
SetPixel(hdc, c1_x001, c1Ypianyi_Y1 + c1_y001, RGB(0, 128, 0)); //暗綠
}//fori100
cout << "_PI=:" << setprecision(90) << test1rad1 << endl;
//圓2號:
for (int i2 = 0; i2 < 350; ++i2) {//fori100
double c2_rad02 = double(hPi / 900 * i2) / 1000000000000000000; //10^18 倍的(PI);hPi 是 1 / 2 PI(π)//注釋:先除后乘以免 uint64存儲溢出
// cout << endl << "c2_rad1:" << fixed << setprecision(30) << c2_rad02;// << endl;
int c2_x002 = C1_200_R01 * cos(c2_rad02);
int c2_y002 = C1_200_R01 * sin(c2_rad02);
SetPixel(hdc, c2Xpianyi_X2 + c2_x002, c2Ypianyi_Y2 + c2_y002, RGB(0, 128, 0)); //暗綠
}//fori100
//
//根據 時間 tt 描點成線-start
int light1R001 = 0;// 210;//發射光的初始半徑 應大于200
int light1new01R001 = light1R001;
int chushi1x001 = 190;// 200;// 0;// 190;
int chushi1y001 = 200;// 0;// 200;
//發光參數:// 參數 :0: hdc,1:which Circle 2:tt光線總長,3:入射弧度,4入射角度(廢棄...角度非弧度), 5(當前)光線入口x坐標x01;6當前光線入口Y坐標Y01;
//long
long lightTlenth = 99992;// 9939;// 119;/// 191179;//光線長度
double lightIncidenceAngle = 0;// = -1.0 / 5 * 2 * hPi; //入射角 1/4π;因為: hPi*2=1*PI(1個π),最后乘hPi...
lightIncidenceAngle = ((-1.0 / 4)* PId); // double(19.0) / 32 * PIld; //5.0 / 8 * PIld; //入射光 控制在(映像到): - 1/2PI --> 到 3/2PI 之間;如果在 3/2PI->2PI應該映像到 -1/2PI~~1/2PI之間
int Circle_Number = 1;
recursion01Draw02Circle02light03(hdc, 1, lightTlenth, lightIncidenceAngle, 160, 200); //digui01DrawLine01light(hdc, tt, 125, 190, 200);
//
return 1;
}//int wm01paint01
// 函數: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// 目的: 處理主窗口的消息。
//
// WM_COMMAND - 處理應用程序菜單
// WM_PAINT - 繪制主窗口
// WM_DESTROY - 發送退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// 分析菜單選擇:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
{//case110
hdc = BeginPaint(hWnd, &ps);
// TODO: 在此添加任意繪圖代碼...
wm01paint01(hWnd, ps ,hdc); //wm01paint01(hWnd, ps, hdc);
EndPaint(hWnd, &ps);
}//case110//case WM_PAINT
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// “關于”框的消息處理程序。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
```
- R高精“密率”-PI的分數的高精度表示形式-R語言181000a
- 高精“密率”-PI的分數的高精度表示形式181001
- java40k2011Terryfix181002
- PI的高精度分數表示形式180101
- c++算PI的分數表示形式180102
- 單圓弧的反射181001a
- 單個圓的圓弧反射181020a
- 附錄11:181001非控制臺(WindowsForm)窗口程序創建控制臺(調試程序用
- 遞歸調用-判斷兩圓相碰撞情況181020
- 用遞歸算法模擬兩圓反射Billiards181020
- 光線(粒子)在兩圓間碰撞效果1810a
- 光線粒子在兩圓內壁碰撞效果1810B
- twoBillards模擬光線(粒子)在重疊的兩圓內壁的碰撞C++完整代碼(帶注釋)Terry181001