2016年7月18日 星期一

Advanced VC++ Chapter 3

課程內容:

課程Github:
https://github.com/QQBoxy/2016vc

Example 1 - Binary file
https://github.com/QQBoxy/2016vc/tree/master/fstream_bin

VC++ seekp & seekg
ios::beg文件開頭
ios::cur文件當前位置
ios::end文件結尾

Example 2 - Class Object
https://github.com/QQBoxy/2016vc/tree/master/classobject


XYZ三維座標系中,點A、點B、點C,連成一個三角形面,上面有一個法向量N

Example 3 - Class Inherit
https://github.com/QQBoxy/2016vc/tree/master/inherit

Example 4 - Vector
https://github.com/QQBoxy/2016vc/tree/master/vector

Vector功能:
檢查是否為空v.empty();
直接將v清空v.clear();
檢查目前大小v.size();
檢查最大容量v.maxsize();
檢查目前容量v.captacity();
清除所有內容v.clear();
清除指定元素v.erase(v.begin()); v.erase(v.end()-1);
讀取並刪除最後一元素v.pop_back(v.size()-1);
重新設定大小v.resize(5);

Example 5 - Eception
https://github.com/QQBoxy/2016vc/tree/master/exception


作業:
撰寫一隻三角網格STL檔案的轉檔工具,
具備以下功能:
1. 能夠拖拉檔案後,顯示兩個功能選項供選擇。
2. 功能選項1: ASCII格式檔案 轉為 Binary格式檔案。
3. 功能選項2: Binary格式檔案 轉為 ASCII格式檔案。
4. 請使用Class搭配Vector撰寫。
5. 讀取出現意外錯誤時,請顯示問題原因。

測試資料:
四角錐 2x2x2 (TriangleASCII.STL)


立方體 2x2x2 (CubeASCII.STL)


測試檔案:
球 (FileName: SphereASCII.STL, Facet Normal: 2352, Vertex: 7056, Diameter: 1mm)
https://sites.google.com/site/ccuboxy/home/SphereASCII.STL?attredirects=0&d=1

小齒輪 (FileName: GearASCII.STL, Facet Normal: 792, Vertex: 2376, Diameter: 10mm)
https://sites.google.com/site/ccuboxy/home/GearASCII.STL?attredirects=0&d=1

大齒輪 (FileName: LargeGearASCII.STL, Facet Normal: 792, Vertex: 2376, Diameter: 100mm)
https://sites.google.com/site/ccuboxy/home/LargeGearASCII.STL?attredirects=0&d=1

風扇 (FileName: FanASCII.STL, Facet Normal: 2928, Vertex: 8784, Diameter: 80mm)
https://sites.google.com/site/ccuboxy/home/FanASCII.STL?attredirects=0&d=1

沒有留言:

張貼留言