aboutsummaryrefslogtreecommitdiffstats
path: root/README.asciidoc
blob: 09f1af83c2bb24e1d4f9af86bf46b0d5100ff923 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
= meow


== Description
一個不需要, 也不應該先compile成obj files的templates.

.Links
* https://github.com/cathook/meow[GitHub]
* http://www.csie.ntu.edu.tw/~b01902109/readme/template_meow/README.html[README.html]
* https://github.com/cathook/meow/archive/master.zip[Download]

== File Tree



=== LaTex/


LaTex 相關模板

===== Makefile

環境變數:

* `SOURCE = source.tex` 設定 'LaTex' 源碼檔名
* `TARGET = output` 設定生出來的 *pdf* 檔名

[NOTE]
`TARGET` 不需要給副檔名

targets:

* `all` 生成 *'<TARGET>'.pdf*
* `view` 用kde-open 把輸出結果開起來(如有需要會先重新編譯)
* `clean` 清除
* `two` 編譯兩次, 如果有目錄的話可能會需要用到

===== source.tex

內容為一些我自己定義的設定, 參數設置等等. 另外還有用寫在註解裡面的小筆記



=== asciidoc/

一些關於asciidoc的example與編譯設定

===== Makefile

編譯asciidoc用的, 裡面有兩個環境變數:

- ASCIIDOC_SOURCE: 指定原始碼, 預設為 'example.txt'
- ASCIIDOC_OUTPUT: 輸出的檔名, 預設為 'output.html'

另外還有一個target:

[source,makefile]
---------------
$(ASCIIDOC_OUTPUT): $(ASCIIDOC_SOURCE)
---------------



=== cppMakefile/



.Description

這是一個簡單的 *GNU makefile for 'C++' project*
類似AutoTool等工具, 不過又更簡化了, 操作方法是利用GNUMakefile裡的targets
當作指令, 生出一個targets檔, 以後鍵入 `make all` 就會自動把所有targets都
編譯出來.

.Commands

* `make init` +
初始化, 設定完之後所在位置會多幾個資料夾如下

** 'bin/' 放編譯出來的執行檔
** 'dep/' dependency相關資料, 內容會自動生成, 不用理它
** 'inc/' 自定義的include file放置位置
** 'src/' source code放置位置
** 'obj/' obj file放置位置, 會自動生成, 不用理它

* `make new NAME=<name> [OBJS=<OBJ_FILES> LIBS=<LIBRARIES>]` +
新增一個target, 須給定目標名 , 並且此Makefile會假定 `main() { ... }` 放在
'src/<name>.cpp' 而最終輸出會是 'bin/<name>' . +
關於 'OBJS=' 與 'LIBS=' 參考下面說明

* `make add NAME=<name> [OBJS=<OBJ_FILES> LIBS=<LIBRARIES>]` +
針對target為 '<name>' 的目標新增需要的 '<OBJ_FILES>' , 與 '<LIBRARIES>'. 
'<LIBRARIES>' 的部份會用 `pkg-config` 去解讀, 例如 '<LIBRARIES>' 為
'opencv lapackpp' 則link時會被以下指令展開 +
`pkg-config --libs opencv lapackpp` +
而 '<OBJ_FILES>' 的部份則只需要給 *name* 就好, 不需要有完整個 pathname, 例如
例如 '<OBJ_FILES>' 是 'a b c' 則此makefile會視為

** source code: 'src/a.cpp src/b.cpp src/c.cpp'
** obj file: 'obj/a.o obj/b.o obj/c.o'

* `make del NAME=<name> [OBJS=<OBJ_FILES> LIBS=<LIBRARIES>]` +
與 add相反, 嘗試將指定target所需的'<OBJ_FILES>'和'<LIBRARIES>'移除

* `make clean` +
將 'bin/*' 'dep/*' 'obj/*' 清除, 有時候覺得dependency怪怪的
時可以嘗試執行此指令

[NOTE]
其中整個project到底有哪些obj file會完全依照 *src/* 裡面有哪些 `.cpp` 檔決定

===== GNUMakefile

就是一個 Makefile, 不過裡面有些東西是 `GNU-make` only的

===== GNUMakefile.dependency.bash

產生 dependency檔用的



=== doxygen/


doxygen 相關設定

===== Makefile

編譯doxygen document的Makefile, 裡面只有一個target: 'document',
另外有兩個環境變數:

- DOXYGEN_RUN_PATH: 指定doxygen執行的pwd, 預設為 `pwd`
- DOXYGEN_CONFIG: 指定config檔放在哪裡, 預設為 `pwd`

===== config

設置, 以下幾點個人覺得比較重要的

[source,conf]
-------------------------

#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING      = UTF-8
PROJECT_NAME           = "Templates -- Meow"
PROJECT_NUMBER         = 1.1.2
PROJECT_BRIEF          = 不能, 也不應該先編譯成obj-file的templates
PROJECT_LOGO           = $(config_path)/logo.png
OUTPUT_DIRECTORY       = doc
CREATE_SUBDIRS         = NO
OUTPUT_LANGUAGE        = English
TAB_SIZE               = 2

#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL            = YES
EXTRACT_STATIC         = YES
EXTRACT_LOCAL_CLASSES  = NO
EXTRACT_LOCAL_CLASSES  = YES
FORCE_LOCAL_INCLUDES   = YES

#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT                  = meowpp
INPUT_ENCODING         = UTF-8
FILE_PATTERNS          =
RECURSIVE              = YES

#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML          = YES
HTML_OUTPUT            = html
HTML_FILE_EXTENSION    = .html
HTML_HEADER            = $(config_path)/header.html
HTML_FOOTER            = $(config_path)/footer.html
HTML_STYLESHEET        = $(config_path)/stylesheet.css
HTML_EXTRA_STYLESHEET  = $(config_path)/custom.css
HTML_EXTRA_FILES       =
HTML_COLORSTYLE_HUE    = 120
HTML_COLORSTYLE_SAT    = 36
HTML_COLORSTYLE_GAMMA  = 166
DISABLE_INDEX          = YES
GENERATE_TREEVIEW      = YES
FORMULA_FONTSIZE       = 11
SEARCHENGINE           = NO

#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX         = YES
LATEX_CMD_NAME         = xelatex
PAPER_TYPE             = letter
HIDE_UNDOC_RELATIONS   = NO
UML_LOOK               = YES
EXTRA_PACKAGES         =
LATEX_HEADER           = $(config_path)/header.tex
LATEX_FOOTER           = $(config_path)/footer.tex

#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CALL_GRAPH             = YES
CALLER_GRAPH           = YES
-------------------------

[NOTE]
'config' 中 `$(config_path)` 是一個環境變數, 代表這個configure file所在位置
*呼叫asciidoc時必須有設置這個環境變數*


===== header.html

*HTML* output 的開頭
沒有更動

===== footer.html

*HTML* output 的結尾
沒有更動

===== logo.png

就是logo


===== stylesheet.css

*HTML* output 的css樣式, 我把他改成暗色系了

以下是更動的地方:
[source,css]
----------------------------------------------
body, table, div, p, dl {
    font: 400 14px/19px Roboto,sans-serif,monospace;
}

.title {
    line-height: 100%;
    font-size: 200%;
    margin :  0px;
    padding: 0px;
    border : 0px;
}

dt {
    color: #999999;
    font-style:italic;
}

div.qindex, div.navtab{
    background-color: #2B3F26;
}

a {
    color: #5D77AC;
}

.contents a:visited {
    color: #7695D2;
}

a.code, a.code:visited {
    color: #7695D2; 
}

a.codeRef, a.codeRef:visited {
    color: #7695D2; 
}

pre.fragment {
        background-color: #0B0C0D;
        border-radius: 4px;
        -moz-border-radius: 4px;
        -webkit-border-top-left-radius: 4px;
}

div.fragment {
    background-color: #0B0C0D;
        border-radius: 4px;
        -moz-border-radius: 4px;
        -webkit-border-top-left-radius: 4px;
}

div.line {
    font-family: 'courier new', monospace, fixed;
    color: #CCCCCC;
        font-size: 14px;
    min-height: 14px;
}

span.lineno {
    background-color: #181818;
}
span.lineno a {
    background-color: #3B3838;
}

span.lineno a:hover {
    background-color: #6B6868;
}

body {
    background-color: #212131;
    color: #DDFFDD;
}

span.keyword {
    color: #00A000
}

span.keywordtype {
    color: #907050
}

span.comment {
    color: #808080
}

table.memberdecls {
    border-top-color: #111111;
}

.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
    background-color: #192322;
}

.mdescLeft, .mdescRight {
    color: #CCCCCC;
}

.memTemplParams {
    color: #7695D2;
}

.memtemplate {
    color: #7695D2;
}

.memproto, dl.reflist dt {
        color: #758575;
        text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.95);
        /* background-image:url('nav_f.png'); */
        background-color: #181C28;
}

.memdoc, dl.reflist dd {
        /* background-image:url('nav_g.png'); */
        background-color: #131923;
}

.params .paramdir {
    color:#A0AA00;
}

.directory tr.even {
    background-color: #272838;
}

.directory .levels span {
    color: #5D77AC;
}

div.header
{
        /* background-image:url('nav_h.png'); */
        /* background-repeat:repeat-x; */
    background-color: #290A1C;
    padding: 0px;
    margin : 0px;
    border : 0px;
    margin-top: 10px;
    border-bottom: 1px solid #AA0000;/*#C4CFE5;*/
}

div.headertitle
{
    padding: 5px;
    margin : 0px;
    border : 0px;
}
 
#projectname
{
    font: 400% Tahoma, Arial,sans-serif,monospace;
}

div.toc h3 {
    color: #7695D2;
}

----------------------------------------------

===== custom.css

*HTML* output 的css樣式, 在這邊設定的話連 'navtree' 等都可以設定. +
另外這個檔案的檔名不能是 `navtree.css` , 不知道是不是bug.

===== header.tex

*LaTex* output 的開頭

===== header.tex

*LaTex* output 的結尾

===== stylesheet.sty

*LaTex* 的樣式設定


=== meowpp/

meow for *C++ templates*


===== Self.h

包含一個具有 *Copy On Write* 技術的 'class' 而且有實作 *by reference* ,
基本上就是改良C\+\+原本的 reference 機制, 原本的 reference 只能在宣告的時候
指定參照指向的變數,
而這邊則可以動態改變


===== Usage.h

方便user製作還算精美的 *usage document* 並且利用 `getopt()` 實作讀入參數與分析

===== utility.h

一些不知道要歸類到哪的小functions


==== colors/


一些 *color space* 以及這些space的 *transformate function* 都放在這資料夾下

[NOTE]
目前transformation function的準確率還很低, 有待以後加強

===== Color3_Space.h

`class Color3_Space<T>` *Channel Number = 3* 的 Color Space 的共通 *Base class*

===== RGB_Space.h

Channel分別是

* Red
* Green
* Blue

.Classes
* `meow::RGBi_Space` 用 'int' 存資料, 每個channel數值合法範圍是 *0~255*
* `meow::RGBf_Space` 用 'double' 存資料, 每個channel數值合法範圍是 *0.0~1.0*

.Functions
* `meow::colorTransformation(in, *out)` for
** RGBi_Space <--> RGBf_Space

===== YUV_Space.h

Channel分別是

* Y 明度
* U 色度
* V 濃度

.Classes
* `meow::YUVf_Space` 用 'double' 存資料, 每個channel數值合法範圍是 *0~1.0*

.Functions
* `meow::colorTransformation(in, *out)` for
** YUVf_Space <--> RGBi_Space
** YUVf_Space <--> RGBf_Space

===== HSL_Space.h

Channel分別是

* H 色調
* S 飽和度
* L 亮度

.Classes
* `meow::HSLf_Space` 用 'double' 存資料, 每個channel數值合法範圍是 *0~1.0*

.Functions
* `meow::colorTransformation(in, *out)` for
** HSLf_Space <--> RGBi_Space
** HSLf_Space <--> RGBf_Space
** HSLf_Space <--> YUVf_Space

===== HSV_Space.h

Channel分別是

* H 色調
* S 飽和度
* V 亮度

.Classes
* `meow::HSVf_Space` 用 'double' 存資料, 每個channel數值合法範圍是 *0~1.0*

.Functions
* `meow::colorTransformation(in, *out)` for
** HSVf_Space <--> RGBi_Space
** HSVf_Space <--> RGBf_Space
** HSVf_Space <--> YUVf_Space
** HSVf_Space <--> HSLf_Space


==== dsa/


包含一些資料結構

===== BinaryIndexTree.h

極度簡化的 *SegmentTree* 已無區間更新的操作.

.Classes
* `meow::BinaryIndexTree<Value>`

===== DisjointSet.h

用來維護一堆互斥集的資訊.

.Classes
* `meow::DisjointSet`

===== HashTable.h

就是傳說中的HashTable

.Classes
* `meow::HashTableList<Data, HashFunc>`

===== KD_Tree.h

查詢第k近鄰居用的

.Classes
* `meow::KD_Tree<Vector>`

===== MergeableHeap.h

可合併Heap

.Classes
* `meow::MergeableHeap<Element>`

===== SegmentTree.h

線段樹
.Classes
* `meow::SegmentTree<Value>`

===== SplayTree.h

伸展樹, 比一般平衡樹稍強的東東
* `meow::SplayTree<Key, Value>`
* `meow::SplayTree_Range<Key, Value>`

===== VP_Tree.h

查詢第k近鄰居用的

.Classes
* `meow::VP_Tree<Vector>`

==== geo/

計算幾何相關, 算是從math中特化出來的

===== Vectors.h

實作上不是用陣列, 是直接宣告2到3個變數分別存x, y (,z)

.Classes
* `meow::Vector2D<Scalar>`
* `meow::Vector3D<Scalar>`



==== math/


===== utility.h

數學相關的小 function 雜七雜八的不知道歸類何處

.Functions
* noEPS()
* normalize()
* denormalize()
* ratioMapping()
* inRange()
* squ()
* cub()
* average()
* average()
* tAbs()

.Constants
* PI

===== Matrix.h

.Classes
* `meow::Matrix<Entry>`

===== Vector.h

實作上將 *Matrix* 重新包裝

.Classes
* `meow::Vector<Scalar>`

===== Transformation.h

各種轉換的 Base Class, 這裡所謂的 *Transformation* 形式上不一定要是 Linear, 
但原則上都是 *input a vector, output a vector* 其中input/output的dimension可以
不同.

.Classes
* `meow::Transformation<Scalar>`

===== Transformations.h

包含各種 *Non-Linear* transformation

.Classes
* `meow::BallProjection<Scalar>`
* `meow::PhotoProjection<Scalar>`

===== LinearTransformation.h

各種 LinearTransformation 的Base Class, 繼承自 `meow::Transformation`

.Classes
* `meow::LinearTransformation<Scalar>`

===== LinearTransformations.h

各種 *Linear* Transformation

.Classes
* `meow::Rotation3D<Scalar>`

===== methods.h

一些數學方法

.Functions
* ransac()
* levenbergMarquardt()



==== oo/

物件相關

===== ObjBase.h

.Classes
* `meow::ObjBase`

===== ObjTypes.h

.Classes
* `meow::ObjType`
* `meow::ObjInt`
* `meow::ObjSizeT`
* `meow::ObjDouble`
* `meow::ObjString`

===== ObjArray.h

.Classes
* `meow::ObjArray`

===== ObjDictionary.h

.Classes
* `meow::ObjDictionary`

===== ObjSelector.h

.Classes
* `meow::ObjSelector<SID>`


== Test
=== ACM 相關題目
[options="header",width="70%",cols="3<s,3<,4^,1^,1<,2^m",grid="rows"]
|=======================================================================
| Name          | Problem               | Link  | Status | Time | source
| KD_Tree       | 'Retrenchment' |
http://acm.csie.org/ntujudge/problem.php?id=1971[NTU-OJ]
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4052[ACM-ICPC Live]
| Accept | 0.083/0.083 | http://codepad.org/U85ruse5[codepad]


| VP_Tree       | 'Retrenchment' |
http://acm.csie.org/ntujudge/problem.php?id=1971[NTU-OJ]
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4052[ACM-ICPC Live]
| Accept | 0.516/0.516 | http://codepad.org/03dW6ZHV[codepad]


| SplayTree + SegmentTree | 'Shuffling_cards' |
http://acm.csie.org/ntujudge/problem.php?id=1353[NTU-OJ]
http://www.spoj.com/problems/SHUFFLEK/[SPOJ]
| Accept/TLE | 6.910/--- | http://codepad.org/yUeiVZc0[codepad]

| SplayTree + BinaryIndexTree | 'Shuffling_cards' |
http://acm.csie.org/ntujudge/problem.php?id=1353[NTU-OJ]
http://www.spoj.com/problems/SHUFFLEK/[SPOJ]
|Accept/Accept|5.480/44.35| http://codepad.org/GAWjEtmq[codepad]



|=======================================================================




== Bug Report / Contact
  * E-Mail: cat.hook31894 \~在~ gmail.com
  * GitHub