From 8b76fbb408f8eedab24195655c45c891af01eaab Mon Sep 17 00:00:00 2001 From: cathook Date: Wed, 24 Sep 2014 13:37:42 +0800 Subject: Big change, detail see README. --- doc/html/BinaryIndexTree_8h.html | 94 - doc/html/BinaryIndexTree_8h_source.html | 133 -- doc/html/BitmapDescript_8h.html | 86 - doc/html/BitmapDescript_8h_source.html | 135 -- doc/html/Bitmap_8h.html | 105 - doc/html/Bitmap_8h.js | 5 - doc/html/Bitmap_8h_source.html | 371 --- doc/html/BundleAdjustment_8h.html | 106 - doc/html/BundleAdjustment_8h.js | 10 - doc/html/BundleAdjustment_8h_source.html | 158 -- doc/html/BundleAdjustment__LM_8h.html | 99 - doc/html/BundleAdjustment__LM_8h_source.html | 474 ---- doc/html/Camera_8h.html | 98 - doc/html/Camera_8h_source.html | 285 --- doc/html/Color3__Space_8h.html | 95 - doc/html/Color3__Space_8h_source.html | 182 -- doc/html/DisjointSet_8h.html | 94 - doc/html/DisjointSet_8h_source.html | 154 -- doc/html/Eye_8h.html | 94 - doc/html/Eye_8h_source.html | 245 -- doc/html/FeaturePoint_8h.html | 97 - doc/html/FeaturePoint_8h_source.html | 299 --- doc/html/FeaturePointsDetector_8h.html | 94 - doc/html/FeaturePointsDetector_8h_source.html | 107 - doc/html/FeaturePointsDetector__Harris_8h.html | 120 - doc/html/FeaturePointsDetector__Harris_8h.js | 5 - .../FeaturePointsDetector__Harris_8h_source.html | 429 ---- doc/html/FeaturePointsMatch_8h.html | 104 - doc/html/FeaturePointsMatch_8h.js | 6 - doc/html/FeaturePointsMatch_8h_source.html | 131 -- doc/html/FeaturePointsMatch__K__Match_8h.html | 116 - doc/html/FeaturePointsMatch__K__Match_8h.js | 5 - .../FeaturePointsMatch__K__Match_8h_source.html | 287 --- doc/html/HI.html | 75 - doc/html/HIJ.html | 72 - doc/html/HIxx.html | 72 - doc/html/HSL_8h.html | 111 - doc/html/HSL_8h.js | 9 - doc/html/HSL_8h_source.html | 171 -- doc/html/HSL_8hpp.html | 104 - doc/html/HSL_8hpp.js | 7 - doc/html/HSL_8hpp_source.html | 247 -- doc/html/HSL__Space_8h.html | 122 - doc/html/HSL__Space_8h.js | 11 - doc/html/HSL__Space_8h_source.html | 301 --- doc/html/HSV_8h.html | 118 - doc/html/HSV_8h.js | 11 - doc/html/HSV_8h_source.html | 182 -- doc/html/HSV_8hpp.html | 111 - doc/html/HSV_8hpp.js | 9 - doc/html/HSV_8hpp_source.html | 250 -- doc/html/HSV__Space_8h.html | 129 -- doc/html/HSV__Space_8h.js | 13 - doc/html/HSV__Space_8h_source.html | 298 --- doc/html/HashTable_8h.html | 93 - doc/html/HashTable_8h_source.html | 253 -- doc/html/IdentityPoints_8h.html | 98 - doc/html/IdentityPoints_8h_source.html | 401 ---- doc/html/KD__Tree_8h.html | 97 - doc/html/KD__Tree_8h_source.html | 338 --- doc/html/LinearTransformation_8h.html | 94 - doc/html/LinearTransformation_8h_source.html | 160 -- doc/html/LinearTransformations_8h.html | 97 - doc/html/LinearTransformations_8h_source.html | 297 --- doc/html/Matrix_8h.html | 96 - doc/html/Matrix_8h_source.html | 510 ---- doc/html/MergeableHeap_8h.html | 93 - doc/html/MergeableHeap_8h_source.html | 207 -- doc/html/ObjArray_8h.html | 98 - doc/html/ObjArray_8h_source.html | 266 --- doc/html/ObjBase_8h.html | 94 - doc/html/ObjBase_8h_source.html | 139 -- doc/html/ObjDictionary_8h.html | 98 - doc/html/ObjDictionary_8h_source.html | 265 --- doc/html/ObjProperties_8h.html | 93 - doc/html/ObjProperties_8h_source.html | 146 -- doc/html/ObjSelector_8h.html | 104 - doc/html/ObjSelector_8h.js | 5 - doc/html/ObjSelector_8h_source.html | 267 --- doc/html/ObjTypes_8h.html | 119 - doc/html/ObjTypes_8h.js | 12 - doc/html/ObjTypes_8h_source.html | 304 --- doc/html/Photo_8h.html | 103 - doc/html/Photo_8h_source.html | 373 --- doc/html/RGB_8h.html | 95 - doc/html/RGB_8h_source.html | 171 -- doc/html/RGB_8hpp.html | 86 - doc/html/RGB_8hpp_source.html | 156 -- doc/html/RGB__Space_8h.html | 114 - doc/html/RGB__Space_8h.js | 9 - doc/html/RGB__Space_8h_source.html | 306 --- doc/html/Register__Implement_8h.html | 94 - doc/html/Register__Implement_8h_source.html | 115 - doc/html/Register__Implement_8hpp.html | 85 - doc/html/Register__Implement_8hpp_source.html | 101 - doc/html/SegmentTree_8h.html | 95 - doc/html/SegmentTree_8h_source.html | 225 -- doc/html/Self_8h.html | 113 - doc/html/Self_8h.js | 5 - doc/html/Self_8h_source.html | 310 --- doc/html/SplayTree_8h.html | 103 - doc/html/SplayTree_8h_source.html | 1021 -------- doc/html/Transformation_8h.html | 95 - doc/html/Transformation_8h_source.html | 209 -- doc/html/Transformations_8h.html | 99 - doc/html/Transformations_8h_source.html | 355 --- doc/html/Usage_8h.html | 97 - doc/html/Usage_8h_source.html | 450 ---- doc/html/Usage_8hpp.html | 92 - doc/html/Usage_8hpp_source.html | 375 --- doc/html/VP__Tree_8h.html | 97 - doc/html/VP__Tree_8h_source.html | 360 --- doc/html/Vector_8h.html | 95 - doc/html/Vector_8h_source.html | 304 --- doc/html/Vectors_8h.html | 98 - doc/html/Vectors_8h_source.html | 621 ----- doc/html/ViewPort_8h.html | 92 - doc/html/ViewPort_8h_source.html | 92 - doc/html/WatchBall_8h.html | 98 - doc/html/WatchBall_8h_source.html | 270 --- doc/html/YUV_8h.html | 104 - doc/html/YUV_8h.js | 7 - doc/html/YUV_8h_source.html | 160 -- doc/html/YUV_8hpp.html | 97 - doc/html/YUV_8hpp.js | 5 - doc/html/YUV_8hpp_source.html | 182 -- doc/html/YUV__Space_8h.html | 115 - doc/html/YUV__Space_8h.js | 9 - doc/html/YUV__Space_8h_source.html | 247 -- doc/html/annotated.html | 77 +- doc/html/annotated.js | 4 +- doc/html/assert_8h.html | 191 ++ doc/html/assert_8h.js | 6 + doc/html/assert_8h_source.html | 120 + doc/html/classFeaturePointDescript-members.html | 84 - doc/html/classFeaturePointDescript.html | 352 --- doc/html/classFeaturePointDescript.js | 11 - doc/html/classFeaturePointDescript.png | Bin 518 -> 0 bytes doc/html/classObjBase.html | 86 - doc/html/classObjBase.png | Bin 521 -> 0 bytes doc/html/classdouble.html | 74 - doc/html/classes.html | 54 +- doc/html/classint.html | 74 - doc/html/classint32__t.html | 74 - doc/html/classmeow_1_1BallProjection-members.html | 105 - doc/html/classmeow_1_1BallProjection.html | 777 ------- doc/html/classmeow_1_1BallProjection.js | 18 - doc/html/classmeow_1_1BallProjection.png | Bin 781 -> 0 bytes .../classmeow_1_1BaseFloatingType-members.html | 93 + doc/html/classmeow_1_1BaseFloatingType.html | 538 +++++ doc/html/classmeow_1_1BaseFloatingType.js | 16 + doc/html/classmeow_1_1BaseFloatingType.png | Bin 0 -> 748 bytes doc/html/classmeow_1_1BaseNumberType-members.html | 98 + doc/html/classmeow_1_1BaseNumberType.html | 688 ++++++ doc/html/classmeow_1_1BaseNumberType.js | 21 + doc/html/classmeow_1_1BaseNumberType.png | Bin 0 -> 745 bytes doc/html/classmeow_1_1BinaryIndexTree-members.html | 82 - doc/html/classmeow_1_1BinaryIndexTree.html | 367 --- doc/html/classmeow_1_1BinaryIndexTree.js | 9 - doc/html/classmeow_1_1Bitmap-members.html | 116 - doc/html/classmeow_1_1Bitmap.html | 1686 -------------- doc/html/classmeow_1_1Bitmap.js | 39 - doc/html/classmeow_1_1Bitmap.png | Bin 612 -> 0 bytes .../classmeow_1_1BundleAdjustment-members.html | 90 - doc/html/classmeow_1_1BundleAdjustment.html | 289 --- doc/html/classmeow_1_1BundleAdjustment.js | 7 - doc/html/classmeow_1_1BundleAdjustment.png | Bin 1156 -> 0 bytes .../classmeow_1_1BundleAdjustment__LM-members.html | 98 - doc/html/classmeow_1_1BundleAdjustment__LM.html | 677 ------ doc/html/classmeow_1_1BundleAdjustment__LM.js | 18 - doc/html/classmeow_1_1BundleAdjustment__LM.png | Bin 1154 -> 0 bytes doc/html/classmeow_1_1Camera-members.html | 105 - doc/html/classmeow_1_1Camera.html | 989 -------- doc/html/classmeow_1_1Camera.js | 28 - doc/html/classmeow_1_1Camera.png | Bin 622 -> 0 bytes doc/html/classmeow_1_1Color3__Space-members.html | 93 - doc/html/classmeow_1_1Color3__Space.html | 732 ------ doc/html/classmeow_1_1Color3__Space.js | 20 - doc/html/classmeow_1_1DisjointSet-members.html | 83 - doc/html/classmeow_1_1DisjointSet.html | 368 --- doc/html/classmeow_1_1DisjointSet.js | 10 - doc/html/classmeow_1_1Eye-members.html | 100 - doc/html/classmeow_1_1Eye.html | 802 ------- doc/html/classmeow_1_1Eye.js | 23 - doc/html/classmeow_1_1Eye.png | Bin 568 -> 0 bytes doc/html/classmeow_1_1Factory-members.html | 90 + doc/html/classmeow_1_1Factory.html | 426 ++++ doc/html/classmeow_1_1Factory.js | 12 + doc/html/classmeow_1_1Factory.png | Bin 0 -> 478 bytes doc/html/classmeow_1_1FeaturePoint-members.html | 107 - doc/html/classmeow_1_1FeaturePoint.html | 1074 --------- doc/html/classmeow_1_1FeaturePoint.js | 29 - doc/html/classmeow_1_1FeaturePoint.png | Bin 1018 -> 0 bytes ...classmeow_1_1FeaturePointsDetector-members.html | 89 - doc/html/classmeow_1_1FeaturePointsDetector.html | 231 -- doc/html/classmeow_1_1FeaturePointsDetector.js | 6 - doc/html/classmeow_1_1FeaturePointsDetector.png | Bin 1527 -> 0 bytes ...w_1_1FeaturePointsDetector__Harris-members.html | 113 - ...classmeow_1_1FeaturePointsDetector__Harris.html | 1205 ---------- .../classmeow_1_1FeaturePointsDetector__Harris.js | 34 - .../classmeow_1_1FeaturePointsDetector__Harris.png | Bin 1525 -> 0 bytes .../classmeow_1_1FeaturePointsMatch-members.html | 94 - doc/html/classmeow_1_1FeaturePointsMatch.html | 421 ---- doc/html/classmeow_1_1FeaturePointsMatch.js | 11 - doc/html/classmeow_1_1FeaturePointsMatch.png | Bin 1598 -> 0 bytes ...ow_1_1FeaturePointsMatch__K__Match-members.html | 103 - .../classmeow_1_1FeaturePointsMatch__K__Match.html | 893 ------- .../classmeow_1_1FeaturePointsMatch__K__Match.js | 24 - .../classmeow_1_1FeaturePointsMatch__K__Match.png | Bin 1591 -> 0 bytes doc/html/classmeow_1_1HSL-members.html | 97 - doc/html/classmeow_1_1HSL.html | 755 ------ doc/html/classmeow_1_1HSL.js | 24 - doc/html/classmeow_1_1HSLf-members.html | 101 - doc/html/classmeow_1_1HSLf.html | 437 ---- doc/html/classmeow_1_1HSLf.js | 13 - doc/html/classmeow_1_1HSLf.png | Bin 560 -> 0 bytes doc/html/classmeow_1_1HSLf__Space-members.html | 124 - doc/html/classmeow_1_1HSLf__Space.html | 1024 -------- doc/html/classmeow_1_1HSLf__Space.js | 34 - doc/html/classmeow_1_1HSLf__Space.png | Bin 720 -> 0 bytes doc/html/classmeow_1_1HSV-members.html | 97 - doc/html/classmeow_1_1HSV.html | 755 ------ doc/html/classmeow_1_1HSV.js | 24 - doc/html/classmeow_1_1HSVf-members.html | 101 - doc/html/classmeow_1_1HSVf.html | 437 ---- doc/html/classmeow_1_1HSVf.js | 13 - doc/html/classmeow_1_1HSVf.png | Bin 578 -> 0 bytes doc/html/classmeow_1_1HSVf__Space-members.html | 124 - doc/html/classmeow_1_1HSVf__Space.html | 1024 -------- doc/html/classmeow_1_1HSVf__Space.js | 34 - doc/html/classmeow_1_1HSVf__Space.png | Bin 724 -> 0 bytes doc/html/classmeow_1_1HashTableList-members.html | 95 - doc/html/classmeow_1_1HashTableList.html | 740 ------ doc/html/classmeow_1_1HashTableList.js | 22 - doc/html/classmeow_1_1IdentityPoints-members.html | 115 - doc/html/classmeow_1_1IdentityPoints.html | 1264 ---------- doc/html/classmeow_1_1IdentityPoints.js | 38 - doc/html/classmeow_1_1IdentityPoints.png | Bin 850 -> 0 bytes .../classmeow_1_1ImplementInterface-members.html | 79 - doc/html/classmeow_1_1ImplementInterface.html | 186 -- doc/html/classmeow_1_1ImplementInterface.js | 6 - doc/html/classmeow_1_1KD__Tree-members.html | 87 - doc/html/classmeow_1_1KD__Tree.html | 487 ---- doc/html/classmeow_1_1KD__Tree.js | 14 - .../classmeow_1_1LinearTransformation-members.html | 104 - doc/html/classmeow_1_1LinearTransformation.html | 516 ----- doc/html/classmeow_1_1LinearTransformation.js | 12 - doc/html/classmeow_1_1LinearTransformation.png | Bin 1183 -> 0 bytes doc/html/classmeow_1_1Matrix-members.html | 127 - doc/html/classmeow_1_1Matrix.html | 2007 ---------------- doc/html/classmeow_1_1Matrix.js | 54 - doc/html/classmeow_1_1MergeableHeap-members.html | 89 - doc/html/classmeow_1_1MergeableHeap.html | 530 ----- doc/html/classmeow_1_1MergeableHeap.js | 16 - doc/html/classmeow_1_1ObjArray-members.html | 105 - doc/html/classmeow_1_1ObjArray.html | 984 -------- doc/html/classmeow_1_1ObjArray.js | 28 - doc/html/classmeow_1_1ObjArray.png | Bin 589 -> 0 bytes doc/html/classmeow_1_1ObjBase-members.html | 86 - doc/html/classmeow_1_1ObjBase.html | 497 ---- doc/html/classmeow_1_1ObjBase.js | 13 - doc/html/classmeow_1_1ObjBase.png | Bin 10601 -> 0 bytes doc/html/classmeow_1_1ObjDictionary-members.html | 105 - doc/html/classmeow_1_1ObjDictionary.html | 964 -------- doc/html/classmeow_1_1ObjDictionary.js | 28 - doc/html/classmeow_1_1ObjDictionary.png | Bin 753 -> 0 bytes doc/html/classmeow_1_1ObjProperties-members.html | 98 - doc/html/classmeow_1_1ObjProperties.html | 634 ----- doc/html/classmeow_1_1ObjProperties.js | 21 - doc/html/classmeow_1_1ObjProperties.png | Bin 681 -> 0 bytes doc/html/classmeow_1_1ObjSelector-members.html | 90 - doc/html/classmeow_1_1ObjSelector.html | 646 ------ doc/html/classmeow_1_1ObjSelector.js | 17 - doc/html/classmeow_1_1ObjType-members.html | 97 - doc/html/classmeow_1_1ObjType.html | 723 ------ doc/html/classmeow_1_1ObjType.js | 20 - doc/html/classmeow_1_1ObjType.png | Bin 774 -> 0 bytes doc/html/classmeow_1_1Object-members.html | 83 + doc/html/classmeow_1_1Object.html | 337 +++ doc/html/classmeow_1_1Object.js | 10 + doc/html/classmeow_1_1Object.png | Bin 0 -> 6380 bytes doc/html/classmeow_1_1Operation-members.html | 88 + doc/html/classmeow_1_1Operation.html | 318 +++ doc/html/classmeow_1_1Operation.js | 8 + doc/html/classmeow_1_1Operation.png | Bin 0 -> 505 bytes doc/html/classmeow_1_1Photo-members.html | 116 - doc/html/classmeow_1_1Photo.html | 1557 ------------- doc/html/classmeow_1_1Photo.js | 39 - doc/html/classmeow_1_1Photo.png | Bin 567 -> 0 bytes doc/html/classmeow_1_1PhotoProjection-members.html | 105 - doc/html/classmeow_1_1PhotoProjection.html | 757 ------ doc/html/classmeow_1_1PhotoProjection.js | 18 - doc/html/classmeow_1_1PhotoProjection.png | Bin 788 -> 0 bytes doc/html/classmeow_1_1Pointer-members.html | 93 + doc/html/classmeow_1_1Pointer.html | 549 +++++ doc/html/classmeow_1_1Pointer.js | 15 + doc/html/classmeow_1_1Pointer.png | Bin 0 -> 609 bytes doc/html/classmeow_1_1RGB-members.html | 97 - doc/html/classmeow_1_1RGB.html | 755 ------ doc/html/classmeow_1_1RGB.js | 24 - doc/html/classmeow_1_1RGBf-members.html | 101 - doc/html/classmeow_1_1RGBf.html | 437 ---- doc/html/classmeow_1_1RGBf.js | 13 - doc/html/classmeow_1_1RGBf.png | Bin 562 -> 0 bytes doc/html/classmeow_1_1RGBf__Space-members.html | 124 - doc/html/classmeow_1_1RGBf__Space.html | 1024 -------- doc/html/classmeow_1_1RGBf__Space.js | 34 - doc/html/classmeow_1_1RGBf__Space.png | Bin 719 -> 0 bytes doc/html/classmeow_1_1RGBi-members.html | 101 - doc/html/classmeow_1_1RGBi.html | 437 ---- doc/html/classmeow_1_1RGBi.js | 13 - doc/html/classmeow_1_1RGBi.png | Bin 573 -> 0 bytes doc/html/classmeow_1_1RGBi__Space-members.html | 124 - doc/html/classmeow_1_1RGBi__Space.html | 1024 -------- doc/html/classmeow_1_1RGBi__Space.js | 34 - doc/html/classmeow_1_1RGBi__Space.png | Bin 690 -> 0 bytes .../classmeow_1_1ReaderWriter__double-members.html | 78 - doc/html/classmeow_1_1ReaderWriter__double.html | 190 -- doc/html/classmeow_1_1ReaderWriter__double.js | 5 - .../classmeow_1_1ReaderWriter__int-members.html | 78 - doc/html/classmeow_1_1ReaderWriter__int.html | 190 -- doc/html/classmeow_1_1ReaderWriter__int.js | 5 - ...classmeow_1_1ReaderWriter__size__t-members.html | 78 - doc/html/classmeow_1_1ReaderWriter__size__t.html | 190 -- doc/html/classmeow_1_1ReaderWriter__size__t.js | 5 - .../classmeow_1_1ReaderWriter__string-members.html | 78 - doc/html/classmeow_1_1ReaderWriter__string.html | 190 -- doc/html/classmeow_1_1ReaderWriter__string.js | 5 - .../classmeow_1_1RegisterInterface-members.html | 80 - doc/html/classmeow_1_1RegisterInterface.html | 217 -- doc/html/classmeow_1_1RegisterInterface.js | 7 - doc/html/classmeow_1_1Rotation3D-members.html | 114 - doc/html/classmeow_1_1Rotation3D.html | 979 -------- doc/html/classmeow_1_1Rotation3D.js | 22 - doc/html/classmeow_1_1Rotation3D.png | Bin 1177 -> 0 bytes doc/html/classmeow_1_1SegmentTree-members.html | 86 - doc/html/classmeow_1_1SegmentTree.html | 507 ---- doc/html/classmeow_1_1SegmentTree.js | 13 - doc/html/classmeow_1_1Self-members.html | 38 +- doc/html/classmeow_1_1Self.html | 576 ++--- doc/html/classmeow_1_1Self.js | 31 +- doc/html/classmeow_1_1SplayTree-members.html | 101 - doc/html/classmeow_1_1SplayTree.html | 970 -------- doc/html/classmeow_1_1SplayTree.js | 29 - .../classmeow_1_1SplayTree_1_1Element-members.html | 87 - doc/html/classmeow_1_1SplayTree_1_1Element.html | 446 ---- doc/html/classmeow_1_1SplayTree_1_1Element.js | 14 - .../classmeow_1_1SplayTree__Range-members.html | 105 - doc/html/classmeow_1_1SplayTree__Range.html | 1113 --------- doc/html/classmeow_1_1SplayTree__Range.js | 33 - ...eow_1_1SplayTree__Range_1_1Element-members.html | 87 - .../classmeow_1_1SplayTree__Range_1_1Element.html | 446 ---- .../classmeow_1_1SplayTree__Range_1_1Element.js | 14 - doc/html/classmeow_1_1State-members.html | 90 + doc/html/classmeow_1_1State.html | 434 ++++ doc/html/classmeow_1_1State.js | 12 + doc/html/classmeow_1_1State.png | Bin 0 -> 441 bytes doc/html/classmeow_1_1Transformation-members.html | 95 - doc/html/classmeow_1_1Transformation.html | 896 ------- doc/html/classmeow_1_1Transformation.js | 22 - doc/html/classmeow_1_1Transformation.png | Bin 2016 -> 0 bytes doc/html/classmeow_1_1Usage-members.html | 94 - doc/html/classmeow_1_1Usage.html | 835 ------- doc/html/classmeow_1_1Usage.js | 21 - doc/html/classmeow_1_1VP__Tree-members.html | 90 - doc/html/classmeow_1_1VP__Tree.html | 584 ----- doc/html/classmeow_1_1VP__Tree.js | 17 - doc/html/classmeow_1_1Vector-members.html | 115 - doc/html/classmeow_1_1Vector.html | 1458 ------------ doc/html/classmeow_1_1Vector.js | 42 - doc/html/classmeow_1_1Vector2D-members.html | 137 -- doc/html/classmeow_1_1Vector2D.html | 2122 ----------------- doc/html/classmeow_1_1Vector2D.js | 64 - doc/html/classmeow_1_1Vector3D-members.html | 139 -- doc/html/classmeow_1_1Vector3D.html | 2229 ------------------ doc/html/classmeow_1_1Vector3D.js | 66 - doc/html/classmeow_1_1ViewPort-members.html | 86 - doc/html/classmeow_1_1ViewPort.html | 133 -- doc/html/classmeow_1_1ViewPort.png | Bin 512 -> 0 bytes doc/html/classmeow_1_1WatchBall-members.html | 105 - doc/html/classmeow_1_1WatchBall.html | 1005 -------- doc/html/classmeow_1_1WatchBall.js | 28 - doc/html/classmeow_1_1WatchBall.png | Bin 643 -> 0 bytes doc/html/classmeow_1_1YUV-members.html | 97 - doc/html/classmeow_1_1YUV.html | 755 ------ doc/html/classmeow_1_1YUV.js | 24 - doc/html/classmeow_1_1YUVf-members.html | 101 - doc/html/classmeow_1_1YUVf.html | 437 ---- doc/html/classmeow_1_1YUVf.js | 13 - doc/html/classmeow_1_1YUVf.png | Bin 552 -> 0 bytes doc/html/classmeow_1_1YUVf__Space-members.html | 124 - doc/html/classmeow_1_1YUVf__Space.html | 1024 -------- doc/html/classmeow_1_1YUVf__Space.js | 34 - doc/html/classmeow_1_1YUVf__Space.png | Bin 720 -> 0 bytes ...lassmeow_1_1factory__types_1_1Base-members.html | 83 + doc/html/classmeow_1_1factory__types_1_1Base.html | 322 +++ doc/html/classmeow_1_1factory__types_1_1Base.js | 11 + doc/html/classmeow_1_1factory__types_1_1Base.png | Bin 0 -> 1012 bytes ...meow_1_1factory__types_1_1CheckOff-members.html | 84 + .../classmeow_1_1factory__types_1_1CheckOff.html | 327 +++ .../classmeow_1_1factory__types_1_1CheckOff.js | 9 + .../classmeow_1_1factory__types_1_1CheckOff.png | Bin 0 -> 774 bytes ...smeow_1_1factory__types_1_1CheckOn-members.html | 84 + .../classmeow_1_1factory__types_1_1CheckOn.html | 329 +++ doc/html/classmeow_1_1factory__types_1_1CheckOn.js | 9 + .../classmeow_1_1factory__types_1_1CheckOn.png | Bin 0 -> 770 bytes doc/html/dir_115d3279a93b9c99d8f569a34543848f.html | 108 - doc/html/dir_115d3279a93b9c99d8f569a34543848f.js | 38 - doc/html/dir_310883ca86d42971a9d74da2c3f04777.html | 96 + doc/html/dir_310883ca86d42971a9d74da2c3f04777.js | 21 + doc/html/dir_33ab824d5df7449c06d9279d1a3e3363.html | 81 + doc/html/dir_33ab824d5df7449c06d9279d1a3e3363.js | 4 + doc/html/dir_540a4c8f2977878a343351220ffba92b.html | 90 - doc/html/dir_540a4c8f2977878a343351220ffba92b.js | 17 - doc/html/dir_77e0ab67466b1e7d76f50725a5ab9910.html | 94 - doc/html/dir_77e0ab67466b1e7d76f50725a5ab9910.js | 24 - doc/html/dir_92fecd8d02dd5e7a67429447fdf0f60f.html | 27 +- doc/html/dir_92fecd8d02dd5e7a67429447fdf0f60f.js | 15 +- doc/html/dir_a17ff8dcb3a1c1b842af541700214096.html | 94 - doc/html/dir_a17ff8dcb3a1c1b842af541700214096.js | 30 - doc/html/dir_a57e9e528cb28fd6752031b735908fb6.html | 80 - doc/html/dir_a57e9e528cb28fd6752031b735908fb6.js | 7 - doc/html/dir_f6840b2fecd08a3779df34f0add0e074.html | 88 - doc/html/dir_f6840b2fecd08a3779df34f0add0e074.js | 10 - doc/html/factory_8h.html | 114 + doc/html/factory_8h_source.html | 371 +++ doc/html/files.html | 65 +- doc/html/form_0.png | Bin 393 -> 0 bytes doc/html/form_1.png | Bin 435 -> 0 bytes doc/html/form_10.png | Bin 6044 -> 0 bytes doc/html/form_11.png | Bin 6041 -> 0 bytes doc/html/form_12.png | Bin 6088 -> 0 bytes doc/html/form_13.png | Bin 393 -> 0 bytes doc/html/form_14.png | Bin 300 -> 0 bytes doc/html/form_15.png | Bin 235 -> 0 bytes doc/html/form_16.png | Bin 241 -> 0 bytes doc/html/form_17.png | Bin 227 -> 0 bytes doc/html/form_18.png | Bin 253 -> 0 bytes doc/html/form_19.png | Bin 3198 -> 0 bytes doc/html/form_2.png | Bin 575 -> 0 bytes doc/html/form_20.png | Bin 763 -> 0 bytes doc/html/form_21.png | Bin 238 -> 0 bytes doc/html/form_22.png | Bin 2060 -> 0 bytes doc/html/form_23.png | Bin 784 -> 0 bytes doc/html/form_24.png | Bin 218 -> 0 bytes doc/html/form_25.png | Bin 221 -> 0 bytes doc/html/form_26.png | Bin 2053 -> 0 bytes doc/html/form_27.png | Bin 341 -> 0 bytes doc/html/form_28.png | Bin 669 -> 0 bytes doc/html/form_29.png | Bin 3451 -> 0 bytes doc/html/form_3.png | Bin 5706 -> 0 bytes doc/html/form_30.png | Bin 930 -> 0 bytes doc/html/form_31.png | Bin 1817 -> 0 bytes doc/html/form_32.png | Bin 767 -> 0 bytes doc/html/form_4.png | Bin 234 -> 0 bytes doc/html/form_5.png | Bin 236 -> 0 bytes doc/html/form_6.png | Bin 922 -> 0 bytes doc/html/form_7.png | Bin 226 -> 0 bytes doc/html/form_8.png | Bin 730 -> 0 bytes doc/html/form_9.png | Bin 5164 -> 0 bytes doc/html/formula.repository | 33 - doc/html/functions.html | 277 ++- doc/html/functions_b.html | 114 - doc/html/functions_c.html | 216 -- doc/html/functions_d.html | 128 - doc/html/functions_dup.js | 30 - doc/html/functions_e.html | 133 -- doc/html/functions_enum.html | 74 - doc/html/functions_eval.html | 77 - doc/html/functions_f.html | 138 -- doc/html/functions_func.html | 262 ++- doc/html/functions_func.js | 30 - doc/html/functions_func_b.html | 114 - doc/html/functions_func_c.html | 210 -- doc/html/functions_func_d.html | 125 - doc/html/functions_func_e.html | 124 - doc/html/functions_func_f.html | 121 - doc/html/functions_func_g.html | 110 - doc/html/functions_func_h.html | 129 -- doc/html/functions_func_i.html | 121 - doc/html/functions_func_j.html | 83 - doc/html/functions_func_k.html | 80 - doc/html/functions_func_l.html | 106 - doc/html/functions_func_m.html | 139 -- doc/html/functions_func_n.html | 95 - doc/html/functions_func_o.html | 267 --- doc/html/functions_func_p.html | 204 -- doc/html/functions_func_q.html | 80 - doc/html/functions_func_r.html | 221 -- doc/html/functions_func_s.html | 150 -- doc/html/functions_func_t.html | 131 -- doc/html/functions_func_u.html | 108 - doc/html/functions_func_v.html | 123 - doc/html/functions_func_w.html | 103 - doc/html/functions_func_x.html | 87 - doc/html/functions_func_y.html | 104 - doc/html/functions_func_z.html | 79 - doc/html/functions_func_~.html | 200 -- doc/html/functions_g.html | 110 - doc/html/functions_h.html | 129 -- doc/html/functions_i.html | 133 -- doc/html/functions_j.html | 83 - doc/html/functions_k.html | 80 - doc/html/functions_l.html | 106 - doc/html/functions_m.html | 145 -- doc/html/functions_n.html | 95 - doc/html/functions_o.html | 267 --- doc/html/functions_p.html | 213 -- doc/html/functions_q.html | 80 - doc/html/functions_r.html | 224 -- doc/html/functions_rela.html | 74 - doc/html/functions_s.html | 156 -- doc/html/functions_t.html | 134 -- doc/html/functions_type.html | 119 - doc/html/functions_u.html | 108 - doc/html/functions_v.html | 130 -- doc/html/functions_vars.html | 30 +- doc/html/functions_w.html | 103 - doc/html/functions_x.html | 87 - doc/html/functions_y.html | 104 - doc/html/functions_z.html | 79 - doc/html/functions_~.html | 200 -- doc/html/globals.html | 16 +- doc/html/globals_defs.html | 16 +- doc/html/hierarchy.html | 97 +- doc/html/hierarchy.js | 100 +- doc/html/index.html | 4 +- doc/html/mainpage_8dox.html | 74 - doc/html/math_2utility_8h.html | 147 -- doc/html/math_2utility_8h.js | 16 - doc/html/math_2utility_8h_source.html | 206 -- doc/html/methods_8h.html | 103 - doc/html/methods_8h.js | 6 - doc/html/methods_8h_source.html | 272 --- doc/html/namespacemembers.html | 180 +- doc/html/namespacemembers_enum.html | 8 +- doc/html/namespacemembers_eval.html | 15 +- doc/html/namespacemembers_func.html | 176 -- doc/html/namespacemembers_type.html | 43 +- doc/html/namespacemembers_vars.html | 80 - doc/html/namespacemeow.html | 2442 +------------------- doc/html/namespacemeow.js | 59 +- doc/html/namespacemeow_1_1factory__types.html | 87 + doc/html/namespacemeow_1_1factory__types.js | 6 + doc/html/namespaces.html | 9 +- doc/html/namespaces.js | 2 +- doc/html/navtree.js | 19 +- doc/html/navtreeindex0.js | 426 ++-- doc/html/navtreeindex1.js | 253 -- doc/html/navtreeindex2.js | 253 -- doc/html/navtreeindex3.js | 253 -- doc/html/navtreeindex4.js | 253 -- doc/html/navtreeindex5.js | 130 -- doc/html/navtreeindex6.js | 29 - doc/html/object_8h.html | 145 ++ doc/html/object_8h.js | 17 + doc/html/object_8h_source.html | 234 ++ doc/html/operation_8h.html | 103 + doc/html/operation_8h_source.html | 132 ++ doc/html/pages.html | 79 - doc/html/pages_8dox.html | 8 +- doc/html/pointer_8h.html | 111 + doc/html/pointer_8h.js | 8 + doc/html/pointer_8h_source.html | 215 ++ doc/html/self_8h.html | 23 +- doc/html/self_8h_source.html | 301 +-- doc/html/state_8h.html | 100 + doc/html/state_8h_source.html | 134 ++ .../structmeow_1_1EyesReferenceInfo-members.html | 83 - doc/html/structmeow_1_1EyesReferenceInfo.html | 318 --- doc/html/structmeow_1_1EyesReferenceInfo.js | 10 - doc/html/structmeow_1_1PairToPair-members.html | 82 - doc/html/structmeow_1_1PairToPair.html | 281 --- doc/html/structmeow_1_1PairToPair.js | 9 - doc/html/structmeow_1_1SceneInfo-members.html | 82 - doc/html/structmeow_1_1SceneInfo.html | 262 --- doc/html/structmeow_1_1SceneInfo.js | 9 - ...factory__types_1_1Base_1_1BaseData-members.html | 82 + ...meow_1_1factory__types_1_1Base_1_1BaseData.html | 232 ++ ...ctmeow_1_1factory__types_1_1Base_1_1BaseData.js | 9 + doc/html/stylesheet.css | 37 +- doc/html/utility_8h.html | 159 -- doc/html/utility_8h.js | 11 - doc/html/utility_8h_source.html | 215 -- doc/html/utility_8hpp.html | 133 -- doc/html/utility_8hpp.js | 16 - doc/html/utility_8hpp_source.html | 262 --- 587 files changed, 9252 insertions(+), 93158 deletions(-) delete mode 100644 doc/html/BinaryIndexTree_8h.html delete mode 100644 doc/html/BinaryIndexTree_8h_source.html delete mode 100644 doc/html/BitmapDescript_8h.html delete mode 100644 doc/html/BitmapDescript_8h_source.html delete mode 100644 doc/html/Bitmap_8h.html delete mode 100644 doc/html/Bitmap_8h.js delete mode 100644 doc/html/Bitmap_8h_source.html delete mode 100644 doc/html/BundleAdjustment_8h.html delete mode 100644 doc/html/BundleAdjustment_8h.js delete mode 100644 doc/html/BundleAdjustment_8h_source.html delete mode 100644 doc/html/BundleAdjustment__LM_8h.html delete mode 100644 doc/html/BundleAdjustment__LM_8h_source.html delete mode 100644 doc/html/Camera_8h.html delete mode 100644 doc/html/Camera_8h_source.html delete mode 100644 doc/html/Color3__Space_8h.html delete mode 100644 doc/html/Color3__Space_8h_source.html delete mode 100644 doc/html/DisjointSet_8h.html delete mode 100644 doc/html/DisjointSet_8h_source.html delete mode 100644 doc/html/Eye_8h.html delete mode 100644 doc/html/Eye_8h_source.html delete mode 100644 doc/html/FeaturePoint_8h.html delete mode 100644 doc/html/FeaturePoint_8h_source.html delete mode 100644 doc/html/FeaturePointsDetector_8h.html delete mode 100644 doc/html/FeaturePointsDetector_8h_source.html delete mode 100644 doc/html/FeaturePointsDetector__Harris_8h.html delete mode 100644 doc/html/FeaturePointsDetector__Harris_8h.js delete mode 100644 doc/html/FeaturePointsDetector__Harris_8h_source.html delete mode 100644 doc/html/FeaturePointsMatch_8h.html delete mode 100644 doc/html/FeaturePointsMatch_8h.js delete mode 100644 doc/html/FeaturePointsMatch_8h_source.html delete mode 100644 doc/html/FeaturePointsMatch__K__Match_8h.html delete mode 100644 doc/html/FeaturePointsMatch__K__Match_8h.js delete mode 100644 doc/html/FeaturePointsMatch__K__Match_8h_source.html delete mode 100644 doc/html/HI.html delete mode 100644 doc/html/HIJ.html delete mode 100644 doc/html/HIxx.html delete mode 100644 doc/html/HSL_8h.html delete mode 100644 doc/html/HSL_8h.js delete mode 100644 doc/html/HSL_8h_source.html delete mode 100644 doc/html/HSL_8hpp.html delete mode 100644 doc/html/HSL_8hpp.js delete mode 100644 doc/html/HSL_8hpp_source.html delete mode 100644 doc/html/HSL__Space_8h.html delete mode 100644 doc/html/HSL__Space_8h.js delete mode 100644 doc/html/HSL__Space_8h_source.html delete mode 100644 doc/html/HSV_8h.html delete mode 100644 doc/html/HSV_8h.js delete mode 100644 doc/html/HSV_8h_source.html delete mode 100644 doc/html/HSV_8hpp.html delete mode 100644 doc/html/HSV_8hpp.js delete mode 100644 doc/html/HSV_8hpp_source.html delete mode 100644 doc/html/HSV__Space_8h.html delete mode 100644 doc/html/HSV__Space_8h.js delete mode 100644 doc/html/HSV__Space_8h_source.html delete mode 100644 doc/html/HashTable_8h.html delete mode 100644 doc/html/HashTable_8h_source.html delete mode 100644 doc/html/IdentityPoints_8h.html delete mode 100644 doc/html/IdentityPoints_8h_source.html delete mode 100644 doc/html/KD__Tree_8h.html delete mode 100644 doc/html/KD__Tree_8h_source.html delete mode 100644 doc/html/LinearTransformation_8h.html delete mode 100644 doc/html/LinearTransformation_8h_source.html delete mode 100644 doc/html/LinearTransformations_8h.html delete mode 100644 doc/html/LinearTransformations_8h_source.html delete mode 100644 doc/html/Matrix_8h.html delete mode 100644 doc/html/Matrix_8h_source.html delete mode 100644 doc/html/MergeableHeap_8h.html delete mode 100644 doc/html/MergeableHeap_8h_source.html delete mode 100644 doc/html/ObjArray_8h.html delete mode 100644 doc/html/ObjArray_8h_source.html delete mode 100644 doc/html/ObjBase_8h.html delete mode 100644 doc/html/ObjBase_8h_source.html delete mode 100644 doc/html/ObjDictionary_8h.html delete mode 100644 doc/html/ObjDictionary_8h_source.html delete mode 100644 doc/html/ObjProperties_8h.html delete mode 100644 doc/html/ObjProperties_8h_source.html delete mode 100644 doc/html/ObjSelector_8h.html delete mode 100644 doc/html/ObjSelector_8h.js delete mode 100644 doc/html/ObjSelector_8h_source.html delete mode 100644 doc/html/ObjTypes_8h.html delete mode 100644 doc/html/ObjTypes_8h.js delete mode 100644 doc/html/ObjTypes_8h_source.html delete mode 100644 doc/html/Photo_8h.html delete mode 100644 doc/html/Photo_8h_source.html delete mode 100644 doc/html/RGB_8h.html delete mode 100644 doc/html/RGB_8h_source.html delete mode 100644 doc/html/RGB_8hpp.html delete mode 100644 doc/html/RGB_8hpp_source.html delete mode 100644 doc/html/RGB__Space_8h.html delete mode 100644 doc/html/RGB__Space_8h.js delete mode 100644 doc/html/RGB__Space_8h_source.html delete mode 100644 doc/html/Register__Implement_8h.html delete mode 100644 doc/html/Register__Implement_8h_source.html delete mode 100644 doc/html/Register__Implement_8hpp.html delete mode 100644 doc/html/Register__Implement_8hpp_source.html delete mode 100644 doc/html/SegmentTree_8h.html delete mode 100644 doc/html/SegmentTree_8h_source.html delete mode 100644 doc/html/Self_8h.html delete mode 100644 doc/html/Self_8h.js delete mode 100644 doc/html/Self_8h_source.html delete mode 100644 doc/html/SplayTree_8h.html delete mode 100644 doc/html/SplayTree_8h_source.html delete mode 100644 doc/html/Transformation_8h.html delete mode 100644 doc/html/Transformation_8h_source.html delete mode 100644 doc/html/Transformations_8h.html delete mode 100644 doc/html/Transformations_8h_source.html delete mode 100644 doc/html/Usage_8h.html delete mode 100644 doc/html/Usage_8h_source.html delete mode 100644 doc/html/Usage_8hpp.html delete mode 100644 doc/html/Usage_8hpp_source.html delete mode 100644 doc/html/VP__Tree_8h.html delete mode 100644 doc/html/VP__Tree_8h_source.html delete mode 100644 doc/html/Vector_8h.html delete mode 100644 doc/html/Vector_8h_source.html delete mode 100644 doc/html/Vectors_8h.html delete mode 100644 doc/html/Vectors_8h_source.html delete mode 100644 doc/html/ViewPort_8h.html delete mode 100644 doc/html/ViewPort_8h_source.html delete mode 100644 doc/html/WatchBall_8h.html delete mode 100644 doc/html/WatchBall_8h_source.html delete mode 100644 doc/html/YUV_8h.html delete mode 100644 doc/html/YUV_8h.js delete mode 100644 doc/html/YUV_8h_source.html delete mode 100644 doc/html/YUV_8hpp.html delete mode 100644 doc/html/YUV_8hpp.js delete mode 100644 doc/html/YUV_8hpp_source.html delete mode 100644 doc/html/YUV__Space_8h.html delete mode 100644 doc/html/YUV__Space_8h.js delete mode 100644 doc/html/YUV__Space_8h_source.html create mode 100644 doc/html/assert_8h.html create mode 100644 doc/html/assert_8h.js create mode 100644 doc/html/assert_8h_source.html delete mode 100644 doc/html/classFeaturePointDescript-members.html delete mode 100644 doc/html/classFeaturePointDescript.html delete mode 100644 doc/html/classFeaturePointDescript.js delete mode 100644 doc/html/classFeaturePointDescript.png delete mode 100644 doc/html/classObjBase.html delete mode 100644 doc/html/classObjBase.png delete mode 100644 doc/html/classdouble.html delete mode 100644 doc/html/classint.html delete mode 100644 doc/html/classint32__t.html delete mode 100644 doc/html/classmeow_1_1BallProjection-members.html delete mode 100644 doc/html/classmeow_1_1BallProjection.html delete mode 100644 doc/html/classmeow_1_1BallProjection.js delete mode 100644 doc/html/classmeow_1_1BallProjection.png create mode 100644 doc/html/classmeow_1_1BaseFloatingType-members.html create mode 100644 doc/html/classmeow_1_1BaseFloatingType.html create mode 100644 doc/html/classmeow_1_1BaseFloatingType.js create mode 100644 doc/html/classmeow_1_1BaseFloatingType.png create mode 100644 doc/html/classmeow_1_1BaseNumberType-members.html create mode 100644 doc/html/classmeow_1_1BaseNumberType.html create mode 100644 doc/html/classmeow_1_1BaseNumberType.js create mode 100644 doc/html/classmeow_1_1BaseNumberType.png delete mode 100644 doc/html/classmeow_1_1BinaryIndexTree-members.html delete mode 100644 doc/html/classmeow_1_1BinaryIndexTree.html delete mode 100644 doc/html/classmeow_1_1BinaryIndexTree.js delete mode 100644 doc/html/classmeow_1_1Bitmap-members.html delete mode 100644 doc/html/classmeow_1_1Bitmap.html delete mode 100644 doc/html/classmeow_1_1Bitmap.js delete mode 100644 doc/html/classmeow_1_1Bitmap.png delete mode 100644 doc/html/classmeow_1_1BundleAdjustment-members.html delete mode 100644 doc/html/classmeow_1_1BundleAdjustment.html delete mode 100644 doc/html/classmeow_1_1BundleAdjustment.js delete mode 100644 doc/html/classmeow_1_1BundleAdjustment.png delete mode 100644 doc/html/classmeow_1_1BundleAdjustment__LM-members.html delete mode 100644 doc/html/classmeow_1_1BundleAdjustment__LM.html delete mode 100644 doc/html/classmeow_1_1BundleAdjustment__LM.js delete mode 100644 doc/html/classmeow_1_1BundleAdjustment__LM.png delete mode 100644 doc/html/classmeow_1_1Camera-members.html delete mode 100644 doc/html/classmeow_1_1Camera.html delete mode 100644 doc/html/classmeow_1_1Camera.js delete mode 100644 doc/html/classmeow_1_1Camera.png delete mode 100644 doc/html/classmeow_1_1Color3__Space-members.html delete mode 100644 doc/html/classmeow_1_1Color3__Space.html delete mode 100644 doc/html/classmeow_1_1Color3__Space.js delete mode 100644 doc/html/classmeow_1_1DisjointSet-members.html delete mode 100644 doc/html/classmeow_1_1DisjointSet.html delete mode 100644 doc/html/classmeow_1_1DisjointSet.js delete mode 100644 doc/html/classmeow_1_1Eye-members.html delete mode 100644 doc/html/classmeow_1_1Eye.html delete mode 100644 doc/html/classmeow_1_1Eye.js delete mode 100644 doc/html/classmeow_1_1Eye.png create mode 100644 doc/html/classmeow_1_1Factory-members.html create mode 100644 doc/html/classmeow_1_1Factory.html create mode 100644 doc/html/classmeow_1_1Factory.js create mode 100644 doc/html/classmeow_1_1Factory.png delete mode 100644 doc/html/classmeow_1_1FeaturePoint-members.html delete mode 100644 doc/html/classmeow_1_1FeaturePoint.html delete mode 100644 doc/html/classmeow_1_1FeaturePoint.js delete mode 100644 doc/html/classmeow_1_1FeaturePoint.png delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector-members.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector.js delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector.png delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector__Harris-members.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector__Harris.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector__Harris.js delete mode 100644 doc/html/classmeow_1_1FeaturePointsDetector__Harris.png delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch-members.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch.js delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch.png delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch__K__Match-members.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch__K__Match.html delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch__K__Match.js delete mode 100644 doc/html/classmeow_1_1FeaturePointsMatch__K__Match.png delete mode 100644 doc/html/classmeow_1_1HSL-members.html delete mode 100644 doc/html/classmeow_1_1HSL.html delete mode 100644 doc/html/classmeow_1_1HSL.js delete mode 100644 doc/html/classmeow_1_1HSLf-members.html delete mode 100644 doc/html/classmeow_1_1HSLf.html delete mode 100644 doc/html/classmeow_1_1HSLf.js delete mode 100644 doc/html/classmeow_1_1HSLf.png delete mode 100644 doc/html/classmeow_1_1HSLf__Space-members.html delete mode 100644 doc/html/classmeow_1_1HSLf__Space.html delete mode 100644 doc/html/classmeow_1_1HSLf__Space.js delete mode 100644 doc/html/classmeow_1_1HSLf__Space.png delete mode 100644 doc/html/classmeow_1_1HSV-members.html delete mode 100644 doc/html/classmeow_1_1HSV.html delete mode 100644 doc/html/classmeow_1_1HSV.js delete mode 100644 doc/html/classmeow_1_1HSVf-members.html delete mode 100644 doc/html/classmeow_1_1HSVf.html delete mode 100644 doc/html/classmeow_1_1HSVf.js delete mode 100644 doc/html/classmeow_1_1HSVf.png delete mode 100644 doc/html/classmeow_1_1HSVf__Space-members.html delete mode 100644 doc/html/classmeow_1_1HSVf__Space.html delete mode 100644 doc/html/classmeow_1_1HSVf__Space.js delete mode 100644 doc/html/classmeow_1_1HSVf__Space.png delete mode 100644 doc/html/classmeow_1_1HashTableList-members.html delete mode 100644 doc/html/classmeow_1_1HashTableList.html delete mode 100644 doc/html/classmeow_1_1HashTableList.js delete mode 100644 doc/html/classmeow_1_1IdentityPoints-members.html delete mode 100644 doc/html/classmeow_1_1IdentityPoints.html delete mode 100644 doc/html/classmeow_1_1IdentityPoints.js delete mode 100644 doc/html/classmeow_1_1IdentityPoints.png delete mode 100644 doc/html/classmeow_1_1ImplementInterface-members.html delete mode 100644 doc/html/classmeow_1_1ImplementInterface.html delete mode 100644 doc/html/classmeow_1_1ImplementInterface.js delete mode 100644 doc/html/classmeow_1_1KD__Tree-members.html delete mode 100644 doc/html/classmeow_1_1KD__Tree.html delete mode 100644 doc/html/classmeow_1_1KD__Tree.js delete mode 100644 doc/html/classmeow_1_1LinearTransformation-members.html delete mode 100644 doc/html/classmeow_1_1LinearTransformation.html delete mode 100644 doc/html/classmeow_1_1LinearTransformation.js delete mode 100644 doc/html/classmeow_1_1LinearTransformation.png delete mode 100644 doc/html/classmeow_1_1Matrix-members.html delete mode 100644 doc/html/classmeow_1_1Matrix.html delete mode 100644 doc/html/classmeow_1_1Matrix.js delete mode 100644 doc/html/classmeow_1_1MergeableHeap-members.html delete mode 100644 doc/html/classmeow_1_1MergeableHeap.html delete mode 100644 doc/html/classmeow_1_1MergeableHeap.js delete mode 100644 doc/html/classmeow_1_1ObjArray-members.html delete mode 100644 doc/html/classmeow_1_1ObjArray.html delete mode 100644 doc/html/classmeow_1_1ObjArray.js delete mode 100644 doc/html/classmeow_1_1ObjArray.png delete mode 100644 doc/html/classmeow_1_1ObjBase-members.html delete mode 100644 doc/html/classmeow_1_1ObjBase.html delete mode 100644 doc/html/classmeow_1_1ObjBase.js delete mode 100644 doc/html/classmeow_1_1ObjBase.png delete mode 100644 doc/html/classmeow_1_1ObjDictionary-members.html delete mode 100644 doc/html/classmeow_1_1ObjDictionary.html delete mode 100644 doc/html/classmeow_1_1ObjDictionary.js delete mode 100644 doc/html/classmeow_1_1ObjDictionary.png delete mode 100644 doc/html/classmeow_1_1ObjProperties-members.html delete mode 100644 doc/html/classmeow_1_1ObjProperties.html delete mode 100644 doc/html/classmeow_1_1ObjProperties.js delete mode 100644 doc/html/classmeow_1_1ObjProperties.png delete mode 100644 doc/html/classmeow_1_1ObjSelector-members.html delete mode 100644 doc/html/classmeow_1_1ObjSelector.html delete mode 100644 doc/html/classmeow_1_1ObjSelector.js delete mode 100644 doc/html/classmeow_1_1ObjType-members.html delete mode 100644 doc/html/classmeow_1_1ObjType.html delete mode 100644 doc/html/classmeow_1_1ObjType.js delete mode 100644 doc/html/classmeow_1_1ObjType.png create mode 100644 doc/html/classmeow_1_1Object-members.html create mode 100644 doc/html/classmeow_1_1Object.html create mode 100644 doc/html/classmeow_1_1Object.js create mode 100644 doc/html/classmeow_1_1Object.png create mode 100644 doc/html/classmeow_1_1Operation-members.html create mode 100644 doc/html/classmeow_1_1Operation.html create mode 100644 doc/html/classmeow_1_1Operation.js create mode 100644 doc/html/classmeow_1_1Operation.png delete mode 100644 doc/html/classmeow_1_1Photo-members.html delete mode 100644 doc/html/classmeow_1_1Photo.html delete mode 100644 doc/html/classmeow_1_1Photo.js delete mode 100644 doc/html/classmeow_1_1Photo.png delete mode 100644 doc/html/classmeow_1_1PhotoProjection-members.html delete mode 100644 doc/html/classmeow_1_1PhotoProjection.html delete mode 100644 doc/html/classmeow_1_1PhotoProjection.js delete mode 100644 doc/html/classmeow_1_1PhotoProjection.png create mode 100644 doc/html/classmeow_1_1Pointer-members.html create mode 100644 doc/html/classmeow_1_1Pointer.html create mode 100644 doc/html/classmeow_1_1Pointer.js create mode 100644 doc/html/classmeow_1_1Pointer.png delete mode 100644 doc/html/classmeow_1_1RGB-members.html delete mode 100644 doc/html/classmeow_1_1RGB.html delete mode 100644 doc/html/classmeow_1_1RGB.js delete mode 100644 doc/html/classmeow_1_1RGBf-members.html delete mode 100644 doc/html/classmeow_1_1RGBf.html delete mode 100644 doc/html/classmeow_1_1RGBf.js delete mode 100644 doc/html/classmeow_1_1RGBf.png delete mode 100644 doc/html/classmeow_1_1RGBf__Space-members.html delete mode 100644 doc/html/classmeow_1_1RGBf__Space.html delete mode 100644 doc/html/classmeow_1_1RGBf__Space.js delete mode 100644 doc/html/classmeow_1_1RGBf__Space.png delete mode 100644 doc/html/classmeow_1_1RGBi-members.html delete mode 100644 doc/html/classmeow_1_1RGBi.html delete mode 100644 doc/html/classmeow_1_1RGBi.js delete mode 100644 doc/html/classmeow_1_1RGBi.png delete mode 100644 doc/html/classmeow_1_1RGBi__Space-members.html delete mode 100644 doc/html/classmeow_1_1RGBi__Space.html delete mode 100644 doc/html/classmeow_1_1RGBi__Space.js delete mode 100644 doc/html/classmeow_1_1RGBi__Space.png delete mode 100644 doc/html/classmeow_1_1ReaderWriter__double-members.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__double.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__double.js delete mode 100644 doc/html/classmeow_1_1ReaderWriter__int-members.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__int.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__int.js delete mode 100644 doc/html/classmeow_1_1ReaderWriter__size__t-members.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__size__t.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__size__t.js delete mode 100644 doc/html/classmeow_1_1ReaderWriter__string-members.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__string.html delete mode 100644 doc/html/classmeow_1_1ReaderWriter__string.js delete mode 100644 doc/html/classmeow_1_1RegisterInterface-members.html delete mode 100644 doc/html/classmeow_1_1RegisterInterface.html delete mode 100644 doc/html/classmeow_1_1RegisterInterface.js delete mode 100644 doc/html/classmeow_1_1Rotation3D-members.html delete mode 100644 doc/html/classmeow_1_1Rotation3D.html delete mode 100644 doc/html/classmeow_1_1Rotation3D.js delete mode 100644 doc/html/classmeow_1_1Rotation3D.png delete mode 100644 doc/html/classmeow_1_1SegmentTree-members.html delete mode 100644 doc/html/classmeow_1_1SegmentTree.html delete mode 100644 doc/html/classmeow_1_1SegmentTree.js delete mode 100644 doc/html/classmeow_1_1SplayTree-members.html delete mode 100644 doc/html/classmeow_1_1SplayTree.html delete mode 100644 doc/html/classmeow_1_1SplayTree.js delete mode 100644 doc/html/classmeow_1_1SplayTree_1_1Element-members.html delete mode 100644 doc/html/classmeow_1_1SplayTree_1_1Element.html delete mode 100644 doc/html/classmeow_1_1SplayTree_1_1Element.js delete mode 100644 doc/html/classmeow_1_1SplayTree__Range-members.html delete mode 100644 doc/html/classmeow_1_1SplayTree__Range.html delete mode 100644 doc/html/classmeow_1_1SplayTree__Range.js delete mode 100644 doc/html/classmeow_1_1SplayTree__Range_1_1Element-members.html delete mode 100644 doc/html/classmeow_1_1SplayTree__Range_1_1Element.html delete mode 100644 doc/html/classmeow_1_1SplayTree__Range_1_1Element.js create mode 100644 doc/html/classmeow_1_1State-members.html create mode 100644 doc/html/classmeow_1_1State.html create mode 100644 doc/html/classmeow_1_1State.js create mode 100644 doc/html/classmeow_1_1State.png delete mode 100644 doc/html/classmeow_1_1Transformation-members.html delete mode 100644 doc/html/classmeow_1_1Transformation.html delete mode 100644 doc/html/classmeow_1_1Transformation.js delete mode 100644 doc/html/classmeow_1_1Transformation.png delete mode 100644 doc/html/classmeow_1_1Usage-members.html delete mode 100644 doc/html/classmeow_1_1Usage.html delete mode 100644 doc/html/classmeow_1_1Usage.js delete mode 100644 doc/html/classmeow_1_1VP__Tree-members.html delete mode 100644 doc/html/classmeow_1_1VP__Tree.html delete mode 100644 doc/html/classmeow_1_1VP__Tree.js delete mode 100644 doc/html/classmeow_1_1Vector-members.html delete mode 100644 doc/html/classmeow_1_1Vector.html delete mode 100644 doc/html/classmeow_1_1Vector.js delete mode 100644 doc/html/classmeow_1_1Vector2D-members.html delete mode 100644 doc/html/classmeow_1_1Vector2D.html delete mode 100644 doc/html/classmeow_1_1Vector2D.js delete mode 100644 doc/html/classmeow_1_1Vector3D-members.html delete mode 100644 doc/html/classmeow_1_1Vector3D.html delete mode 100644 doc/html/classmeow_1_1Vector3D.js delete mode 100644 doc/html/classmeow_1_1ViewPort-members.html delete mode 100644 doc/html/classmeow_1_1ViewPort.html delete mode 100644 doc/html/classmeow_1_1ViewPort.png delete mode 100644 doc/html/classmeow_1_1WatchBall-members.html delete mode 100644 doc/html/classmeow_1_1WatchBall.html delete mode 100644 doc/html/classmeow_1_1WatchBall.js delete mode 100644 doc/html/classmeow_1_1WatchBall.png delete mode 100644 doc/html/classmeow_1_1YUV-members.html delete mode 100644 doc/html/classmeow_1_1YUV.html delete mode 100644 doc/html/classmeow_1_1YUV.js delete mode 100644 doc/html/classmeow_1_1YUVf-members.html delete mode 100644 doc/html/classmeow_1_1YUVf.html delete mode 100644 doc/html/classmeow_1_1YUVf.js delete mode 100644 doc/html/classmeow_1_1YUVf.png delete mode 100644 doc/html/classmeow_1_1YUVf__Space-members.html delete mode 100644 doc/html/classmeow_1_1YUVf__Space.html delete mode 100644 doc/html/classmeow_1_1YUVf__Space.js delete mode 100644 doc/html/classmeow_1_1YUVf__Space.png create mode 100644 doc/html/classmeow_1_1factory__types_1_1Base-members.html create mode 100644 doc/html/classmeow_1_1factory__types_1_1Base.html create mode 100644 doc/html/classmeow_1_1factory__types_1_1Base.js create mode 100644 doc/html/classmeow_1_1factory__types_1_1Base.png create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOff-members.html create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOff.html create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOff.js create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOff.png create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOn-members.html create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOn.html create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOn.js create mode 100644 doc/html/classmeow_1_1factory__types_1_1CheckOn.png delete mode 100644 doc/html/dir_115d3279a93b9c99d8f569a34543848f.html delete mode 100644 doc/html/dir_115d3279a93b9c99d8f569a34543848f.js create mode 100644 doc/html/dir_310883ca86d42971a9d74da2c3f04777.html create mode 100644 doc/html/dir_310883ca86d42971a9d74da2c3f04777.js create mode 100644 doc/html/dir_33ab824d5df7449c06d9279d1a3e3363.html create mode 100644 doc/html/dir_33ab824d5df7449c06d9279d1a3e3363.js delete mode 100644 doc/html/dir_540a4c8f2977878a343351220ffba92b.html delete mode 100644 doc/html/dir_540a4c8f2977878a343351220ffba92b.js delete mode 100644 doc/html/dir_77e0ab67466b1e7d76f50725a5ab9910.html delete mode 100644 doc/html/dir_77e0ab67466b1e7d76f50725a5ab9910.js delete mode 100644 doc/html/dir_a17ff8dcb3a1c1b842af541700214096.html delete mode 100644 doc/html/dir_a17ff8dcb3a1c1b842af541700214096.js delete mode 100644 doc/html/dir_a57e9e528cb28fd6752031b735908fb6.html delete mode 100644 doc/html/dir_a57e9e528cb28fd6752031b735908fb6.js delete mode 100644 doc/html/dir_f6840b2fecd08a3779df34f0add0e074.html delete mode 100644 doc/html/dir_f6840b2fecd08a3779df34f0add0e074.js create mode 100644 doc/html/factory_8h.html create mode 100644 doc/html/factory_8h_source.html delete mode 100644 doc/html/form_0.png delete mode 100644 doc/html/form_1.png delete mode 100644 doc/html/form_10.png delete mode 100644 doc/html/form_11.png delete mode 100644 doc/html/form_12.png delete mode 100644 doc/html/form_13.png delete mode 100644 doc/html/form_14.png delete mode 100644 doc/html/form_15.png delete mode 100644 doc/html/form_16.png delete mode 100644 doc/html/form_17.png delete mode 100644 doc/html/form_18.png delete mode 100644 doc/html/form_19.png delete mode 100644 doc/html/form_2.png delete mode 100644 doc/html/form_20.png delete mode 100644 doc/html/form_21.png delete mode 100644 doc/html/form_22.png delete mode 100644 doc/html/form_23.png delete mode 100644 doc/html/form_24.png delete mode 100644 doc/html/form_25.png delete mode 100644 doc/html/form_26.png delete mode 100644 doc/html/form_27.png delete mode 100644 doc/html/form_28.png delete mode 100644 doc/html/form_29.png delete mode 100644 doc/html/form_3.png delete mode 100644 doc/html/form_30.png delete mode 100644 doc/html/form_31.png delete mode 100644 doc/html/form_32.png delete mode 100644 doc/html/form_4.png delete mode 100644 doc/html/form_5.png delete mode 100644 doc/html/form_6.png delete mode 100644 doc/html/form_7.png delete mode 100644 doc/html/form_8.png delete mode 100644 doc/html/form_9.png delete mode 100644 doc/html/formula.repository delete mode 100644 doc/html/functions_b.html delete mode 100644 doc/html/functions_c.html delete mode 100644 doc/html/functions_d.html delete mode 100644 doc/html/functions_dup.js delete mode 100644 doc/html/functions_e.html delete mode 100644 doc/html/functions_enum.html delete mode 100644 doc/html/functions_eval.html delete mode 100644 doc/html/functions_f.html delete mode 100644 doc/html/functions_func.js delete mode 100644 doc/html/functions_func_b.html delete mode 100644 doc/html/functions_func_c.html delete mode 100644 doc/html/functions_func_d.html delete mode 100644 doc/html/functions_func_e.html delete mode 100644 doc/html/functions_func_f.html delete mode 100644 doc/html/functions_func_g.html delete mode 100644 doc/html/functions_func_h.html delete mode 100644 doc/html/functions_func_i.html delete mode 100644 doc/html/functions_func_j.html delete mode 100644 doc/html/functions_func_k.html delete mode 100644 doc/html/functions_func_l.html delete mode 100644 doc/html/functions_func_m.html delete mode 100644 doc/html/functions_func_n.html delete mode 100644 doc/html/functions_func_o.html delete mode 100644 doc/html/functions_func_p.html delete mode 100644 doc/html/functions_func_q.html delete mode 100644 doc/html/functions_func_r.html delete mode 100644 doc/html/functions_func_s.html delete mode 100644 doc/html/functions_func_t.html delete mode 100644 doc/html/functions_func_u.html delete mode 100644 doc/html/functions_func_v.html delete mode 100644 doc/html/functions_func_w.html delete mode 100644 doc/html/functions_func_x.html delete mode 100644 doc/html/functions_func_y.html delete mode 100644 doc/html/functions_func_z.html delete mode 100644 doc/html/functions_func_~.html delete mode 100644 doc/html/functions_g.html delete mode 100644 doc/html/functions_h.html delete mode 100644 doc/html/functions_i.html delete mode 100644 doc/html/functions_j.html delete mode 100644 doc/html/functions_k.html delete mode 100644 doc/html/functions_l.html delete mode 100644 doc/html/functions_m.html delete mode 100644 doc/html/functions_n.html delete mode 100644 doc/html/functions_o.html delete mode 100644 doc/html/functions_p.html delete mode 100644 doc/html/functions_q.html delete mode 100644 doc/html/functions_r.html delete mode 100644 doc/html/functions_rela.html delete mode 100644 doc/html/functions_s.html delete mode 100644 doc/html/functions_t.html delete mode 100644 doc/html/functions_type.html delete mode 100644 doc/html/functions_u.html delete mode 100644 doc/html/functions_v.html delete mode 100644 doc/html/functions_w.html delete mode 100644 doc/html/functions_x.html delete mode 100644 doc/html/functions_y.html delete mode 100644 doc/html/functions_z.html delete mode 100644 doc/html/functions_~.html delete mode 100644 doc/html/mainpage_8dox.html delete mode 100644 doc/html/math_2utility_8h.html delete mode 100644 doc/html/math_2utility_8h.js delete mode 100644 doc/html/math_2utility_8h_source.html delete mode 100644 doc/html/methods_8h.html delete mode 100644 doc/html/methods_8h.js delete mode 100644 doc/html/methods_8h_source.html delete mode 100644 doc/html/namespacemembers_func.html delete mode 100644 doc/html/namespacemembers_vars.html create mode 100644 doc/html/namespacemeow_1_1factory__types.html create mode 100644 doc/html/namespacemeow_1_1factory__types.js delete mode 100644 doc/html/navtreeindex1.js delete mode 100644 doc/html/navtreeindex2.js delete mode 100644 doc/html/navtreeindex3.js delete mode 100644 doc/html/navtreeindex4.js delete mode 100644 doc/html/navtreeindex5.js delete mode 100644 doc/html/navtreeindex6.js create mode 100644 doc/html/object_8h.html create mode 100644 doc/html/object_8h.js create mode 100644 doc/html/object_8h_source.html create mode 100644 doc/html/operation_8h.html create mode 100644 doc/html/operation_8h_source.html delete mode 100644 doc/html/pages.html create mode 100644 doc/html/pointer_8h.html create mode 100644 doc/html/pointer_8h.js create mode 100644 doc/html/pointer_8h_source.html create mode 100644 doc/html/state_8h.html create mode 100644 doc/html/state_8h_source.html delete mode 100644 doc/html/structmeow_1_1EyesReferenceInfo-members.html delete mode 100644 doc/html/structmeow_1_1EyesReferenceInfo.html delete mode 100644 doc/html/structmeow_1_1EyesReferenceInfo.js delete mode 100644 doc/html/structmeow_1_1PairToPair-members.html delete mode 100644 doc/html/structmeow_1_1PairToPair.html delete mode 100644 doc/html/structmeow_1_1PairToPair.js delete mode 100644 doc/html/structmeow_1_1SceneInfo-members.html delete mode 100644 doc/html/structmeow_1_1SceneInfo.html delete mode 100644 doc/html/structmeow_1_1SceneInfo.js create mode 100644 doc/html/structmeow_1_1factory__types_1_1Base_1_1BaseData-members.html create mode 100644 doc/html/structmeow_1_1factory__types_1_1Base_1_1BaseData.html create mode 100644 doc/html/structmeow_1_1factory__types_1_1Base_1_1BaseData.js delete mode 100644 doc/html/utility_8h.html delete mode 100644 doc/html/utility_8h.js delete mode 100644 doc/html/utility_8h_source.html delete mode 100644 doc/html/utility_8hpp.html delete mode 100644 doc/html/utility_8hpp.js delete mode 100644 doc/html/utility_8hpp_source.html (limited to 'doc/html') diff --git a/doc/html/BinaryIndexTree_8h.html b/doc/html/BinaryIndexTree_8h.html deleted file mode 100644 index a673b39..0000000 --- a/doc/html/BinaryIndexTree_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/BinaryIndexTree.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
BinaryIndexTree.h File Reference
-
-
-
#include <cstdlib>
-#include <vector>
-#include <algorithm>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::BinaryIndexTree< Value >
 極度簡化的 SegmentTree 已無區間更新的操作 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/BinaryIndexTree_8h_source.html b/doc/html/BinaryIndexTree_8h_source.html deleted file mode 100644 index d27f522..0000000 --- a/doc/html/BinaryIndexTree_8h_source.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/BinaryIndexTree.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
BinaryIndexTree.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_BinaryIndexTree_H__
-
2 #define dsa_BinaryIndexTree_H__
-
3 
-
4 #include <cstdlib>
-
5 
-
6 #include <vector>
-
7 #include <algorithm>
-
8 
-
9 namespace meow {
-
10 
-
11 template<class Value>
- -
22 private:
-
23  std::vector<Value> array_;
-
24 public:
- -
29  }
-
30 
-
37  BinaryIndexTree(size_t size, Value const& value):
-
38  array_(size, value) {
-
39  }
-
40 
- -
48  array_(tree2.array_) {
-
49  }
-
50 
-
60  void reset(size_t size, Value const& init) {
-
61  array_.clear();
-
62  array_.resize(size, init);
-
63  }
-
64 
-
74  void update(size_t index, Value const& value) {
-
75  index++;
-
76  for ( ; index <= array_.size(); index += (index & -index)) {
-
77  array_[index - 1] = array_[index - 1] + value;
-
78  }
-
79  }
-
80 
-
81 
-
90  Value query(ssize_t index) const {
-
91  index = std::min(index + 1, (ssize_t)array_.size());
-
92  Value ret(0);
-
93  for ( ; 0 < index; index -= (index & -index)) {
-
94  ret = ret + array_[index - 1];
-
95  }
-
96  return ret;
-
97  }
-
98 };
-
99 
-
100 } // meow
-
101 
-
102 #endif // dsa_BinaryIndexTree_H__
-
void reset(size_t size, Value const &init)
將資料洗掉, 重設
-
極度簡化的 SegmentTree 已無區間更新的操作
-
BinaryIndexTree()
constructor
-
BinaryIndexTree(size_t size, Value const &value)
constructor
-
Value query(ssize_t index) const
詢問 0~index 的區間值
-
void update(size_t index, Value const &value)
將array中第 index (從零算起)個element多加上指定的值
-
BinaryIndexTree(BinaryIndexTree const &tree2)
constructor
-
-
- - - - - diff --git a/doc/html/BitmapDescript_8h.html b/doc/html/BitmapDescript_8h.html deleted file mode 100644 index 5e059db..0000000 --- a/doc/html/BitmapDescript_8h.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/BitmapDescript.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
BitmapDescript.h File Reference
-
-
-
#include "../Self.h"
-#include "../oo/ObjBase.h"
-
-

Go to the source code of this file.

- - - - -

-Classes

class  FeaturePointDescript
 
-
-
- - - - - diff --git a/doc/html/BitmapDescript_8h_source.html b/doc/html/BitmapDescript_8h_source.html deleted file mode 100644 index e43dfe1..0000000 --- a/doc/html/BitmapDescript_8h_source.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/BitmapDescript.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
BitmapDescript.h
-
-
-Go to the documentation of this file.
1 #ifndef BitmapDescript_H__
-
2 #define BitmapDescript_H__
-
3 
-
4 #include "../Self.h"
-
5 
-
6 #include "../oo/ObjBase.h"
-
7 
-
8 
-
9 
- -
11 private:
-
12  struct Myself {
-
13  double ratioL_;
-
14  size_t wSize_;
-
15  size_t cNumber_;
-
16  };
-
17  Self<Myself const> self;
-
18 public:
- -
20  }
-
21 
- -
23  }
-
24 
-
25 
-
26  bool write(FILE* f, bool bin, unsigned int fg) const {
-
27  return false;
-
28  }
-
29 
-
30  bool read(FILE* f, bool bin, unsigned int fg) {
-
31  return false;
-
32  }
-
33 
-
34  ObjBase* create() const {
-
35  return new FeaturePointDescript();
-
36  }
-
37 
-
38  ObjBase* copyFrom(ObjBase const& b) {
-
39  return &(copyFrom(*(FeaturePointDescript const*)b));
-
40  }
-
41 
-
42  char const* ctype() const {
-
43  return typeid(*this).name();
-
44  }
-
45 
-
46  std::string type() const {
-
47  return std::string(ctype());
-
48  }
-
49 };
-
50 
-
51 #endif // BitmapDescript_H__
- -
char const * ctype() const
-
ObjBase * copyFrom(ObjBase const &b)
-
bool read(FILE *f, bool bin, unsigned int fg)
-
ObjBase * create() const
- -
bool write(FILE *f, bool bin, unsigned int fg) const
- -
std::string type() const
- -
-
- - - - - diff --git a/doc/html/Bitmap_8h.html b/doc/html/Bitmap_8h.html deleted file mode 100644 index 832289e..0000000 --- a/doc/html/Bitmap_8h.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Bitmap.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Bitmap.h File Reference
-
-
-
#include "../math/utility.h"
-#include "../math/Matrix.h"
-#include "../oo/ObjBase.h"
-#include <vector>
-#include <cmath>
-#include <string>
-#include <typeinfo>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Bitmap< Pixel >
 二維點陣資料 More...
 
- - - -

-Namespaces

 meow
 
- - - -

-Variables

const unsigned int meow::kBitmapReadWritePixels = 0x1
 
-
-
- - - - - diff --git a/doc/html/Bitmap_8h.js b/doc/html/Bitmap_8h.js deleted file mode 100644 index 78fd9c4..0000000 --- a/doc/html/Bitmap_8h.js +++ /dev/null @@ -1,5 +0,0 @@ -var Bitmap_8h = -[ - [ "Bitmap", "classmeow_1_1Bitmap.html", "classmeow_1_1Bitmap" ], - [ "kBitmapReadWritePixels", "Bitmap_8h.html#af9bbb3a5f01cfa088cf5b6f7e70baba6", null ] -]; \ No newline at end of file diff --git a/doc/html/Bitmap_8h_source.html b/doc/html/Bitmap_8h_source.html deleted file mode 100644 index 0c002a4..0000000 --- a/doc/html/Bitmap_8h_source.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Bitmap.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Bitmap.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_Bitmap_H__
-
2 #define gra_Bitmap_H__
-
3 
-
4 #include "../math/utility.h"
-
5 #include "../math/Matrix.h"
-
6 
-
7 #include "../oo/ObjBase.h"
-
8 
-
9 #include <vector>
-
10 #include <cmath>
-
11 #include <string>
-
12 #include <typeinfo>
-
13 #include <cstdlib>
-
14 
-
15 namespace meow {
-
16 
-
17 const unsigned int kBitmapReadWritePixels = 0x1;
-
18 
-
24 template<class Pixel>
-
25 class Bitmap: public ObjBase {
-
26 private:
-
27  Matrix<Pixel> matrix_;
-
28 
-
30  static std::vector<double> gaussianFactor1(double sigma) {
-
31  double sigma2 = squ(sigma);
-
32  size_t width = std::max(ceil((double)(sigma * 2)), 0.0);
-
33  std::vector<double> factor(width + 1 + width);
-
34  for (size_t x = 0; x < width; x++) {
-
35  double e = exp(-(squ((double)x)) / (2.0 * sigma2));
-
36  factor[width - x - 1] = e;
-
37  factor[width + x + 1] = e;
-
38  }
-
39  factor[width] = 1.0;
-
40  return factor;
-
41  }
-
42 
-
44  static std::vector<double> gradianceFactor1(double sigma) {
-
45  double sigma2 = squ(sigma), ss = sigma * 2;
-
46  size_t width = std::max(ceil(ss), 1.0);
-
47  std::vector<double> factor(width + 1 + width);
-
48  for (size_t x = 0; x < width; x++) {
-
49  double e = exp(-(squ((double)x)) / (2.0 * sigma2));
-
50  factor[width - x - 1] = (double)x * e;
-
51  factor[width + x + 1] = -(double)x * e;
-
52  }
-
53  factor[width] = 0.0;
-
54  return factor;
-
55  }
-
56 
-
58  Bitmap xyBlur(std::vector<double> const& factor,
-
59  ssize_t dx, ssize_t dy) const {
-
60  if (factor.size() <= 1)
-
61  return *this;
-
62  Bitmap ret(height(), width(), Pixel(0));
-
63  ssize_t w = factor.size() / 2;
-
64  for (size_t y = 0, Y = height(); y < Y; y++)
-
65  for (size_t x = 0, X = width(); x < X; x++) {
-
66  Pixel sum(0);
-
67  double fsum(0);
-
68  for (ssize_t i = -w; i <= w; i++) {
-
69  ssize_t x2 = (ssize_t)x + dx * i;
-
70  ssize_t y2 = (ssize_t)y + dy * i;
-
71  if (0 <= x2 && x2 < (ssize_t)X && 0 <= y2 && y2 < (ssize_t)Y) {
-
72  sum = sum + pixel(y2, x2) * factor[i + w];
-
73  fsum = fsum + fabs(factor[i + w]);
-
74  }
-
75  }
-
76  ret.pixel(y, x, sum / fsum);
-
77  }
-
78  return ret;
-
79  }
-
80 public:
-
84  Bitmap() {
-
85  }
-
86 
-
90  Bitmap(Bitmap const& b): matrix_(b.matrix_) {
-
91  }
-
92 
-
96  Bitmap(Matrix<Pixel> const& b): matrix_(b) {
-
97  }
-
98 
-
106  Bitmap(size_t h, size_t w, Pixel const& p): matrix_(h, w, p) {
-
107  }
-
108 
- -
113  }
-
114 
-
118  Bitmap& copyFrom(Bitmap const& b) {
-
119  matrix_.copyFrom(b.matrix_);
-
120  return *this;
-
121  }
-
122 
- -
127  matrix_.referenceFrom(b.matrix_);
-
128  return *this;
-
129  }
-
130 
-
139  void reset(size_t h, size_t w, Pixel const& p) {
-
140  matrix_.reset(h, w, p);
-
141  }
-
142 
-
146  void clear() {
-
147  matrix_.clear();
-
148  }
-
149 
-
153  size_t height() const {
-
154  return matrix_.rows();
-
155  }
-
156 
-
160  size_t width() const {
-
161  return matrix_.cols();
-
162  }
-
163 
-
167  size_t size() const {
-
168  return matrix_.size();
-
169  }
-
170 
-
178  size_t height(size_t h2, Pixel const& p) {
-
179  return matrix_.rows(h2, p);
-
180  }
-
181 
-
189  size_t width(size_t w2, Pixel const& p) {
-
190  return matrix_.cols(w2, p);
-
191  }
-
192 
-
201  size_t size(size_t h2, size_t w2, Pixel const& p) {
-
202  return matrix_.size(h2, w2, p);
-
203  }
-
204 
-
212  Pixel pixel(size_t y, size_t x) const {
-
213  return matrix_.entry(y, x);
-
214  }
-
215 
-
224  Pixel pixel(size_t y, size_t x, Pixel const& p) {
-
225  return matrix_.entry(y, x, p);
-
226  }
-
227 
-
240  void pixels(ssize_t yFirst, ssize_t yLast,
-
241  ssize_t xFirst, ssize_t xLast,
-
242  Pixel const& p) {
-
243  return matrix_.entries(yFirst, yLast, xFirst, xLast, p);
-
244  }
-
245 
- -
250  return matrix_;
-
251  }
-
252 
- -
257  return matrix_;
-
258  }
-
259 
- -
264  matrix_.copyFrom(p);
-
265  return matrix();
-
266  }
-
267 
-
275  Bitmap gaussian(double radiusY, double radiusX) const {
-
276  return (xyBlur(gaussianFactor1(radiusY), 1, 0).
-
277  xyBlur(gaussianFactor1(radiusX), 0, 1));
-
278  }
-
279 
-
287  Bitmap& gaussianed(double radiusY, double radiusX) {
-
288  return copyFrom(gaussian(radiusY, radiusX));
-
289  }
-
290 
-
298  Bitmap gradianceX(double radiusY, double radiusX) const {
-
299  return (xyBlur(gaussianFactor1(radiusY), 1, 0).
-
300  xyBlur(gradianceFactor1(radiusX), 0, 1));
-
301  }
-
302 
-
310  Bitmap<Pixel>& gradiancedX(double radiusY, double radiusX) {
-
311  return copyFrom(gradianceX(radiusY, radiusX));
-
312  }
-
313 
-
321  Bitmap<Pixel> gradianceY (double radiusY, double radiusX) const {
-
322  return (xyBlur(gaussianFactor1(radiusX), 0, 1).
-
323  xyBlur(gradianceFactor1(radiusY), 1, 0));
-
324  }
-
325 
-
333  Bitmap<Pixel>& gradiancedY(double radiusY, double radiusX) {
-
334  return copyFrom(gradianceY(radiusY, radiusX));
-
335  }
-
336 
-
340  Bitmap& operator=(Bitmap const& b) {
-
341  return copyFrom(b);
-
342  }
-
343 
-
347  Pixel operator()(size_t y, size_t x) const {
-
348  return pixel(y, x);
-
349  }
-
350 
-
354  Pixel const& operator()(size_t y, size_t x, Pixel const& p) const {
-
355  return pixel(y, x, p);
-
356  }
-
357 
-
362  bool write(FILE* f, bool bin, unsigned int fg) const {
-
363  if (fg & kBitmapReadWritePixels)
-
364  return false;
-
365  if (bin) {
-
366  long tmp;
-
367  if (fwrite(&(tmp = matrix_.cols()), sizeof(tmp), 1, f) < 1) return false;
-
368  if (fwrite(&(tmp = matrix_.rows()), sizeof(tmp), 1, f) < 1) return false;
-
369  }
-
370  else {
-
371  if (fprintf(f, "%ld %ld\n", (long)matrix_.cols(), (long)matrix_.rows())
-
372  < 2) return false;
-
373  }
-
374  return true;
-
375  }
-
376 
-
381  bool read(FILE* f, bool bin, unsigned int fg) {
-
382  if (fg & kBitmapReadWritePixels)
-
383  return false;
-
384  long tmp1, tmp2;
-
385  if (bin) {
-
386  if (fread(&tmp1, sizeof(tmp1), 1, f) < 1) return false;
-
387  if (fread(&tmp2, sizeof(tmp2), 1, f) < 1) return false;
-
388  }
-
389  else {
-
390  if (fscanf(f, "%ld %ld", &tmp1, &tmp2) < 2) return false;
-
391  }
-
392  matrix_.size(tmp1, tmp2, Pixel(0));
-
393  return true;
-
394  }
-
395 
-
400  ObjBase* create() const {
-
401  return new Bitmap();
-
402  }
-
403 
-
413  ObjBase* copyFrom(ObjBase const* b) {
-
414  return &(copyFrom(*(Bitmap const*)b));
-
415  }
-
416 
-
421  char const* ctype() const{
-
422  return typeid(*this).name();
-
423  }
-
424 
-
429  std::string type() const {
-
430  return std::string(ctype());
-
431  }
-
432 };
-
433 
-
434 
-
435 } // meow
-
436 
-
437 #endif // gra_Bitmap_H__
-
Bitmap< Pixel > gradianceY(double radiusY, double radiusX) const
回傳對y偏微分
Definition: Bitmap.h:321
-
ObjBase * copyFrom(ObjBase const *b)
複製資料
Definition: Bitmap.h:413
-
void pixels(ssize_t yFirst, ssize_t yLast, ssize_t xFirst, ssize_t xLast, Pixel const &p)
區塊修改
Definition: Bitmap.h:240
-
Bitmap(size_t h, size_t w, Pixel const &p)
constructor, 指定寬高, 預設Pixel
Definition: Bitmap.h:106
-
size_t size(size_t h2, size_t w2, Pixel const &p)
修改寬高
Definition: Bitmap.h:201
-
Matrix & referenceFrom(Matrix const &m)
reference
Definition: Matrix.h:110
-
Pixel operator()(size_t y, size_t x) const
same as pixel(y, x)
Definition: Bitmap.h:347
-
size_t height() const
回傳高度
Definition: Bitmap.h:153
-
size_t rows() const
Return number of rows.
Definition: Matrix.h:129
-
void clear()
清除資料, 寬高階規零
Definition: Bitmap.h:146
-
Pixel const & operator()(size_t y, size_t x, Pixel const &p) const
same as pixel(y, x, p)
Definition: Bitmap.h:354
-
const unsigned int kBitmapReadWritePixels
Definition: Bitmap.h:17
-
char const * ctype() const
回傳class的type
Definition: Bitmap.h:421
-
Bitmap & operator=(Bitmap const &b)
same as copyFrom(b)
Definition: Bitmap.h:340
-
Bitmap gaussian(double radiusY, double radiusX) const
回傳高斯模糊
Definition: Bitmap.h:275
-
size_t cols() const
Return number of cols.
Definition: Matrix.h:134
- -
Bitmap()
constructor, 產生一個空的Bitmap
Definition: Bitmap.h:84
-
Matrix< Pixel > matrix() const
回傳矩陣形式
Definition: Bitmap.h:249
-
Bitmap(Bitmap const &b)
constructor, 複製一個bitmap
Definition: Bitmap.h:90
-
Matrix< Pixel > matrix(Matrix< Pixel > const &p)
直接設定
Definition: Bitmap.h:263
-
二維點陣資料
Definition: Bitmap.h:25
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
Definition: Bitmap.h:381
-
Matrix< Pixel > & matrixGet()
回傳矩陣形式 (non-constant form)
Definition: Bitmap.h:256
-
Pixel pixel(size_t y, size_t x) const
取得 (y, x) 的pixel
Definition: Bitmap.h:212
-
size_t width() const
回傳寬度
Definition: Bitmap.h:160
-
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
Definition: Bitmap.h:362
-
Matrix & copyFrom(Matrix const &m)
copy
Definition: Matrix.h:97
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
Bitmap & copyFrom(Bitmap const &b)
複製
Definition: Bitmap.h:118
-
void entries(ssize_t rFirst, ssize_t rLast, ssize_t cFirst, ssize_t cLast, Entry const &e)
Change the entries from rFirst x cFirst to rLast x cLast.
Definition: Matrix.h:237
-
size_t size() const
Return number of rows times number of cols.
Definition: Matrix.h:139
-
size_t size() const
回傳高度乘以寬度
Definition: Bitmap.h:167
-
void clear()
free the memory
Definition: Matrix.h:204
-
Pixel pixel(size_t y, size_t x, Pixel const &p)
修改 (y, x) 的pixel
Definition: Bitmap.h:224
-
~Bitmap()
destructor
Definition: Bitmap.h:112
-
Bitmap gradianceX(double radiusY, double radiusX) const
回傳對x偏微分
Definition: Bitmap.h:298
-
size_t width(size_t w2, Pixel const &p)
修改寬度
Definition: Bitmap.h:189
-
Bitmap(Matrix< Pixel > const &b)
constructor, copy data from a matrix
Definition: Bitmap.h:96
- -
void reset(size_t h, size_t w, Pixel const &p)
全部重設
Definition: Bitmap.h:139
-
std::string type() const
回傳class的type
Definition: Bitmap.h:429
-
Bitmap & referenceFrom(Bitmap const &b)
reference
Definition: Bitmap.h:126
-
Entry entry(size_t r, size_t c) const
Access the entry at r x c.
Definition: Matrix.h:212
-
Bitmap< Pixel > & gradiancedX(double radiusY, double radiusX)
把自己對x偏微分
Definition: Bitmap.h:310
-
size_t height(size_t h2, Pixel const &p)
修改高度
Definition: Bitmap.h:178
-
void reset(size_t r, size_t c, Entry const &e)
reset the size of the matrix to r x c with entry all be e
Definition: Matrix.h:116
-
Bitmap & gaussianed(double radiusY, double radiusX)
把自己高斯模糊
Definition: Bitmap.h:287
-
ObjBase * create() const
new一個自己
Definition: Bitmap.h:400
-
T squ(T const &x)
x*x
Definition: utility.h:77
-
Bitmap< Pixel > & gradiancedY(double radiusY, double radiusX)
把自己對y偏微分
Definition: Bitmap.h:333
-
-
- - - - - diff --git a/doc/html/BundleAdjustment_8h.html b/doc/html/BundleAdjustment_8h.html deleted file mode 100644 index f9b3eec..0000000 --- a/doc/html/BundleAdjustment_8h.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/BundleAdjustment.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
BundleAdjustment.h File Reference
-
-
-
#include "Eye.h"
-#include "../oo/ObjBase.h"
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

struct  meow::EyesReferenceInfo< Pixel >
 記住每個 Eye 的reference以及Flag More...
 
class  meow::BundleAdjustment< Pixel >
 這邊定義Bundle-Adjustment就是利用一系列場景來反推算出相機資訊 (包含拍攝座標, 角度與焦距) 或是在已知相機資訊的情況下推算出底片中 物體如何移動. More...
 
- - - -

-Namespaces

 meow
 
- - - - -

-Enumerations

enum  meow::EyesReferenceInfoFlags { meow::CAN_OFFSET = 0x01, -meow::CAN_ROTATE = 0x02, -meow::CAN_ZOOM = 0x04 - }
 列舉每個 Eye 可以有哪些種類的移動 More...
 
-
-
- - - - - diff --git a/doc/html/BundleAdjustment_8h.js b/doc/html/BundleAdjustment_8h.js deleted file mode 100644 index 114c9e6..0000000 --- a/doc/html/BundleAdjustment_8h.js +++ /dev/null @@ -1,10 +0,0 @@ -var BundleAdjustment_8h = -[ - [ "EyesReferenceInfo", "structmeow_1_1EyesReferenceInfo.html", "structmeow_1_1EyesReferenceInfo" ], - [ "BundleAdjustment", "classmeow_1_1BundleAdjustment.html", "classmeow_1_1BundleAdjustment" ], - [ "EyesReferenceInfoFlags", "BundleAdjustment_8h.html#a62736f7790a097fc54e0a6a608dfe690", [ - [ "CAN_OFFSET", "BundleAdjustment_8h.html#a62736f7790a097fc54e0a6a608dfe690aa91dfed3c139ca574cc320b6e938fbba", null ], - [ "CAN_ROTATE", "BundleAdjustment_8h.html#a62736f7790a097fc54e0a6a608dfe690aad583589f041b1648b1e21205ff15b5e", null ], - [ "CAN_ZOOM", "BundleAdjustment_8h.html#a62736f7790a097fc54e0a6a608dfe690a6e34cdff1ccf772a88749ce39658a9e3", null ] - ] ] -]; \ No newline at end of file diff --git a/doc/html/BundleAdjustment_8h_source.html b/doc/html/BundleAdjustment_8h_source.html deleted file mode 100644 index 2aaad1d..0000000 --- a/doc/html/BundleAdjustment_8h_source.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/BundleAdjustment.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
BundleAdjustment.h
-
-
-Go to the documentation of this file.
1 #ifndef BundleAdjustment_H__
-
2 #define BundleAdjustment_H__
-
3 
-
4 #include "Eye.h"
-
5 
-
6 #include "../oo/ObjBase.h"
-
7 
-
8 namespace meow {
-
9 
- -
14  CAN_OFFSET = 0x01,
-
15  CAN_ROTATE = 0x02,
-
16  CAN_ZOOM = 0x04
-
17 };
-
18 
-
22 template<class Pixel>
- -
24  unsigned long flag;
- -
26 
- -
31  }
-
32 
-
37  EyesReferenceInfo(Eye<Pixel>& e, unsigned long f): flag(f), eye() {
-
38  eye.referenceFrom(e);
-
39  }
-
40 
- -
45  eye.referenceFrom(si.eye);
-
46  }
-
47 
- -
52  }
-
53 
- -
58  flag = e.flag;
-
59  eye.referenceFrom(e.eye);
-
60  return *this;
-
61  }
-
62 };
-
63 
-
69 template<class Pixel>
-
70 class BundleAdjustment: public ObjBase {
-
71 protected:
- -
73  }
-
74 public:
-
75  virtual ~BundleAdjustment() {
-
76  }
-
77 
-
84  virtual
-
85  bool adjustEyes(std::vector<EyesReferenceInfo<Pixel> > seq) const {
-
86  return false;
-
87  }
-
88 
-
97  virtual
-
98  bool adjustFixedPoints(std::vector<EyesReferenceInfo<Pixel> > seq) const {
-
99  return false;
-
100  }
-
101 };
-
102 
-
103 } // meow
-
104 
-
105 #endif // BundleAdjustment_H__
- -
這邊定義Bundle-Adjustment就是利用一系列場景來反推算出相機資訊 (包含拍攝座標, 角度與焦距) 或是在已知相機資訊的情況下推算出底片中 物體如何移動.
- -
EyesReferenceInfo & operator=(EyesReferenceInfo const &e)
copy operator, still use reference method
-
virtual bool adjustFixedPoints(std::vector< EyesReferenceInfo< Pixel > > seq) const
推算場景中的物體資訊
-
記住每個 Eye 的reference以及Flag
-
EyesReferenceInfo()
constructor with nothing
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- - - -
virtual bool adjustEyes(std::vector< EyesReferenceInfo< Pixel > > seq) const
推算相機資訊
-
EyesReferenceInfoFlags
列舉每個 Eye 可以有哪些種類的移動
-
Eye< Pixel > eye
reference
-
改變焦距
-
unsigned long flag
Flag, 定義如EyesReferenceInfoFlags.
-
EyesReferenceInfo(EyesReferenceInfo const &si)
constructor with another EyesReferenceInfo
-
一個 Camera 加上一個offset transformation
Definition: Eye.h:17
- -
EyesReferenceInfo(Eye< Pixel > &e, unsigned long f)
constructor with flag and an Eye object. Here we will let memember '.eye' reference from the specify ...
-
-
- - - - - diff --git a/doc/html/BundleAdjustment__LM_8h.html b/doc/html/BundleAdjustment__LM_8h.html deleted file mode 100644 index ce0240f..0000000 --- a/doc/html/BundleAdjustment__LM_8h.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/BundleAdjustment_LM.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
BundleAdjustment_LM.h File Reference
-
-
-
#include "BundleAdjustment.h"
-#include "Eye.h"
-#include "../math/methods.h"
-#include "../math/Vector.h"
-#include "../math/Matrix.h"
-#include "../math/utility.h"
-#include "../oo/ObjBase.h"
-#include <algorithm>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::BundleAdjustment_LM< Pixel >
 利用 Levenberg-Marquardt Method去推估相機旋轉角度與焦距 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/BundleAdjustment__LM_8h_source.html b/doc/html/BundleAdjustment__LM_8h_source.html deleted file mode 100644 index 50e2aa7..0000000 --- a/doc/html/BundleAdjustment__LM_8h_source.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/BundleAdjustment_LM.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
BundleAdjustment_LM.h
-
-
-Go to the documentation of this file.
1 #ifndef BundleAdjustment_LM_H__
-
2 #define BundleAdjustment_LM_H__
-
3 
-
4 
-
5 #include "BundleAdjustment.h"
-
6 
-
7 #include "Eye.h"
-
8 
-
9 #include "../math/methods.h"
-
10 #include "../math/Vector.h"
-
11 #include "../math/Matrix.h"
-
12 #include "../math/utility.h"
-
13 
-
14 #include "../oo/ObjBase.h"
-
15 
-
16 #include <algorithm>
-
17 
-
18 namespace meow {
-
19 
-
25 template<class Pixel>
-
26 class BundleAdjustment_LM: public BundleAdjustment<Pixel> {
-
27 private:
-
28  /*
-
29  struct MatchPair {
-
30  size_t from_i;
-
31  Matrix<double> from_m;
-
32  size_t to_i;
-
33  Matrix<double> to_m;
-
34  };
-
35 
-
36  class NoOffsetController {
-
37  private:
-
38  std::vector<MatchPair >* pairs_;
-
39  std::vector<Rotation3D <double> >* rot_;
-
40  std::vector<PhotoProjection<double> >* pho_;
-
41  BallProjection<double> bll_;
-
42  bool flag;
-
43  public:
-
44  NoOffsetController(std::vector<MatchPair >* pairs,
-
45  std::vector<Rotation3D<double> >* rot,
-
46  std::vector<PhotoProjection<double> >* pho,
-
47  bool fg):
-
48  pairs_(pairs), rot_(rot), pho_(pho), bll_(3.0, 1.0), flag(fg) {
-
49  }
-
50  Vector<double> init() {
-
51  if (flag == false) {
-
52  Vector<double> v(4, 0.0);
-
53  int i = (*pho_).size() - 1, n = 0;
-
54  v.scalar(n++, (*pho_)[i].focal());
-
55  v.scalar(n++, (*rot_)[i].theta(0));
-
56  v.scalar(n++, (*rot_)[i].theta(1));
-
57  v.scalar(n++, (*rot_)[i].theta(2));
-
58  return v;
-
59  }
-
60  Vector<double> v((*rot_).size() * 4, 0.0);
-
61  for (size_t n = 0, i = 0, I = (*rot_).size(); i < I; ++i) {
-
62  v.scalar(n++, (*pho_)[i].focal());
-
63  v.scalar(n++, (*rot_)[i].theta(0));
-
64  v.scalar(n++, (*rot_)[i].theta(1));
-
65  v.scalar(n++, (*rot_)[i].theta(2));
-
66  }
-
67  return v;
-
68  }
-
69  Vector<double> residure(Vector<double> const& v) {
-
70  for (size_t n = 0, i = 0, I = (*rot_).size(); i < I; ++i) {
-
71  if (flag == false && i != I - 1) continue;
-
72  (*pho_)[i].focal(v(n++));
-
73  (*rot_)[i].theta(0, v(n++));
-
74  (*rot_)[i].theta(1, v(n++));
-
75  (*rot_)[i].theta(2, v(n++));
-
76  }
-
77  for (typename std::vector<MatchPair>::iterator
-
78  it = (*pairs_).begin(), ed = (*pairs_).end(); it != ed; ++it) {
-
79  (*it).from_m.entry(2, 0, -(*pho_)[(*it).from_i].focal());
-
80  (*it). to_m.entry(2, 0, -(*pho_)[(*it). to_i].focal());
-
81  }
-
82  //
-
83  Vector<double> ret((*pairs_).size() * 2, 0.0);
-
84  size_t n = 0;
-
85  for (typename std::vector<MatchPair>::iterator
-
86  it = (*pairs_).begin(), ed = (*pairs_).end(); it != ed; ++it, ++n) {
-
87  Matrix<double> tr(
-
88  (*it).to_m
-
89  -
-
90  (*pho_)[(*it).to_i].transformate(
-
91  (*rot_)[(*it).to_i].transformate(
-
92  (*rot_)[(*it).from_i].transformateInv(
-
93  bll_.transformate(
-
94  (*it).from_m
-
95  )
-
96  )
-
97  )
-
98  )
-
99  );
-
100  ret.scalar(n * 2 , tr(0, 0));
-
101  ret.scalar(n * 2 + 1, tr(1, 0));
-
102  }
-
103  //*
-
104  //for (size_t i = 0; i < ret.dimension(); i++) {
-
105  // printf("(%-9.1f ", ret(i));
-
106  // if (i % 8 == 7) printf("\n");
-
107  //}
-
108  //printf("\n");
-
109  printf("re = %20.5f ?? %f\n", ret.length2(), 25.0 * (*pairs_).size());
-
110  // */
-
111  return ret;
-
112  }
-
113  Matrix<double> jacobian() const {
-
114  Matrix<double> ret;
-
115  if (flag == false) {
-
116  ret.reset((*pairs_).size() * 2, 4, 0.0);
-
117  }
-
118  else {
-
119  ret.reset((*pairs_).size() * 2, (*rot_).size() * 4, 0.0);
-
120  }
-
121  size_t n = 0;
-
122  for (typename std::vector<MatchPair>::iterator
-
123  it = (*pairs_).begin(), ed = (*pairs_).end(); it != ed; ++it, ++n) {
-
124  Matrix<double> tr_A( bll_ .transformate((*it).from_m));
-
125  Matrix<double> tr_B((*rot_)[(*it).from_i].transformateInv(tr_A));
-
126  Matrix<double> tr_C((*rot_)[(*it). to_i].transformate (tr_B));
-
127  Matrix<double> ja_A((*pho_)[(*it). to_i].jacobian (tr_C));
-
128  Matrix<double> ja_B((*rot_)[(*it). to_i].jacobian (tr_B));
-
129  Matrix<double> ja_C((*rot_)[(*it).from_i].jacobianInv(tr_A));
-
130  Matrix<double> m;
-
131  int fr = (flag == false ? 0 : (*it).from_i);
-
132  int to = (flag == false ? 0 : (*it). to_i);
-
133  if (flag != false || (*it).from_i == (*rot_).size() - 1) {
-
134  m = ja_A * ja_B * ja_C * bll_.jacobian((*it).from_m).col(2);
-
135  ret.entry(n * 2 , fr * 4, m(0, 0));
-
136  ret.entry(n * 2 + 1, fr * 4, m(1, 0));
-
137  for (size_t k = 0; k < 3; ++k) {
-
138  m = ja_A * ja_B * (*rot_)[(*it).from_i].jacobianInv(tr_A, k);
-
139  ret.entry(n * 2 , fr * 4 + 1 + k, m(0, 0));
-
140  ret.entry(n * 2 + 1, fr * 4 + 1 + k, m(1, 0));
-
141  }
-
142  }
-
143  if (flag != false || (*it).to_i == (*rot_).size() - 1) {
-
144  m = (*pho_)[(*it).to_i].jacobian(tr_C, 0);
-
145  ret.entry(n * 2 , to * 4, m(0, 0));
-
146  ret.entry(n * 2 + 1, to * 4, m(1, 0));
-
147  for (size_t k = 0; k < 3; ++k) {
-
148  m = ja_A * (*rot_)[(*it).to_i].jacobian(tr_B, k);
-
149  ret.entry(n * 2 , to * 4 + 1 + k, m(0, 0));
-
150  ret.entry(n * 2 + 1, to * 4 + 1 + k, m(1, 0));
-
151  }
-
152  }
-
153  }
-
154  return ret;
-
155  }
-
156  Matrix<double> identity() const {
-
157  if (flag == false) {
-
158  Matrix<double> ret(4, 4, 0.0);
-
159  ret.identitied();
-
160  return ret;
-
161  }
-
162  Matrix<double> ret((*rot_).size() * 4, (*rot_).size() * 4, 0.0);
-
163  ret.identitied();
-
164  return ret;
-
165  }
-
166  };
-
167  // */
-
168 
-
169  struct Myself {
-
170  double t_;
-
171 
-
172  Myself(): t_(5.0) {
-
173  }
-
174 
-
175  Myself(Myself const& m): t_(m.t_) {
-
176  }
-
177 
-
178  ~Myself() {
-
179  }
-
180  };
-
181 
-
182  Self<Myself> const self;
-
183 
-
184 public:
- -
186  }
-
187 
- -
189  self(b.self, Self<Myself>::COPY_FROM) {
-
190  }
-
191 
- -
193  }
-
194 
- -
196  self().copyFrom(b.self);
-
197  return *this;
-
198  }
-
199 
- -
201  self().referenceFrom(b.self);
-
202  return *this;
-
203  }
-
204 
-
205  double threshold() const {
-
206  return self->t_;
-
207  }
-
208 
-
209  double threshold(double t) {
-
210  self()->t_ = t;
-
211  return threshold();
-
212  }
-
213 
-
214  bool adjustEyes(std::vector<EyesReferenceInfo<Pixel> > seq) const {
-
215  // check
-
216  size_t N = seq.size();
-
217  for (size_t i = 0; i < N; ++i) {
-
218  if ( seq[i].flag & CAN_OFFSET ) return false;
-
219  if (!(seq[i].flag & CAN_ROTATE)) return false;
-
220  if (!(seq[i].flag & CAN_ZOOM )) return false;
-
221  if (i > 0 && seq[i - 1].eye.offset() != seq[i].eye.offset()) return false;
-
222  }
-
223  return false;
-
224 
-
225  /*
-
226  std::vector<std::vector<Vector3D<double> > > points;
-
227  // reference
-
228  std::vector<Rotation3D <double> > rots(N);
-
229  std::vector<PhotoProjection<double> > phos(N, PhotoProjection<double>(3));
-
230  for (size_t i = 0; i < N; ++i) {
-
231  rots[i].referenceFrom(seq[i].eye.cameraGet().rotationGet());
-
232  phos[i].referenceFrom(seq[i].eye.cameraGet().photoGet().projectionGet());
-
233  }
-
234 
-
235  // get all pairs
-
236  typedef typename Camera<Pixel>::FixedPoints2D::IdentityPointsMapIterK FPS_K;
-
237  std::vector<FPS_K> beg(N), end(N);
-
238  for (size_t i = 0; i < N; ++i) {
-
239  beg[i] = seq[i].eye.cameraGet().fixedPoints2DGet().pointsGet().begin();
-
240  end[i] = seq[i].eye.cameraGet().fixedPoints2DGet().pointsGet().end ();
-
241  }
-
242 
-
243  FPS_K it1, it2;
-
244  std::vector<std::vector<std::vector<MatchPair> > > all_pairs(N);
-
245  for (size_t i = 0; i < N; ++i) {
-
246  all_pairs[i].resize(N);
-
247  for (size_t j = 0; j < N; ++j) {
-
248  if (i == j) continue;
-
249  for (it1 = beg[i], it2 = beg[j]; it1 != end[i] && it2 != end[j]; ) {
-
250  if (it1->first < it2->first) ++it1;
-
251  else if(it1->first > it2->first) ++it2;
-
252  else {
-
253  MatchPair tmp;
-
254  tmp.from_i = i;
-
255  tmp.from_m = it1->second.matrix();
-
256  tmp.from_m.rows(3, -seq[i].eye.camera().photo().focal());
-
257  tmp. to_i = j;
-
258  tmp. to_m = it2->second.matrix();
-
259  tmp. to_m.rows(3, -seq[j].eye.camera().photo().focal());
-
260  all_pairs[i][j].push_back(tmp);
-
261  ++it1;
-
262  ++it2;
-
263  }
-
264  }
-
265  }
-
266  }
-
267  //
-
268  std::vector<MatchPair > pairs;
-
269  std::vector<Rotation3D <double> > rot;
-
270  std::vector<PhotoProjection<double> > pho;
-
271  std::vector<int > sum (N, 0);
-
272  std::vector<int > big (N, 0);
-
273  std::vector<int > real(N);
-
274  std::vector<int > rev (N);
-
275  // first!!
-
276  int best = -1, best_ct = -1;
-
277  for (size_t i = 0; i < N; ++i) {
-
278  int d = 0;
-
279  for (size_t j = 0; j < N; ++j) {
-
280  d += all_pairs[i][j].size();
-
281  }
-
282  if (best_ct < d) {
-
283  best_ct = d;
-
284  best = i;
-
285  }
-
286  real[i] = i;
-
287  big [i] = i;
-
288  }
-
289  for (size_t i = 0; i < N; ++i) {
-
290  // update else
-
291  real[i] = best;
-
292  rev[best] = i;
-
293  for (size_t j = 0; j < N; ++j) {
-
294  if ((int)j == best) {
-
295  sum[j] = -1;
-
296  continue;
-
297  }
-
298  if (sum[j] < 0) continue;
-
299  sum[j] += all_pairs[best][j].size();
-
300  if (all_pairs[j][big[j]].size() < all_pairs[j][best].size())
-
301  big[j] = best;
-
302  }
-
303  // add me
-
304  printf("%d same as %d\n", best, big[best]);
-
305  if (big[best] == best) {
-
306  rot.push_back((*seq)[big[best]].eye->camera() .rotation());
-
307  pho.push_back((*seq)[big[best]].eye->camera().photo().projection());
-
308  }
-
309  else {
-
310  rot.push_back(rot[rev[big[best]]]);
-
311  pho.push_back(pho[rev[big[best]]]);
-
312  }
-
313  for (size_t j = 0; j < N; ++j) {
-
314  if (sum[j] >= 0) continue;
-
315  for (size_t k = 0, K = all_pairs[best][j].size(); k < K; ++k) {
-
316  all_pairs[best][j][k].from_i = rev[all_pairs[best][j][k].from_i];
-
317  all_pairs[best][j][k]. to_i = rev[all_pairs[best][j][k]. to_i];
-
318  pairs.push_back(all_pairs[best][j][k]);
-
319  }
-
320  for (size_t k = 0, K = all_pairs[j][best].size(); k < K; ++k) {
-
321  all_pairs[j][best][k].from_i = rev[all_pairs[j][best][k].from_i];
-
322  all_pairs[j][best][k]. to_i = rev[all_pairs[j][best][k]. to_i];
-
323  pairs.push_back(all_pairs[j][best][k]);
-
324  }
-
325  }
-
326  if (i > 0) {
-
327  NoOffsetController ct1(&pairs, &rot, &pho, false);
-
328  ct1.residure(levenbergMarquardtTraining(ct1, ct1.init(),
-
329  7.3, 1.0,
-
330  squ(threshold()) * pairs.size(),
-
331  7, 1000));
-
332  }
-
333  best_ct = 0;
-
334  for (size_t j = 0; j < N; ++j) {
-
335  if (best_ct < sum[j]) {
-
336  best = j;
-
337  best_ct = sum[j];
-
338  }
-
339  }
-
340  }
-
341  return true;
-
342  // */
-
343  }
-
344 
-
345  bool adjustFixedPoints(std::vector<EyesReferenceInfo<Pixel> > seq) const {
-
346  return false;
-
347  }
-
348 
-
349  bool write(FILE* f, bool bin, unsigned int fg) const {
-
350  return false;
-
351  }
-
352 
-
353  bool read(FILE* f, bool bin, unsigned int fg) const {
-
354  return false;
-
355  }
-
356 
-
357  ObjBase* create() const {
-
358  return new BundleAdjustment_LM;
-
359  }
-
360 
-
361  ObjBase* copyFrom(ObjBase const* o) {
-
362  return &(copyFrom(*(BundleAdjustment_LM const*)o));
-
363  }
-
364 
-
365  char const* ctype() const {
-
366  return typeid(*this).name();
-
367  }
-
368 
-
369  std::string type() const {
-
370  return std::string(ctype());
-
371  }
-
372 };
-
373 
-
374 } // meow
-
375 
-
376 #endif // BundleAdjustment_LM_H__
-
這邊定義Bundle-Adjustment就是利用一系列場景來反推算出相機資訊 (包含拍攝座標, 角度與焦距) 或是在已知相機資訊的情況下推算出底片中 物體如何移動.
- - - -
char const * ctype() const
用C-style string回傳這個class的type name
-
記住每個 Eye 的reference以及Flag
-
利用 Levenberg-Marquardt Method去推估相機旋轉角度與焦距
-
std::string type() const
用std::string回傳這個class的type name
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
-
BundleAdjustment_LM & referenceFrom(BundleAdjustment_LM const &b)
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- -
bool adjustFixedPoints(std::vector< EyesReferenceInfo< Pixel > > seq) const
推算場景中的物體資訊
- -
ObjBase * copyFrom(ObjBase const *o)
複製, 預設使用operator=
- -
BundleAdjustment_LM(BundleAdjustment_LM const &b)
-
改變焦距
-
bool adjustEyes(std::vector< EyesReferenceInfo< Pixel > > seq) const
推算相機資訊
- -
bool read(FILE *f, bool bin, unsigned int fg) const
-
Matrix & identitied()
Let itself be an identity matrix.
Definition: Matrix.h:367
-
Entry entry(size_t r, size_t c) const
Access the entry at r x c.
Definition: Matrix.h:212
- -
For developer to pack the attributes of a class.
Definition: self.h:110
- -
void reset(size_t r, size_t c, Entry const &e)
reset the size of the matrix to r x c with entry all be e
Definition: Matrix.h:116
-
BundleAdjustment_LM & copyFrom(BundleAdjustment_LM const &b)
-
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
-
-
- - - - - diff --git a/doc/html/Camera_8h.html b/doc/html/Camera_8h.html deleted file mode 100644 index ab8d4af..0000000 --- a/doc/html/Camera_8h.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Camera.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Camera.h File Reference
-
-
-
#include "Photo.h"
-#include "IdentityPoints.h"
-#include "../Self.h"
-#include "../math/utility.h"
-#include "../math/LinearTransformations.h"
-#include "../math/methods.h"
-#include "../oo/ObjBase.h"
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Camera< Pixel >
 Camera. More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Camera_8h_source.html b/doc/html/Camera_8h_source.html deleted file mode 100644 index 3d126c5..0000000 --- a/doc/html/Camera_8h_source.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Camera.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Camera.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_Camera_H__
-
2 #define gra_Camera_H__
-
3 
-
4 #include "Photo.h"
-
5 #include "IdentityPoints.h"
-
6 #include "../Self.h"
-
7 #include "../math/utility.h"
-
8 #include "../math/LinearTransformations.h"
-
9 #include "../math/methods.h"
-
10 #include "../oo/ObjBase.h"
-
11 
-
12 namespace meow {
-
13 
-
22 template<class Pixel>
-
23 class Camera: public ObjBase {
-
24 public:
- -
26 private:
-
27  struct Myself {
-
28  Photo<Pixel> photo_;
-
29  Rotation3D<double> rot_;
-
30  FixedPoints2D fixed2D_;
-
31 
-
32  Myself(): fixed2D_(2) {
-
33  }
-
34 
-
35  Myself(Myself const& v):
-
36  photo_(v.photo_), rot_(v.rot_), fixed2D_(v.fixed2D_) {
-
37  }
-
38 
-
39  ~Myself() {
-
40  }
-
41  };
-
42 
-
43  Self<Myself> const self;
-
44 public:
-
48  Camera(): self() {
-
49  }
-
50 
-
54  Camera(Camera const& b): self(b.self, Self<Myself>::COPY_FROM) {
-
55  }
-
56 
-
60  ~Camera() {
-
61  }
-
62 
-
66  Camera& copyFrom(Camera const& b) {
-
67  self().copyFrom(b.self);
-
68  return *this;
-
69  }
-
70 
- -
75  self().referenceFrom(b.self);
-
76  return *this;
-
77  }
-
78 
-
82  Photo<Pixel> photo() const {
-
83  return self->photo_;
-
84  }
-
85 
- -
90  return self()->photo_;
-
91  }
-
92 
- -
97  self()->photo_.copyFrom(pho);
-
98  return photo();
-
99  }
-
100 
- -
105  return self->rot_;
-
106  }
-
107 
- -
112  return self()->rot_;
-
113  }
-
114 
- -
119  self()->rot_.copyFrom(rot);
-
120  return rotation();
-
121  }
-
122 
- -
127  return self->fixed2D_;
-
128  }
-
129 
- -
134  return self()->fixed2D_;
-
135  }
-
136 
- -
141  if (fps2d.dimension() == 2) {
-
142  self()->fixed2D_.copyFrom(fps2d);
-
143  }
-
144  return fixedPoints2D();
-
145  }
-
146 
- -
151  return self->fixed2D_.identityPoint(i);
-
152  }
-
153 
-
157  bool inside(Vector3D<double> const& p) const {
-
158  return self->photo_.inside(
-
159  Vector3D<double>(rotation().transformate(p.matrix())));
-
160  }
-
161 
-
165  Pixel color(Vector3D<double> const& p) const {
-
166  return self->photo_.color(
-
167  Vector3D<double>(rotation().transformate(p.matrix())));
-
168  }
-
169 
-
173  Camera& operator=(Camera const& b) {
-
174  return copyFrom(b);
-
175  }
-
176 
-
181  bool write(FILE* f, bool bin, unsigned int fg) const {
-
182  if (bin) {
-
183  double tmp;
-
184  for (size_t i = 0; i < 3; ++i) {
-
185  if (fwrite(&(tmp = rotation().theta(i)), sizeof(tmp), 1, f) < 1)
-
186  return false;
-
187  }
-
188  }
-
189  else {
-
190  for (size_t i = 0; i < 3; ++i) {
-
191  if (fprintf(f, "%f ", rotation().theta(i)) < 1) return false;
-
192  }
-
193  fprintf(f, "\n");
-
194  }
-
195  return (fixedPoints2D().write(f, bin, fg) && photo().write(f, bin, fg));
-
196  }
-
197 
-
202  bool read(FILE* f, bool bin, unsigned int fg) {
-
203  if (bin) {
-
204  double tmp;
-
205  for (size_t i = 0; i < 3; ++i) {
-
206  if (fread(&tmp, sizeof(tmp), 1, f) < 1) {
-
207  return false;
-
208  }
-
209  rotationGet().theta(i, tmp);
-
210  }
-
211  }
-
212  else {
-
213  double a;
-
214  for (size_t i = 0; i < 3; ++i) {
-
215  if (fscanf(f, "%lf", &a) < 1) return false;
-
216  rotationGet().theta(i, a);
-
217  }
-
218  }
-
219  return (fixedPoints2DGet().read(f, bin, fg) && photoGet().read(f, bin, fg));
-
220  }
-
221 
-
226  ObjBase* create() const {
-
227  return new Camera();
-
228  }
-
229 
-
238  ObjBase* copyFrom(ObjBase const* b) {
-
239  return &(copyFrom(*(Camera const*)b));
-
240  }
-
241 
-
246  char const* ctype() const{
-
247  return typeid(*this).name();
-
248  }
-
249 
-
254  std::string type() const {
-
255  return std::string(ctype());
-
256  }
-
257 };
-
258 
-
259 } // meow
-
260 
-
261 #endif // gra_Camera_H__
-
Rotation3D & copyFrom(Rotation3D const &b)
Copy data.
-
size_t dimension() const
回傳dimension
-
Scalar const & theta(size_t i) const
Get the i -th theta.
-
Camera.
Definition: Camera.h:23
- -
std::string type() const
回傳class的type
Definition: Camera.h:254
-
Photo< Pixel > photo() const
取得 photo
Definition: Camera.h:82
-
把一個 std::map<Identity, Point > 包起來
-
Rotation3D< double > rotation(Rotation3D< double > const &rot)
設定rotation
Definition: Camera.h:118
-
Camera & copyFrom(Camera const &b)
複製資料
Definition: Camera.h:66
-
bool inside(Vector3D< double > const &p) const
詢問某點是否在底片範圍內
Definition: Camera.h:157
-
Camera & operator=(Camera const &b)
same as copyFrom(b)
Definition: Camera.h:173
-
Rotation3D< double > rotation() const
取得rotation
Definition: Camera.h:104
-
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
Definition: Camera.h:181
-
Rotation3D< double > & rotationGet()
取得rotation (non-constant)
Definition: Camera.h:111
- -
Photo< Pixel > & photoGet()
取得 photo (non-constant)
Definition: Camera.h:89
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
Photo< Pixel > photo(Photo< Pixel > const &pho)
設定 photo
Definition: Camera.h:96
-
vector
Definition: Vector.h:19
-
ObjBase * create() const
new一個自己
Definition: Camera.h:226
-
char const * ctype() const
回傳class的type
Definition: Camera.h:246
-
Matrix< Scalar > matrix() const
return a 3x1 matrix form of itself
Definition: Vectors.h:458
- -
Vector< double > fixedPoint2D(int i)
取得編號為i的fixed points 2d
Definition: Camera.h:150
-
Pixel color(Vector3D< double > const &p) const
取得底片color
Definition: Camera.h:165
-
Camera()
constructor
Definition: Camera.h:48
-
底片
Definition: Photo.h:31
-
ObjBase * copyFrom(ObjBase const *b)
複製資料
Definition: Camera.h:238
-
FixedPoints2D fixedPoints2D(FixedPoints2D const &fps2d) const
設定FixedPoint
Definition: Camera.h:140
- -
IdentityPoints & copyFrom(IdentityPoints const &b)
複製資料
-
FixedPoints2D fixedPoints2D() const
取得所有FixedPoint
Definition: Camera.h:126
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
Definition: Camera.h:202
- -
Camera & referenceFrom(Camera const &b)
參照
Definition: Camera.h:74
-
Camera(Camera const &b)
copy constructor
Definition: Camera.h:54
-
FixedPoints2D & fixedPoints2DGet() const
取得所有FixedPoint(non-constant reference)
Definition: Camera.h:133
-
~Camera()
destructor
Definition: Camera.h:60
-
IdentityPoints< int, double, Vector2D< double > > FixedPoints2D
Definition: Camera.h:25
-
-
- - - - - diff --git a/doc/html/Color3__Space_8h.html b/doc/html/Color3__Space_8h.html deleted file mode 100644 index 9fc6412..0000000 --- a/doc/html/Color3__Space_8h.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/Color3_Space.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Color3_Space.h File Reference
-
-
-
#include "../geo/Vectors.h"
-#include "../math/Matrix.h"
-#include "../math/utility.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Color3_Space< T >
 Base class of color space with 3 channels. More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Color3__Space_8h_source.html b/doc/html/Color3__Space_8h_source.html deleted file mode 100644 index 187b319..0000000 --- a/doc/html/Color3__Space_8h_source.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/Color3_Space.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Color3_Space.h
-
-
-Go to the documentation of this file.
1 #ifndef colors_Color3_Space_H__
-
2 #define colors_Color3_Space_H__
-
3 
-
4 #include "../geo/Vectors.h"
-
5 #include "../math/Matrix.h"
-
6 #include "../math/utility.h"
-
7 
-
8 #include <cstdlib>
-
9 
-
10 namespace meow {
-
11 
-
17 template<class T>
-
18 class Color3_Space {
-
19 protected:
- - - -
23 
-
31  Color3_Space(Vector3D<T> const& min_bound,
-
32  Vector3D<T> const& max_bound,
-
33  Vector3D<T> const& init_value):
-
34  min_(min_bound), max_(max_bound), val_(init_value) {
-
35  }
-
36 
- -
43  min_(b.min_), max_(b.max_), val_(b.val_) {
-
44  }
-
45 
- -
55  val_ = b.val_;
-
56  return *this;
-
57  }
-
58 public:
-
60  virtual ~Color3_Space() { }
-
61 
-
63  Vector3D<T> const& minV() const {
-
64  return min_;
-
65  }
-
66 
-
68  Vector3D<T> const& maxV() const {
-
69  return max_;
-
70  }
-
71 
-
73  Vector3D<T> const& valV() const {
-
74  return val_;
-
75  }
-
76 
-
83  Vector3D<T> const& valV(Vector3D<T> const& vv) {
-
84  val_ = vv;
-
85  return val();
-
86  }
-
87 
- -
90  return val_;
-
91  }
-
92 
-
99  T const& min(size_t id) const { return minV()(id); }
-
100 
-
107  T const& max(size_t id) const {
-
108  return maxV()(id);
-
109  }
-
110 
-
117  T const& val(size_t id) const {
-
118  return valV()(id);
-
119  }
-
120 
-
127  T const& val(size_t i, T const& c) {
-
128  if (i == 0) val_.x(c);
-
129  else if (i == 1) val_.y(c);
-
130  else if (i == 2) val_.z(c);
-
131  return val(i);
-
132  }
-
133 
-
139  T& valGet(size_t id) {
-
140  if (id == 0) return valVGet().xGet();
-
141  else if (id == 1) return valVGet().yGet();
-
142  else return valVGet().zGet();
-
143  }
-
144 };
-
145 
-
146 } // meow
-
147 
-
148 #endif // colors_Color3_Space_H__
-
Scalar & xGet()
access x with non-constant reference
Definition: Vectors.h:316
-
Vector3D< T > const & maxV() const
maximum bound of each channels.
Definition: Color3_Space.h:68
-
Color3_Space(Vector3D< T > const &min_bound, Vector3D< T > const &max_bound, Vector3D< T > const &init_value)
Constructor.
Definition: Color3_Space.h:31
-
Scalar & zGet()
access z with non-constant reference
Definition: Vectors.h:318
-
T const & min(size_t id) const
Return the minimum of the i -th channel.
Definition: Color3_Space.h:99
-
Scalar const & z() const
access z
Definition: Vectors.h:314
-
T & valGet(size_t id)
Get the non-constant reference of value of the i -th channel.
Definition: Color3_Space.h:139
-
T const & max(size_t id) const
Return the maximum of the i -th channel.
Definition: Color3_Space.h:107
-
Scalar const & y() const
access y
Definition: Vectors.h:313
-
Base class of color space with 3 channels.
Definition: Color3_Space.h:18
- -
Vector3D< T > min_
Definition: Color3_Space.h:20
-
virtual ~Color3_Space()
Destructor.
Definition: Color3_Space.h:60
-
Vector3D< T > const & minV() const
minimum bound of each channels.
Definition: Color3_Space.h:63
-
Scalar & yGet()
access y with non-constant reference
Definition: Vectors.h:317
-
Vector3D< T > const & valV() const
value of each channels.
Definition: Color3_Space.h:73
-
Color3_Space(Color3_Space const &b)
Copy constructor.
Definition: Color3_Space.h:42
-
Vector3D< T > max_
Definition: Color3_Space.h:21
-
Scalar const & x() const
access x
Definition: Vectors.h:312
-
T const & val(size_t i, T const &c)
Set the value of i -th channel.
Definition: Color3_Space.h:127
-
Vector3D< T > const & valV(Vector3D< T > const &vv)
Set the value of each channels.
Definition: Color3_Space.h:83
-
Color3_Space< T > & copyFrom(Color3_Space< T > const &b)
Copy method.
Definition: Color3_Space.h:54
-
T const & val(size_t id) const
Return the value of the i -th channel.
Definition: Color3_Space.h:117
-
Vector3D< T > val_
Definition: Color3_Space.h:22
-
Vector3D< T > & valVGet()
Get the non-constant reference of each channels.
Definition: Color3_Space.h:89
-
-
- - - - - diff --git a/doc/html/DisjointSet_8h.html b/doc/html/DisjointSet_8h.html deleted file mode 100644 index 27de929..0000000 --- a/doc/html/DisjointSet_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/DisjointSet.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
DisjointSet.h File Reference
-
-
-
#include <vector>
-#include <cstdlib>
-#include <cstdio>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::DisjointSet
 用來維護一堆互斥集的資訊 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/DisjointSet_8h_source.html b/doc/html/DisjointSet_8h_source.html deleted file mode 100644 index 3fa9fde..0000000 --- a/doc/html/DisjointSet_8h_source.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/DisjointSet.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
DisjointSet.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_DisjointSet_H__
-
2 #define dsa_DisjointSet_H__
-
3 
-
4 #include <vector>
-
5 #include <cstdlib>
-
6 #include <cstdio>
-
7 
-
8 namespace meow {
-
25 class DisjointSet {
-
26 private:
-
27  size_t n_;
-
28  std::vector<size_t> father_;
-
29  std::vector<size_t> depth_;
-
30  //
-
31  size_t root_(size_t now) {
-
32  if (father_[now] == now) return now;
-
33  return (father_[now] = root_(father_[now]));
-
34  }
-
35 
-
36  size_t merge_(size_t a, size_t b) {
-
37  a = root_(a);
-
38  b = root_(b);
-
39  if (a == b) return a;
-
40  if (depth_[a] > depth_[b]) {
-
41  father_[b] = a;
-
42  return a;
-
43  }
-
44  else {
-
45  father_[a] = b;
-
46  if (depth_[a] == depth_[b]) depth_[b]++;
-
47  return b;
-
48  }
-
49  }
-
50 public:
-
54  DisjointSet(): n_(0) {
-
55  }
-
56 
-
62  DisjointSet(size_t n) {
-
63  reset(n);
-
64  }
-
65 
-
73  DisjointSet(DisjointSet const& dsj):
-
74  n_(dsj.n_), father_(dsj.father_), depth_(dsj.depth_) {
-
75  }
-
76 
-
85  size_t root(size_t a) const {
-
86  return ((DisjointSet*)this)->root_(a);
-
87  }
-
88 
-
89 
-
95  size_t size() const {
-
96  return n_;
-
97  }
-
98 
-
107  void reset(size_t n) {
-
108  n_ = n;
-
109  father_.resize(n);
-
110  depth_ .resize(n);
-
111  for (size_t i = 0; i < n; i++) {
-
112  father_[i] = i;
-
113  depth_ [i] = 1;
-
114  }
-
115  }
-
116 
-
128  size_t merge(size_t a, size_t b) {
-
129  return merge_(a, b);
-
130  }
-
131 };
-
132 
-
133 } // meow
-
134 
-
135 #endif // dsa_DisjointSet_H__
-
void reset(size_t n)
重設
Definition: DisjointSet.h:107
-
用來維護一堆互斥集的資訊
Definition: DisjointSet.h:25
-
DisjointSet()
constructor
Definition: DisjointSet.h:54
-
DisjointSet(DisjointSet const &dsj)
constructor
Definition: DisjointSet.h:73
-
size_t merge(size_t a, size_t b)
合併
Definition: DisjointSet.h:128
-
size_t root(size_t a) const
回傳指定的number所在的 集合的編號
Definition: DisjointSet.h:85
-
DisjointSet(size_t n)
constructor
Definition: DisjointSet.h:62
-
size_t size() const
回傳總element數
Definition: DisjointSet.h:95
-
-
- - - - - diff --git a/doc/html/Eye_8h.html b/doc/html/Eye_8h.html deleted file mode 100644 index da79620..0000000 --- a/doc/html/Eye_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Eye.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Eye.h File Reference
-
-
-
#include "Camera.h"
-#include "../Self.h"
-#include "../oo/ObjBase.h"
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Eye< Pixel >
 一個 Camera 加上一個offset transformation More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Eye_8h_source.html b/doc/html/Eye_8h_source.html deleted file mode 100644 index 3aba150..0000000 --- a/doc/html/Eye_8h_source.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Eye.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Eye.h
-
-
-Go to the documentation of this file.
1 #ifndef Eye_H__
-
2 #define Eye_H__
-
3 
-
4 #include "Camera.h"
-
5 
-
6 #include "../Self.h"
-
7 #include "../oo/ObjBase.h"
-
8 
-
9 namespace meow {
-
10 
-
16 template<class Pixel>
-
17 class Eye: public ObjBase {
-
18 private:
-
19  struct Myself {
-
20  Camera<Pixel> cam_;
-
21  Vector3D<double> ofs_;
-
22 
-
23  Myself(): cam_(), ofs_(0.0, 0.0, 0.0) {
-
24  }
-
25 
-
26  Myself(Camera<Pixel> const& c, Vector3D<double> const& o): cam_(c), ofs_(o){
-
27  }
-
28 
-
29  Myself(Myself const& b): cam_(b.cam_), ofs_(b.ofs_) {
-
30  }
-
31 
-
32  ~Myself() {
-
33  }
-
34  };
-
35 
-
36  Self<Myself> const self;
-
37 public:
-
38  Eye(): self() {
-
39  }
-
40 
-
41  Eye(Eye const& b): self(b.self(), Self<Myself>::COPY_FROM) {
-
42  }
-
43 
-
44  Eye(Camera<Pixel> const& c, Vector3D<double> const& o): self(Myself(c, o)) {
-
45  }
-
46 
-
47  ~Eye() {
-
48  }
-
49 
-
50  Eye& copyFrom(Eye const& e) {
-
51  self().copyFrom(e.self);
-
52  return *this;
-
53  }
-
54 
-
55  Eye& referenceFrom(Eye const& e) {
-
56  self().referenceFrom(e.self);
-
57  return *this;
-
58  }
-
59 
- -
61  return self->cam_;
-
62  }
-
63 
- -
65  return self()->cam_;
-
66  }
-
67 
- -
69  self()->cam_.copyFrom(c);
-
70  return camera();
-
71  }
-
72 
- -
74  return self->ofs_;
-
75  }
-
76 
- -
78  return self()->ofs_;
-
79  }
-
80 
- -
82  self()->ofs_ = ofs;
-
83  return offset();
-
84  }
-
85 
-
86  bool inside(Vector3D<double> const& v) const {
-
87  return camera().inside(v - offset());
-
88  }
-
89 
-
90  Eye& operator=(Eye const& e) {
-
91  return copyFrom(e);
-
92  }
-
93 
-
98  bool write(FILE* f, bool bin, unsigned int fg) const {
-
99  if (bin) {
-
100  double tmp;
-
101  for (size_t i = 0; i < 3; ++i) {
-
102  if (fwrite(&(tmp = offset()(i)), sizeof(tmp), 1, f) < 1)
-
103  return false;
-
104  }
-
105  }
-
106  else {
-
107  for (size_t i = 0; i < 3; ++i) {
-
108  if (fprintf(f, "%f ", offset()(i)) < 1) return false;
-
109  }
-
110  fprintf(f, "\n");
-
111  }
-
112  return camera().write(f, bin, fg);
-
113  }
-
114 
-
119  bool read(FILE* f, bool bin, unsigned int fg) {
-
120  if (bin) {
-
121  double tmp[3];
-
122  if (fread(tmp, sizeof(double), 3, f) < 3) return false;
-
123  offsetGet().xyz(tmp[0], tmp[1], tmp[2]);
-
124  }
-
125  else {
-
126  double a, b, c;
-
127  if (fscanf(f, "%lf %lf %lf", &a, &b, &c) < 3) return false;
-
128  offsetGet().x(a);
-
129  offsetGet().y(b);
-
130  offsetGet().z(c);
-
131  }
-
132  return cameraGet().read(f, bin, fg);
-
133  }
-
134 
-
139  ObjBase* create() const {
-
140  return new Eye();
-
141  }
-
142 
-
151  ObjBase* copyFrom(ObjBase const* b) {
-
152  return &(copyFrom(*(Eye const*)b));
-
153  }
-
154 
-
159  char const* ctype() const{
-
160  return typeid(*this).name();
-
161  }
-
162 
-
167  std::string type() const {
-
168  return std::string(ctype());
-
169  }
-
170 };
-
171 
-
172 } // meow
-
173 
-
174 #endif // Eye_H__
-
Vector3D< double > offset() const
Definition: Eye.h:73
-
Camera< Pixel > camera() const
Definition: Eye.h:60
-
Eye & operator=(Eye const &e)
Definition: Eye.h:90
- -
Camera.
Definition: Camera.h:23
-
ObjBase * copyFrom(ObjBase const *b)
複製資料
Definition: Eye.h:151
-
Eye & copyFrom(Eye const &e)
Definition: Eye.h:50
-
Vector3D< double > & offsetGet()
Definition: Eye.h:77
-
Scalar const & z() const
access z
Definition: Vectors.h:314
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
Definition: Eye.h:119
-
Vector3D & xyz(Scalar const &sx, Scalar const &sy, Scalar const &sz)
modify x, y and z
Definition: Vectors.h:325
-
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
Definition: Eye.h:98
-
~Eye()
Definition: Eye.h:47
-
char const * ctype() const
回傳class的type
Definition: Eye.h:159
-
ObjBase * create() const
new一個自己
Definition: Eye.h:139
-
Scalar const & y() const
access y
Definition: Vectors.h:313
-
Eye(Camera< Pixel > const &c, Vector3D< double > const &o)
Definition: Eye.h:44
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- -
Eye()
Definition: Eye.h:38
-
Camera< Pixel > & cameraGet()
Definition: Eye.h:64
-
Scalar const & x() const
access x
Definition: Vectors.h:312
-
Eye & referenceFrom(Eye const &e)
Definition: Eye.h:55
- -
Eye(Eye const &b)
Definition: Eye.h:41
-
Vector3D< double > offset(Vector3D< double > const &ofs)
Definition: Eye.h:81
-
bool inside(Vector3D< double > const &v) const
Definition: Eye.h:86
-
Camera< Pixel > camera(Camera< Pixel > const &c)
Definition: Eye.h:68
-
一個 Camera 加上一個offset transformation
Definition: Eye.h:17
-
std::string type() const
回傳class的type
Definition: Eye.h:167
-
-
- - - - - diff --git a/doc/html/FeaturePoint_8h.html b/doc/html/FeaturePoint_8h.html deleted file mode 100644 index 7753cda..0000000 --- a/doc/html/FeaturePoint_8h.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePoint.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
FeaturePoint.h File Reference
-
-
-
#include "../oo/ObjBase.h"
-#include "../math/Vector.h"
-#include <string>
-#include <typeinfo>
-#include <cstdlib>
-#include <cstdio>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::FeaturePoint< Scalar, Description, Position, Feature >
 特徵點 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/FeaturePoint_8h_source.html b/doc/html/FeaturePoint_8h_source.html deleted file mode 100644 index 6487c6c..0000000 --- a/doc/html/FeaturePoint_8h_source.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePoint.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
FeaturePoint.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_FeaturePoint_H__
-
2 #define gra_FeaturePoint_H__
-
3 
-
4 #include "../oo/ObjBase.h"
-
5 
-
6 #include "../math/Vector.h"
-
7 
-
8 #include <string>
-
9 #include <typeinfo>
-
10 #include <cstdlib>
-
11 #include <cstdio>
-
12 
-
13 namespace meow {
-
14 
-
20 template <class Scalar, class Description,
-
21  class Position = Vector<Scalar >,
-
22  class Feature = Vector<Description> >
-
23 
-
24 class FeaturePoint: public ObjBase {
-
25 private:
-
26  Position pos_;
-
27  Feature des_;
-
28 public:
- -
33  }
-
34 
-
38  FeaturePoint(size_t pDim, size_t dDim):
-
39  pos_(pDim, Scalar(0)), des_(dDim, Description(0)) {
-
40  }
-
41 
-
45  FeaturePoint(Position const& v, Feature const& d):
-
46  pos_(v), des_(d) {
-
47  }
-
48 
- -
53  pos_(fp.pos_), des_(fp.des_) {
-
54  }
-
55 
- -
60  }
-
61 
- -
66  pos_.copyFrom(fp.pos_);
-
67  des_.copyFrom(fp.des_);
-
68  return *this;
-
69  }
-
70 
- -
75  pos_.referenceFrom(fp.pos_);
-
76  des_.referenceFrom(fp.des_);
-
77  return *this;
-
78  }
-
79 
-
83  Position position() const {
-
84  return pos_;
-
85  }
-
86 
-
90  Position& positionGet() {
-
91  return pos_;
-
92  }
-
93 
-
97  Feature description() const {
-
98  return des_;
-
99  }
-
100 
-
104  Feature& descriptionGet() {
-
105  return des_;
-
106  }
-
107 
-
111  Position position(Position const& p) {
-
112  pos_.copyFrom(p);
-
113  return position();
-
114  }
-
115 
-
119  Feature description(Feature const& d) {
-
120  des_.copyFrom(d);
-
121  return description();
-
122  }
-
123 
-
127  Scalar position(size_t index) const {
-
128  return position()(index);
-
129  }
-
130 
-
134  Description description(size_t index) const {
-
135  return des_(index);
-
136  }
-
137 
-
141  Scalar position(size_t i, Scalar const& s) {
-
142  pos_.scalar(i, s);
-
143  return position()(i);
-
144  }
-
145 
-
149  Description description(size_t i, Description const& d) {
-
150  des_.scalar(i, d);
-
151  return description()(i);
-
152  }
-
153 
- -
158  return copyFrom(fp);
-
159  }
-
160 
-
164  Scalar const& operator()(size_t i) const {
-
165  return position(i);
-
166  }
-
167 
-
171  Description operator[](size_t i) const {
-
172  return description(i);
-
173  }
-
174 
-
175  bool write(FILE* f, bool bin, unsigned int fg) const {
-
176  if (bin) {
-
177  double tmp;
-
178  int a, b;
-
179  a = position().dimension();
-
180  b = description().dimension();
-
181  if (fwrite(&a, sizeof(a), 1, f) < 1) return false;
-
182  if (fwrite(&b, sizeof(b), 1, f) < 1) return false;
-
183  for (size_t i = 0, I = position().dimension(); i < I; ++i) {
-
184  if (fwrite(&(tmp = position(i)), sizeof(tmp), 1, f) < 1) return false;
-
185  }
-
186  for (size_t i = 0, I = description().dimension(); i < I; ++i) {
-
187  if (fwrite(&(tmp = description(i)), sizeof(tmp), 1, f) < 1)
-
188  return false;
-
189  }
-
190  }
-
191  else {
-
192  int a, b;
-
193  a = position().dimension();
-
194  b = description().dimension();
-
195  if (fprintf(f, "%d %d\n", a, b) < 2) return false;
-
196  for (size_t i = 0, I = position().dimension(); i < I; ++i) {
-
197  if (fprintf(f, "%f ", (double)position(i)) < 1) return false;
-
198  }
-
199  fprintf(f, "\n");
-
200  for (size_t i = 0, I = description().dimension(); i < I; ++i) {
-
201  if (fprintf(f, "%f ", (double)description(i)) < 1) return false;
-
202  }
-
203  fprintf(f, "\n");
-
204  }
-
205  return true;
-
206  }
-
207 
-
208  bool read(FILE* f, bool bin, unsigned int fg) {
-
209  if (bin) {
-
210  double tmp;
-
211  int a, b;
-
212  if (fread(&a, sizeof(a), 1, f) < 1) return false;
-
213  if (fread(&b, sizeof(b), 1, f) < 1) return false;
-
214  position(Position((size_t)a, Scalar(0)));
-
215  description(Feature((size_t)b, Description(0)));
-
216  for (size_t i = 0, I = position().dimension(); i < I; ++i) {
-
217  if (fread(&tmp, sizeof(tmp), 1, f) < 1) return false;
-
218  position(i, tmp);
-
219  }
-
220  for (size_t i = 0, I = description().dimension(); i < I; ++i) {
-
221  if (fread(&tmp, sizeof(tmp), 1, f) < 1) return false;
-
222  description(i, tmp);
-
223  }
-
224  }
-
225  else {
-
226  double tmp;
-
227  int a, b;
-
228  if (fscanf(f, "%d %d", &a, &b) < 2) return false;
-
229  position(Position((size_t)a, Scalar(0)));
-
230  description(Feature((size_t)b, Description(0)));
-
231  for (size_t i = 0, I = position().dimension(); i < I; ++i) {
-
232  if (fscanf(f, "%lf", &tmp) < 1) return false;
-
233  position(i, tmp);
-
234  }
-
235  for (size_t i = 0, I = description().dimension(); i < I; ++i) {
-
236  if (fscanf(f, "%lf", &tmp) < 1) return false;
-
237  description(i, tmp);
-
238  }
-
239  }
-
240  return true;
-
241  }
-
242 
-
243  ObjBase* create() const {
-
244  return new FeaturePoint();
-
245  }
-
246 
-
247  ObjBase* copyFrom(ObjBase const& b) {
-
248  return &(copyFrom(*(FeaturePoint const*)b));
-
249  }
-
250 
-
251  char const* ctype() const {
-
252  return typeid(*this).name();
-
253  }
-
254 
-
255  std::string type() const {
-
256  return std::string(ctype());
-
257  }
-
258 };
-
259 
-
260 } // meow
-
261 
-
262 #endif // gra_FeaturePoint_H__
-
FeaturePoint(FeaturePoint const &fp)
constructor
Definition: FeaturePoint.h:52
-
Scalar position(size_t index) const
回傳position的第i個scalar
Definition: FeaturePoint.h:127
-
Description description(size_t index) const
回傳description的第i個Description
Definition: FeaturePoint.h:134
-
Description description(size_t i, Description const &d)
修改description的第i個Description
Definition: FeaturePoint.h:149
-
char const * ctype() const
用C-style string回傳這個class的type name
Definition: FeaturePoint.h:251
-
Feature description() const
回傳description
Definition: FeaturePoint.h:97
-
FeaturePoint(Position const &v, Feature const &d)
constructor
Definition: FeaturePoint.h:45
-
Position position(Position const &p)
修改position
Definition: FeaturePoint.h:111
-
FeaturePoint & referenceFrom(FeaturePoint const &fp)
參照
Definition: FeaturePoint.h:74
-
Scalar position(size_t i, Scalar const &s)
修改position的第i個scalar
Definition: FeaturePoint.h:141
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
Description operator[](size_t i) const
same as description(i)
Definition: FeaturePoint.h:171
-
ObjBase * copyFrom(ObjBase const &b)
Definition: FeaturePoint.h:247
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
Definition: FeaturePoint.h:175
-
~FeaturePoint()
destructor
Definition: FeaturePoint.h:59
-
std::string type() const
用std::string回傳這個class的type name
Definition: FeaturePoint.h:255
-
Feature description(Feature const &d)
修改description
Definition: FeaturePoint.h:119
-
Position position() const
回傳position
Definition: FeaturePoint.h:83
-
FeaturePoint & copyFrom(FeaturePoint const &fp)
複製
Definition: FeaturePoint.h:65
-
Feature & descriptionGet()
回傳description (non-const reference)
Definition: FeaturePoint.h:104
-
FeaturePoint(size_t pDim, size_t dDim)
constructor
Definition: FeaturePoint.h:38
-
FeaturePoint & operator=(FeaturePoint const &fp)
same as copyFrom(fp)
Definition: FeaturePoint.h:157
-
bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
Definition: FeaturePoint.h:208
- -
Position & positionGet()
回傳position (non-const reference)
Definition: FeaturePoint.h:90
-
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
Definition: FeaturePoint.h:243
-
Scalar const & operator()(size_t i) const
same as position(i)
Definition: FeaturePoint.h:164
-
FeaturePoint()
constructor
Definition: FeaturePoint.h:32
-
-
- - - - - diff --git a/doc/html/FeaturePointsDetector_8h.html b/doc/html/FeaturePointsDetector_8h.html deleted file mode 100644 index a89201b..0000000 --- a/doc/html/FeaturePointsDetector_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsDetector.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
FeaturePointsDetector.h File Reference
-
-
-
#include "../oo/ObjBase.h"
-#include "FeaturePoint.h"
-#include "Bitmap.h"
-#include <vector>
-
-

Go to the source code of this file.

- - - - -

-Classes

class  meow::FeaturePointsDetector< Pixel, MyFP >
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/FeaturePointsDetector_8h_source.html b/doc/html/FeaturePointsDetector_8h_source.html deleted file mode 100644 index 480e8a4..0000000 --- a/doc/html/FeaturePointsDetector_8h_source.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsDetector.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
FeaturePointsDetector.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_FeaturePointsDetector_H__
-
2 #define gra_FeaturePointsDetector_H__
-
3 
-
4 #include "../oo/ObjBase.h"
-
5 
-
6 #include "FeaturePoint.h"
-
7 #include "Bitmap.h"
-
8 
-
9 #include <vector>
-
10 
-
11 namespace meow {
-
12 
-
13 template <class Pixel, class MyFP = FeaturePoint<double, double> >
- -
15 protected:
- -
17 public:
-
18  virtual ~FeaturePointsDetector() { }
-
19 
-
20  virtual std::vector<MyFP> detect(Bitmap<Pixel> const& bmp) const = 0;
-
21 };
-
22 
-
23 } // meow
-
24 
-
25 #endif // gra_FeaturePointsDetector_H__
- -
二維點陣資料
Definition: Bitmap.h:25
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- - - - -
virtual std::vector< MyFP > detect(Bitmap< Pixel > const &bmp) const =0
-
-
- - - - - diff --git a/doc/html/FeaturePointsDetector__Harris_8h.html b/doc/html/FeaturePointsDetector__Harris_8h.html deleted file mode 100644 index 9165e12..0000000 --- a/doc/html/FeaturePointsDetector__Harris_8h.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsDetector_Harris.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
FeaturePointsDetector_Harris.h File Reference
-
-
-
#include "FeaturePointsDetector.h"
-#include "Bitmap.h"
-#include "FeaturePoint.h"
-#include "../dsa/DisjointSet.h"
-#include "../math/utility.h"
-#include "../Self.h"
-#include <vector>
-#include <algorithm>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::FeaturePointsDetector_Harris< Pixel, MyFP >
 Harris-Corner-Detect algorithm for finding feature points. More...
 
- - - -

-Namespaces

 meow
 
- - - -

-Macros

#define FPD_Harris   FeaturePointsDetector_Harris
 
-

Macro Definition Documentation

- -
-
- - - - -
#define FPD_Harris   FeaturePointsDetector_Harris
-
- -

Definition at line 27 of file FeaturePointsDetector_Harris.h.

- -
-
-
-
- - - - - diff --git a/doc/html/FeaturePointsDetector__Harris_8h.js b/doc/html/FeaturePointsDetector__Harris_8h.js deleted file mode 100644 index acd3b21..0000000 --- a/doc/html/FeaturePointsDetector__Harris_8h.js +++ /dev/null @@ -1,5 +0,0 @@ -var FeaturePointsDetector__Harris_8h = -[ - [ "FeaturePointsDetector_Harris", "classmeow_1_1FeaturePointsDetector__Harris.html", "classmeow_1_1FeaturePointsDetector__Harris" ], - [ "FPD_Harris", "FeaturePointsDetector__Harris_8h.html#aba22d1a87f3c9e09d7960b2e45e81555", null ] -]; \ No newline at end of file diff --git a/doc/html/FeaturePointsDetector__Harris_8h_source.html b/doc/html/FeaturePointsDetector__Harris_8h_source.html deleted file mode 100644 index 73534ba..0000000 --- a/doc/html/FeaturePointsDetector__Harris_8h_source.html +++ /dev/null @@ -1,429 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsDetector_Harris.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
FeaturePointsDetector_Harris.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_FeaturePointsDetector_Harris
-
2 #define gra_FeaturePointsDetector_Harris
-
3 
- -
5 
-
6 #include "Bitmap.h"
-
7 #include "FeaturePoint.h"
- -
9 
-
10 #include "../dsa/DisjointSet.h"
-
11 #include "../math/utility.h"
-
12 
-
13 #include "../Self.h"
-
14 
-
15 #include <vector>
-
16 #include <algorithm>
-
17 
-
18 namespace meow {
-
19 
-
25 template <class Pixel, class MyFP = FeaturePoint<double, double> >
- -
27 # define FPD_Harris FeaturePointsDetector_Harris
-
28 private:
-
29  struct Myself {
-
30  double ratioK_;
-
31  double thresholdR_;
-
32  double sizeW_;
-
33  double noiseN_;
-
34  double lightL_;
-
35  double featureG_;
-
36  size_t boundB_;
-
37  size_t angleA_;
-
38 
-
39  Myself():
-
40  ratioK_(0.03),
-
41  thresholdR_(0.001),
-
42  sizeW_(2.0),
-
43  noiseN_(3.0),
-
44  lightL_(30.0),
-
45  featureG_(3.0),
-
46  boundB_(10u),
-
47  angleA_(8) {
-
48  }
-
49  Myself(Myself const& m):
-
50  ratioK_(m.ratioK_),
-
51  thresholdR_(m.thresholdR_),
-
52  sizeW_(m.sizeW_),
-
53  noiseN_(m.noiseN_),
-
54  lightL_(m.lightL_),
-
55  featureG_(m.featureG_),
-
56  boundB_(m.boundB_){
-
57  }
-
58  ~Myself() {
-
59  }
-
60  };
-
61 
-
62  Self<Myself> const self;
-
63 public:
-
65  FPD_Harris(): self() {
-
66  }
-
67 
-
69  FPD_Harris(FPD_Harris const& fps): self(fps.self, Self<Myself>::COPY_FROM) {
-
70  }
-
71 
- -
74  }
-
75 
- -
78  self().copyFrom(fps.self);
-
79  return *this;
-
80  }
-
81 
- -
84  self().referenceFrom(fps.self);
-
85  return *this;
-
86  }
-
87 
-
89  double paramK() const {
-
90  return self->ratioK_;
-
91  }
-
92 
-
94  double paramR() const {
-
95  return self->thresholdR_;
-
96  }
-
97 
-
99  double paramW() const {
-
100  return self->sizeW_;
-
101  }
-
102 
-
104  double paramN() const {
-
105  return self->noiseN_;
-
106  }
-
107 
-
109  double paramG() const {
-
110  return self->featureG_;
-
111  }
-
112 
-
114  double paramL() const {
-
115  return self->lightL_;
-
116  }
-
117 
-
119  size_t paramB() const {
-
120  return self->boundB_;
-
121  }
-
122 
-
124  size_t paramA() const {
-
125  return self->angleA_;
-
126  }
-
127 
-
129  double paramK(double k) {
-
130  self()->ratioK_ = k;
-
131  return paramK();
-
132  }
-
133 
-
135  double paramR(double r) {
-
136  self()->thresholdR_ = r;
-
137  return paramR();
-
138  }
-
139 
-
141  double paramW(double w) {
-
142  self()->sizeW_ = w;
-
143  return paramW();
-
144  }
-
145 
-
147  double paramN(double n){
-
148  self()->noiseN_ = n;
-
149  return paramN();
-
150  }
-
151 
-
153  double paramL(double l) {
-
154  self()->lightL_ = l;
-
155  return paramL();
-
156  }
-
157 
-
159  double paramG(double g) {
-
160  self()->featureG_ = g;
-
161  return paramG();
-
162  }
-
163 
-
165  size_t paramB(size_t b) {
-
166  self()->boundB_ = b;
-
167  return paramB();
-
168  }
-
169 
-
171  size_t paramA(size_t a) {
-
172  self()->angleA_ = a;
-
173  return paramA();
-
174  }
-
175 
-
176  size_t descriptionDimension() const {
-
177  return (paramA() + 1) * squ(paramB() * 2 + 1);
-
178  //return (squ(self->boundB_ * 2 + 1) - 1) * 2;
-
179  }
-
180 
-
186  std::vector<MyFP> detect(Bitmap<Pixel> const& bmp) const {
-
187  // blur for feature, gradiance
-
188  Bitmap<Pixel> input (bmp.gaussian (self->featureG_, self->featureG_));
-
189  Bitmap<Pixel> input_gx(bmp.gradianceX(0 , self->noiseN_ ));
-
190  Bitmap<Pixel> input_gy(bmp.gradianceY(self->noiseN_ , 0 ));
-
191 
-
192  // get Matrix Ixx, Iyy, Ixy for each pixel
-
193  Bitmap<Vector3D<double> > Ixys(input.height(), input.width(),
-
194  Vector3D<double>(0.0));
-
195  for (ssize_t y = 0, Y = input.height(); y < Y; y++)
-
196  for (ssize_t x = 0, X = input.width(); x < X; x++) {
-
197  Pixel gx(input_gx(y, x));
-
198  Pixel gy(input_gy(y, x));
-
199  Ixys.pixel(y, x, Vector3D<double>(gx * gx, gy * gy, gx * gy));
-
200  }
-
201 
-
202  // blur for window size
-
203  Ixys.gaussianed(self->sizeW_, self->sizeW_);
-
204  //input_gx.clear();
-
205  //input_gy.clear();
-
206 
-
207  // filter too flat or on edge
-
208  Bitmap<double> R(input.height(), input.width(), 0.0);
-
209  Bitmap<bool> good(input.height(), input.width(), false);
-
210  for (ssize_t y = 0, Y = input.height(); y < Y; y++)
-
211  for (ssize_t x = 0, X = input.width(); x < X; x++) {
-
212  double det = Ixys(y, x)(0) * Ixys(y, x)(1) - squ(Ixys(y, x)(2));
-
213  double tra = Ixys(y, x)(0) + Ixys(y, x)(1);
-
214  double r = det - self->ratioK_ * squ(tra);
-
215  R.pixel(y, x, r);
-
216  good.pixel(y, x, (r >= self->thresholdR_));
-
217  }
-
218  Ixys.clear();
-
219 
-
220  // find union neighbor
-
221  DisjointSet dsj(input.size());
-
222  ssize_t dy[2] = {0, 1};
-
223  ssize_t dx[2] = {1, 0};
-
224  for (ssize_t y = 0, Y = input.height(); y + 1 < Y; y++)
-
225  for (ssize_t x = 0, X = input.width(); x + 1 < X; x++)
-
226  if(good.pixel((size_t)y, (size_t)x))
-
227  for (size_t k = 0; k < 2u; k++)
-
228  if (good.pixel((size_t)(y + dy[k]), (size_t)(x + dx[k])))
-
229  dsj.merge( y * input.width() + x,
-
230  (y + dy[k]) * input.width() + (x + dx[k]));
-
231 
-
232  // find local maximum
-
233  std::vector<size_t> max_i(input.size());
-
234  for (size_t i = 0, I = input.size(); i < I; i++)
-
235  max_i[i] = i;
-
236 
-
237  for (size_t i = 0, I = input.size(); i < I; i++) {
-
238  size_t ri = dsj.root(i);
-
239  if (R.pixel( i / input.width(), i % input.width()) >
-
240  R.pixel(max_i[ri] / input.width(), max_i[ri] % input.width()))
-
241  max_i[ri] = i;
-
242  }
-
243 
-
244  // Ignore side
-
245  ssize_t b = std::max<int>(std::max<int>(self->boundB_,
-
246  2 * self->sizeW_),
-
247  2 * self->noiseN_);
-
248  std::vector<MyFP> ret;
-
249  Vector<double> desc(descriptionDimension(), 0.0); // description
-
250  for (ssize_t y = b, Y = -b + input.height(); y < Y; y++)
-
251  for (ssize_t x = b, X = -b + input.width(); x < X; x++) {
-
252  if (!good.pixel((size_t)y, (size_t)x)) continue;
-
253  size_t i = y * input.width() + x;
-
254  if (max_i[dsj.root(i)] != i) continue;
-
255  int B = paramB();
-
256  size_t ct = 0;
-
257  for (ssize_t dx = -B; dx <= B; ++dx)
-
258  for (ssize_t dy = -B; dy <= B; ++dy) {
-
259  double gx = input_gx.pixel(y+dy, x+dx) * input_gx.pixel(y+dy, x+dx);
-
260  double gy = input_gy.pixel(y+dy, x+dx) * input_gy.pixel(y+dy, x+dx);
-
261  double light = sqrt(gx + gy);
-
262  double angle = circle(atan2(sqrt(gy), sqrt(gx)));
-
263  int a = angle / (2 * PI / paramA());
-
264  for (size_t k = 0; k < paramA(); ++k) {
-
265  desc.scalar(ct++, (a + k) % paramA());
-
266  }
-
267  desc.scalar(ct++, light * paramL());
-
268  }
-
269  /*
-
270  ssize_t dx[4] = {1, 0, -1, 0};
-
271  ssize_t dy[4] = {0, 1, 0, -1};
-
272  size_t ct = 0;
-
273  for (ssize_t d = 1; d <= (ssize_t)self->boundB_; ++d) {
-
274  std::vector<double> light;
-
275  size_t max_id = 0, x0 = x - d, y0 = y - d;
-
276  for (size_t k = 0; k < 4; k++)
-
277  for (ssize_t n = 0; n < (ssize_t)d * 2; n++,
-
278  x0 += dx[k], y0 += dy[k]) {
-
279  Pixel diff = input.pixel(y0, x0) - input.pixel(y, x) * 0.2;
-
280  light.push_back(diff * diff * self->lightL_);
-
281  if (light[max_id] < light[(ssize_t)light.size() - 1])
-
282  max_id = (ssize_t)light.size() - 1;
-
283  }
-
284  double W = squ(light.size()) * 0.5;
-
285  for (ssize_t n = 0, N = light.size(); n < N; n++) {
-
286  desc.scalar(ct++, (max_id + n) % N * 1.0 / W);
-
287  desc.scalar(ct++, light[(max_id + n) % N] / N);
-
288  }
-
289  }
-
290  // */
-
291  ret.push_back(MyFP(Vector2D<double>(1.0 * x, 1.0 * y).matrix(), desc));
-
292  }
-
293  return ret;
-
294  }
-
295 
- -
298  return copyFrom(fps);
-
299  }
-
300 
-
302  std::vector<MyFP> operator()(Bitmap<Pixel> const& bmp) const {
-
303  return detect(bmp);
-
304  }
-
305 
-
310  bool write(FILE* f, bool bin, unsigned int fg) const {
-
311  // TODO
-
312  return false;
-
313  }
-
314 
-
319  bool read (FILE* f, bool bin, unsigned int fg) {
-
320  // TODO
-
321  return false;
-
322  }
-
323 
-
328  ObjBase* create() const {
-
329  return (ObjBase*)new FPD_Harris<Pixel>();
-
330  }
-
331 
-
341  ObjBase* copyFrom(ObjBase const* b) {
-
342  return &(copyFrom(*(FPD_Harris const*)b));
-
343  }
-
344 
-
349  char const* ctype() const {
-
350  return typeid(*this).name();
-
351  }
-
352 
-
357  std::string type() const {
-
358  return std::string(ctype());
-
359  }
-
360 # undef FPD_Harris
-
361 };
-
362 
-
363 } // meow
-
364 
-
365 #endif // gra_FeaturePointsDetector_Harris
- -
Bitmap< Pixel > gradianceY(double radiusY, double radiusX) const
回傳對y偏微分
Definition: Bitmap.h:321
-
bool write(FILE *f, bool bin, unsigned int fg) const
寫到檔案裡
- -
ObjBase * create() const
new一個自己
-
ObjBase * copyFrom(ObjBase const *b)
複製資料
- -
Bitmap gaussian(double radiusY, double radiusX) const
回傳高斯模糊
Definition: Bitmap.h:275
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
- - - - -
用來維護一堆互斥集的資訊
Definition: DisjointSet.h:25
-
二維點陣資料
Definition: Bitmap.h:25
- - -
std::vector< MyFP > operator()(Bitmap< Pixel > const &bmp) const
same as detect(bmp)
-
Pixel pixel(size_t y, size_t x) const
取得 (y, x) 的pixel
Definition: Bitmap.h:212
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
vector
Definition: Vector.h:19
- -
size_t merge(size_t a, size_t b)
合併
Definition: DisjointSet.h:128
- -
FPD_Harris & operator=(FPD_Harris const &fps)
same as copyFrom(fps)
-
FPD_Harris & copyFrom(FPD_Harris const &fps)
複製
- -
FPD_Harris()
constructor 使用預設參數
- -
Bitmap gradianceX(double radiusY, double radiusX) const
回傳對x偏微分
Definition: Bitmap.h:298
-
std::vector< MyFP > detect(Bitmap< Pixel > const &bmp) const
找出特徵點
-
Scalar scalar(size_t i) const
return i -th scalar
Definition: Vector.h:125
-
std::string type() const
回傳class的type
-
T circle(T x)
將角度調整於0~2PI
Definition: utility.h:18
-
static const double PI
圓周率...
Definition: utility.h:12
-
Harris-Corner-Detect algorithm for finding feature points.
- - -
For developer to pack the attributes of a class.
Definition: self.h:110
- - -
char const * ctype() const
回傳class的type
-
FPD_Harris(FPD_Harris const &fps)
constructor 參數複製自另一個 FeaturePointsDetector_Harris
- - - - - - - -
T squ(T const &x)
x*x
Definition: utility.h:77
-
FPD_Harris & referenceFrom(FPD_Harris const &fps)
參照
-
-
- - - - - diff --git a/doc/html/FeaturePointsMatch_8h.html b/doc/html/FeaturePointsMatch_8h.html deleted file mode 100644 index 7b3fb9d..0000000 --- a/doc/html/FeaturePointsMatch_8h.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsMatch.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
FeaturePointsMatch.h File Reference
-
-
-
#include "FeaturePoint.h"
-#include "../utility.h"
-#include "../oo/ObjBase.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - -

-Classes

class  meow::FeaturePointsMatch< FeaturePoint >
 
- - - -

-Namespaces

 meow
 
- - - - - -

-Typedefs

typedef PairToPair< size_t,
-size_t, size_t, size_t > 
meow::FeaturePointIndexPair
 
typedef std::vector
-< FeaturePointIndexPair > 
meow::FeaturePointIndexPairs
 
-
-
- - - - - diff --git a/doc/html/FeaturePointsMatch_8h.js b/doc/html/FeaturePointsMatch_8h.js deleted file mode 100644 index 62517ed..0000000 --- a/doc/html/FeaturePointsMatch_8h.js +++ /dev/null @@ -1,6 +0,0 @@ -var FeaturePointsMatch_8h = -[ - [ "FeaturePointsMatch", "classmeow_1_1FeaturePointsMatch.html", "classmeow_1_1FeaturePointsMatch" ], - [ "FeaturePointIndexPair", "FeaturePointsMatch_8h.html#ae8e7032d7bf6ef923dda87dba4d057f2", null ], - [ "FeaturePointIndexPairs", "FeaturePointsMatch_8h.html#a03cd29a3b4f8874be532a4b0c9422961", null ] -]; \ No newline at end of file diff --git a/doc/html/FeaturePointsMatch_8h_source.html b/doc/html/FeaturePointsMatch_8h_source.html deleted file mode 100644 index 2038b15..0000000 --- a/doc/html/FeaturePointsMatch_8h_source.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsMatch.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
FeaturePointsMatch.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_FeaturePointsMatch_H__
-
2 #define gra_FeaturePointsMatch_H__
-
3 
-
4 #include "FeaturePoint.h"
-
5 
-
6 #include "../utility.h"
-
7 #include "../oo/ObjBase.h"
-
8 
-
9 #include <cstdlib>
-
10 
-
11 namespace meow {
-
12 
- -
14 typedef std::vector<FeaturePointIndexPair> FeaturePointIndexPairs;
-
15 
-
16 template<class FeaturePoint = FeaturePoint<double, double> >
-
17 class FeaturePointsMatch: public ObjBase {
-
18 protected:
- -
20  }
-
21 public:
-
22  typedef std::vector<FeaturePoint > FeaturePoints;
-
23  typedef std::vector<FeaturePoints> FeaturePointss;
-
24 
-
25  virtual ~FeaturePointsMatch() {
-
26  }
-
27 
-
28  virtual FeaturePointIndexPairs match(size_t dimension,
-
29  FeaturePoints const& from,
-
30  FeaturePoints const& to) const = 0;
-
31 
-
32  virtual FeaturePointIndexPairs match(size_t dimension,
-
33  FeaturePoints const& from,
-
34  FeaturePointss const& to) const = 0;
-
35 
-
36  virtual FeaturePointIndexPairs match(size_t dimension,
-
37  FeaturePointss const& from,
-
38  FeaturePointss const& to) const = 0;
-
39 
-
40  virtual FeaturePointIndexPairs match(size_t dimension,
-
41  FeaturePointss const& fpss) const = 0;
-
42 };
-
43 
-
44 } // meow
-
45 
-
46 #endif // gra_FeaturePointsMatch_H__
-
A structur with memember .from.first , .from.second , .to.first , .to.second.
Definition: utility.h:20
-
virtual FeaturePointIndexPairs match(size_t dimension, FeaturePoints const &from, FeaturePoints const &to) const =0
-
PairToPair< size_t, size_t, size_t, size_t > FeaturePointIndexPair
-
std::vector< FeaturePointIndexPair > FeaturePointIndexPairs
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- -
std::vector< FeaturePoints > FeaturePointss
- - -
std::vector< FeaturePoint > FeaturePoints
- -
-
- - - - - diff --git a/doc/html/FeaturePointsMatch__K__Match_8h.html b/doc/html/FeaturePointsMatch__K__Match_8h.html deleted file mode 100644 index dc1a4b7..0000000 --- a/doc/html/FeaturePointsMatch__K__Match_8h.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsMatch_K_Match.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
FeaturePointsMatch_K_Match.h File Reference
-
-
-
#include "FeaturePointsMatch.h"
-#include "../Self.h"
-#include "../dsa/VP_Tree.h"
-#include "../oo/ObjBase.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - -

-Classes

class  meow::FeaturePointsMatch_K_Match< Scalar, Description, FeaturePoint >
 
- - - -

-Namespaces

 meow
 
- - - -

-Macros

#define FPMKM   FeaturePointsMatch_K_Match
 
-

Macro Definition Documentation

- -
-
- - - - -
#define FPMKM   FeaturePointsMatch_K_Match
-
- -

Definition at line 17 of file FeaturePointsMatch_K_Match.h.

- -
-
-
-
- - - - - diff --git a/doc/html/FeaturePointsMatch__K__Match_8h.js b/doc/html/FeaturePointsMatch__K__Match_8h.js deleted file mode 100644 index c261e4e..0000000 --- a/doc/html/FeaturePointsMatch__K__Match_8h.js +++ /dev/null @@ -1,5 +0,0 @@ -var FeaturePointsMatch__K__Match_8h = -[ - [ "FeaturePointsMatch_K_Match", "classmeow_1_1FeaturePointsMatch__K__Match.html", "classmeow_1_1FeaturePointsMatch__K__Match" ], - [ "FPMKM", "FeaturePointsMatch__K__Match_8h.html#a58e89d43a69e628ede9275899ef6ebbb", null ] -]; \ No newline at end of file diff --git a/doc/html/FeaturePointsMatch__K__Match_8h_source.html b/doc/html/FeaturePointsMatch__K__Match_8h_source.html deleted file mode 100644 index 56bdccc..0000000 --- a/doc/html/FeaturePointsMatch__K__Match_8h_source.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/FeaturePointsMatch_K_Match.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
FeaturePointsMatch_K_Match.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_FeaturePointsMatch_K_Match_H__
-
2 #define gra_FeaturePointsMatch_K_Match_H__
-
3 
-
4 #include "FeaturePointsMatch.h"
-
5 
-
6 #include "../Self.h"
-
7 #include "../dsa/VP_Tree.h"
-
8 #include "../oo/ObjBase.h"
-
9 
-
10 #include <cstdlib>
-
11 
-
12 namespace meow {
-
13 
-
14 template <class Scalar, class Description,
-
15  class FeaturePoint = FeaturePoint<Scalar, Description> >
-
16 class FeaturePointsMatch_K_Match: public FeaturePointsMatch<FeaturePoint> {
-
17 # define FPMKM FeaturePointsMatch_K_Match
-
18 public:
-
19  typedef std::vector<FeaturePoint > FeaturePoints ;
-
20  typedef std::vector<FeaturePoints> FeaturePointss;
-
21 private:
-
22  struct Node {
-
23  size_t id_;
-
24  size_t index_;
-
25  FeaturePointss const* ptr_;
-
26 
-
27  Node() {
-
28  }
-
29  Node(Node const& nd) {
-
30  id_ = nd. id_;
-
31  index_ = nd.index_;
-
32  ptr_ = nd. ptr_;
-
33  }
-
34  Node(size_t id, size_t index, FeaturePointss const* ptr) {
-
35  id_ = id;
-
36  index_ = index;
-
37  ptr_ = ptr;
-
38  }
-
39  ~Node() {
-
40  }
-
41  bool operator<(Node const& nd) const {
-
42  return (id_ < nd.id_);
-
43  }
-
44  Description operator[](size_t id) const {
-
45  return (*ptr_)[id_][index_][id];
-
46  }
-
47  };
-
48 
-
49  struct Myself {
-
50  size_t k_;
-
51  Myself(): k_(1) {
-
52  }
-
53  Myself(size_t k): k_(k) {
-
54  }
-
55  Myself(Myself const& m): k_(m.k_) {
-
56  }
-
57  ~Myself() {
-
58  }
-
59  };
-
60 
-
61  Self<Myself> const self;
-
62 public:
-
63  FPMKM(): self() {
-
64  }
-
65 
-
66  FPMKM(FPMKM const& m): self(m.self, Self<Myself>::COPY_FROM) {
-
67  self().copyFrom(m.self);
-
68  }
-
69 
-
70  FPMKM(size_t k): self(Myself(k)) {
-
71  }
-
72 
-
73  ~FPMKM() {
-
74  }
-
75 
-
76  FPMKM& copyFrom(FPMKM const& m) {
-
77  self().copyFrom(m.self);
-
78  return *this;
-
79  }
-
80 
-
81  FPMKM& referenceFrom(FPMKM const& m) {
-
82  self().referenceFrom(m.self);
-
83  return *this;
-
84  }
-
85 
-
86  size_t paramK() const {
-
87  return self->k_;
-
88  }
-
89 
-
90  size_t paramK(size_t k) {
-
91  self()->k_ = std::max(k, (size_t)1);
-
92  return paramK();
-
93  }
-
94 
-
95 
-
96  FeaturePointIndexPairs match(size_t dimension,
-
97  FeaturePoints const& from,
-
98  FeaturePoints const& to) const {
-
99  return match(dimension, FeaturePointss(1, from), FeaturePointss(1, to));
-
100  }
-
101 
-
102 
-
103  FeaturePointIndexPairs match(size_t dimension,
-
104  FeaturePoints const& from,
-
105  FeaturePointss const& to) const {
-
106  return match(dimension, FeaturePointss(1, from), to);
-
107  }
-
108 
-
109  FeaturePointIndexPairs match(size_t dimension,
-
110  FeaturePointss const& from,
-
111  FeaturePointss const& to) const {
-
112  VP_Tree<Node, Description> tree(dimension);
-
113  for (size_t i = 0, I = to.size(); i < I; i++)
-
114  for (size_t j = 0, J = to[i].size(); j < J; j++)
-
115  tree.insert(Node(i, j, &to));
- -
117  for (size_t i = 0, I = from.size(); i < I; i++)
-
118  for (size_t j = 0, J = from[i].size(); j < J; j++) {
-
119  Node now(i, j, &from);
-
120  std::vector<Node> tree_ret = tree.query(now, self->k_, true);
-
121  for (size_t k = 0, K = tree_ret.size(); k < K; k++)
-
122  ret.push_back(FeaturePointIndexPair(i, j,
-
123  tree_ret[k].id_,
-
124  tree_ret[k].index_));
-
125  }
-
126  return ret;
-
127  }
-
128 
-
129  FeaturePointIndexPairs match(size_t dimension,
-
130  FeaturePointss const& fpss) const {
-
131  FeaturePointIndexPairs ret, add;
-
132  FeaturePointss to(fpss);
-
133  for (size_t i = 0, I = fpss.size(); i < I; i++) {
-
134  to[i].clear();
-
135  add = match(dimension, fpss[i], to);
-
136  for (size_t j = 0, J = add.size(); j < J; j++) {
-
137  ret.push_back(FeaturePointIndexPair(i , add[j].from.second,
-
138  add[j].to.first, add[j].to.second));
-
139  }
-
140  to[i] = fpss[i];
-
141  }
-
142  return ret;
-
143  }
-
144 
-
145  FPMKM& operator=(FPMKM const& b) {
-
146  return copyFrom(b);
-
147  }
-
148 
-
149 
-
150  bool write(FILE* f, bool bin, unsigned int fg) const {
-
151  // TODO
-
152  return false;
-
153  }
-
154 
-
155  bool read (FILE* f, bool bin, unsigned int fg) {
-
156  // TODO
-
157  return false;
-
158  }
-
159 
-
160  ObjBase* create() const {
-
161  return new FPMKM();
-
162  }
-
163 
-
164  ObjBase* copyFrom(ObjBase const* ptr) {
-
165  return &(copyFrom(*(FPMKM*)ptr));
-
166  }
-
167 
-
168  char const* ctype() const {
-
169  return typeid(*this).name();
-
170  }
-
171 
-
172  std::string type() const {
-
173  return std::string(ctype());
-
174  }
-
175 # undef FPMKM
-
176 };
-
177 
-
178 } // meow
-
179 
-
180 #endif // gra_FeaturePointsMatch_K_Match_H__
- - -
char const * ctype() const
用C-style string回傳這個class的type name
-
FeaturePointIndexPairs match(size_t dimension, FeaturePointss const &from, FeaturePointss const &to) const
- -
A structur with memember .from.first , .from.second , .to.first , .to.second.
Definition: utility.h:20
-
std::string type() const
用std::string回傳這個class的type name
-
FeaturePointIndexPairs match(size_t dimension, FeaturePoints const &from, FeaturePointss const &to) const
-
ObjBase * copyFrom(ObjBase const *ptr)
複製, 預設使用operator=
-
void insert(Vector const &vector)
將給定的Vector加到set中
Definition: VP_Tree.h:252
-
PairToPair< size_t, size_t, size_t, size_t > FeaturePointIndexPair
-
std::vector< FeaturePoint > FeaturePoints
- - -
std::vector< FeaturePoints > FeaturePointss
-
std::vector< FeaturePointIndexPair > FeaturePointIndexPairs
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- -
FeaturePointIndexPairs match(size_t dimension, FeaturePoints const &from, FeaturePoints const &to) const
-
std::vector< FeaturePoints > FeaturePointss
-
bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
- -
跟KD_Tree很像歐
Definition: VP_Tree.h:51
- - -
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
- -
FeaturePointIndexPairs match(size_t dimension, FeaturePointss const &fpss) const
- -
For developer to pack the attributes of a class.
Definition: self.h:110
- -
std::vector< FeaturePoint > FeaturePoints
-
-
- - - - - diff --git a/doc/html/HI.html b/doc/html/HI.html deleted file mode 100644 index e7a48ca..0000000 --- a/doc/html/HI.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - -Templates -- Meow: $title - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.5 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-

-adasdbc

-

bb

-

-abe

-

cc

-
-
- - - - - diff --git a/doc/html/HIJ.html b/doc/html/HIJ.html deleted file mode 100644 index 14d5b49..0000000 --- a/doc/html/HIJ.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - -Templates -- Meow: $title - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.5 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-

-abe

-

cc

-
-
- - - - - diff --git a/doc/html/HIxx.html b/doc/html/HIxx.html deleted file mode 100644 index dcc8c64..0000000 --- a/doc/html/HIxx.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - -Templates -- Meow: $title - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.5 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-

-adasdbc

-

bb

-
-
- - - - - diff --git a/doc/html/HSL_8h.html b/doc/html/HSL_8h.html deleted file mode 100644 index 11a3a53..0000000 --- a/doc/html/HSL_8h.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSL.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HSL.h File Reference
-
-
-
#include "RGB.h"
-#include "YUV.h"
-#include "HSL.hpp"
-
-

Go to the source code of this file.

- - - - - - -

-Classes

class  meow::HSL< T >
 
class  meow::HSLf
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - -

-Functions

template<class RGB_T , class HSL_T >
void meow::RGB_to_HSL (RGB< RGB_T > const &rgb, HSL< HSL_T > *hsl)
 
template<class HSL_T , class RGB_T >
void meow::HSL_to_RGB (HSL< HSL_T > const &hsl, RGB< RGB_T > *rgb)
 
template<class YUV_T , class HSL_T >
void meow::YUV_to_HSL (YUV< YUV_T > const &yuv, HSL< HSL_T > *hsl)
 
template<class HSL_T , class YUV_T >
void meow::HSL_to_YUV (HSL< HSL_T > const &hsl, YUV< YUV_T > *yuv)
 
-
-
- - - - - diff --git a/doc/html/HSL_8h.js b/doc/html/HSL_8h.js deleted file mode 100644 index 7232202..0000000 --- a/doc/html/HSL_8h.js +++ /dev/null @@ -1,9 +0,0 @@ -var HSL_8h = -[ - [ "HSL", "classmeow_1_1HSL.html", "classmeow_1_1HSL" ], - [ "HSLf", "classmeow_1_1HSLf.html", "classmeow_1_1HSLf" ], - [ "HSL_to_RGB", "HSL_8h.html#a0ef9dd19ef8613c009398be225d7dba5", null ], - [ "HSL_to_YUV", "HSL_8h.html#a1ec923575a53dcd2d9a40e49b228ceed", null ], - [ "RGB_to_HSL", "HSL_8h.html#ab5a740e832854cb4edd4db00b0550b03", null ], - [ "YUV_to_HSL", "HSL_8h.html#ac568f9be6b54c16176377ab7941b82ff", null ] -]; \ No newline at end of file diff --git a/doc/html/HSL_8h_source.html b/doc/html/HSL_8h_source.html deleted file mode 100644 index 829bf6e..0000000 --- a/doc/html/HSL_8h_source.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSL.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HSL.h
-
-
-Go to the documentation of this file.
1 #ifndef HSL_H_
-
2 #define HSL_H_
-
3 
-
4 #include "RGB.h"
-
5 #include "YUV.h"
-
6 
-
7 namespace meow{
-
8  template<class T> class HSL{
-
9  protected:
-
10  T hsl_[3];
-
11  HSL();
-
12  HSL(T const& h, T const& s, T const& l);
-
13  HSL(T const* hsl);
-
14  public:
-
15  virtual ~HSL(){ }
-
17  virtual T hMax() const = 0;
-
18  virtual T hMin() const = 0;
-
19  virtual T sMax() const = 0;
-
20  virtual T sMin() const = 0;
-
21  virtual T lMax() const = 0;
-
22  virtual T lMin() const = 0;
-
24  T h() const;
-
25  T s() const;
-
26  T l() const;
-
27  T hsl(size_t i) const;
-
28  T lsh(size_t i) const;
-
30  T h(T const& val);
-
31  T s(T const& val);
-
32  T l(T const& val);
-
33  T hsl(size_t i, T const& val);
-
34  T lsh(size_t i, T const& val);
-
35  };
-
36 
-
37  class HSLf: public HSL<double>{
-
38  public:
-
39  HSLf();
-
40  ~HSLf();
-
41  HSLf(double const&h,double const&s,double const&l);
-
42  HSLf(double const* hsl);
-
43  double hMin() const;
-
44  double hMax() const;
-
45  double sMin() const;
-
46  double sMax() const;
-
47  double lMin() const;
-
48  double lMax() const;
-
49  };
-
50 
-
51  template<class RGB_T, class HSL_T> inline void RGB_to_HSL(
-
52  RGB<RGB_T> const& rgb,
-
53  HSL<HSL_T> * hsl);
-
54  template<class HSL_T, class RGB_T> inline void HSL_to_RGB(
-
55  HSL<HSL_T> const& hsl,
-
56  RGB<RGB_T> * rgb);
-
57  template<class YUV_T, class HSL_T> inline void YUV_to_HSL(
-
58  YUV<YUV_T> const& yuv,
-
59  HSL<HSL_T> * hsl);
-
60  template<class HSL_T, class YUV_T> inline void HSL_to_YUV(
-
61  HSL<HSL_T> const& hsl,
-
62  YUV<YUV_T> * yuv);
-
63 }
-
64 
-
65 #include "HSL.hpp"
-
66 
-
67 #endif // HSL_H_
-
HSL()
Definition: HSL.hpp:9
-
T lsh(size_t i) const
Definition: HSL.hpp:23
-
virtual T lMin() const =0
- -
double hMax() const
Definition: HSL.hpp:43
-
T hsl(size_t i) const
Definition: HSL.hpp:20
-
T h() const
Definition: HSL.hpp:17
-
virtual T hMin() const =0
-
double sMin() const
Definition: HSL.hpp:44
-
void HSL_to_RGB(HSL< HSL_T > const &hsl, RGB< RGB_T > *rgb)
Definition: HSL.hpp:74
-
Definition: RGB.h:5
-
void HSL_to_YUV(HSL< HSL_T > const &hsl, YUV< YUV_T > *yuv)
Definition: HSL.hpp:121
-
double hMin() const
Definition: HSL.hpp:42
-
Definition: YUV.h:7
-
virtual T lMax() const =0
-
Definition: HSL.h:37
-
~HSLf()
Definition: HSL.hpp:39
-
virtual T sMax() const =0
-
double sMax() const
Definition: HSL.hpp:45
-
HSLf()
Definition: HSL.hpp:38
-
Definition: HSL.h:8
-
void YUV_to_HSL(YUV< YUV_T > const &yuv, HSL< HSL_T > *hsl)
Definition: HSL.hpp:114
-
double lMax() const
Definition: HSL.hpp:47
-
virtual T hMax() const =0
-
T hsl_[3]
Definition: HSL.h:10
- -
void RGB_to_HSL(RGB< RGB_T > const &rgb, HSL< HSL_T > *hsl)
Definition: HSL.hpp:52
-
T s() const
Definition: HSL.hpp:18
-
T l() const
Definition: HSL.hpp:19
-
virtual ~HSL()
Definition: HSL.h:15
-
virtual T sMin() const =0
-
double lMin() const
Definition: HSL.hpp:46
- -
-
- - - - - diff --git a/doc/html/HSL_8hpp.html b/doc/html/HSL_8hpp.html deleted file mode 100644 index f3d5eb0..0000000 --- a/doc/html/HSL_8hpp.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSL.hpp File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HSL.hpp File Reference
-
-
-
#include "HSL.h"
-#include "RGB.h"
-#include "YUV.h"
-#include "../utility.h"
-
-

Go to the source code of this file.

- - - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - -

-Functions

template<class RGB_T , class HSL_T >
void meow::RGB_to_HSL (RGB< RGB_T > const &rgb, HSL< HSL_T > *hsl)
 
template<class HSL_T , class RGB_T >
void meow::HSL_to_RGB (HSL< HSL_T > const &hsl, RGB< RGB_T > *rgb)
 
template<class YUV_T , class HSL_T >
void meow::YUV_to_HSL (YUV< YUV_T > const &yuv, HSL< HSL_T > *hsl)
 
template<class HSL_T , class YUV_T >
void meow::HSL_to_YUV (HSL< HSL_T > const &hsl, YUV< YUV_T > *yuv)
 
-
-
- - - - - diff --git a/doc/html/HSL_8hpp.js b/doc/html/HSL_8hpp.js deleted file mode 100644 index 21ebee5..0000000 --- a/doc/html/HSL_8hpp.js +++ /dev/null @@ -1,7 +0,0 @@ -var HSL_8hpp = -[ - [ "HSL_to_RGB", "HSL_8hpp.html#a0ef9dd19ef8613c009398be225d7dba5", null ], - [ "HSL_to_YUV", "HSL_8hpp.html#a1ec923575a53dcd2d9a40e49b228ceed", null ], - [ "RGB_to_HSL", "HSL_8hpp.html#ab5a740e832854cb4edd4db00b0550b03", null ], - [ "YUV_to_HSL", "HSL_8hpp.html#ac568f9be6b54c16176377ab7941b82ff", null ] -]; \ No newline at end of file diff --git a/doc/html/HSL_8hpp_source.html b/doc/html/HSL_8hpp_source.html deleted file mode 100644 index bf0bd40..0000000 --- a/doc/html/HSL_8hpp_source.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSL.hpp Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HSL.hpp
-
-
-Go to the documentation of this file.
1 #include "HSL.h"
-
2 
-
3 #include "RGB.h"
-
4 #include "YUV.h"
-
5 
-
6 #include "../utility.h"
-
7 
-
8 namespace meow{
-
9  template<class T> inline HSL<T>::HSL(){ }
-
10  template<class T> inline HSL<T>::HSL(T const& h, T const& s, T const& l){
-
11  hsl_[0] = h; hsl_[1] = s; hsl_[2] = l;
-
12  }
-
13  template<class T> inline HSL<T>::HSL(T const* hsl){
-
14  for(int i = 0; i < 3; i++) hsl_[i] = hsl[i];
-
15  }
-
16 
-
17  template<class T> inline T HSL<T>::h() const { return hsl_[0]; }
-
18  template<class T> inline T HSL<T>::s() const { return hsl_[1]; }
-
19  template<class T> inline T HSL<T>::l() const { return hsl_[2]; }
-
20  template<class T> inline T HSL<T>::hsl(size_t i) const {
-
21  return hsl_[std::min((size_t)3 - 1, i)];
-
22  }
-
23  template<class T> inline T HSL<T>::lsh(size_t i)const{return hsl(2-i);}
-
24  template<class T> inline T HSL<T>::h(T const& val){return (hsl_[0]=val);}
-
25  template<class T> inline T HSL<T>::s(T const& val){return (hsl_[1]=val);}
-
26  template<class T> inline T HSL<T>::l(T const& val){return (hsl_[2]=val);}
-
27  template<class T> inline T HSL<T>::hsl(size_t i, T const& val){
-
28  return (hsl_[std::min((size_t)3 - 1, i)] = val);
-
29  }
-
30  template<class T> inline T HSL<T>::lsh(size_t i, T const& val){
-
31  return hsl(2 - i, val);
-
32  }
-
33 
-
34 
-
35 
-
36 
-
37 
-
38  inline HSLf:: HSLf(): HSL(){ }
-
39  inline HSLf::~HSLf(){ }
-
40  inline HSLf::HSLf(double const&h,double const&s,double const&l):HSL(h,s,l){}
-
41  inline HSLf::HSLf(double const* hsl):HSL(hsl){}
-
42  inline double HSLf::hMin() const { return 0.0; }
-
43  inline double HSLf::hMax() const { return 2.0 * PI; }
-
44  inline double HSLf::sMin() const { return 0.0; }
-
45  inline double HSLf::sMax() const { return 1.0; }
-
46  inline double HSLf::lMin() const { return 0.0; }
-
47  inline double HSLf::lMax() const { return 1.0; }
-
48 
-
49 
-
50 
-
51 
-
52  template<class RGB_T, class HSL_T> inline void RGB_to_HSL(
-
53  RGB<RGB_T> const& rgb,
-
54  HSL<HSL_T> * hsl){
-
55  double r = normalize(rgb.rMin(), rgb.rMax(), rgb.r());
-
56  double g = normalize(rgb.gMin(), rgb.gMax(), rgb.g());
-
57  double b = normalize(rgb.bMin(), rgb.bMax(), rgb.b());
-
58  double mx = std::max(std::max(r, g), b);
-
59  double mn = std::min(std::min(r, g), b);
-
60  double h, s, l;
-
61  if (mx == mn ) h = 0;
-
62  else if(mx == r && g >= b) h = PI/3.0 * (g-b) / (mx-mn);
-
63  else if(mx == r && g < b) h = PI/3.0 * (g-b) / (mx-mn) + PI * 2.0;
-
64  else if(mx == g ) h = PI/3.0 * (b-r) / (mx-mn) + PI/3.0*2.0;
-
65  else h = PI/3.0 * (r-g) / (mx-mn) + PI/3.0*4.0;
-
66  l = 0.5 * (mx + mn);
-
67  if (l == 0 || mx == mn) s = 0;
-
68  else if(l < 0.5 ) s = (mx - mn) / (2.0 * l);
-
69  else s = (mx - mn) / (2 - 2.0 * l);
-
70  hsl->h(h);
-
71  hsl->s(s);
-
72  hsl->l(l);
-
73  }
-
74  template<class HSL_T, class RGB_T> inline void HSL_to_RGB(
-
75  HSL<HSL_T> const& hsl,
-
76  RGB<RGB_T> * rgb){
-
77  double h = normalize(hsl.hMin(), hsl.hMax(), hsl.h());
-
78  double s = normalize(hsl.sMin(), hsl.sMax(), hsl.s());
-
79  double l = normalize(hsl.lMin(), hsl.lMax(), hsl.l());
-
80  if(s == 0){
-
81  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), l));
-
82  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), l));
-
83  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), l));
-
84  return ;
-
85  }
-
86  double q = (l < 0.5 ? (l * (1 + s)) : (l + s - (l * s)));
-
87  double p = 2 * l - q;
-
88  double t_r = h + 1.0 / 3.0;
-
89  double t_g = h;
-
90  double t_b = h - 1.0 / 3.0;
-
91  if(t_r < 0) t_r = t_r + 1.0;
-
92  if(t_r > 1) t_r = t_r - 1.0;
-
93  if(t_g < 0) t_g = t_g + 1.0;
-
94  if(t_g > 1) t_g = t_g - 1.0;
-
95  if(t_b < 0) t_b = t_b + 1.0;
-
96  if(t_b > 1) t_b = t_b - 1.0;
-
97  double r, g, b;
-
98  if (t_r < 1.0 / 6.0) r = p + (q - p) * 6 * t_r;
-
99  else if(t_r < 0.5 ) r = q;
-
100  else if(t_r < 2.0 / 3.0) r = p + (q - p) * 6 * (2.0 / 3.0 - t_r);
-
101  else r = p;
-
102  if (t_g < 1.0 / 6.0) g = p + (q - p) * 6 * t_g;
-
103  else if(t_g < 0.5 ) g = q;
-
104  else if(t_g < 2.0 / 3.0) g = p + (q - p) * 6 * (2.0 / 3.0 - t_g);
-
105  else g = p;
-
106  if (t_b < 1.0 / 6.0) b = p + (q - p) * 6 * t_b;
-
107  else if(t_b < 0.5 ) b = q;
-
108  else if(t_b < 2.0 / 3.0) b = p + (q - p) * 6 * (2.0 / 3.0 - t_b);
-
109  else b = p;
-
110  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), r));
-
111  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), g));
-
112  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), b));
-
113  }
-
114  template<class YUV_T, class HSL_T> inline void YUV_to_HSL(
-
115  YUV<YUV_T> const& yuv,
-
116  HSL<HSL_T> * hsl){
-
117  RGBf tmp;
-
118  YUV_to_RGB(yuv, &tmp);
-
119  RGB_to_HSL(tmp, hsl);
-
120  }
-
121  template<class HSL_T, class YUV_T> inline void HSL_to_YUV(
-
122  HSL<HSL_T> const& hsl,
-
123  YUV<YUV_T> * yuv){
-
124  RGBf tmp;
-
125  HSL_to_RGB(hsl, &tmp);
-
126  RGB_to_YUV(tmp, yuv);
-
127  }
-
128 }
- -
virtual T rMax() const =0
-
HSL()
Definition: HSL.hpp:9
-
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
Definition: utility.h:27
-
T lsh(size_t i) const
Definition: HSL.hpp:23
-
virtual T lMin() const =0
- -
double hMax() const
Definition: HSL.hpp:43
-
T hsl(size_t i) const
Definition: HSL.hpp:20
-
T h() const
Definition: HSL.hpp:17
-
virtual T hMin() const =0
-
double sMin() const
Definition: HSL.hpp:44
-
virtual T bMax() const =0
-
void HSL_to_RGB(HSL< HSL_T > const &hsl, RGB< RGB_T > *rgb)
Definition: HSL.hpp:74
-
Definition: RGB.h:5
-
T r() const
Definition: RGB.hpp:14
-
void HSL_to_YUV(HSL< HSL_T > const &hsl, YUV< YUV_T > *yuv)
Definition: HSL.hpp:121
-
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
Definition: utility.h:35
-
virtual T bMin() const =0
-
Definition: RGB.h:34
-
double hMin() const
Definition: HSL.hpp:42
-
Definition: YUV.h:7
-
virtual T lMax() const =0
-
void RGB_to_YUV(RGB< RGB_T > const &rgb, YUV< YUV_T > *yuv)
Definition: YUV.hpp:47
-
~HSLf()
Definition: HSL.hpp:39
-
virtual T sMax() const =0
-
double sMax() const
Definition: HSL.hpp:45
-
HSLf()
Definition: HSL.hpp:38
-
Definition: HSL.h:8
-
void YUV_to_HSL(YUV< YUV_T > const &yuv, HSL< HSL_T > *hsl)
Definition: HSL.hpp:114
-
void YUV_to_RGB(YUV< YUV_T > const &yuv, RGB< RGB_T > *rgb)
Definition: YUV.hpp:60
-
double lMax() const
Definition: HSL.hpp:47
-
virtual T hMax() const =0
-
virtual T gMax() const =0
-
static const double PI
圓周率...
Definition: utility.h:12
-
virtual T rMin() const =0
-
T g() const
Definition: RGB.hpp:15
-
virtual T gMin() const =0
-
void RGB_to_HSL(RGB< RGB_T > const &rgb, HSL< HSL_T > *hsl)
Definition: HSL.hpp:52
-
T s() const
Definition: HSL.hpp:18
-
T l() const
Definition: HSL.hpp:19
-
T b() const
Definition: RGB.hpp:16
-
virtual T sMin() const =0
-
double lMin() const
Definition: HSL.hpp:46
- -
-
- - - - - diff --git a/doc/html/HSL__Space_8h.html b/doc/html/HSL__Space_8h.html deleted file mode 100644 index 22e0efb..0000000 --- a/doc/html/HSL__Space_8h.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSL_Space.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HSL_Space.h File Reference
-
-
-
#include "Color3_Space.h"
-#include "RGB_Space.h"
-#include "YUV_Space.h"
-#include "../geo/Vectors.h"
-#include "../math/utility.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::HSLf_Space
 以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間 More...
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - - - - - - - - - - -

-Functions

void meow::colorTransformate (HSLf_Space const &in, HSLf_Space *out)
 HSLf_Space to HSLf_Space More...
 
void meow::colorTransformate (RGBf_Space const &rgb, HSLf_Space *hsl)
 RGBf_Space to HSLf_Space More...
 
void meow::colorTransformate (YUVf_Space const &yuv, HSLf_Space *hsl)
 YUVf_Space to HSLf_Space More...
 
void meow::colorTransformate (HSLf_Space const &hsl, RGBf_Space *rgb)
 HSLf_Space to RGBf_Space More...
 
void meow::colorTransformate (HSLf_Space const &hsl, YUVf_Space *yuv)
 HSLf_Space to YUVf_Space More...
 
void meow::colorTransformate (HSLf_Space const &hsl, RGBi_Space *rgb)
 HSLf_Space to RGBi_Space More...
 
void meow::colorTransformate (RGBi_Space const &rgb, HSLf_Space *hsl)
 RGBi_Space to HSLf_Space More...
 
-
-
- - - - - diff --git a/doc/html/HSL__Space_8h.js b/doc/html/HSL__Space_8h.js deleted file mode 100644 index de9ae3b..0000000 --- a/doc/html/HSL__Space_8h.js +++ /dev/null @@ -1,11 +0,0 @@ -var HSL__Space_8h = -[ - [ "HSLf_Space", "classmeow_1_1HSLf__Space.html", "classmeow_1_1HSLf__Space" ], - [ "colorTransformate", "HSL__Space_8h.html#a096556e550d6407f2c7f9b9507eab5be", null ], - [ "colorTransformate", "HSL__Space_8h.html#af9ab85cd87a9f843e710657188f4c601", null ], - [ "colorTransformate", "HSL__Space_8h.html#a7f2b465df93750016d3ff54b2adce77b", null ], - [ "colorTransformate", "HSL__Space_8h.html#ad429f8a956d1f0e1484d08bb9419685b", null ], - [ "colorTransformate", "HSL__Space_8h.html#a4c39f0ec6860546a7b16e3f165bed83e", null ], - [ "colorTransformate", "HSL__Space_8h.html#a992d4c33aed66c0d4d7f578ef92dfa15", null ], - [ "colorTransformate", "HSL__Space_8h.html#ae9b7bb880aa5b6dfebd523a6b344a4f1", null ] -]; \ No newline at end of file diff --git a/doc/html/HSL__Space_8h_source.html b/doc/html/HSL__Space_8h_source.html deleted file mode 100644 index 28cba3e..0000000 --- a/doc/html/HSL__Space_8h_source.html +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSL_Space.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HSL_Space.h
-
-
-Go to the documentation of this file.
1 #ifndef colors_HSL_Space_H__
-
2 #define colors_HSL_Space_H__
-
3 
-
4 #include "Color3_Space.h"
-
5 #include "RGB_Space.h"
-
6 #include "YUV_Space.h"
-
7 
-
8 #include "../geo/Vectors.h"
-
9 #include "../math/utility.h"
-
10 
-
11 #include <cstdlib>
-
12 
-
13 namespace meow {
-
14 
-
22 class HSLf_Space: public Color3_Space<double> {
-
23 public:
- -
25  Vector3D<double>(PI * 2.0, 1.0, 1.0),
-
26  Vector3D<double>( 0.0, 0.0, 0.0)) {
-
27  }
-
28  HSLf_Space(double c): Color3_Space<double>(Vector3D<double>( 0.0, 0.0, 0.0),
-
29  Vector3D<double>(PI*2.0, 1.0, 1.0),
-
30  Vector3D<double>( c, c, c))
-
31  { }
- -
33  Color3_Space<double>(Vector3D<double>(0.0, 0.0, 0.0),
-
34  Vector3D<double>(1.0, 1.0, 1.0),
-
35  Vector3D<double>(v)) {
-
36  }
-
37  HSLf_Space(HSL_Space const& b): Color3_Space<double>(b) {
-
38  }
- -
40  }
-
41  double const& hslMin(size_t i) const { return min(i); }
-
42  double const& hMin( ) const { return min(0); }
-
43  double const& sMin( ) const { return min(1); }
-
44  double const& lMin( ) const { return min(2); }
-
45  double const& hslMax(size_t i) const { return max(i); }
-
46  double const& hMax( ) const { return max(0); }
-
47  double const& sMax( ) const { return max(1); }
-
48  double const& lMax( ) const { return max(2); }
-
49  double const& hsl(size_t i) const { return val(i); }
-
50  double const& h( ) const { return hsl(0); }
-
51  double const& s( ) const { return hsl(1); }
-
52  double const& l( ) const { return hsl(2); }
-
53  double const& hsl(size_t i, double c) { return val(i, c); }
-
54  double const& h( double c) { return hsl(0, c); }
-
55  double const& s( double c) { return hsl(1, c); }
-
56  double const& l( double c) { return hsl(2, c); }
-
57  double& hslGet(size_t i) { return valGet(i); }
-
58  double& hGet( ) { return hslGet(0); }
-
59  double& sGet( ) { return hslGet(1); }
-
60  double& lGet( ) { return hslGet(2); }
- -
62  copyFrom(b);
-
63  return *this;
-
64  }
-
65  HSLf_Space operator+(HSLf_Space const& b) const {
-
66  return HSLf_Space(val_ + b.val_);
-
67  }
-
68  HSLf_Space operator-(HSLf_Space const& b) const {
-
69  return HSLf_Space(val_ - b.val_);
-
70  }
-
71  HSLf_Space operator*(double const& c) const {
-
72  return HSLf_Space(val_ * c);
-
73  }
-
74  HSLf_Space operator/(double const& c) const {
-
75  return HSLf_Space(val_ / c);
-
76  }
-
77  double operator*(HSLf_Space const& b) const {
-
78  return val_ * b.val_;
-
79  }
-
80 };
-
81 
-
85 inline void colorTransformate(HSLf_Space const& in, HSLf_Space* out) {
-
86  *out = in;
-
87 }
-
88 
-
92 inline void colorTransformate(RGBf_Space const& rgb, HSLf_Space* hsl) {
-
93  double r = normalize(rgb.rMin(), rgb.rMax(), rgb.r());
-
94  double g = normalize(rgb.gMin(), rgb.gMax(), rgb.g());
-
95  double b = normalize(rgb.bMin(), rgb.bMax(), rgb.b());
-
96  double mx = std::max(std::max(r, g), b);
-
97  double mn = std::min(std::min(r, g), b);
-
98  double h, s, l;
-
99  if (mx == mn ) h = 0;
-
100  else if(mx == r && g >= b) h = PI/3.0 * (g-b) / (mx-mn);
-
101  else if(mx == r && g < b) h = PI/3.0 * (g-b) / (mx-mn) + PI * 2.0;
-
102  else if(mx == g ) h = PI/3.0 * (b-r) / (mx-mn) + PI/3.0*2.0;
-
103  else h = PI/3.0 * (r-g) / (mx-mn) + PI/3.0*4.0;
-
104  l = 0.5 * (mx + mn);
-
105  if (l == 0 || mx == mn) s = 0;
-
106  else if(l < 0.5 ) s = (mx - mn) / (2.0 * l);
-
107  else s = (mx - mn) / (2 - 2.0 * l);
-
108  hsl->h(h);
-
109  hsl->s(s);
-
110  hsl->l(l);
-
111 }
-
112 
-
116 inline void colorTransformate(YUVf_Space const& yuv, HSLf_Space* hsl) {
-
117  RGBf_Space tmp;
-
118  colorTransformate(yuv, &tmp);
-
119  colorTransformate(tmp, hsl);
-
120 }
-
121 
-
125 inline void colorTransformate(HSLf_Space const& hsl, RGBf_Space* rgb) {
-
126  double h = normalize(hsl.hMin(), hsl.hMax(), hsl.h());
-
127  double s = normalize(hsl.sMin(), hsl.sMax(), hsl.s());
-
128  double l = normalize(hsl.lMin(), hsl.lMax(), hsl.l());
-
129  if(s == 0){
-
130  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), l));
-
131  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), l));
-
132  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), l));
-
133  return ;
-
134  }
-
135  double q = (l < 0.5 ? (l * (1 + s)) : (l + s - (l * s)));
-
136  double p = 2 * l - q;
-
137  double t_r = h + 1.0 / 3.0;
-
138  double t_g = h;
-
139  double t_b = h - 1.0 / 3.0;
-
140  if(t_r < 0) t_r = t_r + 1.0;
-
141  if(t_r > 1) t_r = t_r - 1.0;
-
142  if(t_g < 0) t_g = t_g + 1.0;
-
143  if(t_g > 1) t_g = t_g - 1.0;
-
144  if(t_b < 0) t_b = t_b + 1.0;
-
145  if(t_b > 1) t_b = t_b - 1.0;
-
146  double r, g, b;
-
147  if (t_r < 1.0 / 6.0) r = p + (q - p) * 6 * t_r;
-
148  else if(t_r < 0.5 ) r = q;
-
149  else if(t_r < 2.0 / 3.0) r = p + (q - p) * 6 * (2.0 / 3.0 - t_r);
-
150  else r = p;
-
151  if (t_g < 1.0 / 6.0) g = p + (q - p) * 6 * t_g;
-
152  else if(t_g < 0.5 ) g = q;
-
153  else if(t_g < 2.0 / 3.0) g = p + (q - p) * 6 * (2.0 / 3.0 - t_g);
-
154  else g = p;
-
155  if (t_b < 1.0 / 6.0) b = p + (q - p) * 6 * t_b;
-
156  else if(t_b < 0.5 ) b = q;
-
157  else if(t_b < 2.0 / 3.0) b = p + (q - p) * 6 * (2.0 / 3.0 - t_b);
-
158  else b = p;
-
159  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), r));
-
160  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), g));
-
161  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), b));
-
162 }
-
163 
-
167 inline void colorTransformate(HSLf_Space const& hsl, YUVf_Space* yuv) {
-
168  RGBf_Space tmp;
-
169  colorTransformate(hsl, &tmp);
-
170  colorTransformate(tmp, yuv);
-
171 }
-
172 
-
176 inline void colorTransformate(HSLf_Space const& hsl, RGBi_Space* rgb) {
-
177  RGBf_Space tmp;
-
178  colorTransformate(hsl, &tmp);
-
179  rgb->copyFrom(tmp);
-
180 }
-
181 
-
182 
-
186 inline void colorTransformate(RGBi_Space const& rgb, HSLf_Space* hsl) {
-
187  RGBf_Space tmp;
-
188  tmp.copyFrom(rgb);
-
189  colorTransformate(rgb, hsl);
-
190 }
-
191 
-
192 } // meow
-
193 
-
194 
-
195 #endif // colors_HSL_Space_H__
-
HSLf_Space(Vector3D< double > const &v)
Definition: HSL_Space.h:32
-
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
Definition: utility.h:37
-
double const & rMin() const
Definition: RGB_Space.h:106
-
HSLf_Space & operator=(HSLf_Space const &b)
Definition: HSL_Space.h:61
-
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Definition: HSL_Space.h:22
- -
double const & h() const
Definition: HSL_Space.h:50
-
double const & l() const
Definition: HSL_Space.h:52
-
HSLf_Space operator*(double const &c) const
Definition: HSL_Space.h:71
-
double & hGet()
Definition: HSL_Space.h:58
-
以浮點數Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:86
-
HSLf_Space(HSL_Space const &b)
Definition: HSL_Space.h:37
-
doubleconst & min(size_t id) const
Return the minimum of the i -th channel.
Definition: Color3_Space.h:99
- -
double & hslGet(size_t i)
Definition: HSL_Space.h:57
-
double const & h(double c)
Definition: HSL_Space.h:54
- -
double & valGet(size_t id)
Get the non-constant reference of value of the i -th channel.
Definition: Color3_Space.h:139
-
double const & hsl(size_t i) const
Definition: HSL_Space.h:49
-
double & lGet()
Definition: HSL_Space.h:60
-
double const & hslMin(size_t i) const
Definition: HSL_Space.h:41
-
double const & sMin() const
Definition: HSL_Space.h:43
-
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
Definition: utility.h:45
-
void colorTransformate(HSLf_Space const &in, HSLf_Space *out)
HSLf_Space to HSLf_Space
Definition: HSL_Space.h:85
-
double const & r() const
Definition: RGB_Space.h:114
-
doubleconst & max(size_t id) const
Return the maximum of the i -th channel.
Definition: Color3_Space.h:107
-
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Definition: YUV_Space.h:21
-
Base class of color space with 3 channels.
Definition: Color3_Space.h:18
- -
3D's vector
Definition: Vectors.h:258
-
double const & hMax() const
Definition: HSL_Space.h:46
-
double const & gMin() const
Definition: RGB_Space.h:107
-
HSLf_Space operator/(double const &c) const
Definition: HSL_Space.h:74
-
double const & lMax() const
Definition: HSL_Space.h:48
-
以整數 Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:19
-
HSLf_Space(double c)
Definition: HSL_Space.h:28
-
double & sGet()
Definition: HSL_Space.h:59
- -
double const & bMax() const
Definition: RGB_Space.h:112
-
double const & rMax() const
Definition: RGB_Space.h:110
-
double const & hslMax(size_t i) const
Definition: HSL_Space.h:45
-
double const & lMin() const
Definition: HSL_Space.h:44
-
double const & sMax() const
Definition: HSL_Space.h:47
-
static const double PI
圓周率...
Definition: utility.h:12
- -
HSLf_Space operator+(HSLf_Space const &b) const
Definition: HSL_Space.h:65
-
double const & gMax() const
Definition: RGB_Space.h:111
-
double const & b() const
Definition: RGB_Space.h:116
-
double const & g() const
Definition: RGB_Space.h:115
-
double const & bMin() const
Definition: RGB_Space.h:108
-
double const & l(double c)
Definition: HSL_Space.h:56
-
Color3_Space< double > & copyFrom(Color3_Space< double > const &b)
Copy method.
Definition: Color3_Space.h:54
-
double operator*(HSLf_Space const &b) const
Definition: HSL_Space.h:77
-
HSLf_Space operator-(HSLf_Space const &b) const
Definition: HSL_Space.h:68
-
double const & hMin() const
Definition: HSL_Space.h:42
-
double const & hsl(size_t i, double c)
Definition: HSL_Space.h:53
-
doubleconst & val(size_t id) const
Return the value of the i -th channel.
Definition: Color3_Space.h:117
-
Vector3D< double > val_
Definition: Color3_Space.h:22
-
double const & s(double c)
Definition: HSL_Space.h:55
-
double const & s() const
Definition: HSL_Space.h:51
-
-
- - - - - diff --git a/doc/html/HSV_8h.html b/doc/html/HSV_8h.html deleted file mode 100644 index 20d7bb4..0000000 --- a/doc/html/HSV_8h.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSV.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HSV.h File Reference
-
-
-
#include "RGB.h"
-#include "YUV.h"
-#include "HSL.h"
-#include "HSV.hpp"
-
-

Go to the source code of this file.

- - - - - - -

-Classes

class  meow::HSV< T >
 
class  meow::HSVf
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - - - - - - - -

-Functions

template<class RGB_T , class HSV_T >
void meow::RGB_to_HSV (RGB< RGB_T > const &rgb, HSV< HSV_T > *hsv)
 
template<class HSV_T , class RGB_T >
void meow::HSV_to_RGB (HSV< HSV_T > const &hsv, RGB< RGB_T > *rgb)
 
template<class YUV_T , class HSV_T >
void meow::YUV_to_HSV (YUV< YUV_T > const &yuv, HSV< HSV_T > *hsv)
 
template<class HSV_T , class YUV_T >
void meow::HSV_to_YUV (HSV< HSV_T > const &hsv, YUV< YUV_T > *yuv)
 
template<class HSL_T , class HSV_T >
void meow::HSL_to_HSV (HSL< HSL_T > const &hsl, HSV< HSV_T > *hsv)
 
template<class HSV_T , class HSL_T >
void meow::HSV_to_HSL (HSV< HSV_T > const &hsv, HSL< HSL_T > *hsl)
 
-
-
- - - - - diff --git a/doc/html/HSV_8h.js b/doc/html/HSV_8h.js deleted file mode 100644 index b5aa0d3..0000000 --- a/doc/html/HSV_8h.js +++ /dev/null @@ -1,11 +0,0 @@ -var HSV_8h = -[ - [ "HSV", "classmeow_1_1HSV.html", "classmeow_1_1HSV" ], - [ "HSVf", "classmeow_1_1HSVf.html", "classmeow_1_1HSVf" ], - [ "HSL_to_HSV", "HSV_8h.html#a7c7d8533654e56cfd37a1ce22e76cde8", null ], - [ "HSV_to_HSL", "HSV_8h.html#a0ba8115cbe1d3c7bc41899a0035f9003", null ], - [ "HSV_to_RGB", "HSV_8h.html#a5500d712d9a2fb7efcc1574474e94f67", null ], - [ "HSV_to_YUV", "HSV_8h.html#a74a4a3629d0406ef3d0e8bbb73dfaaeb", null ], - [ "RGB_to_HSV", "HSV_8h.html#a58776e88aeb6bec45c2201cb70edda5d", null ], - [ "YUV_to_HSV", "HSV_8h.html#afc93890f332ecc0a7c081a1a1343d656", null ] -]; \ No newline at end of file diff --git a/doc/html/HSV_8h_source.html b/doc/html/HSV_8h_source.html deleted file mode 100644 index a1d3ebd..0000000 --- a/doc/html/HSV_8h_source.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSV.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HSV.h
-
-
-Go to the documentation of this file.
1 #ifndef HSV_H_
-
2 #define HSV_H_
-
3 
-
4 #include "RGB.h"
-
5 #include "YUV.h"
-
6 #include "HSL.h"
-
7 
-
8 namespace meow{
-
9  template<class T> class HSV{
-
10  protected:
-
11  T hsv_[3];
-
12  HSV();
-
13  HSV(T const& h, T const& s, T const& v);
-
14  HSV(T const* hsv);
-
15  public:
-
16  virtual ~HSV(){ }
-
18  virtual T hMax() const = 0;
-
19  virtual T hMin() const = 0;
-
20  virtual T sMax() const = 0;
-
21  virtual T sMin() const = 0;
-
22  virtual T vMax() const = 0;
-
23  virtual T vMin() const = 0;
-
25  T h() const;
-
26  T s() const;
-
27  T v() const;
-
28  T hsv(size_t i) const;
-
29  T vsh(size_t i) const;
-
31  T h(T const& val);
-
32  T s(T const& val);
-
33  T v(T const& val);
-
34  T hsv(size_t i, T const& val);
-
35  T vsh(size_t i, T const& val);
-
36  };
-
37 
-
38  class HSVf: public HSV<double>{
-
39  public:
-
40  HSVf();
-
41  ~HSVf();
-
42  HSVf(double const&h,double const&s,double const&v);
-
43  HSVf(double const* hsv);
-
44  double hMin() const;
-
45  double hMax() const;
-
46  double sMin() const;
-
47  double sMax() const;
-
48  double vMin() const;
-
49  double vMax() const;
-
50  };
-
51 
-
52  template<class RGB_T, class HSV_T> inline void RGB_to_HSV(
-
53  RGB<RGB_T> const& rgb,
-
54  HSV<HSV_T> * hsv);
-
55  template<class HSV_T, class RGB_T> inline void HSV_to_RGB(
-
56  HSV<HSV_T> const& hsv,
-
57  RGB<RGB_T> * rgb);
-
58  template<class YUV_T, class HSV_T> inline void YUV_to_HSV(
-
59  YUV<YUV_T> const& yuv,
-
60  HSV<HSV_T> * hsv);
-
61  template<class HSV_T, class YUV_T> inline void HSV_to_YUV(
-
62  HSV<HSV_T> const& hsv,
-
63  YUV<YUV_T> * yuv);
-
64  template<class HSL_T, class HSV_T> inline void HSL_to_HSV(
-
65  HSL<HSL_T> const& hsl,
-
66  HSV<HSV_T> * hsv);
-
67  template<class HSV_T, class HSL_T> inline void HSV_to_HSL(
-
68  HSV<HSV_T> const& hsv,
-
69  HSL<HSL_T> * hsl);
-
70 }
-
71 
-
72 #include "HSV.hpp"
-
73 
-
74 #endif // HSV_H_
- -
virtual ~HSV()
Definition: HSV.h:16
-
T h() const
Definition: HSV.hpp:18
-
void RGB_to_HSV(RGB< RGB_T > const &rgb, HSV< HSV_T > *hsv)
Definition: HSV.hpp:53
- -
T s() const
Definition: HSV.hpp:19
-
virtual T hMax() const =0
-
void HSV_to_YUV(HSV< HSV_T > const &hsv, YUV< YUV_T > *yuv)
Definition: HSV.hpp:103
-
virtual T sMin() const =0
-
Definition: HSV.h:38
-
virtual T vMax() const =0
-
Definition: RGB.h:5
-
Definition: HSV.h:9
-
~HSVf()
Definition: HSV.hpp:40
-
double sMax() const
Definition: HSV.hpp:46
-
T hsv(size_t i) const
Definition: HSV.hpp:21
-
Definition: YUV.h:7
-
void HSV_to_RGB(HSV< HSV_T > const &hsv, RGB< RGB_T > *rgb)
Definition: HSV.hpp:74
-
double hMax() const
Definition: HSV.hpp:44
-
void HSL_to_HSV(HSL< HSL_T > const &hsl, HSV< HSV_T > *hsv)
Definition: HSV.hpp:110
-
Definition: HSL.h:8
-
T hsv_[3]
Definition: HSV.h:11
-
void YUV_to_HSV(YUV< YUV_T > const &yuv, HSV< HSV_T > *hsv)
Definition: HSV.hpp:96
-
virtual T hMin() const =0
-
virtual T sMax() const =0
-
HSV()
Definition: HSV.hpp:10
-
T v() const
Definition: HSV.hpp:20
-
double sMin() const
Definition: HSV.hpp:45
-
virtual T vMin() const =0
-
double hMin() const
Definition: HSV.hpp:43
-
T vsh(size_t i) const
Definition: HSV.hpp:24
- -
double vMin() const
Definition: HSV.hpp:47
-
HSVf()
Definition: HSV.hpp:39
-
double vMax() const
Definition: HSV.hpp:48
-
void HSV_to_HSL(HSV< HSV_T > const &hsv, HSL< HSL_T > *hsl)
Definition: HSV.hpp:117
- -
-
- - - - - diff --git a/doc/html/HSV_8hpp.html b/doc/html/HSV_8hpp.html deleted file mode 100644 index bf38f10..0000000 --- a/doc/html/HSV_8hpp.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSV.hpp File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HSV.hpp File Reference
-
-
-
#include "HSV.h"
-#include "RGB.h"
-#include "YUV.h"
-#include "HSL.h"
-#include "../utility.h"
-
-

Go to the source code of this file.

- - - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - - - - - - - -

-Functions

template<class RGB_T , class HSV_T >
void meow::RGB_to_HSV (RGB< RGB_T > const &rgb, HSV< HSV_T > *hsv)
 
template<class HSV_T , class RGB_T >
void meow::HSV_to_RGB (HSV< HSV_T > const &hsv, RGB< RGB_T > *rgb)
 
template<class YUV_T , class HSV_T >
void meow::YUV_to_HSV (YUV< YUV_T > const &yuv, HSV< HSV_T > *hsv)
 
template<class HSV_T , class YUV_T >
void meow::HSV_to_YUV (HSV< HSV_T > const &hsv, YUV< YUV_T > *yuv)
 
template<class HSL_T , class HSV_T >
void meow::HSL_to_HSV (HSL< HSL_T > const &hsl, HSV< HSV_T > *hsv)
 
template<class HSV_T , class HSL_T >
void meow::HSV_to_HSL (HSV< HSV_T > const &hsv, HSL< HSL_T > *hsl)
 
-
-
- - - - - diff --git a/doc/html/HSV_8hpp.js b/doc/html/HSV_8hpp.js deleted file mode 100644 index e0c5d6b..0000000 --- a/doc/html/HSV_8hpp.js +++ /dev/null @@ -1,9 +0,0 @@ -var HSV_8hpp = -[ - [ "HSL_to_HSV", "HSV_8hpp.html#a7c7d8533654e56cfd37a1ce22e76cde8", null ], - [ "HSV_to_HSL", "HSV_8hpp.html#a0ba8115cbe1d3c7bc41899a0035f9003", null ], - [ "HSV_to_RGB", "HSV_8hpp.html#a5500d712d9a2fb7efcc1574474e94f67", null ], - [ "HSV_to_YUV", "HSV_8hpp.html#a74a4a3629d0406ef3d0e8bbb73dfaaeb", null ], - [ "RGB_to_HSV", "HSV_8hpp.html#a58776e88aeb6bec45c2201cb70edda5d", null ], - [ "YUV_to_HSV", "HSV_8hpp.html#afc93890f332ecc0a7c081a1a1343d656", null ] -]; \ No newline at end of file diff --git a/doc/html/HSV_8hpp_source.html b/doc/html/HSV_8hpp_source.html deleted file mode 100644 index 0036827..0000000 --- a/doc/html/HSV_8hpp_source.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSV.hpp Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HSV.hpp
-
-
-Go to the documentation of this file.
1 #include "HSV.h"
-
2 
-
3 #include "RGB.h"
-
4 #include "YUV.h"
-
5 #include "HSL.h"
-
6 
-
7 #include "../utility.h"
-
8 
-
9 namespace meow{
-
10  template<class T> inline HSV<T>::HSV(){ }
-
11  template<class T> inline HSV<T>::HSV(T const& h, T const& s, T const& v){
-
12  hsv_[0] = h; hsv_[1] = s; hsv_[2] = v;
-
13  }
-
14  template<class T> inline HSV<T>::HSV(T const* hsv){
-
15  for(int i = 0; i < 3; i++) hsv_[i] = hsv[i];
-
16  }
-
17 
-
18  template<class T> inline T HSV<T>::h() const { return hsv_[0]; }
-
19  template<class T> inline T HSV<T>::s() const { return hsv_[1]; }
-
20  template<class T> inline T HSV<T>::v() const { return hsv_[2]; }
-
21  template<class T> inline T HSV<T>::hsv(size_t i) const {
-
22  return hsv_[std::min((size_t)3 - 1, i)];
-
23  }
-
24  template<class T> inline T HSV<T>::vsh(size_t i)const{return hsv(2-i);}
-
25  template<class T> inline T HSV<T>::h(T const& val){return (hsv_[0]=val);}
-
26  template<class T> inline T HSV<T>::s(T const& val){return (hsv_[1]=val);}
-
27  template<class T> inline T HSV<T>::v(T const& val){return (hsv_[2]=val);}
-
28  template<class T> inline T HSV<T>::hsv(size_t i, T const& val){
-
29  return (hsv_[std::min((size_t)3 - 1, i)] = val);
-
30  }
-
31  template<class T> inline T HSV<T>::vsh(size_t i, T const& val){
-
32  return hsv(2 - i, val);
-
33  }
-
34 
-
35 
-
36 
-
37 
-
38 
-
39  inline HSVf:: HSVf(): HSV(){ }
-
40  inline HSVf::~HSVf(){ }
-
41  inline HSVf::HSVf(double const&h,double const&s,double const&v):HSV(h,s,v){}
-
42  inline HSVf::HSVf(double const* hsv):HSV(hsv){}
-
43  inline double HSVf::hMin() const { return 0.0; }
-
44  inline double HSVf::hMax() const { return 2.0 * PI; }
-
45  inline double HSVf::sMin() const { return 0.0; }
-
46  inline double HSVf::sMax() const { return 1.0; }
-
47  inline double HSVf::vMin() const { return 0.0; }
-
48  inline double HSVf::vMax() const { return 1.0; }
-
49 
-
50 
-
51 
-
52 
-
53  template<class RGB_T, class HSV_T> inline void RGB_to_HSV(
-
54  RGB<RGB_T> const& rgb,
-
55  HSV<HSV_T> * hsv){
-
56  double r = normalize(rgb.rMin(), rgb.rMax(), rgb.r());
-
57  double g = normalize(rgb.gMin(), rgb.gMax(), rgb.g());
-
58  double b = normalize(rgb.bMin(), rgb.bMax(), rgb.b());
-
59  double mx = std::max(std::max(r, g), b);
-
60  double mn = std::min(std::min(r, g), b);
-
61  double h, s, v;
-
62  if (mx == mn ) h = 0;
-
63  else if(mx == r && g >= b) h = PI/3.0 * (g-b) / (mx-mn);
-
64  else if(mx == r && g < b) h = PI/3.0 * (g-b) / (mx-mn) + PI * 2.0;
-
65  else if(mx == g ) h = PI/3.0 * (b-r) / (mx-mn) + PI/3.0*2.0;
-
66  else h = PI/3.0 * (r-g) / (mx-mn) + PI/3.0*4.0;
-
67  if(mx == 0) s = 0;
-
68  else s = 1 - mn / mx;
-
69  v = mx;
-
70  hsv->h(h);
-
71  hsv->s(s);
-
72  hsv->v(v);
-
73  }
-
74  template<class HSV_T, class RGB_T> inline void HSV_to_RGB(
-
75  HSV<HSV_T> const& hsv,
-
76  RGB<RGB_T> * rgb){
-
77  double h = normalize(hsv.hMin(), hsv.hMax(), hsv.h()) * 360;
-
78  double s = normalize(hsv.sMin(), hsv.sMax(), hsv.s());
-
79  double v = normalize(hsv.vMin(), hsv.vMax(), hsv.v());
-
80  int hi = (int)h / 60 % 6;
-
81  double f = h / 60.0 - hi;
-
82  double p = v * (1 - s);
-
83  double q = v * (1 - f * s);
-
84  double t = v * (1 - (1 - f) * s);
-
85  double r, g, b;
-
86  if (hi == 0){ r = v; g = t; b = p; }
-
87  else if(hi == 1){ r = q; g = v; b = p; }
-
88  else if(hi == 2){ r = p; g = v; b = t; }
-
89  else if(hi == 3){ r = p; g = q; b = v; }
-
90  else if(hi == 4){ r = t; g = p; b = v; }
-
91  else { r = v; g = p; b = q; }
-
92  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), r));
-
93  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), g));
-
94  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), b));
-
95  }
-
96  template<class YUV_T, class HSV_T> inline void YUV_to_HSV(
-
97  YUV<YUV_T> const& yuv,
-
98  HSV<HSV_T> * hsv){
-
99  RGBf tmp;
-
100  YUV_to_RGB(yuv, &tmp);
-
101  RGB_to_HSV(tmp, hsv);
-
102  }
-
103  template<class HSV_T, class YUV_T> inline void HSV_to_YUV(
-
104  HSV<HSV_T> const& hsv,
-
105  YUV<YUV_T> * yuv){
-
106  RGBf tmp;
-
107  HSV_to_RGB(hsv, &tmp);
-
108  RGB_to_YUV(tmp, yuv);
-
109  }
-
110  template<class HSL_T, class HSV_T> inline void HSL_to_HSV(
-
111  HSL<HSL_T> const& hsl,
-
112  HSV<HSV_T> * hsv){
-
113  RGBf tmp;
-
114  HSL_to_RGB(hsl, &tmp);
-
115  RGB_to_HSV(tmp, hsv);
-
116  }
-
117  template<class HSV_T, class HSL_T> inline void HSV_to_HSL(
-
118  HSV<HSV_T> const& hsv,
-
119  HSL<HSL_T> * hsl){
-
120  RGBf tmp;
-
121  HSV_to_RGB(hsv, &tmp);
-
122  RGB_to_HSL(tmp, hsl);
-
123  }
-
124 }
- -
virtual T rMax() const =0
-
T h() const
Definition: HSV.hpp:18
-
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
Definition: utility.h:27
-
void RGB_to_HSV(RGB< RGB_T > const &rgb, HSV< HSV_T > *hsv)
Definition: HSV.hpp:53
- -
T s() const
Definition: HSV.hpp:19
-
virtual T hMax() const =0
-
void HSV_to_YUV(HSV< HSV_T > const &hsv, YUV< YUV_T > *yuv)
Definition: HSV.hpp:103
-
virtual T sMin() const =0
-
virtual T bMax() const =0
-
void HSL_to_RGB(HSL< HSL_T > const &hsl, RGB< RGB_T > *rgb)
Definition: HSL.hpp:74
-
virtual T vMax() const =0
-
Definition: RGB.h:5
-
Definition: HSV.h:9
-
T r() const
Definition: RGB.hpp:14
-
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
Definition: utility.h:35
-
virtual T bMin() const =0
-
Definition: RGB.h:34
-
~HSVf()
Definition: HSV.hpp:40
-
double sMax() const
Definition: HSV.hpp:46
-
T hsv(size_t i) const
Definition: HSV.hpp:21
-
Definition: YUV.h:7
-
void RGB_to_YUV(RGB< RGB_T > const &rgb, YUV< YUV_T > *yuv)
Definition: YUV.hpp:47
-
void HSV_to_RGB(HSV< HSV_T > const &hsv, RGB< RGB_T > *rgb)
Definition: HSV.hpp:74
-
double hMax() const
Definition: HSV.hpp:44
-
void HSL_to_HSV(HSL< HSL_T > const &hsl, HSV< HSV_T > *hsv)
Definition: HSV.hpp:110
-
Definition: HSL.h:8
-
void YUV_to_RGB(YUV< YUV_T > const &yuv, RGB< RGB_T > *rgb)
Definition: YUV.hpp:60
-
void YUV_to_HSV(YUV< YUV_T > const &yuv, HSV< HSV_T > *hsv)
Definition: HSV.hpp:96
-
virtual T hMin() const =0
-
virtual T sMax() const =0
-
HSV()
Definition: HSV.hpp:10
-
T v() const
Definition: HSV.hpp:20
-
virtual T gMax() const =0
-
double sMin() const
Definition: HSV.hpp:45
-
static const double PI
圓周率...
Definition: utility.h:12
-
virtual T rMin() const =0
-
virtual T vMin() const =0
-
T g() const
Definition: RGB.hpp:15
-
virtual T gMin() const =0
-
double hMin() const
Definition: HSV.hpp:43
-
T vsh(size_t i) const
Definition: HSV.hpp:24
-
void RGB_to_HSL(RGB< RGB_T > const &rgb, HSL< HSL_T > *hsl)
Definition: HSL.hpp:52
-
double vMin() const
Definition: HSV.hpp:47
-
T b() const
Definition: RGB.hpp:16
-
HSVf()
Definition: HSV.hpp:39
-
double vMax() const
Definition: HSV.hpp:48
- -
void HSV_to_HSL(HSV< HSV_T > const &hsv, HSL< HSL_T > *hsl)
Definition: HSV.hpp:117
- - -
-
- - - - - diff --git a/doc/html/HSV__Space_8h.html b/doc/html/HSV__Space_8h.html deleted file mode 100644 index b323149..0000000 --- a/doc/html/HSV__Space_8h.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSV_Space.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HSV_Space.h File Reference
-
-
-
#include "Color3_Space.h"
-#include "../geo/Vectors.h"
-#include "RGB_Space.h"
-#include "YUV_Space.h"
-#include "HSL_Space.h"
-#include "../math/utility.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::HSVf_Space
 以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間 More...
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Functions

void meow::colorTransformate (HSVf_Space const &in, HSVf_Space *out)
 HSVf_Space to HSVf_Space More...
 
void meow::colorTransformate (RGBf_Space const &rgb, HSVf_Space *hsv)
 RGBf_Space to HSVf_Space More...
 
void meow::colorTransformate (YUVf_Space const &yuv, HSVf_Space *hsv)
 YUVf_Space to HSVf_Space More...
 
void meow::colorTransformate (HSLf_Space const &hsl, HSVf_Space *hsv)
 HSLf_Space to HSVf_Space More...
 
void meow::colorTransformate (HSVf_Space const &hsv, RGBf_Space *rgb)
 HSVf_Space to RGBf_Space More...
 
void meow::colorTransformate (HSVf_Space const &hsv, YUVf_Space *yuv)
 HSVf_Space to YUVf_Space More...
 
void meow::colorTransformate (HSVf_Space const &hsv, HSLf_Space *hsl)
 HSVf_Space to HSLf_Space More...
 
void meow::colorTransformate (HSVf_Space const &hsv, RGBi_Space *rgb)
 HSVf_Space to RGBi_Space More...
 
void meow::colorTransformate (RGBi_Space const &rgb, HSVf_Space *hsv)
 RGBi_Space to HSVf_Space More...
 
-
-
- - - - - diff --git a/doc/html/HSV__Space_8h.js b/doc/html/HSV__Space_8h.js deleted file mode 100644 index 08cb281..0000000 --- a/doc/html/HSV__Space_8h.js +++ /dev/null @@ -1,13 +0,0 @@ -var HSV__Space_8h = -[ - [ "HSVf_Space", "classmeow_1_1HSVf__Space.html", "classmeow_1_1HSVf__Space" ], - [ "colorTransformate", "HSV__Space_8h.html#a7611fd0d38c6dd2aa3eea58a96ccb2b7", null ], - [ "colorTransformate", "HSV__Space_8h.html#a1591a113b022322f1119894a83a56625", null ], - [ "colorTransformate", "HSV__Space_8h.html#ad01fb20ad0ae3932e408c06ad80f7b1e", null ], - [ "colorTransformate", "HSV__Space_8h.html#a19e830f03459a25435ff963551772e74", null ], - [ "colorTransformate", "HSV__Space_8h.html#a2f627a58a3394af709ddc8114b4b5286", null ], - [ "colorTransformate", "HSV__Space_8h.html#a930aec4a586b79b076e64541f3a96cc7", null ], - [ "colorTransformate", "HSV__Space_8h.html#ae5a2c4f9f20fe94d8fcd378a86e05260", null ], - [ "colorTransformate", "HSV__Space_8h.html#a303120584f2d7e474096da63bec4cdf5", null ], - [ "colorTransformate", "HSV__Space_8h.html#a0239dc74535f528644a22e3e86e5221c", null ] -]; \ No newline at end of file diff --git a/doc/html/HSV__Space_8h_source.html b/doc/html/HSV__Space_8h_source.html deleted file mode 100644 index 5201fa1..0000000 --- a/doc/html/HSV__Space_8h_source.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/HSV_Space.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HSV_Space.h
-
-
-Go to the documentation of this file.
1 #ifndef colors_HSV_Space_H__
-
2 #define colors_HSV_Space_H__
-
3 
-
4 #include "Color3_Space.h"
-
5 #include "../geo/Vectors.h"
-
6 
-
7 #include "RGB_Space.h"
-
8 #include "YUV_Space.h"
-
9 #include "HSL_Space.h"
-
10 #include "../math/utility.h"
-
11 
-
12 #include <cstdlib>
-
13 
-
14 namespace meow {
-
15 
-
23 class HSVf_Space: public Color3_Space<double> {
-
24 public:
- -
26  Vector3D<double>(PI*2.0, 1.0, 1.0),
-
27  Vector3D<double>( 0.0, 0.0, 0.0)) {
-
28  }
-
29  HSVf_Space(double c): Color3_Space<double>(Vector3D<double>( 0.0, 0.0, 0.0),
-
30  Vector3D<double>(PI*2.0, 1.0, 1.0),
-
31  Vector3D<double>( c, c, c))
-
32  { }
- -
34  Color3_Space<double>(Vector3D<double>(0.0, 0.0, 0.0),
-
35  Vector3D<double>(1.0, 1.0, 1.0),
-
36  Vector3D<double>(v)) {
-
37  }
-
38  HSVf_Space(HSV_Space const& b): Color3_Space<double>(b) {
-
39  }
- -
41  }
-
42  double const& hsvMin(size_t i) const { return min(i); }
-
43  double const& hMin( ) const { return min(0); }
-
44  double const& sMin( ) const { return min(1); }
-
45  double const& vMin( ) const { return min(2); }
-
46  double const& hsvMax(size_t i) const { return max(i); }
-
47  double const& hMax( ) const { return max(0); }
-
48  double const& sMax( ) const { return max(1); }
-
49  double const& vMax( ) const { return max(2); }
-
50  double const& hsv(size_t i) const { return val(i); }
-
51  double const& h( ) const { return hsv(0); }
-
52  double const& s( ) const { return hsv(1); }
-
53  double const& v( ) const { return hsv(2); }
-
54  double const& hsv(size_t i, double c) { return val(i, c); }
-
55  double const& h( double c) { return hsv(0, c); }
-
56  double const& s( double c) { return hsv(1, c); }
-
57  double const& v( double c) { return hsv(2, c); }
-
58  double& hsvGet(size_t i) { return valGet(i); }
-
59  double& hGet( ) { return hsvGet(0); }
-
60  double& sGet( ) { return hsvGet(1); }
-
61  double& vGet( ) { return hsvGet(2); }
- -
63  copyFrom(b);
-
64  return *this;
-
65  }
-
66  HSVf_Space operator+(HSVf_Space const& b) const {
-
67  return HSVf_Space(val_ + b.val_);
-
68  }
-
69  HSVf_Space operator-(HSVf_Space const& b) const {
-
70  return HSVf_Space(val_ - b.val_);
-
71  }
-
72  HSVf_Space operator*(double const& c) const {
-
73  return HSVf_Space(val_ * c);
-
74  }
-
75  HSVf_Space operator/(double const& c) const {
-
76  return HSVf_Space(val_ / c);
-
77  }
-
78  double operator*(HSVf_Space const& b) const {
-
79  return val_ * b.val_;
-
80  }
-
81 };
-
82 
-
86 inline void colorTransformate(HSVf_Space const& in, HSVf_Space* out) {
-
87  *out = in;
-
88 }
-
89 
-
93 inline void colorTransformate(RGBf_Space const& rgb, HSVf_Space* hsv) {
-
94  double r = normalize(rgb.rMin(), rgb.rMax(), rgb.r());
-
95  double g = normalize(rgb.gMin(), rgb.gMax(), rgb.g());
-
96  double b = normalize(rgb.bMin(), rgb.bMax(), rgb.b());
-
97  double mx = std::max(std::max(r, g), b);
-
98  double mn = std::min(std::min(r, g), b);
-
99  double h, s, v;
-
100  if (mx == mn ) h = 0;
-
101  else if(mx == r && g >= b) h = PI/3.0 * (g-b) / (mx-mn);
-
102  else if(mx == r && g < b) h = PI/3.0 * (g-b) / (mx-mn) + PI * 2.0;
-
103  else if(mx == g ) h = PI/3.0 * (b-r) / (mx-mn) + PI/3.0*2.0;
-
104  else h = PI/3.0 * (r-g) / (mx-mn) + PI/3.0*4.0;
-
105  if(mx == 0) s = 0;
-
106  else s = 1 - mn / mx;
-
107  v = mx;
-
108  hsv->h(h);
-
109  hsv->s(s);
-
110  hsv->v(v);
-
111 }
-
112 
-
116 inline void colorTransformate(YUVf_Space const& yuv, HSVf_Space* hsv) {
-
117  RGBf_Space tmp;
-
118  colorTransformate( yuv, &tmp);
-
119  colorTransformate(*tmp, hsv);
-
120 }
-
121 
-
125 inline void colorTransformate(HSLf_Space const& hsl, HSVf_Space* hsv) {
-
126  RGBf_Space tmp;
-
127  colorTransformate( hsl, &tmp);
-
128  colorTransformate(*tmp, hsv);
-
129 }
-
130 
-
134 inline void colorTransformate(HSVf_Space const& hsv, RGBf_Space* rgb) {
-
135  double h = normalize(hsv.hMin(), hsv.hMax(), hsv.h()) * 360;
-
136  double s = normalize(hsv.sMin(), hsv.sMax(), hsv.s());
-
137  double v = normalize(hsv.vMin(), hsv.vMax(), hsv.v());
-
138  int hi = (int)h / 60 % 6;
-
139  double f = h / 60.0 - hi;
-
140  double p = v * (1 - s);
-
141  double q = v * (1 - f * s);
-
142  double t = v * (1 - (1 - f) * s);
-
143  double r, g, b;
-
144  if (hi == 0){ r = v; g = t; b = p; }
-
145  else if(hi == 1){ r = q; g = v; b = p; }
-
146  else if(hi == 2){ r = p; g = v; b = t; }
-
147  else if(hi == 3){ r = p; g = q; b = v; }
-
148  else if(hi == 4){ r = t; g = p; b = v; }
-
149  else { r = v; g = p; b = q; }
-
150  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), r));
-
151  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), g));
-
152  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), b));
-
153 }
-
154 
-
158 inline void colorTransformate(HSVf_Space const& hsv, YUVf_Space* yuv) {
-
159  RGBf_Space tmp;
-
160  colorTransformate( hsv, &tmp);
-
161  colorTransformate(*tmp, yuv);
-
162 }
-
163 
-
167 inline void colorTransformate(HSVf_Space const& hsv, HSLf_Space* hsl) {
-
168  RGBf_Space tmp;
-
169  colorTransformate( hsv, &tmp);
-
170  colorTransformate(*tmp, hsl);
-
171 }
-
172 
-
176 inline void colorTransformate(HSVf_Space const& hsv, RGBi_Space* rgb) {
-
177  RGBf_Space tmp;
-
178  colorTransformate(hsv, &tmp);
-
179  rgb->copyFrom(tmp);
-
180 }
-
181 
-
182 
-
186 inline void colorTransformate(RGBi_Space const& rgb, HSVf_Space* hsv) {
-
187  RGBf_Space tmp;
-
188  tmp.copyFrom(rgb);
-
189  colorTransformate(rgb, hsv);
-
190 }
-
191 
-
192 } // meow
-
193 
-
194 
-
195 #endif // colors_HSV_Space_H__
-
double & sGet()
Definition: HSV_Space.h:60
-
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
Definition: utility.h:37
-
double const & rMin() const
Definition: RGB_Space.h:106
-
double const & hsvMin(size_t i) const
Definition: HSV_Space.h:42
-
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Definition: HSL_Space.h:22
- - -
HSVf_Space & operator=(HSVf_Space const &b)
Definition: HSV_Space.h:62
-
以浮點數Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:86
-
HSVf_Space(double c)
Definition: HSV_Space.h:29
- -
doubleconst & min(size_t id) const
Return the minimum of the i -th channel.
Definition: Color3_Space.h:99
- -
double & valGet(size_t id)
Get the non-constant reference of value of the i -th channel.
Definition: Color3_Space.h:139
-
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
Definition: utility.h:45
-
double const & sMin() const
Definition: HSV_Space.h:44
-
void colorTransformate(HSLf_Space const &in, HSLf_Space *out)
HSLf_Space to HSLf_Space
Definition: HSL_Space.h:85
-
double const & r() const
Definition: RGB_Space.h:114
-
HSVf_Space operator/(double const &c) const
Definition: HSV_Space.h:75
-
doubleconst & max(size_t id) const
Return the maximum of the i -th channel.
Definition: Color3_Space.h:107
-
double const & s(double c)
Definition: HSV_Space.h:56
-
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Definition: YUV_Space.h:21
-
double const & hsv(size_t i) const
Definition: HSV_Space.h:50
-
double const & v() const
Definition: HSV_Space.h:53
-
Base class of color space with 3 channels.
Definition: Color3_Space.h:18
-
double const & h() const
Definition: HSV_Space.h:51
-
double const & hMin() const
Definition: HSV_Space.h:43
- - -
double const & hsv(size_t i, double c)
Definition: HSV_Space.h:54
-
3D's vector
Definition: Vectors.h:258
-
double const & gMin() const
Definition: RGB_Space.h:107
-
double const & s() const
Definition: HSV_Space.h:52
-
以整數 Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:19
- -
double const & bMax() const
Definition: RGB_Space.h:112
-
double const & rMax() const
Definition: RGB_Space.h:110
-
double operator*(HSVf_Space const &b) const
Definition: HSV_Space.h:78
-
double const & vMin() const
Definition: HSV_Space.h:45
-
double const & v(double c)
Definition: HSV_Space.h:57
-
double const & vMax() const
Definition: HSV_Space.h:49
-
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Definition: HSV_Space.h:23
-
double & hsvGet(size_t i)
Definition: HSV_Space.h:58
-
static const double PI
圓周率...
Definition: utility.h:12
-
double const & sMax() const
Definition: HSV_Space.h:48
-
double const & hMax() const
Definition: HSV_Space.h:47
-
HSVf_Space operator-(HSVf_Space const &b) const
Definition: HSV_Space.h:69
-
double const & h(double c)
Definition: HSV_Space.h:55
-
double const & hsvMax(size_t i) const
Definition: HSV_Space.h:46
-
double const & gMax() const
Definition: RGB_Space.h:111
-
double & vGet()
Definition: HSV_Space.h:61
-
HSVf_Space(HSV_Space const &b)
Definition: HSV_Space.h:38
-
HSVf_Space operator+(HSVf_Space const &b) const
Definition: HSV_Space.h:66
-
double const & b() const
Definition: RGB_Space.h:116
-
double const & g() const
Definition: RGB_Space.h:115
-
double const & bMin() const
Definition: RGB_Space.h:108
-
double & hGet()
Definition: HSV_Space.h:59
-
Color3_Space< double > & copyFrom(Color3_Space< double > const &b)
Copy method.
Definition: Color3_Space.h:54
- -
doubleconst & val(size_t id) const
Return the value of the i -th channel.
Definition: Color3_Space.h:117
-
Vector3D< double > val_
Definition: Color3_Space.h:22
-
HSVf_Space operator*(double const &c) const
Definition: HSV_Space.h:72
-
HSVf_Space(Vector3D< double > const &v)
Definition: HSV_Space.h:33
-
-
- - - - - diff --git a/doc/html/HashTable_8h.html b/doc/html/HashTable_8h.html deleted file mode 100644 index 270e135..0000000 --- a/doc/html/HashTable_8h.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/HashTable.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
HashTable.h File Reference
-
-
-
#include <vector>
-#include <list>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::HashTableList< Data, HashFunc >
 一個當key相撞時會用list解決的hash_table More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/HashTable_8h_source.html b/doc/html/HashTable_8h_source.html deleted file mode 100644 index 7af72aa..0000000 --- a/doc/html/HashTable_8h_source.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/HashTable.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
HashTable.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_HashTable_H__
-
2 #define dsa_HashTable_H__
-
3 
-
4 #include <vector>
-
5 #include <list>
-
6 
-
7 namespace meow {
-
8 
-
14 template<class Data, class HashFunc>
- -
16 private:
-
17  std::vector<std::list<Data> > table_;
-
18  HashFunc func_;
-
19 public:
- -
24  }
-
25 
-
31  HashTableList(size_t size, HashFunc const& func): table_(size), func_(func) {
-
32  }
-
33 
- -
38  }
-
39 
- -
44  table_ = b.table_;
-
45  func_ = b.func_;
-
46  return *this;
-
47  }
-
48 
-
52  void clear() {
-
53  for (size_t i = 0, I = table_.size(); i < I; i++) {
-
54  table_[i].clear();
-
55  }
-
56  }
-
57 
-
61  void reset(size_t size, HashFunc const& func) {
-
62  table_.clear();
-
63  table_.resize(std::max(size, 1u));
-
64  func_ = func;
-
65  }
-
66 
-
70  size_t tableSize() const {
-
71  return table_.size();
-
72  }
-
73 
-
77  size_t size() const {
-
78  size_t ret = 0;
-
79  for (size_t i = 0, I = table_.size(); i < I; i++) {
-
80  ret += table_[i].size();
-
81  }
-
82  return ret;
-
83  }
-
84 
-
88  HashFunc const& func() const {
-
89  return func_;
-
90  }
-
91 
-
95  bool add(Data const& e) {
-
96  size_t index = func_(e) % size();
-
97  table_[index].push_back(e);
-
98  return true;
-
99  }
-
100 
-
104  bool add(HashTableList const& h) {
-
105  for (size_t i = 0, I = h.table_.size(); i < I; i++) {
-
106  for (std::list<Data>::const_iterator
-
107  it = h.table_[index].begin(); it != h.table_[index].end(); ++it) {
-
108  insert(*it);
-
109  }
-
110  }
-
111  return true;
-
112  }
-
113 
-
117  bool del(Data const& e) {
-
118  size_t index = func_(e) % size();
-
119  for (std::list<Data>::const_iterator
-
120  it = table_[index].begin(); it != table_[index].end(); ++it) {
-
121  if ((*it) == e) {
-
122  table_[index].erase(i);
-
123  return true;
-
124  }
-
125  }
-
126  return false;
-
127  }
-
128 
-
132  bool del(HashTableList const& h) {
-
133  if (size() > h.size()) {
-
134  for (size_t i = 0, I = h.table_.size(); i < I; i++) {
-
135  for (std::list<Data>::const_iterator
-
136  it = h.table_[index].begin(); it != h.table_[index].end(); ++it) {
-
137  erase(*it);
-
138  }
-
139  }
-
140  }
-
141  else {
-
142  for (size_t i = 0, I = table_.size(); i < I; i++) {
-
143  for (std::list<Data>::const_iterator
-
144  it = table_[index].begin(); it != table_[index].end(); ) {
-
145  if (h.exist(*it)) {
-
146  table_[index].erase(it);
-
147  }
-
148  else {
-
149  ++it;
-
150  }
-
151  }
-
152  }
-
153  }
-
154  return true;
-
155  }
-
156 
-
160  bool exist(Data const& e) const {
-
161  size_t index = func_(e) % size();
-
162  for (std::list<Data>::const_iterator
-
163  it = table_[index].begin(); it != table_[index].end(); ++it) {
-
164  if ((*it) == e)
-
165  return true;
-
166  }
-
167  return false;
-
168  }
-
169 
-
173  std::vector<Data> all() const {
-
174  std::vector<Data> ret;
-
175  for (size_t i = 0, I = table_.size(); i < I; i++) {
-
176  for (std::list<Data>::const_iterator
-
177  it = table_[i].begin(); it != table_[i].end(); ++it) {
-
178  ret.push_back(*it);
-
179  }
-
180  }
-
181  return ret;
-
182  }
-
183 
-
187  std::vector<Data> all(size_t index) const {
-
188  index %= table_.size();
-
189  std::vector<Data> ret;
-
190  for (std::list<Data>::const_iterator
-
191  it = table_[index].begin(); it != table_[index].end(); ++it) {
-
192  ret.push_back(*it);
-
193  }
-
194  return ret;
-
195  }
-
196 
- -
199  return copyFrom(h);
-
200  }
-
201 
- -
204  add(h);
-
205  return *this;
-
206  }
-
207 
- -
210  del(h);
-
211  return *this;
-
212  }
-
213 };
-
214 
-
215 } // meow
-
216 
-
217 #endif // dsa_HashTable_H__
-
std::vector< Data > all(size_t index) const
回傳所有存下來且key為index的資料
Definition: HashTable.h:187
-
bool del(HashTableList const &h)
刪除有出現在給定的的HashTableList中的element
Definition: HashTable.h:132
-
HashTableList()
constructor
Definition: HashTable.h:23
-
HashTableList(size_t size, HashFunc const &func)
constructor
Definition: HashTable.h:31
-
HashTableList & operator+=(HashTableList const &h)
same as add(h)
Definition: HashTable.h:203
-
HashTableList & operator-=(HashTableList const &h)
same as del(h)
Definition: HashTable.h:209
-
void clear()
清除資料
Definition: HashTable.h:52
-
一個當key相撞時會用list解決的hash_table
Definition: HashTable.h:15
-
size_t size() const
回傳目前有多少element在其中
Definition: HashTable.h:77
-
std::vector< Data > all() const
回傳所有存下來的資料
Definition: HashTable.h:173
-
bool del(Data const &e)
刪除element
Definition: HashTable.h:117
-
HashFunc const & func() const
回傳hash function
Definition: HashTable.h:88
-
size_t tableSize() const
回傳table size
Definition: HashTable.h:70
-
bool exist(Data const &e) const
查看某element是否已經擁有
Definition: HashTable.h:160
-
bool add(Data const &e)
加入新的element
Definition: HashTable.h:95
-
void reset(size_t size, HashFunc const &func)
清除資料, 指定新的size與hash function
Definition: HashTable.h:61
-
bool add(HashTableList const &h)
把給定的HashTableList中所有的element全加進來
Definition: HashTable.h:104
-
HashTableList & copyFrom(HashTableList const &b)
copy
Definition: HashTable.h:43
-
HashTableList & operator=(HashTableList const &h)
same as copyFrom(h)
Definition: HashTable.h:198
-
~HashTableList()
destructor
Definition: HashTable.h:37
-
-
- - - - - diff --git a/doc/html/IdentityPoints_8h.html b/doc/html/IdentityPoints_8h.html deleted file mode 100644 index 53028e4..0000000 --- a/doc/html/IdentityPoints_8h.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/IdentityPoints.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
IdentityPoints.h File Reference
-
-
-
#include "../Self.h"
-#include "../math/Vector.h"
-#include "../oo/ObjBase.h"
-#include <map>
-#include <set>
-#include <utility>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::IdentityPoints< Identity, Scalar, Point >
 把一個 std::map<Identity, Point > 包起來 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/IdentityPoints_8h_source.html b/doc/html/IdentityPoints_8h_source.html deleted file mode 100644 index affb07a..0000000 --- a/doc/html/IdentityPoints_8h_source.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/IdentityPoints.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
IdentityPoints.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_IdentityPoints_H__
-
2 #define gra_IdentityPoints_H__
-
3 
-
4 #include "../Self.h"
-
5 #include "../math/Vector.h"
-
6 #include "../oo/ObjBase.h"
-
7 
-
8 #include <map>
-
9 #include <set>
-
10 #include <utility>
-
11 
-
12 #include <cstdlib>
-
13 
-
14 namespace meow {
-
15 
-
21 template<class Identity, class Scalar, class Point = Vector<Scalar> >
-
22 class IdentityPoints: public ObjBase {
-
23 public:
-
24 
-
25  typedef typename std::vector<Identity> Identities;
-
26  typedef typename std::vector<Point> Points;
-
27 
-
28  typedef typename std::pair<Identity, Point> IdentityPointPair;
-
29  typedef typename std::vector<IdentityPointPair> IdentityPointPairs;
-
30 
-
31  typedef typename std::pair<Point, Point> PointPair;
-
32  typedef typename std::vector<PointPair> PointPairs;
-
33 
-
34 private:
-
35  typedef typename std::map<Identity, Point> IdentityPointsMap ;
-
36  typedef typename IdentityPointsMap:: iterator IdentityPointsMapIter ;
-
37  typedef typename IdentityPointsMap::const_iterator IdentityPointsMapIterK;
-
38 
-
39  struct Myself {
-
40  IdentityPointsMap points_;
-
41  size_t dimension_;
-
42 
-
43  Myself(size_t d): dimension_(d) {
-
44  }
-
45 
-
46  Myself(Myself const& m): points_(m.points_), dimension_(m.dimension_) {
-
47  }
-
48 
-
49  ~Myself() {
-
50  }
-
51  };
-
52 
-
53  Self<Myself> const self;
-
54 public:
-
58  IdentityPoints(size_t d): self(Myself(d)) {
-
59  }
-
60 
- -
65  self(b.self, Self<Myself>::COPY_FROM) {
-
66  }
-
67 
- -
72  }
-
73 
- -
78  self().copyFrom(b.self);
-
79  return *this;
-
80  }
-
81 
- -
86  self().referenceFrom(b.self);
-
87  return *this;
-
88  }
-
89 
-
93  void clear() {
-
94  self()->points_.clear();
-
95  }
-
96 
-
100  size_t size() const {
-
101  return self->points_.size();
-
102  }
-
103 
-
107  bool empty() const {
-
108  return (size() == 0u);
-
109  }
-
110 
-
114  bool exist(Identity const& id) const {
-
115  return (self->points_.find(id) != self->points_.end());
-
116  }
-
117 
-
121  size_t dimension() const {
-
122  return self->dimension_;
-
123  }
-
124 
- -
129  Identities ret;
-
130  for (IdentityPointsMapIterK
-
131  it = self->points_.begin(), ed = self->points_.end(); it != ed; ++it) {
-
132  ret.push_back(it->first);
-
133  }
-
134  return ret;
-
135  }
-
136 
-
140  Points points() const {
-
141  Points ret;
-
142  for (IdentityPointsMapIterK
-
143  it = self->points_.begin(), ed = self->points_.end(); it != ed; ++it) {
-
144  ret.push_back(it->second);
-
145  }
-
146  return ret;
-
147  }
-
148 
- -
153  IdentityPointPairs ret;
-
154  for (IdentityPointsMapIterK
-
155  it = self->points_.begin(), ed = self->points_.end(); it != ed; ++it) {
-
156  ret.push_back(IdentityPointPair(it->first, it->second));
-
157  }
-
158  return ret;
-
159  }
-
160 
- -
165  clear();
-
166  for (size_t i = 0, I = p.size(); i < I; ++i) {
-
167  pointAdd(p[i].first, p[i].second);
-
168  }
-
169  return pairs();
-
170  }
-
171 
- -
176  for (size_t i = 0, I = p.size(); i < I; ++i) {
-
177  pointAdd(p[i].first, p[i].second);
-
178  }
-
179  return pairs();
-
180  }
-
181 
-
185  Point point(Identity const& id) const {
-
186  return (exist(id) ? self->points_.find(id)->second : Point());
-
187  }
-
188 
-
192  Point& point(Identity const& id) {
-
193  static Point tmp(0);
-
194  return (exist(id) ? self()->points_.find(id)->second : tmp);
-
195  }
-
196 
-
200  Point point(Identity const& id, Point const& b) {
-
201  if (b.dimension() == self->dimension_) {
-
202  self()->points_[id].copyFrom(b);
-
203  }
-
204  return point(id);
-
205  }
-
206 
-
210  Point pointAdd(Identity const& id, Point const& b) {
-
211  if (b.dimension() == self->dimension_ && !exist(id)) {
-
212  self()->points_[id].copyFrom(b);
-
213  }
-
214  return point(id);
-
215  }
-
216 
-
220  void pointDel(Identity const& id) {
-
221  self()->points_.erase(id);
-
222  }
-
223 
- -
228  Identities ret;
-
229  IdentityPointsMapIterK it1, ed1, it2, ed2;
-
230  it1 = self->points_.begin();
-
231  ed1 = self->points_.end ();
-
232  it2 = b.self->points_.begin();
-
233  ed2 = b.self->points_.end ();
-
234  while (it1 != ed1 && it2 != ed2) {
-
235  if (it1->first < it2->first) { ++it1; }
-
236  else if(it1->first > it2->first) { ++it2; }
-
237  else {
-
238  ret.push_back(it1->first);
-
239  ++it1;
-
240  ++it2;
-
241  }
-
242  }
-
243  return ret;
-
244  }
-
245 
- -
250  PointPairs ret;
-
251  IdentityPointsMapIterK it1, ed1, it2, ed2;
-
252  it1 = self->points_.begin();
-
253  ed1 = self->points_.end ();
-
254  it2 = b.self->points_.begin();
-
255  ed2 = b.self->points_.end ();
-
256  while (it1 != ed1 && it2 != ed2) {
-
257  if (it1->first < it2->first) { ++it1; }
-
258  else if(it1->first > it2->first) { ++it2; }
-
259  else {
-
260  ret.push_back(PointPair(it1->second, it2->second));
-
261  ++it1;
-
262  ++it2;
-
263  }
-
264  }
-
265  return ret;
-
266  }
-
267 
- -
272  return copyFrom(b);
-
273  }
-
274 
-
279  bool write(FILE* f, bool bin, unsigned int fg) const {
-
280  if (bin) {
-
281  long dim, ct;
-
282  if (fwrite(&(dim = dimension()), sizeof(dim), 1, f) < 1) return false;
-
283  if (fwrite(&(ct = size()), sizeof(ct), 1, f) < 1) return false;
-
284  IdentityPointsMapIterK it = self->points_.begin();
-
285  IdentityPointsMapIterK ed = self->points_.end ();
-
286  for ( ; it != ed; ++it) {
-
287  double tmp;
-
288  if (fwrite(&(tmp = it->first), sizeof(tmp), 1, f) < 1) return false;
-
289  for (long i = 0; i < dim; ++i) {
-
290  if (fwrite(&(tmp = it->second(i)), sizeof(tmp), 1, f) < 1)
-
291  return false;
-
292  }
-
293  }
-
294  }
-
295  else {
-
296  if (fprintf(f, "%ld %lu\n", dimension(), size()) < 1) return false;
-
297  IdentityPointsMapIterK it = self->points_.begin();
-
298  IdentityPointsMapIterK ed = self->points_.end ();
-
299  for ( ; it != ed; ++it) {
-
300  if (fprintf(f, "%f ", (double)it->first) < 1) return false;
-
301  for (long i = 0, I = dimension(); i < I; ++i) {
-
302  if (fprintf(f, "%f ", (double)it->second(i)) < 1) return false;
-
303  }
-
304  fprintf(f, "\n");
-
305  }
-
306  }
-
307  return true;
-
308  }
-
309 
-
314  bool read(FILE* f, bool bin, unsigned int fg) {
-
315  long dim, ct;
-
316  if (bin) {
-
317  if (fread(&dim, sizeof(dim), 1, f) < 1) return false;
-
318  copyFrom(IdentityPoints(dim));
-
319  if (fread(&ct, sizeof(ct), 1, f) < 1) return false;
-
320  double id, tt;
-
321  IdentityPointsMapIterK it = self->points_.begin();
-
322  IdentityPointsMapIterK ed = self->points_.end ();
-
323  Point tmp((size_t)dim, Scalar(0));
-
324  for ( ; it != ed; ++it) {
-
325  if (fread(&id, sizeof(id), 1, f) < 1) return false;
-
326  for (size_t j = 0, J = dim; j < J; ++j) {
-
327  if (fread(&tt, sizeof(tt), 1, f) < 1) return false;
-
328  tmp.scalar(j, tt);
-
329  }
-
330  pointAdd((Identity)id, tmp);
-
331  }
-
332  }
-
333  else {
-
334  if (fscanf(f, "%ld %ld", &dim, &ct) < 2) return false;
-
335  copyFrom(IdentityPoints(dim));
-
336  double id, tt;
-
337  IdentityPointsMapIterK it = self->points_.begin();
-
338  IdentityPointsMapIterK ed = self->points_.end ();
-
339  Point tmp((size_t)dim, Scalar(0));
-
340  for ( ; it != ed; ++it) {
-
341  if (fscanf(f, "%lf", &id) < 1) return false;
-
342  for (int j = 0, J = dim; j < J; ++j) {
-
343  if (fscanf(f, "%lf", &tt) < 1) return false;
-
344  tmp.scalar(j, tt);
-
345  }
-
346  pointAdd((Identity)id, tmp);
-
347  }
-
348  }
-
349  return true;
-
350  }
-
351 
-
356  ObjBase* create() const {
-
357  return new IdentityPoints(dimension());
-
358  }
-
359 
-
369  ObjBase* copyFrom(ObjBase const* b) {
-
370  return &(copyFrom(*(IdentityPoints const*)b));
-
371  }
-
372 
-
377  char const* ctype() const {
-
378  return typeid(*this).name();
-
379  }
-
380 
-
385  std::string type() const {
-
386  return std::string(ctype());
-
387  }
-
388 };
-
389 
-
390 } // meow
-
391 
-
392 #endif // gra_IdentityPoints_H__
-
Points points() const
回傳所有 points
-
ObjBase * copyFrom(ObjBase const *b)
複製資料
-
IdentityPoints & referenceFrom(IdentityPoints const &b)
參照
-
Point point(Identity const &id, Point const &b)
修改一個identity point
-
~IdentityPoints()
destructor
-
void pointDel(Identity const &id)
刪除一個identity point
-
size_t dimension() const
回傳dimension
-
Point pointAdd(Identity const &id, Point const &b)
新增一個identity point
-
PointPairs intersectPoints(IdentityPoints const &b)
intersection
-
IdentityPointPairs pairsAdd(IdentityPointPairs const &p)
加入所有pair
-
size_t size() const
回傳有幾個identity points
-
把一個 std::map<Identity, Point > 包起來
-
IdentityPoints(size_t d)
setup dimension
-
ObjBase * create() const
new一個自己
-
IdentityPointPairs pairs(IdentityPointPairs const &p)
取代所有pair
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
-
IdentityPointPairs pairs() const
回傳所有pair
-
std::string type() const
回傳class的type
-
bool empty() const
回傳是否沒有identity points
-
std::vector< Point > Points
-
bool exist(Identity const &id) const
檢查某id是否有使用
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
IdentityPoints(IdentityPoints const &b)
constructor, 並且複製資料
-
Identities identities() const
回傳所有 identity
-
std::pair< Point, Point > PointPair
-
std::vector< Identity > Identities
-
std::vector< IdentityPointPair > IdentityPointPairs
-
IdentityPoints & copyFrom(IdentityPoints const &b)
複製資料
-
Point point(Identity const &id) const
取得一個identity point
-
void clear()
清除一切identity points
-
char const * ctype() const
回傳class的type
- -
Identities intersectIdentites(IdentityPoints const &b)
intersection
-
Point & point(Identity const &id)
取得一個 identity point (non-constant reference)
-
IdentityPoints & operator=(IdentityPoints const &b)
same as copyFrom(b)
-
std::pair< Identity, Point > IdentityPointPair
-
std::vector< PointPair > PointPairs
-
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
-
-
- - - - - diff --git a/doc/html/KD__Tree_8h.html b/doc/html/KD__Tree_8h.html deleted file mode 100644 index 955c21c..0000000 --- a/doc/html/KD__Tree_8h.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/KD_Tree.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
KD_Tree.h File Reference
-
-
-
#include "../utility.h"
-#include "../math/utility.h"
-#include <cstdlib>
-#include <vector>
-#include <algorithm>
-#include <queue>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::KD_Tree< Vector, Scalar >
 k-dimension tree More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/KD__Tree_8h_source.html b/doc/html/KD__Tree_8h_source.html deleted file mode 100644 index 844a237..0000000 --- a/doc/html/KD__Tree_8h_source.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/KD_Tree.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
KD_Tree.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_KD_Tree_H__
-
2 #define dsa_KD_Tree_H__
-
3 
-
4 #include "../utility.h"
-
5 #include "../math/utility.h"
-
6 
-
7 #include <cstdlib>
-
8 
-
9 #include <vector>
-
10 #include <algorithm>
-
11 #include <queue>
-
12 
-
13 namespace meow {
-
14 
-
39 template<class Vector, class Scalar>
-
40 class KD_Tree {
-
41 private:
-
42  struct Node {
-
43  Vector vector_;
-
44  ssize_t lChild_;
-
45  ssize_t rChild_;
-
46 
-
47  Node(Vector v, ssize_t l, ssize_t r): vector_(v), lChild_(l), rChild_(r){
-
48  }
-
49  };
-
50  typedef std::vector<Node> Nodes;
-
51 
-
52  class Sorter {
-
53  private:
-
54  Nodes const* nodes_;
-
55  size_t cmp_;
-
56  public:
-
57  Sorter(Nodes const* nodes, size_t cmp):
-
58  nodes_(nodes), cmp_(cmp){
-
59  }
-
60  bool operator()(size_t const& a, size_t const& b) const{
-
61  if ((*nodes_)[a].vector_[cmp_] != (*nodes_)[b].vector_[cmp_]) {
-
62  return ((*nodes_)[a].vector_[cmp_] < (*nodes_)[b].vector_[cmp_]);
-
63  }
-
64  return ((*nodes_)[a].vector_ < (*nodes_)[b].vector_);
-
65  }
-
66  };
-
67  struct Answer {
-
68  ssize_t index_;
-
69  Scalar dist2_;
-
70  //
-
71  Answer(ssize_t index, Scalar dist2):
-
72  index_(index), dist2_(dist2) {
-
73  }
-
74  Answer(Answer const& answer2):
-
75  index_(answer2.index_), dist2_(answer2.dist2_) {
-
76  }
-
77  };
-
78  class AnswerCompare {
-
79  private:
-
80  Nodes const* nodes_;
-
81  bool cmpValue_;
-
82  public:
-
83  AnswerCompare(Nodes const* nodes, bool cmpValue):
-
84  nodes_(nodes), cmpValue_(cmpValue) {
-
85  }
-
86  bool operator()(Answer const& a, Answer const& b) const {
-
87  if (cmpValue_ == true && a.dist2_ == b.dist2_) {
-
88  return ((*nodes_)[a.index_].vector_ < (*nodes_)[b.index_].vector_);
-
89  }
-
90  return (a.dist2_ < b.dist2_);
-
91  }
-
92  };
-
93  typedef std::vector<Answer> AnswerV;
-
94  typedef std::priority_queue<Answer, AnswerV, AnswerCompare> Answers;
-
95  //
-
96  const ssize_t kNIL_;
-
97  //
-
98  Nodes nodes_;
-
99  size_t root_;
-
100  bool needRebuild_;
-
101  size_t dimension_;
-
102  //
-
103  Scalar distance2(Vector const& v1, Vector const& v2) const {
-
104  Scalar ret(0);
-
105  for(size_t i = 0; i < dimension_; i++){
-
106  ret += squ(v1[i] - v2[i]);
-
107  }
-
108  return ret;
-
109  }
-
110  //
-
111  void query(Vector const& v,
-
112  size_t nearestNumber,
-
113  AnswerCompare const& answerCompare,
-
114  ssize_t index,
-
115  int depth,
-
116  std::vector<Scalar>& dist2Vector,
-
117  Scalar dist2Minimum,
-
118  Answers *out) const {
-
119  if (index == kNIL_) return ;
-
120  size_t cmp = depth % dimension_;
-
121  ssize_t this_side, that_side;
-
122  if (!(nodes_[index].vector_[cmp] < v[cmp])) {
-
123  this_side = nodes_[index].lChild_;
-
124  that_side = nodes_[index].rChild_;
-
125  }else{
-
126  this_side = nodes_[index].rChild_;
-
127  that_side = nodes_[index].lChild_;
-
128  }
-
129  query(v, nearestNumber, answerCompare,
-
130  this_side, depth + 1,
-
131  dist2Vector, dist2Minimum,
-
132  out);
-
133  Answer my_ans(index, distance2(nodes_[index].vector_, v));
-
134  if (out->size() < nearestNumber || answerCompare(my_ans, out->top())) {
-
135  out->push(my_ans);
-
136  if (out->size() > nearestNumber) out->pop();
-
137  }
-
138  Scalar dist2_old(dist2Vector[cmp]);
-
139  dist2Vector[cmp] = squ(nodes_[index].vector_[cmp] - v[cmp]);
-
140  Scalar dist2Minimum2(dist2Minimum + dist2Vector[cmp] - dist2_old);
-
141  if (out->size() < nearestNumber || !(out->top().dist2_ < dist2Minimum)) {
-
142  query(v, nearestNumber, answerCompare,
-
143  that_side, depth + 1,
-
144  dist2Vector, dist2Minimum2,
-
145  out);
-
146  }
-
147  dist2Vector[cmp] = dist2_old;
-
148  }
-
149  ssize_t build(ssize_t beg,
-
150  ssize_t end,
-
151  std::vector<size_t>* orders,
-
152  int depth) {
-
153  if (beg > end) return kNIL_;
-
154  size_t tmp_order = dimension_;
-
155  size_t which_side = dimension_ + 1;
-
156  ssize_t mid = (beg + end) / 2;
-
157  size_t cmp = depth % dimension_;
-
158  for (ssize_t i = beg; i <= mid; i++) {
-
159  orders[which_side][orders[cmp][i]] = 0;
-
160  }
-
161  for (ssize_t i = mid + 1; i <= end; i++) {
-
162  orders[which_side][orders[cmp][i]] = 1;
-
163  }
-
164  for (size_t i = 0; i < dimension_; i++) {
-
165  if (i == cmp) continue;
-
166  size_t left = beg, right = mid + 1;
-
167  for (int j = beg; j <= end; j++) {
-
168  size_t ask = orders[i][j];
-
169  if(ask == orders[cmp][mid]) {
-
170  orders[tmp_order][mid] = ask;
-
171  }
-
172  else if(orders[which_side][ask] == 1) {
-
173  orders[tmp_order][right++] = ask;
-
174  }
-
175  else {
-
176  orders[tmp_order][left++] = ask;
-
177  }
-
178  }
-
179  for (int j = beg; j <= end; j++) {
-
180  orders[i][j] = orders[tmp_order][j];
-
181  }
-
182  }
-
183  nodes_[orders[cmp][mid]].lChild_ = build(beg, mid - 1, orders, depth + 1);
-
184  nodes_[orders[cmp][mid]].rChild_ = build(mid + 1, end, orders, depth + 1);
-
185  return orders[cmp][mid];
-
186  }
-
187 public:
-
189  typedef typename std::vector<Vector> Vectors;
-
190 
-
192  KD_Tree(): kNIL_(-1), root_(kNIL_), needRebuild_(false), dimension_(1) {
-
193  }
-
194 
-
196  KD_Tree(size_t dimension):
-
197  kNIL_(-1), root_(kNIL_), needRebuild_(false), dimension_(dimension) {
-
198  }
-
199 
- -
202  }
-
203 
-
207  void insert(Vector const& v) {
-
208  nodes_.push_back(Node(v, kNIL_, kNIL_));
-
209  needRebuild_ = true;
-
210  }
-
211 
-
215  bool erase(Vector const& v) {
-
216  for (size_t i = 0, I = nodes_.size(); i < I; i++) {
-
217  if (nodes_[i] == v) {
-
218  if (i != I - 1) {
-
219  std::swap(nodes_[i], nodes_[I - 1]);
-
220  }
-
221  needRebuild_ = true;
-
222  return true;
-
223  }
-
224  }
-
225  return false;
-
226  }
-
227 
-
231  void build(){
-
232  if (needRebuild_) {
-
233  forceBuild();
-
234  }
-
235  }
-
236 
-
240  void forceBuild() {
-
241  std::vector<size_t> *orders = new std::vector<size_t>[dimension_ + 2];
-
242  for (size_t j = 0; j < dimension_ + 2; j++) {
-
243  orders[j].resize(nodes_.size());
-
244  }
-
245  for (size_t j = 0; j < dimension_; j++) {
-
246  for (size_t i = 0, I = nodes_.size(); i < I; i++) {
-
247  orders[j][i] = i;
-
248  }
-
249  std::sort(orders[j].begin(), orders[j].end(), Sorter(&nodes_, j));
-
250  }
-
251  root_ = build(0, (ssize_t)nodes_.size() - 1, orders, 0);
-
252  delete [] orders;
-
253  needRebuild_ = false;
-
254  }
-
255 
-
263  Vectors query(Vector const& v,
-
264  size_t nearestNumber,
-
265  bool compareWholeVector) const {
-
266  ((KD_Tree*)this)->build();
-
267  AnswerCompare answer_compare(&nodes_, compareWholeVector);
-
268  Answers answer_set(answer_compare);
-
269  std::vector<Scalar> tmp(dimension_, 0);
-
270  query(v, nearestNumber,
-
271  answer_compare,
-
272  root_, 0,
-
273  tmp, Scalar(0),
-
274  &answer_set);
-
275  Vectors ret(answer_set.size());
-
276  for (int i = (ssize_t)answer_set.size() - 1; i >= 0; i--) {
-
277  ret[i] = nodes_[answer_set.top().index_].vector_;
-
278  answer_set.pop();
-
279  }
-
280  return ret;
-
281  }
-
282 
-
286  void clear() {
-
287  root_ = kNIL_;
-
288  nodes_.clear();
-
289  needRebuild_ = false;
-
290  }
-
291 
-
295  void reset(size_t dimension) {
-
296  clear();
-
297  dimension_ = dimension;
-
298  }
-
299 };
-
300 
-
301 } // meow
-
302 
-
303 #endif // dsa_KD_Tree_H__
-
bool erase(Vector const &v)
將給定的Vector從set移除
Definition: KD_Tree.h:215
-
void clear()
清空所有資料
Definition: KD_Tree.h:286
-
k-dimension tree
Definition: KD_Tree.h:40
-
void forceBuild()
重新建樹
Definition: KD_Tree.h:240
-
KD_Tree()
constructor, with dimension = 1
Definition: KD_Tree.h:192
-
vector
Definition: Vector.h:19
-
Vectors query(Vector const &v, size_t nearestNumber, bool compareWholeVector) const
查找
Definition: KD_Tree.h:263
-
void insert(Vector const &v)
將給定的Vector加到set中
Definition: KD_Tree.h:207
-
std::vector< Vector > Vectors
Custom Type: Vectors is std::vector<Vector>
Definition: KD_Tree.h:189
-
KD_Tree(size_t dimension)
constructor, given dimension
Definition: KD_Tree.h:196
-
void reset(size_t dimension)
清空所有資料並重新給定維度
Definition: KD_Tree.h:295
-
T squ(T const &x)
x*x
Definition: utility.h:77
-
void build()
檢查至今是否有 insert/erase 被呼叫來決定是否 rebuild()
Definition: KD_Tree.h:231
-
~KD_Tree()
destructor
Definition: KD_Tree.h:201
-
-
- - - - - diff --git a/doc/html/LinearTransformation_8h.html b/doc/html/LinearTransformation_8h.html deleted file mode 100644 index 1c640d9..0000000 --- a/doc/html/LinearTransformation_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/LinearTransformation.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
LinearTransformation.h File Reference
-
-
-
#include "Transformation.h"
-#include "Matrix.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::LinearTransformation< Scalar >
 A base class for implementing kinds of linear transformations. More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/LinearTransformation_8h_source.html b/doc/html/LinearTransformation_8h_source.html deleted file mode 100644 index eded806..0000000 --- a/doc/html/LinearTransformation_8h_source.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/LinearTransformation.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
LinearTransformation.h
-
-
-Go to the documentation of this file.
1 #ifndef math_LinearTransformation_H__
-
2 #define math_LinearTransformation_H__
-
3 
-
4 #include "Transformation.h"
-
5 #include "Matrix.h"
-
6 
-
7 #include <cstdlib>
-
8 
-
9 namespace meow {
-
10 
-
19 template<class Scalar>
-
20 class LinearTransformation: public Transformation<Scalar> {
-
21 private:
-
22  Matrix<Scalar> matrix_;
-
23 protected:
-
27  LinearTransformation(size_t inputRows, size_t outputRows, size_t psize):
-
28  Transformation<Scalar>(inputRows, 1u, outputRows, 1u, psize),
-
29  matrix_(outputRows, inputRows, Scalar(0.0)) {
-
30  }
-
31 
-
35  LinearTransformation(size_t inputRows, size_t outputRows, size_t psize,
-
36  Matrix<Scalar> const& m):
-
37  Transformation<Scalar>(inputRows, 1u, outputRows, 1u, psize),
-
38  matrix_(m) {
-
39  }
-
40 
- -
47  Transformation<Scalar>(b),
-
48  matrix_(b.matrix_) {
-
49  }
-
50 
- - -
58  matrix_.copyFrom(b.matrix_);
-
59  return *this;
-
60  }
-
61 
- - -
69  matrix_.referenceFrom(b.matrix_);
-
70  return *this;
-
71  }
-
72 
-
76  virtual Matrix<Scalar> const& matrix(Matrix<Scalar> const& m) {
-
77  matrix_.copyFrom(m);
-
78  return matrix();
-
79  }
-
80 
-
81 public:
- -
86  }
-
87 
-
93  virtual Matrix<Scalar> const& matrix() const {
-
94  return matrix_;
-
95  }
-
96 
-
102  virtual Matrix<Scalar> matrixInv() const {
-
103  return matrix_.inverse();
-
104  }
-
105 };
-
106 
-
107 
-
108 } // meow
-
109 
-
110 #endif // math_LinearTransformation_H__
- -
Matrix & referenceFrom(Matrix const &m)
reference
Definition: Matrix.h:110
-
size_t outputRows() const
Return the number of rows of the output matrix.
-
Matrix inverse() const
Return a matrix which is an inverse matrix of (*this)
Definition: Matrix.h:401
-
A base class for implementing kinds of linear transformations.
-
size_t inputRows() const
Return the number of rows of the input matrix.
-
virtual Matrix< Scalar > matrixInv() const
Return the inverse of the matrix form of this transformate.
-
virtual Matrix< Scalar > const & matrix(Matrix< Scalar > const &m)
setup the matrix
-
Matrix & copyFrom(Matrix const &m)
copy
Definition: Matrix.h:97
-
LinearTransformation & copyFrom(LinearTransformation const &b)
Copy settings, matrix from another LinearTransformation.
-
LinearTransformation(LinearTransformation const &b)
- -
Transformation & copyFrom(Transformation const &b)
Copy from the specified one.
-
virtual Matrix< Scalar > const & matrix() const
Return the matrix form of this transformation.
-
LinearTransformation(size_t inputRows, size_t outputRows, size_t psize)
- - -
Transformation & referenceFrom(Transformation const &b)
reference from the specified one
-
A base class for implementing kinds of transformations.
-
LinearTransformation(size_t inputRows, size_t outputRows, size_t psize, Matrix< Scalar > const &m)
-
LinearTransformation & referenceFrom(LinearTransformation const &b)
Reference settings, matrix from another LinearTransformation.
-
-
- - - - - diff --git a/doc/html/LinearTransformations_8h.html b/doc/html/LinearTransformations_8h.html deleted file mode 100644 index 3e1cf7d..0000000 --- a/doc/html/LinearTransformations_8h.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/LinearTransformations.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
LinearTransformations.h File Reference
-
-
-
#include "LinearTransformation.h"
-#include "Matrix.h"
-#include "utility.h"
-#include "../Self.h"
-#include "../geo/Vectors.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Rotation3D< Scalar >
 Rotation a point/vector alone an axis with given angle in 3D world. More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/LinearTransformations_8h_source.html b/doc/html/LinearTransformations_8h_source.html deleted file mode 100644 index c3ad4ab..0000000 --- a/doc/html/LinearTransformations_8h_source.html +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/LinearTransformations.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
LinearTransformations.h
-
-
-Go to the documentation of this file.
1 #ifndef math_LinearTransformations_H__
-
2 #define math_LinearTransformations_H__
-
3 
-
4 #include "LinearTransformation.h"
-
5 #include "Matrix.h"
-
6 #include "utility.h"
-
7 #include "../Self.h"
-
8 #include "../geo/Vectors.h"
-
9 
-
10 #include <cstdlib>
-
11 
-
12 namespace meow {
-
13 
-
19 template<class Scalar>
-
20 class Rotation3D: public LinearTransformation<Scalar> {
-
21 private:
-
22  struct Myself {
-
23  Vector3D<Scalar> theta_;
-
24  bool need_;
-
25 
-
26  Myself(): theta_(0, 0, 0), need_(true) {
-
27  }
-
28 
-
29  Myself(Myself const& b): theta_(b.theta_), need_(b.need_) {
-
30  }
-
31 
-
32  ~Myself() {
-
33  }
-
34  };
-
35 
-
36  Self<Myself> const self;
-
37 
-
38  void calcMatrix() const {
-
39  if (self->need_) {
-
40  Matrix<Scalar> tmp(3, 3, 0.0);
-
41  if (noEPS(self->theta_.length2()) == 0) {
-
42  tmp.identitied();
-
43  }
-
44  else {
-
45  Vector3D<double> axis (self->theta_.normalize());
-
46  double angle(self->theta_.length());
-
47  double cs(cos(angle / 2.0));
-
48  double sn(sin(angle / 2.0));
-
49 
-
50  tmp.entry(0, 0, 2*(squ(axis.x())-1.0)*squ(sn) + 1);
-
51  tmp.entry(1, 1, 2*(squ(axis.y())-1.0)*squ(sn) + 1);
-
52  tmp.entry(2, 2, 2*(squ(axis.z())-1.0)*squ(sn) + 1);
-
53  tmp.entry(0, 1, 2*axis.x()*axis.y()*squ(sn) - 2*axis.z()*cs*sn);
-
54  tmp.entry(1, 0, 2*axis.y()*axis.x()*squ(sn) + 2*axis.z()*cs*sn);
-
55  tmp.entry(0, 2, 2*axis.x()*axis.z()*squ(sn) + 2*axis.y()*cs*sn);
-
56  tmp.entry(2, 0, 2*axis.z()*axis.x()*squ(sn) - 2*axis.y()*cs*sn);
-
57  tmp.entry(1, 2, 2*axis.y()*axis.z()*squ(sn) - 2*axis.x()*cs*sn);
-
58  tmp.entry(2, 1, 2*axis.z()*axis.y()*squ(sn) + 2*axis.x()*cs*sn);
-
59  }
-
60  ((Rotation3D*)this)->LinearTransformation<Scalar>::matrix(tmp);
-
61  self()->need_ = false;
-
62  }
-
63  }
-
64 
-
65 public:
-
69  Rotation3D(): LinearTransformation<Scalar>(3u, 3u, 3u), self() {
-
70  }
-
71 
- -
76  self(b.self, Self<Myself>::COPY_FROM) {
-
77  }
-
78 
- -
83  }
-
84 
- - -
93  self().copyFrom(b.self);
-
94  return *this;
-
95  }
-
96 
- - -
105  self().referenceFrom(b.self);
-
106  return *this;
-
107  }
-
108 
-
112  Scalar parameter(size_t i) const {
-
113  return theta(i);
-
114  }
-
115 
-
119  Scalar parameter(size_t i, Scalar const& s) {
-
120  return theta(i, s);
-
121  }
-
122 
-
131  Scalar const& theta(size_t i) const {
-
132  return self->theta_(i);
-
133  }
-
134 
-
144  Scalar const& theta(size_t i, Scalar const& s) {
-
145  if (theta(i) != s) {
-
146  if (i == 0) self()->theta_.x(s);
-
147  else if (i == 1) self()->theta_.y(s);
-
148  else if (i == 2) self()->theta_.z(s);
-
149  self()->need_ = true;
-
150  }
-
151  return theta(i);
-
152  }
-
153 
-
160  void axisAngle(Vector<Scalar> const& axis, Scalar const& angle) {
-
161  Vector<Scalar> n(axis.normalize());
-
162  for (size_t i = 0; i < 3; i++) {
-
163  theta(i, n(i) * angle);
-
164  }
-
165  }
-
166 
-
171  Rotation3D& add(Rotation3D const& r) {
-
172  for (size_t i = 0; i < 3; i++) {
-
173  theta(i, r.theta(i));
-
174  }
-
175  return *this;
-
176  }
-
177 
- -
214  calcMatrix();
- -
216  }
-
217 
- -
244  calcMatrix();
- -
246  }
-
247 
-
320  Matrix<Scalar> jacobian(Matrix<Scalar> const& x, size_t i) const {
-
321  calcMatrix();
-
322  Matrix<Scalar> mid(3u, 3u, Scalar(0.0));
-
323  if (i == 0) {
-
324  mid.entry(1, 2, Scalar(-1.0));
-
325  mid.entry(2, 1, Scalar( 1.0));
-
326  }
-
327  else if(i == 1) {
-
328  mid.entry(0, 2, Scalar( 1.0));
-
329  mid.entry(2, 0, Scalar(-1.0));
-
330  }
-
331  else {
-
332  mid.entry(0, 1, Scalar(-1.0));
-
333  mid.entry(1, 0, Scalar( 1.0));
-
334  }
-
335  return mid * LinearTransformation<Scalar>::matrix() * x;
-
336  }
-
337 
- -
345  return matrixInv() * x;
-
346  }
-
347 
- -
355  return matrixInv();
-
356  }
-
357 
-
365  Matrix<Scalar> jacobianInv(Matrix<Scalar> const& x, size_t i) const {
-
366  calcMatrix();
-
367  Matrix<Scalar> mid(3u, 3u, Scalar(0.0));
-
368  if (i == 0) {
-
369  mid.entry(1, 2, Scalar(-1.0));
-
370  mid.entry(2, 1, Scalar( 1.0));
-
371  }
-
372  else if(i == 1) {
-
373  mid.entry(0, 2, Scalar( 1.0));
-
374  mid.entry(2, 0, Scalar(-1.0));
-
375  }
-
376  else {
-
377  mid.entry(0, 1, Scalar(-1.0));
-
378  mid.entry(1, 0, Scalar( 1.0));
-
379  }
-
380  return matrixInv() * mid.transpose() * x;
-
381  return (-mid) * matrixInv() * x;
-
382  }
-
383 
- -
392  calcMatrix();
- -
394  }
-
395 
- -
398  return copyFrom(b);
-
399  }
-
400 };
-
401 
-
402 } // meow
-
403 
-
404 #endif // math_LinearTransformations_H__
-
Rotation3D & operator=(Rotation3D const &b)
same as copyFrom(b)
-
Scalar parameter(size_t i, Scalar const &s)
same as theta(i, s)
-
Matrix< Scalar > jacobian(Matrix< Scalar > const &x, size_t i) const
Return the jacobian matrix of this transformate.
-
Rotation3D & copyFrom(Rotation3D const &b)
Copy data.
-
Scalar const & theta(size_t i) const
Get the i -th theta.
-
Rotation3D & referenceFrom(Rotation3D const &b)
Reference data.
-
Matrix< Scalar > transformate(Matrix< Scalar > const &x) const
Do the transformate.
-
Matrix< Scalar > jacobian(Matrix< Scalar > const &x) const
Return the jacobian matrix (derivate by the input vector) of this transformate.
-
Matrix< Scalar > matrixInv() const
Return the inverse matrix.
-
A base class for implementing kinds of linear transformations.
- -
Scalar parameter(size_t i) const
same as theta(i)
- -
T noEPS(T value, T eps=1e-9)
如果abs(輸入的數值) < eps, 則回傳0, 否則回傳輸入的數值
Definition: utility.h:28
- -
LinearTransformation & copyFrom(LinearTransformation const &b)
Copy settings, matrix from another LinearTransformation.
-
vector
Definition: Vector.h:19
-
Matrix< Scalar > jacobianInv(Matrix< Scalar > const &x) const
Return the jacobian matrix of the inverse form of this transformate.
-
3D's vector
Definition: Vectors.h:258
- -
Matrix transpose() const
return itself's transpose matrix
Definition: Matrix.h:435
- -
Rotation a point/vector alone an axis with given angle in 3D world.
-
Rotation3D(Rotation3D const &b)
-
virtual Matrix< Scalar > const & matrix() const
Return the matrix form of this transformation.
- -
Matrix & identitied()
Let itself be an identity matrix.
Definition: Matrix.h:367
-
Entry entry(size_t r, size_t c) const
Access the entry at r x c.
Definition: Matrix.h:212
-
void axisAngle(Vector< Scalar > const &axis, Scalar const &angle)
Setting.
-
Matrix< Scalar > transformateInv(Matrix< Scalar > const &x) const
Do the inverse transformate.
- -
Rotation3D & add(Rotation3D const &r)
Concat another rotation transformation.
-
Matrix< Scalar > jacobianInv(Matrix< Scalar > const &x, size_t i) const
Return the jacobian matrix of the inverse form of this transformate.
-
LinearTransformation & referenceFrom(LinearTransformation const &b)
Reference settings, matrix from another LinearTransformation.
-
Scalar const & theta(size_t i, Scalar const &s)
Set the i -th theta.
-
T squ(T const &x)
x*x
Definition: utility.h:77
-
Vector normalize() const
return a normalize form of itself
Definition: Vector.h:209
-
-
- - - - - diff --git a/doc/html/Matrix_8h.html b/doc/html/Matrix_8h.html deleted file mode 100644 index 4d6251f..0000000 --- a/doc/html/Matrix_8h.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Matrix.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Matrix.h File Reference
-
-
-
#include "../Self.h"
-#include "../math/utility.h"
-#include <vector>
-#include <algorithm>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Matrix< Entry >
 matrix More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Matrix_8h_source.html b/doc/html/Matrix_8h_source.html deleted file mode 100644 index 8eee4f6..0000000 --- a/doc/html/Matrix_8h_source.html +++ /dev/null @@ -1,510 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Matrix.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Matrix.h
-
-
-Go to the documentation of this file.
1 #ifndef math_Matrix_H__
-
2 #define math_Matrix_H__
-
3 
-
4 #include "../Self.h"
-
5 #include "../math/utility.h"
-
6 
-
7 #include <vector>
-
8 #include <algorithm>
-
9 
-
10 #include <cstdlib>
-
11 
-
12 namespace meow {
-
18 template<class Entry>
-
19 class Matrix {
-
20 public:
-
21  typedef typename std::vector<Entry>::reference EntryRef ;
-
22  typedef typename std::vector<Entry>::const_reference EntryRefK;
-
23 private:
-
24  struct Myself {
-
25  size_t rows_;
-
26  size_t cols_;
-
27  std::vector<Entry> entries_;
-
28 
-
29  Myself():
-
30  rows_(0), cols_(0), entries_(0) {
-
31  }
-
32 
-
33  Myself(Myself const& b):
-
34  rows_(b.rows_), cols_(b.cols_), entries_(b.entries_) {
-
35  }
-
36 
-
37  Myself(size_t r, size_t c, Entry const& e):
-
38  rows_(r), cols_(c), entries_(r * c, e) {
-
39  }
-
40 
-
41  ~Myself() {
-
42  }
-
43 
-
44  size_t index(size_t r, size_t c) const {
-
45  return r * cols_ + c;
-
46  }
-
47 
-
48  void realSize() {
-
49  std::vector<Entry> tmp(entries_);
-
50  entries_.swap(tmp);
-
51  }
-
52  };
-
53 
-
54  Self<Myself> const self;
-
55 public:
-
62  Matrix(): self() { }
-
63 
-
71  Matrix(Matrix const& m): self(m.self, Self<Myself>::COPY_FROM) {
-
72  }
-
73 
-
83  Matrix(size_t r, size_t c, Entry const& e): self(Myself(r, c, e)) {
-
84  }
-
85 
-
87  ~Matrix() { }
-
88 
-
97  Matrix& copyFrom(Matrix const& m) {
-
98  self().copyFrom(m.self);
-
99  return *this;
-
100  }
-
101 
- -
111  self().referenceFrom(m.self);
-
112  return *this;
-
113  }
-
114 
-
116  void reset(size_t r, size_t c, Entry const& e) {
-
117  self()->rows_ = r;
-
118  self()->cols_ = c;
-
119  self()->entries_.clear();
-
120  self()->entries_.resize(r * c, e);
-
121  }
-
122 
-
124  bool valid() const {
-
125  return (rows() > 0 && cols() > 0);
-
126  }
-
127 
-
129  size_t rows() const {
-
130  return self->rows_;
-
131  }
-
132 
-
134  size_t cols() const {
-
135  return self->cols_;
-
136  }
-
137 
-
139  size_t size() const {
-
140  return rows() * cols();
-
141  }
-
142 
-
152  size_t rows(size_t r, Entry const& e) {
-
153  if (r != rows()) {
-
154  self()->entries_.resize(r * cols(), e);
-
155  self()->rows_ = r;
-
156  }
-
157  return rows();
-
158  }
-
159 
-
169  size_t cols(size_t c, Entry const& e) {
-
170  if (c != cols()) {
-
171  Self<Myself> const old(self, Self<Myself>::COPY_FROM);
-
172  self()->entries_.resize(rows() * c);
-
173  self()->cols_ = c;
-
174  for (size_t i = 0, I = rows(); i < I; i++) {
-
175  size_t j, J1 = std::min(old->cols_, cols()), J2 = cols();
-
176  for (j = 0; j < J1; j++)
-
177  self()->entries_[self->index(i, j)] = old->entries_[old->index(i, j)];
-
178  for (j = J1; j < J2; j++)
-
179  self()->entries_[self->index(i, j)] = e;
-
180  }
-
181  }
-
182  return cols();
-
183  }
-
184 
-
195  size_t size(size_t r, size_t c, Entry const& e) {
-
196  cols(c, e);
-
197  rows(r, e);
-
198  return rows() * cols();
-
199  }
-
200 
-
204  void clear() {
-
205  self()->rows_ = 0;
-
206  self()->cols_ = 0;
-
207  self()->entries_.clear();
-
208  self()->realSize();
-
209  }
-
210 
-
212  Entry entry(size_t r, size_t c) const {
-
213  return self->entries_[self->index(r, c)];
-
214  }
-
215 
-
217  Entry entry(size_t r, size_t c, Entry const& e) {
-
218  self()->entries_[self->index(r, c)] = e;
-
219  return entry(r, c);
-
220  }
-
221 
-
223  EntryRef entryGet(size_t r, size_t c) {
-
224  return self()->entries_[self->index(r, c)];
-
225  }
-
226 
-
237  void entries(ssize_t rFirst, ssize_t rLast,
-
238  ssize_t cFirst, ssize_t cLast,
-
239  Entry const& e) {
-
240  for (ssize_t r = rFirst; r <= rLast; r++) {
-
241  for (ssize_t c = cFirst; c <=cFirst; c++) {
-
242  entry(r, c, e);
-
243  }
-
244  }
-
245  }
-
246 
-
258  Matrix subMatrix(size_t rFirst, size_t rLast,
-
259  size_t cFirst, size_t cLast) const {
-
260  if (rFirst > rLast || cFirst > cLast) return Matrix();
-
261  if (rFirst == 0 && cFirst == 0) {
-
262  Matrix ret(*this);
-
263  ret.size(rLast + 1, cLast + 1, Entry(0));
-
264  return ret;
-
265  }
-
266  Matrix ret(rLast - rFirst + 1, cLast - cFirst + 1, entry(rFirst, cFirst));
-
267  for (size_t r = rFirst; r <= rLast; r++)
-
268  for (size_t c = cFirst; c <= cLast; c++)
-
269  ret.entry(r - rFirst, c - cFirst, entry(r, c));
-
270  return ret;
-
271  }
-
272 
-
274  Matrix row(size_t r) const {
-
275  return subMatrix(r, r, 0, cols() - 1);
-
276  }
-
277 
-
279  Matrix col(size_t c) const {
-
280  return subMatrix(0, rows() - 1, c, c);
-
281  }
-
282 
-
284  Matrix positive() const {
-
285  return *this;
-
286  }
-
287 
-
289  Matrix negative() const {
-
290  Matrix ret(*this);
-
291  for (size_t r = 0, R = rows(); r < R; r++)
-
292  for (size_t c = 0, C = cols(); c < C; c++)
-
293  ret.entry(r, c, -ret.entry(r, c));
-
294  return ret;
-
295  }
-
296 
-
301  Matrix add(Matrix const& m) const {
-
302  if (rows() != m.rows() || cols() != m.cols()) return Matrix();
-
303  Matrix ret(*this);
-
304  for (size_t r = 0, R = rows(); r < R; r++)
-
305  for (size_t c = 0, C = cols(); c < C; c++)
-
306  ret.entry(r, c, ret.entry(r, c) + m.entry(r, c));
-
307  return ret;
-
308  }
-
309 
-
314  Matrix sub(Matrix const& m) const {
-
315  if (rows() != m.rows() || cols() != m.cols()) return Matrix();
-
316  Matrix ret(*this);
-
317  for (size_t r = 0, R = rows(); r < R; r++)
-
318  for (size_t c = 0, C = cols(); c < C; c++)
-
319  ret.entry(r, c, ret.entry(r, c) - m.entry(r, c));
-
320  return ret;
-
321  }
-
322 
-
327  Matrix mul(Matrix const& m) const {
-
328  if (cols() != m.rows()) return Matrix();
-
329  Matrix ret(rows(), m.cols(), Entry(0));
-
330  for (size_t r = 0, R = rows(); r < R; r++)
-
331  for (size_t c = 0, C = m.cols(); c < C; c++)
-
332  for (size_t k = 0, K = cols(); k < K; k++)
-
333  ret.entry(r, c, ret.entry(r, c) + entry(r, k) * m.entry(k, c));
-
334  return ret;
-
335  }
-
336 
-
338  Matrix mul(Entry const& s) const {
-
339  Matrix ret(*this);
-
340  for (size_t r = 0, R = rows(); r < R; r++)
-
341  for (size_t c = 0, C = cols(); c < C; c++)
-
342  ret.entry(r, c, ret.entry(r, c) * s);
-
343  return ret;
-
344  }
-
345 
-
347  Matrix div(Entry const& s) const {
-
348  Matrix ret(*this);
-
349  for (size_t r = 0, R = rows(); r < R; r++)
-
350  for (size_t c = 0, C = cols(); c < C; c++)
-
351  ret.entry(r, c, ret.entry(r, c) / s);
-
352  return ret;
-
353  }
-
354 
-
356  Matrix identity() const {
-
357  Matrix ret(*this);
-
358  ret.identitied();
-
359  return ret;
-
360  }
-
361 
- -
368  for (size_t r = 0, R = rows(); r < R; r++)
-
369  for (size_t c = 0, C = cols(); c < C; c++)
-
370  entry(r, c, (r == c ? Entry(1) : Entry(0)));
-
371  return *this;
-
372  }
-
373 
- -
378  triangulared();
-
379  for (size_t i = 0, I = rows(); i < I; ++i) {
-
380  for (size_t j = i + 1, J = cols(); j < J; ++j) {
-
381  entry(i, j, Entry(0));
-
382  }
-
383  }
-
384  return *this;
-
385  }
-
386 
-
390  Matrix diagonal() const {
-
391  Matrix ret(*this);
-
392  ret.diagonaled();
-
393  return ret;
-
394  }
-
395 
-
401  Matrix inverse() const {
-
402  if (rows() != cols() || rows() == 0) return Matrix<Entry>();
-
403  Matrix tmp(rows(), cols() * 2, Entry(0));
-
404  for (size_t r = 0, R = rows(); r < R; r++) {
-
405  for (size_t c = 0, C = cols(); c < C; c++) {
-
406  tmp.entry(r, c, entry(r, c));
-
407  tmp.entry(r, c + cols(), (r == c ? Entry(1) : Entry(0)));
-
408  }
-
409  }
-
410  tmp.triangulared();
-
411  for (ssize_t r = rows() - 1; r >= 0; r--) {
-
412  if (tmp(r, r) == Entry(0)) return Matrix<Entry>();
-
413  for (ssize_t r2 = r - 1; r2 >= 0; r2--) {
-
414  Entry rat(-tmp.entry(r2, r) / tmp.entry(r, r));
-
415  for (size_t c = r, C = tmp.cols(); c < C; c++) {
-
416  tmp.entry(r2, c, tmp.entry(r2, c) + rat * tmp(r, c));
-
417  }
-
418  }
-
419  Entry rat(tmp.entry(r, r));
-
420  for (size_t c = cols(), C = tmp.cols(); c < C; c++) {
-
421  tmp.entry(r, c - cols(), tmp.entry(r, c) / rat);
-
422  }
-
423  }
-
424  tmp.size(cols(), rows(), Entry(0));
-
425  return tmp;
-
426  }
-
427 
- -
430  copyFrom(inverse());
-
431  return *this;
-
432  }
-
433 
-
435  Matrix transpose() const {
-
436  Matrix ret(cols(), rows(), Entry(0));
-
437  for (size_t r = 0, R = cols(); r < R; r++)
-
438  for (size_t c = 0, C = rows(); c < C; c++)
-
439  ret.entry(r, c, entry(c, r));
-
440  return ret;
-
441  }
-
442 
- -
445  copyFrom(transpose());
-
446  return *this;
-
447  }
-
448 
-
450  Matrix triangular() const {
-
451  Matrix<Entry> ret(*this);
-
452  ret.triangulared();
-
453  return ret;
-
454  }
-
455 
- -
458  for (size_t r = 0, c = 0, R = rows(), C = cols(); r < R && c < C; r++) {
-
459  ssize_t maxR;
-
460  for ( ; c < C; c++) {
-
461  maxR = -1;
-
462  for (size_t r2 = r; r2 < R; r2++)
-
463  if (maxR == -1 || tAbs(entry(r2, c)) > tAbs(entry(maxR, c)))
-
464  maxR = r2;
-
465  if (entry(maxR, c) != Entry(0)) break;
-
466  }
-
467  if (c >= C) break;
-
468  if (maxR != (ssize_t)r) {
-
469  for (size_t c2 = c; c2 < C; c2++)
-
470  std::swap(self()->entries_[self->index( r, c2)],
-
471  self()->entries_[self->index(maxR, c2)]);
-
472  }
-
473  for (size_t r2 = r + 1; r2 < R; r2++) {
-
474  Entry rati = -entry(r2, c) / entry(r, c);
-
475  entry(r2, c, Entry(0));
-
476  for (size_t c2 = c + 1; c2 < C; c2++)
-
477  entry(r2, c2, entry(r2, c2) + entry(r, c2) * rati);
-
478  }
-
479  }
-
480  return *this;
-
481  }
-
482 
-
484  Matrix& operator=(Matrix const& m) {
-
485  return copyFrom(m);
-
486  }
-
487 
-
489  Entry operator()(size_t r, size_t c) const {
-
490  return entry(r, c);
-
491  }
-
492 
-
494  Entry operator()(size_t r, size_t c, Entry const& e) {
-
495  return entry(r, c, e);
-
496  }
-
497 
-
499  Matrix operator+() const {
-
500  return positive();
-
501  }
-
502 
-
504  Matrix operator-() const {
-
505  return negative();
-
506  }
-
507 
-
509  Matrix operator+(Matrix const& m) const {
-
510  return add(m);
-
511  }
-
512 
-
514  Matrix operator-(Matrix const& m) const {
-
515  return sub(m);
-
516  }
-
517 
-
519  Matrix operator*(Matrix const& m) const {
-
520  return mul(m);
-
521  }
-
522 
-
524  Matrix operator*(Entry const& s) const {
-
525  return mul(s);
-
526  }
-
527 
-
529  Matrix operator/(Entry const& s) const {
-
530  return div(s);
-
531  }
-
532 };
-
533 
-
534 } // meow
-
535 
-
536 #endif // math_Matrix_H__
-
Matrix col(size_t c) const
Return the c -th column.
Definition: Matrix.h:279
-
Matrix & triangulared()
triangluar itself
Definition: Matrix.h:457
-
std::vector< Entry >::const_reference EntryRefK
Definition: Matrix.h:22
-
Matrix & referenceFrom(Matrix const &m)
reference
Definition: Matrix.h:110
-
size_t rows() const
Return number of rows.
Definition: Matrix.h:129
-
Matrix operator*(Entry const &s) const
same as mul(m)
Definition: Matrix.h:524
-
Matrix div(Entry const &s) const
return (*this) / s. s is a scalar
Definition: Matrix.h:347
-
Matrix operator+() const
same as positive()
Definition: Matrix.h:499
-
std::vector< Entry >::reference EntryRef
Definition: Matrix.h:21
-
size_t rows(size_t r, Entry const &e)
resize the matrix such that number of rows become r.
Definition: Matrix.h:152
-
Matrix & transposed()
Let itself become itself's transpose matrix.
Definition: Matrix.h:444
-
size_t cols() const
Return number of cols.
Definition: Matrix.h:134
-
Entry operator()(size_t r, size_t c, Entry const &e)
same as entry(r,c,e)
Definition: Matrix.h:494
-
Matrix inverse() const
Return a matrix which is an inverse matrix of (*this)
Definition: Matrix.h:401
-
Matrix subMatrix(size_t rFirst, size_t rLast, size_t cFirst, size_t cLast) const
Return a rLast-rFirst+1 x cLast-cFirst+1 matrix.
Definition: Matrix.h:258
-
bool valid() const
Return whether it is a valid matrix.
Definition: Matrix.h:124
-
Matrix operator*(Matrix const &m) const
same as mul(m)
Definition: Matrix.h:519
-
Matrix row(size_t r) const
Return the r -th row.
Definition: Matrix.h:274
-
Matrix & operator=(Matrix const &m)
same as copyFrom
Definition: Matrix.h:484
-
Matrix()
constructor
Definition: Matrix.h:62
-
Matrix diagonal() const
Return a matrix which is a diangonal form of me.
Definition: Matrix.h:390
-
Matrix(Matrix const &m)
constructor
Definition: Matrix.h:71
-
Matrix & copyFrom(Matrix const &m)
copy
Definition: Matrix.h:97
-
T tAbs(T const &t)
就只是個取絕對值
Definition: utility.h:151
-
Matrix(size_t r, size_t c, Entry const &e)
constructor
Definition: Matrix.h:83
-
void entries(ssize_t rFirst, ssize_t rLast, ssize_t cFirst, ssize_t cLast, Entry const &e)
Change the entries from rFirst x cFirst to rLast x cLast.
Definition: Matrix.h:237
-
size_t size() const
Return number of rows times number of cols.
Definition: Matrix.h:139
-
size_t size(size_t r, size_t c, Entry const &e)
resize
Definition: Matrix.h:195
-
void clear()
free the memory
Definition: Matrix.h:204
-
Matrix identity() const
Return a identity matrix with size equal to itself.
Definition: Matrix.h:356
-
Matrix & diagonaled()
Let itself be an diagonal form of original itself.
Definition: Matrix.h:377
-
Matrix transpose() const
return itself's transpose matrix
Definition: Matrix.h:435
-
~Matrix()
destructor
Definition: Matrix.h:87
-
Matrix mul(Matrix const &m) const
return (*this) times m.
Definition: Matrix.h:327
-
Matrix mul(Entry const &s) const
return (*this) times s. s is a scalar
Definition: Matrix.h:338
-
EntryRef entryGet(size_t r, size_t c)
Get the entry at r x c.
Definition: Matrix.h:223
-
Matrix & inversed()
let itself become itself's inverse matrix
Definition: Matrix.h:429
-
Matrix sub(Matrix const &m) const
return (*this) - m.
Definition: Matrix.h:314
-
Matrix operator+(Matrix const &m) const
same as add(m)
Definition: Matrix.h:509
-
Entry operator()(size_t r, size_t c) const
same as entry(r,c)
Definition: Matrix.h:489
-
matrix
Definition: Matrix.h:19
-
Matrix operator-() const
same as negative()
Definition: Matrix.h:504
-
Entry entry(size_t r, size_t c, Entry const &e)
Change the entry at r x c.
Definition: Matrix.h:217
-
Matrix & identitied()
Let itself be an identity matrix.
Definition: Matrix.h:367
-
Entry entry(size_t r, size_t c) const
Access the entry at r x c.
Definition: Matrix.h:212
-
Matrix negative() const
return -(*this)
Definition: Matrix.h:289
- -
size_t cols(size_t c, Entry const &e)
resize the matrix such that number of cols become c
Definition: Matrix.h:169
-
Matrix operator/(Entry const &s) const
same as div(s)
Definition: Matrix.h:529
-
Matrix positive() const
return +(*this)
Definition: Matrix.h:284
-
void reset(size_t r, size_t c, Entry const &e)
reset the size of the matrix to r x c with entry all be e
Definition: Matrix.h:116
-
Matrix operator-(Matrix const &m) const
same as sub(m)
Definition: Matrix.h:514
-
Matrix triangular() const
return a matrix which is the triangular form of (*this)
Definition: Matrix.h:450
-
Matrix add(Matrix const &m) const
return (*this) + m.
Definition: Matrix.h:301
-
-
- - - - - diff --git a/doc/html/MergeableHeap_8h.html b/doc/html/MergeableHeap_8h.html deleted file mode 100644 index 6a9629b..0000000 --- a/doc/html/MergeableHeap_8h.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/MergeableHeap.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
MergeableHeap.h File Reference
-
-
-
#include <cstdlib>
-#include <algorithm>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::MergeableHeap< Element >
 一個用 左偏樹 實作的 Maximum-Heap , 除了原本heap有的功能外, 還支援 merge 功能 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/MergeableHeap_8h_source.html b/doc/html/MergeableHeap_8h_source.html deleted file mode 100644 index 0dbc83c..0000000 --- a/doc/html/MergeableHeap_8h_source.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/MergeableHeap.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
MergeableHeap.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_MergeableHeap_H__
-
2 #define dsa_MergeableHeap_H__
-
3 
-
4 #include <cstdlib>
-
5 #include <algorithm>
-
6 
-
7 namespace meow {
-
8 
-
29 template<class Element>
-
30 class MergeableHeap { // maximum-heap
-
31 private:
-
32  struct Node {
-
33  Element value_;
-
34  Node* lChild_;
-
35  Node* rChild_;
-
36  size_t weight_;
-
37  Node(Element const& value):
-
38  value_(value), lChild_(NULL), rChild_(NULL), weight_(1){
-
39  }
-
40  };
-
41 
-
42  Node* root_;
-
43 
-
44  void clear(Node* node) {
-
45  if (node != NULL) {
-
46  clear(node->lChild_);
-
47  clear(node->rChild_);
-
48  delete node;
-
49  }
-
50  }
-
51  Node* dup(Node* node) {
-
52  if (node == NULL) return NULL;
-
53  Node* ret = new Node(node->value_);
-
54  ret->lChild_ = dup(node->lChild_);
-
55  ret->rChild_ = dup(node->rChild_);
-
56  ret->weight_ = 1;
-
57  ret->weight_ += (ret->lChild_ == NULL ? 0 : ret->lChild_->weight_);
-
58  ret->weight_ += (ret->rChild_ == NULL ? 0 : ret->rChild_->weight_);
-
59  return ret;
-
60  }
-
61  Node* merge(Node* left, Node* right) {
-
62  if (left == NULL) return right;
-
63  if (right == NULL) return left;
-
64  if (left->value_ < right->value_) {
-
65  std::swap(left, right);
-
66  }
-
67  left->rChild_ = merge(left->rChild_, right);
-
68  size_t lw = (left->lChild_ == NULL ? 0 : left->lChild_->weight_);
-
69  size_t rw = (left->rChild_ == NULL ? 0 : left->rChild_->weight_);
-
70  if (lw < rw) {
-
71  std::swap(left->lChild_, left->rChild_);
-
72  }
-
73  left->weight_ = 1 + lw + rw;
-
74  return left;
-
75  }
-
76 public:
-
78  MergeableHeap(): root_(NULL){
-
79  }
-
80 
-
82  MergeableHeap(MergeableHeap const& heap2): root_(dup(heap2.root_)) {
-
83  }
-
84 
- -
87  clear(root_);
-
88  }
-
89 
- -
92  delete root_;
-
93  root_ = dup(heap2.root_);
-
94  return *this;
-
95  }
-
96 
-
100  void moveTo(MergeableHeap* heap2){
-
101  heap2->clear();
-
102  heap2->root_ = root_;
-
103  root_ = NULL;
-
104  }
-
105 
-
109  Element const& top() const {
-
110  return root_->value_;
-
111  }
-
112 
-
116  size_t size() const {
-
117  return (root_ == NULL ? 0 : root_->weight_);
-
118  }
-
119 
-
123  bool empty() const {
-
124  return (size() == 0);
-
125  }
-
126 
-
130  void push(Element const& value) {
-
131  root_ = merge(root_, new Node(value));
-
132  }
-
133 
-
137  void pop() {
-
138  Node* l = root_->lChild_;
-
139  Node* r = root_->rChild_;
-
140  delete root_;
-
141  root_ = merge(l, r);
-
142  }
-
143 
-
147  void clear() {
-
148  clear(root_);
-
149  root_ = NULL;
-
150  }
-
151 
-
155  void merge(MergeableHeap* heap2) {
-
156  root_ = merge(root_, heap2->root_);
-
157  heap2->root_ = NULL;
-
158  }
-
159 
- -
162  return copyFrom(heap2);
-
163  }
-
164 };
-
165 
-
166 } // meow
-
167 
-
168 #endif // dsa_MergeableHeap_H__
-
void push(Element const &value)
加入element
-
Element const & top() const
回傳最大的那個 Element
-
MergeableHeap & copyFrom(MergeableHeap const &heap2)
複製資料
Definition: MergeableHeap.h:91
-
MergeableHeap()
constructor
Definition: MergeableHeap.h:78
- -
一個用 左偏樹 實作的 Maximum-Heap , 除了原本heap有的功能外, 還支援 merge 功能
Definition: MergeableHeap.h:30
-
void pop()
將最大的element移除
-
size_t size() const
回傳資料個數
-
~MergeableHeap()
destructor
Definition: MergeableHeap.h:86
-
MergeableHeap & operator=(MergeableHeap const &heap2)
same as copyFrom(heap2)
-
void merge(MergeableHeap *heap2)
-
void moveTo(MergeableHeap *heap2)
將自己的資料丟給指定的heap, 從此自己一身空
-
bool empty() const
回傳是否為空
-
MergeableHeap(MergeableHeap const &heap2)
constructor, 並且複製資料
Definition: MergeableHeap.h:82
-
-
- - - - - diff --git a/doc/html/ObjArray_8h.html b/doc/html/ObjArray_8h.html deleted file mode 100644 index 75b0294..0000000 --- a/doc/html/ObjArray_8h.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjArray.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ObjArray.h File Reference
-
-
-
#include "ObjBase.h"
-#include "../Self.h"
-#include <vector>
-#include <string>
-#include <typeinfo>
-#include <cstdio>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::ObjArray< T >
 純粹把 std::vector 包起來, 變成繼承自 ObjBase More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/ObjArray_8h_source.html b/doc/html/ObjArray_8h_source.html deleted file mode 100644 index c33ca94..0000000 --- a/doc/html/ObjArray_8h_source.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjArray.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ObjArray.h
-
-
-Go to the documentation of this file.
1 #ifndef oo_ObjArray_H__
-
2 #define oo_ObjArray_H__
-
3 
-
4 #include "ObjBase.h"
-
5 
-
6 #include "../Self.h"
-
7 
-
8 #include <vector>
-
9 #include <string>
-
10 #include <typeinfo>
-
11 
-
12 #include <cstdio>
-
13 #include <cstdlib>
-
14 
-
15 namespace meow {
-
16 
-
22 template<class T>
-
23 class ObjArray: public ObjBase {
-
24 private:
-
25  struct Myself {
-
26  std::vector<T> array_;
-
27 
-
28  Myself() {
-
29  }
-
30 
-
31  Myself(Myself const& b): array_(b.array_) {
-
32  }
-
33 
-
34  Myself(size_t sz, T const& e): array_(sz, e) {
-
35  }
-
36 
-
37  ~Myself() {
-
38  }
-
39  };
-
40  Self<Myself> const self;
-
41 public:
-
42  ObjArray(): self() {
-
43  }
-
44 
-
45  ObjArray(ObjArray const& a): self(a.self, Self<Myself>::COPY_FROM) {
-
46  }
-
47 
-
48  ObjArray(std::vector<T> const& a): self(a) {
-
49  }
-
50 
-
51  ObjArray(size_t sz, T const& e): self(Myself(sz, e)) {
-
52  }
-
53 
- -
55  }
-
56 
-
57  ObjArray& copyFrom(ObjArray const& a) {
-
58  self().copyFrom(a.self);
-
59  return *this;
-
60  }
-
61 
- -
63  self().referenceFrom(a.self);
-
64  return *this;
-
65  }
-
66 
-
67  size_t size() const {
-
68  return self->array_.size();
-
69  }
-
70  bool empty() const {
-
71  return self->array_.empty();
-
72  }
-
73 
-
74  size_t size(size_t res, T const& i) {
-
75  self()->array_.resize(res, i);
-
76  return size();
-
77  }
-
78 
-
79  size_t size(size_t res) {
-
80  self()->array_.resize(res);
-
81  return size();
-
82  }
-
83 
-
84  void clear() {
-
85  self()->array_.clear();
-
86  }
-
87 
-
88  T entry(size_t i) const {
-
89  return self->array_[i];
-
90  }
-
91 
-
92  T entry(size_t i, T const& e) {
-
93  self()->array_[i] = e;
-
94  return entry(i);
-
95  }
-
96 
-
97  T putBack(T const& e) {
-
98  self()->array_.push_back(e);
-
99  return entry(size() - 1);
-
100  }
-
101 
-
102  bool popBack() {
-
103  if (empty()) return false;
-
104  self()->array_.pop_back();
-
105  return true;
-
106  }
-
107 
- -
109  return copyFrom(a);
-
110  }
-
111 
-
112  T operator[](size_t i) const {
-
113  return self->array_[i];
-
114  }
-
115 
-
116  std::vector<T>::reference operator[](size_t i) {
-
117  return self()->array_[i];
-
118  }
-
119 
-
120  bool write(FILE* f, bool bin, unsigned int fg) const {
-
121  size_t sz = size();
-
122  if (bin) {
-
123  if (fwrite(&sz, sizeof(size_t), 1, f) < 1) return false;
-
124  }
-
125  else {
-
126  if (fprintf(f, "%lu\n", sz) < 1) return false;
-
127  }
-
128  for (size_t i = 0; i < sz; i++) {
-
129  if (self->array_[i].write(f, bin, fg) == false) return false;
-
130  }
-
131  return true;
-
132  }
-
133 
-
134  bool read(FILE* f, bool bin, unsigned int fg) {
-
135  size_t sz;
-
136  if (bin) {
-
137  if (fread(&sz, sizeof(size_t), 1, f) < 1) return false;
-
138  }
-
139  else {
-
140  if (fscanf(f, "%lu\n", &sz) < 1) return false;
-
141  }
-
142  size(sz);
-
143  for (size_t i = 0; i < sz; i++) {
-
144  if (self()->array_[i].read(f, bin, fg) == false) return false;
-
145  }
-
146  return true;
-
147  }
-
148 
-
149  ObjBase* create() const {
-
150  return new ObjArray();
-
151  }
-
152 
-
153  ObjBase* copyFrom(ObjBase const* b) {
-
154  return &(copyFrom(*(ObjArray const*)b));
-
155  }
-
156 
-
157  char const* ctype() const {
-
158  return typeid(*this).name();
-
159  }
-
160 
-
161  std::string type() const {
-
162  return std::string(ctype());
-
163  }
-
164 };
-
165 
-
166 } // meow
-
167 
-
168 #endif // oo_ObjArray_H__
-
char const * ctype() const
用C-style string回傳這個class的type name
Definition: ObjArray.h:157
- -
ObjArray(size_t sz, T const &e)
Definition: ObjArray.h:51
-
size_t size(size_t res, T const &i)
Definition: ObjArray.h:74
-
ObjArray(ObjArray const &a)
Definition: ObjArray.h:45
-
ObjArray & referenceFrom(ObjArray const &a)
Definition: ObjArray.h:62
-
ObjArray & operator=(ObjArray const &a)
Definition: ObjArray.h:108
-
size_t size() const
Definition: ObjArray.h:67
-
size_t size(size_t res)
Definition: ObjArray.h:79
-
bool empty() const
Definition: ObjArray.h:70
-
bool popBack()
Definition: ObjArray.h:102
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
Definition: ObjArray.h:120
-
T entry(size_t i) const
Definition: ObjArray.h:88
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
ObjArray & copyFrom(ObjArray const &a)
Definition: ObjArray.h:57
-
std::string type() const
用std::string回傳這個class的type name
Definition: ObjArray.h:161
- -
ObjArray(std::vector< T > const &a)
Definition: ObjArray.h:48
-
T operator[](size_t i) const
Definition: ObjArray.h:112
-
ObjBase * copyFrom(ObjBase const *b)
複製, 預設使用operator=
Definition: ObjArray.h:153
-
std::vector< T >::reference operator[](size_t i)
Definition: ObjArray.h:116
- -
T entry(size_t i, T const &e)
Definition: ObjArray.h:92
-
bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
Definition: ObjArray.h:134
-
void clear()
Definition: ObjArray.h:84
-
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
Definition: ObjArray.h:149
-
純粹把 std::vector 包起來, 變成繼承自 ObjBase
Definition: ObjArray.h:23
- -
T putBack(T const &e)
Definition: ObjArray.h:97
-
-
- - - - - diff --git a/doc/html/ObjBase_8h.html b/doc/html/ObjBase_8h.html deleted file mode 100644 index 8c8d410..0000000 --- a/doc/html/ObjBase_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjBase.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ObjBase.h File Reference
-
-
-
#include <cstdio>
-#include <typeinfo>
-#include <string>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::ObjBase
 一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/ObjBase_8h_source.html b/doc/html/ObjBase_8h_source.html deleted file mode 100644 index 2edccbb..0000000 --- a/doc/html/ObjBase_8h_source.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjBase.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ObjBase.h
-
-
-Go to the documentation of this file.
1 #ifndef oo_ObjBase_H__
-
2 #define oo_ObjBase_H__
-
3 
-
4 #include <cstdio>
-
5 #include <typeinfo>
-
6 #include <string>
-
7 
-
8 namespace meow {
-
9 
-
15 class ObjBase {
-
16 protected:
-
17 
-
21  ObjBase() { }
-
22 public:
-
23  virtual ~ObjBase() { }
-
24 
-
33  virtual bool write(FILE* f, bool bin, unsigned int fg) const {
-
34  return false;
-
35  }
-
36 
-
45  virtual bool read(FILE* f, bool bin, unsigned int fg) {
-
46  return false;
-
47  }
-
48 
-
52  virtual ObjBase* create() const {
-
53  return NULL;
-
54  }
-
55 
-
62  virtual ObjBase* copyFrom(ObjBase const* b) {
-
63  (*this) = (*b);
-
64  return this;
-
65  }
-
66 
-
70  virtual char const* ctype() const {
-
71  return typeid(*this).name();
-
72  }
-
73 
-
77  virtual std::string type() const {
-
78  return std::string(ctype());
-
79  }
-
80 
-
84  static char const* ctypeBase() {
-
85  return typeid(ObjBase).name();
-
86  }
-
87 
-
91  static std::string typeBase() {
-
92  static std::string s(ctypeBase());
-
93  return s;
-
94  }
-
95 };
-
96 
-
97 } // meow
-
98 
-
99 #endif // oo_ObjBase_H__
-
static char const * ctypeBase()
用C-style string回傳base的type name
Definition: ObjBase.h:84
-
virtual ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
Definition: ObjBase.h:52
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
virtual ObjBase * copyFrom(ObjBase const *b)
複製, 預設使用operator=
Definition: ObjBase.h:62
-
virtual char const * ctype() const
用C-style string回傳這個class的type name
Definition: ObjBase.h:70
-
virtual ~ObjBase()
Definition: ObjBase.h:23
-
virtual bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
Definition: ObjBase.h:45
-
ObjBase()
Constructor with doing nothing.
Definition: ObjBase.h:21
-
static std::string typeBase()
用std::string回傳base的type name
Definition: ObjBase.h:91
-
virtual bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
Definition: ObjBase.h:33
-
virtual std::string type() const
用std::string回傳這個class的type name
Definition: ObjBase.h:77
-
-
- - - - - diff --git a/doc/html/ObjDictionary_8h.html b/doc/html/ObjDictionary_8h.html deleted file mode 100644 index 63fbe83..0000000 --- a/doc/html/ObjDictionary_8h.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjDictionary.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ObjDictionary.h File Reference
-
-
-
#include "ObjBase.h"
-#include "../Self.h"
-#include <string>
-#include <typeinfo>
-#include <map>
-#include <cstdio>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::ObjDictionary< Key, Value >
 純粹把 std::map 包起來, 變成繼承自 ObjBase More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/ObjDictionary_8h_source.html b/doc/html/ObjDictionary_8h_source.html deleted file mode 100644 index cf0162f..0000000 --- a/doc/html/ObjDictionary_8h_source.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjDictionary.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ObjDictionary.h
-
-
-Go to the documentation of this file.
1 #ifndef oo_ObjDictionary_H__
-
2 #define oo_ObjDictionary_H__
-
3 
-
4 #include "ObjBase.h"
-
5 
-
6 #include "../Self.h"
-
7 
-
8 #include <string>
-
9 #include <typeinfo>
-
10 #include <map>
-
11 
-
12 #include <cstdio>
-
13 #include <cstdlib>
-
14 
-
15 namespace meow {
-
16 
-
22 template<class Key, class Value>
-
23 class ObjDictionary: public ObjBase {
-
24 private:
-
25  struct Myself {
-
26  std::map<Key, Value> dictionary_;
-
27 
-
28  Myself() {
-
29  }
-
30 
-
31  Myself(Myself const& b): dictionary_(b.dictionary_) {
-
32  }
-
33 
-
34  ~Myself() {
-
35  }
-
36  };
-
37 
-
38  Self<Myself> const self;
-
39 public:
-
40  ObjDictionary(): self() {
-
41  }
-
42 
-
43  ObjDictionary(ObjDictionary const& d): self(d.self, Self<Myself>::COPY_FROM) {
-
44  self.copyFrom(b.self);
-
45  }
-
46 
-
47  ObjDictionary(std::map<Key, Value> const& d): self(Myself(d)) {
-
48  }
-
49 
- -
51  }
-
52 
- -
54  self().copyFrom(d.self);
-
55  return *this;
-
56  }
-
57 
- -
59  self().referenceFrom(d.self);
-
60  return *this;
-
61  }
-
62 
-
63  size_t size() const {
-
64  return self->dictionary_.size();
-
65  }
-
66 
-
67  bool empty() const {
-
68  return self->dictionary_.empty();
-
69  }
-
70 
-
71  void clear() {
-
72  self()->dictionary_.clear();
-
73  }
-
74 
-
75  std::map<Key, Value>::const_iterator first() const {
-
76  return self()->dictionary_.begin();
-
77  }
-
78 
-
79  std::map<Key, Value>::iterator first() {
-
80  return self()->dictionary_.begin();
-
81  }
-
82 
-
83  std::map<Key, Value>::const_iterator end() const {
-
84  return self()->dictionary_.end(); // OAO!!!
-
85  }
-
86 
-
87  std::map<Key, Value>::iterator end() {
-
88  return self()->dictionary_.end();
-
89  }
-
90 
-
91  std::map<Key, Value>::const_iterator find(Key const& k) const {
-
92  return self()->dictionary_.find(k); // OAO!!!
-
93  }
-
94 
-
95  std::map<Key, Value>::iterator find(Key const& k) {
-
96  return self()->dictionary_.find(k);
-
97  }
-
98 
-
99  bool exist(Key const& k) const {
-
100  return (find() != end());
-
101  }
-
102 
-
103  void insert(Key const& k, Value const& v) {
-
104  self->dictionary_.insert(std::pair<Key, Value>(k, v));
-
105  }
-
106 
- -
108  return copyFrom(a);
-
109  }
-
110 
-
111  Value operator[](Key const& k) {
-
112  return self()->dictionary_[k];
-
113  }
-
114 
-
115  bool write(FILE* f, bool bin, unsigned int fg) const {
-
116  size_t sz = size();
-
117  if (bin) {
-
118  if (fwrite(&sz, sizeof(size_t), 1, f) < 1) return false;
-
119  }
-
120  else {
-
121  if (fprintf(f, "%lu\n", sz) < 1) return false;
-
122  }
-
123  for (std::map<Key, Value>::const_iterator it = begin(); it != end(); ++it) {
-
124  if (it->first .write(f, bin, fg) == false) return false;
-
125  if (it->second.write(f, bin, fg) == false) return false;
-
126  }
-
127  return true;
-
128  }
-
129 
-
130  bool read(FILE* f, bool bin, unsigned int fg) {
-
131  size_t sz;
-
132  if (bin) {
-
133  if (fread(&sz, sizeof(size_t), 1, f) < 1) return false;
-
134  }
-
135  else {
-
136  if (fscanf(f, "%lu\n", &sz) < 0) return false;
-
137  }
-
138  for (size_t i = 0; i < sz; i++) {
-
139  Key k;
-
140  Value v;
-
141  if (k.read(f, bin, fg) == false) return false;
-
142  if (v.read(f, bin, fg) == false) return false;
-
143  insert(k, v);
-
144  }
-
145  return true;
-
146  }
-
147 
-
148  ObjBase* create() const {
-
149  return new ObjDictionary();
-
150  }
-
151 
-
152  ObjBase* copyFrom(ObjBase const* b) {
-
153  return &(copyFrom(*(ObjDictionary const*)b));
-
154  }
-
155 
-
156  char const* ctype() const {
-
157  return typeid(*this).name();
-
158  }
-
159 
-
160  std::string type() const {
-
161  return std::string(ctype());
-
162  }
-
163 };
-
164 
-
165 }
-
166 
-
167 #endif // oo_ObjDictionary_H__
-
ObjDictionary(ObjDictionary const &d)
Definition: ObjDictionary.h:43
-
std::map< Key, Value >::iterator first()
Definition: ObjDictionary.h:79
- -
ObjDictionary & copyFrom(ObjDictionary const &d)
Definition: ObjDictionary.h:53
-
size_t size() const
Definition: ObjDictionary.h:63
-
ObjDictionary & operator=(ObjDictionary const &a)
-
std::map< Key, Value >::const_iterator first() const
Definition: ObjDictionary.h:75
-
std::string type() const
用std::string回傳這個class的type name
-
bool empty() const
Definition: ObjDictionary.h:67
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
-
ObjDictionary & referenceFrom(ObjDictionary const &d)
Definition: ObjDictionary.h:58
-
ObjBase * copyFrom(ObjBase const *b)
複製, 預設使用operator=
-
std::map< Key, Value >::iterator find(Key const &k)
Definition: ObjDictionary.h:95
- -
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
-
Value operator[](Key const &k)
- -
char const * ctype() const
用C-style string回傳這個class的type name
-
ObjDictionary(std::map< Key, Value > const &d)
Definition: ObjDictionary.h:47
-
void insert(Key const &k, Value const &v)
-
std::map< Key, Value >::const_iterator find(Key const &k) const
Definition: ObjDictionary.h:91
-
std::map< Key, Value >::const_iterator end() const
Definition: ObjDictionary.h:83
-
std::map< Key, Value >::iterator end()
Definition: ObjDictionary.h:87
-
純粹把 std::map 包起來, 變成繼承自 ObjBase
Definition: ObjDictionary.h:23
- -
bool exist(Key const &k) const
Definition: ObjDictionary.h:99
- -
bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
-
-
- - - - - diff --git a/doc/html/ObjProperties_8h.html b/doc/html/ObjProperties_8h.html deleted file mode 100644 index 25c7963..0000000 --- a/doc/html/ObjProperties_8h.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjProperties.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ObjProperties.h File Reference
-
-
-
#include "ObjBase.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::ObjProperties< SID >
 目前擺爛中 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/ObjProperties_8h_source.html b/doc/html/ObjProperties_8h_source.html deleted file mode 100644 index 9ba65fd..0000000 --- a/doc/html/ObjProperties_8h_source.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjProperties.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ObjProperties.h
-
-
-Go to the documentation of this file.
1 #ifndef oo_ObjProperties_H__
-
2 #define oo_ObjProperties_H__
-
3 
-
4 #include "ObjBase.h"
-
5 
-
6 #include <cstdlib>
-
7 
-
8 namespace meow {
-
9 
-
10 template<size_t SID>
-
11 
-
13 class ObjProperties: public ObjBase {
-
14 private:
-
15 public:
-
16  ObjProperties();
-
17 
-
18  ObjProperties(ObjProperties const& p);
-
19 
-
20  virtual ~ObjProperties();
-
21 
-
22  size_t propertySize() const;
-
23 
-
24  bool propertyEmpty() const;
-
25 
-
26  void propertyClear();
-
27 
-
28  ObjBase const* property(std::string name) const;
-
29 
-
30  ObjBase* property(std::string name);
-
31 
-
32  bool propertyAdd(std::string name, ObjBase* obj, bool autoRemove);
-
33 
-
34  bool propertyDel(std::string name);
-
35 
-
36  ObjProperties& properties() const;
-
37 
- -
39 
-
40  bool write(FILE* f, bool bin, unsigned int fg) const;
-
41 
-
42  bool read(FILE* f, bool bin, unsigned int fg);
-
43 
-
44  ObjBase* create() const;
-
45 
-
46  ObjBase* copyFrom(ObjBase const* b);
-
47 
-
48  char const* ctype() const;
-
49 
-
50  std::string type() const;
-
51 };
-
52 
-
53 }
-
54 
-
55 #endif // oo_ObjProperties_H__
- -
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
-
ObjProperties & properties() const
-
char const * ctype() const
用C-style string回傳這個class的type name
-
bool propertyDel(std::string name)
-
virtual ~ObjProperties()
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
bool propertyAdd(std::string name, ObjBase *obj, bool autoRemove)
-
目前擺爛中
Definition: ObjProperties.h:13
-
bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
- -
size_t propertySize() const
-
std::string type() const
用std::string回傳這個class的type name
-
ObjBase * copyFrom(ObjBase const *b)
複製, 預設使用operator=
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
-
bool propertyEmpty() const
-
ObjBase const * property(std::string name) const
- -
-
- - - - - diff --git a/doc/html/ObjSelector_8h.html b/doc/html/ObjSelector_8h.html deleted file mode 100644 index d8903ac..0000000 --- a/doc/html/ObjSelector_8h.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjSelector.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ObjSelector.h File Reference
-
-
-
#include "ObjBase.h"
-#include <utility>
-#include <vector>
-#include <string>
-#include <map>
-#include <cstdlib>
-#include <cstdio>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::ObjSelector< id >
 利用register的概念, 達到runtime用string選擇要new的class More...
 
- - - -

-Namespaces

 meow
 
- - - -

-Variables

static const size_t meow::kGlobalSeletorID = 0
 
-
-
- - - - - diff --git a/doc/html/ObjSelector_8h.js b/doc/html/ObjSelector_8h.js deleted file mode 100644 index 7e105da..0000000 --- a/doc/html/ObjSelector_8h.js +++ /dev/null @@ -1,5 +0,0 @@ -var ObjSelector_8h = -[ - [ "ObjSelector", "classmeow_1_1ObjSelector.html", "classmeow_1_1ObjSelector" ], - [ "kGlobalSeletorID", "ObjSelector_8h.html#aaa678bbd106012a98ed5679e2ca8cc32", null ] -]; \ No newline at end of file diff --git a/doc/html/ObjSelector_8h_source.html b/doc/html/ObjSelector_8h_source.html deleted file mode 100644 index 9083c7e..0000000 --- a/doc/html/ObjSelector_8h_source.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjSelector.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ObjSelector.h
-
-
-Go to the documentation of this file.
1 #ifndef oo_ObjSelector_H__
-
2 #define oo_ObjSelector_H__
-
3 
-
4 #include "ObjBase.h"
-
5 
-
6 #include <utility>
-
7 #include <vector>
-
8 #include <string>
-
9 #include <map>
-
10 
-
11 #include <cstdlib>
-
12 #include <cstdio>
-
13 
-
14 namespace meow {
-
15 
-
21 template<size_t id>
-
22 class ObjSelector {
-
23 private:
-
24  struct Info {
-
25  ObjSelector* parent_;
-
26  ObjBase const* pointer_;
-
27  bool autoDelete_;
-
28 
-
29  Info(ObjSelector* parent,
-
30  ObjBase const* ptr,
-
31  bool autoDelete) {
-
32  parent_ = parent;
-
33  pointer_ = ptr;
-
34  autoDelete_ = autoDelete;
-
35  }
-
36 
-
37  ~Info() {
-
38  if (autoDelete_) {
-
39  delete pointer_;
-
40  }
-
41  if (parent_ != NULL) {
-
42  parent_->me_.second = NULL;
-
43  }
-
44  }
-
45  };
-
46  friend struct Info;
-
47 
-
48  typedef typename std::map<std::string, Info*> Infos;
-
49  typedef typename std::map<std::string, Info*>::iterator InfosIterator;
-
50 
-
51  static Infos& funcs() {
-
52  static Infos f;
-
53  return f;
-
54  }
-
55  static Info* add(std::string name,
-
56  ObjSelector* parent,
-
57  ObjBase* ptr,
-
58  bool autoDelete) {
-
59  Info* info = new Info(parent, ptr, autoDelete);
-
60  del(name);
-
61  funcs()[name] = info;
-
62  return info;
-
63  }
-
64 
-
65  std::pair<std::string, Info*> me_;
-
66 public:
-
70  static void add(std::string name, ObjBase* obj, bool autoDelete) {
-
71  add(name, NULL, obj, autoDelete);
-
72  }
-
73 
-
77  static void add(ObjBase* obj, bool autoDelete) {
-
78  add(obj->type(), NULL, obj, autoDelete);
-
79  }
-
80 
-
84  static void del(std::string name) {
-
85  if (funcs().find(name) != funcs().end()) {
-
86  delete funcs()[name];
-
87  funcs().erase(name);
-
88  }
-
89  }
-
90 
-
94  static ObjBase const* get(std::string name) {
-
95  if (funcs().find(name) == funcs().end()) return NULL;
-
96  return funcs()[name]->pointer_;
-
97  }
-
98 
-
102  static ObjBase* create(std::string name) {
-
103  ObjBase const* ptr = get(name);
-
104  if(ptr == NULL) return NULL;
-
105  return ptr->create();
-
106  }
-
107 
-
111  static bool exist(ObjBase* obj) {
-
112  for (InfosIterator it = funcs().begin(); it != funcs().end(); it++) {
-
113  if (it->second->pointer_ == obj ||
-
114  (it->second->pointer_ != NULL &&
-
115  it->second->pointer_->type() == obj->type())) {
-
116  return true;
-
117  }
-
118  }
-
119  return false;
-
120  }
-
121 
-
125  static std::string name(ObjBase* obj) {
-
126  for (InfosIterator it = funcs().begin(); it != funcs().end(); it++) {
-
127  if (it->second->pointer_ == obj ||
-
128  (it->second->pointer_ != NULL &&
-
129  it->second->pointer_->type() == obj->type())) {
-
130  return it->first;
-
131  }
-
132  }
-
133  return std::string();
-
134  }
-
135 
-
139  static std::vector<std::string> names() {
-
140  std::vector<std::string> ret;
-
141  for (InfosIterator it = funcs().begin(); it != funcs().end(); it++)
-
142  ret.push_back(it->first);
-
143  return ret;
-
144  }
-
145 
-
149  ObjSelector(std::string name, ObjBase* obj, bool autoDelete) {
-
150  me_.first = name;
-
151  me_.second = add(me_.first, this, obj, autoDelete);
-
152  }
-
153 
-
157  ObjSelector(ObjBase* obj, bool autoDelete) {
-
158  me_.first = obj->type();
-
159  me_.second = add(me_.first, this, obj, autoDelete);
-
160  }
-
161 
- -
164  if (me_.second != NULL) {
-
165  del(me_.first);
-
166  }
-
167  }
-
168 
-
172  static bool write(FILE* f, bool binary, ObjBase* obj, unsigned int fg) {
-
173  if (!exist(obj)) return false;
-
174  char const* nme = name(obj).c_str();
-
175  size_t len = strlen(nme);
-
176  if (binary) {
-
177  if (fwrite(&len, sizeof(size_t ), 1, f) < 1) return false;
-
178  if (fwrite(nme , sizeof(char ), len, f) < len) return false;
-
179  if (fwrite(&fg , sizeof(unsigned int), 1, f) < 1) return false;
-
180  } else {
-
181  if (fprintf(f, "%s %u\n", nme, fg) < 2) return false;
-
182  }
-
183  return obj->write(f, binary, fg);
-
184  }
-
185 
-
189  static ObjBase* read(FILE* f, bool binary) {
-
190  static char name[2048];
-
191  size_t len;
-
192  unsigned int fg;
-
193  if (binary) {
-
194  if (fread(&len, sizeof(size_t ), 1, f) < 1) return NULL;
-
195  if (fread(name, sizeof(char ), len, f) < len) return NULL;
-
196  if (fread(&fg , sizeof(unsigned int), 1, f) < 1) return NULL;
-
197  name[len] = '\0';
-
198  } else {
-
199  if (fscanf(f, "%s %u", name, &fg) < 2) return NULL;
-
200  }
-
201  ObjBase* ret = create(std::string(name));
-
202  if (ret != NULL && ret->read(f, binary, fg) == false) {
-
203  delete ret;
-
204  ret = NULL;
-
205  }
-
206  return ret;
-
207  }
-
208 };
-
209 
-
210 static const size_t kGlobalSeletorID = 0;
-
211 
-
212 } // meow
-
213 
-
214 #endif // oo_ObjSelector_H__
-
friend struct Info
Definition: ObjSelector.h:46
-
static void add(ObjBase *obj, bool autoDelete)
新增(註冊) 一個Class (必須要繼承自 ObjBase) 並且默認type為name
Definition: ObjSelector.h:77
-
static ObjBase * read(FILE *f, bool binary)
從檔案中讀取一個物件(該物件必須要有註冊過)
Definition: ObjSelector.h:189
-
ObjSelector(ObjBase *obj, bool autoDelete)
宣告一個ObjSelector實體, 並且註冊一個 ObjBase
Definition: ObjSelector.h:157
-
static bool exist(ObjBase *obj)
利用type檢查是否有註冊過同種類的Class
Definition: ObjSelector.h:111
-
利用register的概念, 達到runtime用string選擇要new的class
Definition: ObjSelector.h:22
-
virtual ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
Definition: ObjBase.h:52
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
ObjSelector(std::string name, ObjBase *obj, bool autoDelete)
宣告一個ObjSelector實體, 並且註冊一個 ObjBase
Definition: ObjSelector.h:149
-
static ObjBase * create(std::string name)
回傳一個之前註冊過得Class new出來的實體
Definition: ObjSelector.h:102
-
~ObjSelector()
解構子
Definition: ObjSelector.h:163
-
static std::string name(ObjBase *obj)
利用type尋找name
Definition: ObjSelector.h:125
-
static void add(std::string name, ObjBase *obj, bool autoDelete)
新增(註冊) 一個Class (必須要繼承自 ObjBase) 並且給定其Name
Definition: ObjSelector.h:70
-
virtual bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
Definition: ObjBase.h:45
-
static bool write(FILE *f, bool binary, ObjBase *obj, unsigned int fg)
將一個物件寫到檔案裡(該物件必須要有註冊過)
Definition: ObjSelector.h:172
-
static std::vector< std::string > names()
回傳所有註冊過的name
Definition: ObjSelector.h:139
-
static const size_t kGlobalSeletorID
Definition: ObjSelector.h:210
-
static void del(std::string name)
依照name刪除之前註冊過得Class
Definition: ObjSelector.h:84
-
virtual bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
Definition: ObjBase.h:33
-
virtual std::string type() const
用std::string回傳這個class的type name
Definition: ObjBase.h:77
- -
-
- - - - - diff --git a/doc/html/ObjTypes_8h.html b/doc/html/ObjTypes_8h.html deleted file mode 100644 index 022ad9a..0000000 --- a/doc/html/ObjTypes_8h.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjTypes.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ObjTypes.h File Reference
-
-
-
#include "../Self.h"
-#include "ObjBase.h"
-#include <cstdlib>
-#include <cstdio>
-
-

Go to the source code of this file.

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

-Classes

class  meow::ObjType< Type, ReaderWriter >
 純粹把給定的 Type 包起來, 變成繼承自 ObjBase More...
 
class  meow::ReaderWriter_int
 
class  meow::ReaderWriter_size_t
 
class  meow::ReaderWriter_double
 
class  meow::ReaderWriter_string
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - -

-Typedefs

typedef ObjType< int,
-ReaderWriter_int > 
meow::ObjInt
 
typedef ObjType< size_t,
-ReaderWriter_size_t > 
meow::ObjSizeT
 
typedef ObjType< double,
-ReaderWriter_double > 
meow::ObjDouble
 
typedef ObjType< std::string,
-ReaderWriter_string > 
meow::ObjString
 
-
-
- - - - - diff --git a/doc/html/ObjTypes_8h.js b/doc/html/ObjTypes_8h.js deleted file mode 100644 index 1c56482..0000000 --- a/doc/html/ObjTypes_8h.js +++ /dev/null @@ -1,12 +0,0 @@ -var ObjTypes_8h = -[ - [ "ObjType", "classmeow_1_1ObjType.html", "classmeow_1_1ObjType" ], - [ "ReaderWriter_int", "classmeow_1_1ReaderWriter__int.html", "classmeow_1_1ReaderWriter__int" ], - [ "ReaderWriter_size_t", "classmeow_1_1ReaderWriter__size__t.html", "classmeow_1_1ReaderWriter__size__t" ], - [ "ReaderWriter_double", "classmeow_1_1ReaderWriter__double.html", "classmeow_1_1ReaderWriter__double" ], - [ "ReaderWriter_string", "classmeow_1_1ReaderWriter__string.html", "classmeow_1_1ReaderWriter__string" ], - [ "ObjDouble", "ObjTypes_8h.html#a936afddaa5716457741832ee501c7a58", null ], - [ "ObjInt", "ObjTypes_8h.html#add07dcc8e06a1394daa3e6402bc40c4b", null ], - [ "ObjSizeT", "ObjTypes_8h.html#a52b9d9ec3b004a9335222e7bf30e521a", null ], - [ "ObjString", "ObjTypes_8h.html#a52d52e58feff5e9f9013279e2dbd2fee", null ] -]; \ No newline at end of file diff --git a/doc/html/ObjTypes_8h_source.html b/doc/html/ObjTypes_8h_source.html deleted file mode 100644 index 7a76b6a..0000000 --- a/doc/html/ObjTypes_8h_source.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/ObjTypes.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ObjTypes.h
-
-
-Go to the documentation of this file.
1 #ifndef oo_ObjType_H__
-
2 #define oo_ObjType_H__
-
3 
-
4 #include "../Self.h"
-
5 #include "ObjBase.h"
-
6 
-
7 #include <cstdlib>
-
8 #include <cstdio>
-
9 
-
10 namespace meow {
-
11 
-
17 template<class Type, class ReaderWriter>
-
18 class ObjType: public ObjBase {
-
19 private:
-
20  struct Myself {
-
21  Type data_;
-
22 
-
23  Myself() {
-
24  }
-
25 
-
26  Myself(Type const& t): data_(t) {
-
27  }
-
28 
-
29  ~Myself() {
-
30  }
-
31  };
-
32  Self<Type> const self;
-
33 public:
-
35  ObjType(): self() {
-
36  }
-
37 
-
39  ObyType(Type const& t): self(Myself(t)) {
-
40  }
-
41 
-
43  ObjType(ObjType const& a): self(a.self, Self<Type>::COPY_FROM) {
-
44  }
-
45 
- -
47  }
-
48 
-
49  ObjType& copyFrom(ObjType const& a) {
-
50  self().copyFrom(a.self);
-
51  return *this;
-
52  }
-
53 
- -
55  self().referenceFrom(a.self);
-
56  return *this;
-
57  }
-
58 
-
59  Type access() const {
-
60  return self->data_;
-
61  }
-
62 
-
63  Type& modify() {
-
64  return self()->data_;
-
65  }
-
66 
-
67  ObjType& operator=(ObjType const& a) {
-
68  return copyFrom(a);
-
69  }
-
70 
-
71  Type operator()() const {
-
72  return access();
-
73  }
-
74 
-
75  Type& operator()() {
-
76  return modify();
-
77  }
-
78 
-
79  bool write(FILE* f, bool bin, unsigned int fg) const {
-
80  return ReaderWriter::write(f, bin, fg, self->data_);
-
81  }
-
82 
-
83  bool read(FILE* f, bool bin, unsigned int fg) {
-
84  return ReaderWriter::read(f, bin, fg, &(self()->data_));
-
85  }
-
86 
-
87  ObjBase* create() const {
-
88  return new ObjType();
-
89  }
-
90 
-
91  ObjBase* copyFrom(ObjBase const* b) {
-
92  return &(copyFrom(*(ObjType const*)b));
-
93  }
-
94 
-
95  char const* ctype() const {
-
96  return typeid(*this).name();
-
97  }
-
98 
-
99  std::string type() const {
-
100  return std::string(ctype());
-
101  }
-
102 };
-
103 
- -
105 public:
-
106  static bool write(FILE* f, bool bin, unsigned int fg, int const& k) {
-
107  if (bin) {
-
108  return (fwrite(&k, sizeof(k), 1, f) == 1);
-
109  }
-
110  else {
-
111  return (fprintf(f, "%d\n", k) == 1);
-
112  }
-
113  }
-
114  static bool read(FILE* f, bool bin, unsigned int fg, int* k) {
-
115  if (bin) {
-
116  return (fread(k, sizeof(k), 1, f) == 1);
-
117  }
-
118  else {
-
119  return (fscanf(f, "%d", k) == 1);
-
120  }
-
121  }
-
122 };
-
123 
- -
125 public:
-
126  static bool write(FILE* f, bool bin, unsigned int fg, size_t const& k) {
-
127  if (bin) {
-
128  return (fwrite(&k, sizeof(k), 1, f) == 1);
-
129  }
-
130  else {
-
131  return (fprintf(f, "%lu\n", k) == 1);
-
132  }
-
133  }
-
134  static bool read(FILE* f, bool bin, unsigned int fg, size_t* k) {
-
135  if (bin) {
-
136  return (fread(k, sizeof(k), 1, f) == 1);
-
137  }
-
138  else {
-
139  return (fscanf(f, "%lu", k) == 1);
-
140  }
-
141  }
-
142 };
-
143 
- -
145 public:
-
146  static bool write(FILE* f, bool bin, unsigned int fg, double const& k) {
-
147  if (bin) {
-
148  return (fwrite(&k, sizeof(k), 1, f) == 1);
-
149  }
-
150  else {
-
151  return (fprintf(f, "%.15f\n", k) == 1);
-
152  }
-
153  }
-
154  static bool read(FILE* f, bool bin, unsigned int fg, double* k) {
-
155  if (bin) {
-
156  return (fread(k, sizeof(k), 1, f) == 1);
-
157  }
-
158  else {
-
159  return (fscanf(f, "%lf", k) == 1);
-
160  }
-
161  }
-
162 };
-
163 
- -
165 public:
-
166  static bool write(FILE* f, bool bin, unsigned int fg, std::string const& k) {
-
167  size_t len = k.size();
-
168  char const* buf = k.c_str();
-
169  if (bin) {
-
170  if (fwrite(&len, sizeof(len) , 1, f) < 1) return false;
-
171  if (fwrite( buf, sizeof(char), len, f) < len) return false;
-
172  }
-
173  else {
-
174  if (fprintf(f, "%s\n", buf) < 1) return false;
-
175  }
-
176  return true;
-
177  }
-
178  static bool read(FILE* f, bool bin, unsigned int fg, std::string* k) {
-
179  size_t len;
-
180  char buf[81920];
-
181  if (bin) {
-
182  if (fread(&len, sizeof(len) , 1, f) < 1) return false;
-
183  if (fread( buf, sizeof(char), len, f) < len) return false;
-
184  buf[len] = '\0';
-
185  }
-
186  else {
-
187  if (fscanf(f, "%s", buf) < 1) return false;
-
188  }
-
189  (*k) = buf;
-
190  return true;
-
191  }
-
192 };
-
193 
- - - - -
198 
-
199 } // meow
-
200 
-
201 #endif // oo_ObjType_H__
- -
Type access() const
Definition: ObjTypes.h:59
-
Type & operator()()
Definition: ObjTypes.h:75
-
static bool write(FILE *f, bool bin, unsigned int fg, std::string const &k)
Definition: ObjTypes.h:166
-
ObjType & referenceFrom(ObjType const &a)
Definition: ObjTypes.h:54
-
static bool read(FILE *f, bool bin, unsigned int fg, int *k)
Definition: ObjTypes.h:114
-
ObjType()
constructor
Definition: ObjTypes.h:35
-
純粹把給定的 Type 包起來, 變成繼承自 ObjBase
Definition: ObjTypes.h:18
-
bool write(FILE *f, bool bin, unsigned int fg) const
將物件寫入檔案, 預設implement為直接回傳 false
Definition: ObjTypes.h:79
-
static bool read(FILE *f, bool bin, unsigned int fg, size_t *k)
Definition: ObjTypes.h:134
-
ObjBase * create() const
回傳一個new出來的物件, 預設implement為直接回傳 NULL
Definition: ObjTypes.h:87
-
ObjType< std::string, ReaderWriter_string > ObjString
Definition: ObjTypes.h:197
-
std::string type() const
用std::string回傳這個class的type name
Definition: ObjTypes.h:99
-
ObjType & operator=(ObjType const &a)
Definition: ObjTypes.h:67
- -
ObyType(Type const &t)
constructor, 並且給值
Definition: ObjTypes.h:39
-
static bool write(FILE *f, bool bin, unsigned int fg, double const &k)
Definition: ObjTypes.h:146
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
ObjBase * copyFrom(ObjBase const *b)
複製, 預設使用operator=
Definition: ObjTypes.h:91
- -
static bool read(FILE *f, bool bin, unsigned int fg, double *k)
Definition: ObjTypes.h:154
-
Type operator()() const
Definition: ObjTypes.h:71
-
Type & modify()
Definition: ObjTypes.h:63
-
ObjType< double, ReaderWriter_double > ObjDouble
Definition: ObjTypes.h:196
-
ObjType & copyFrom(ObjType const &a)
Definition: ObjTypes.h:49
-
static bool write(FILE *f, bool bin, unsigned int fg, int const &k)
Definition: ObjTypes.h:106
-
ObjType< int, ReaderWriter_int > ObjInt
Definition: ObjTypes.h:194
- -
static bool write(FILE *f, bool bin, unsigned int fg, size_t const &k)
Definition: ObjTypes.h:126
-
bool read(FILE *f, bool bin, unsigned int fg)
將物件從檔案讀出, 預設implement為直接回傳 false
Definition: ObjTypes.h:83
-
ObjType(ObjType const &a)
constructor, 並且copy資料
Definition: ObjTypes.h:43
- - -
char const * ctype() const
用C-style string回傳這個class的type name
Definition: ObjTypes.h:95
-
static bool read(FILE *f, bool bin, unsigned int fg, std::string *k)
Definition: ObjTypes.h:178
- -
ObjType< size_t, ReaderWriter_size_t > ObjSizeT
Definition: ObjTypes.h:195
-
-
- - - - - diff --git a/doc/html/Photo_8h.html b/doc/html/Photo_8h.html deleted file mode 100644 index 8c57676..0000000 --- a/doc/html/Photo_8h.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Photo.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Photo.h File Reference
-
-
-
#include "Bitmap.h"
-#include "../Self.h"
-#include "../geo/Vectors.h"
-#include "../math/utility.h"
-#include "../math/Matrix.h"
-#include "../math/Transformations.h"
-#include "../oo/ObjBase.h"
-#include <vector>
-#include <cmath>
-#include <string>
-#include <typeinfo>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Photo< Pixel >
 底片 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Photo_8h_source.html b/doc/html/Photo_8h_source.html deleted file mode 100644 index a0e8704..0000000 --- a/doc/html/Photo_8h_source.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/Photo.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Photo.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_Photo_H__
-
2 #define gra_Photo_H__
-
3 
-
4 #include "Bitmap.h"
-
5 
-
6 #include "../Self.h"
-
7 
-
8 #include "../geo/Vectors.h"
-
9 #include "../math/utility.h"
-
10 #include "../math/Matrix.h"
-
11 #include "../math/Transformations.h"
-
12 
-
13 #include "../oo/ObjBase.h"
-
14 
-
15 #include <vector>
-
16 #include <cmath>
-
17 #include <string>
-
18 #include <typeinfo>
-
19 #include <cstdlib>
-
20 
-
21 namespace meow {
-
22 
-
30 template<class Pixel>
-
31 class Photo: public ObjBase {
-
32 private:
-
33  struct Myself {
-
34  Bitmap<Pixel> bmp_;
- - -
37 
-
38  Myself(): proj_(3) {
-
39  }
-
40 
-
41  Myself(Myself const& b): bmp_(b.bmp_), c_(b.c_), proj_(b.proj_) {
-
42  }
-
43 
-
44  ~Myself() {
-
45  }
-
46  };
-
47 
-
48  Self<Myself> const self;
-
49 
-
53  Vector2D<double> bitmapCoord(Vector2D<double> const& yx) const {
-
54  return Vector2D<double>(yx.x() + center().x(), -yx.y() + center().y());
-
55  }
-
56 public:
-
62  Photo(): self() {
-
63  self()->proj_.focal(1.0);
-
64  }
-
65 
-
73  Photo(Photo const& b): self(b.self, Self<Myself>::COPY_FROM) {
-
74  }
-
75 
-
83  Photo(Bitmap<Pixel> const& bmp): self() {
-
84  reset(bmp);
-
85  }
-
86 
-
95  Photo(Bitmap<Pixel> const& bmp, double f): self() {
-
96  reset(bmp, f);
-
97  }
-
98 
-
108  Photo(Bitmap<Pixel> const& bmp, double f, Vector2D<double> const& c): self() {
-
109  reset(bmp, f, c);
-
110  }
-
111 
-
115  ~Photo() {
-
116  }
-
117 
-
123  Photo& copyFrom(Photo const& b) {
-
124  self().copyFrom(b.self);
-
125  return *this;
-
126  }
-
127 
-
133  Photo& referneceFrom(Photo const& b) {
-
134  self().referenceFrom(b.self);
-
135  return *this;
-
136  }
-
137 
-
145  void reset(Bitmap<Pixel> const& bmp) {
-
146  bitmap(bmp);
-
147  focal(sqrt(squ(width()) + squ(height())));
-
148  center(Vector2D<double>(bmp.width() / 2, bmp.height() / 2));
-
149  }
-
150 
-
159  void reset(Bitmap<Pixel> const& bmp, double f) {
-
160  bitmap(bmp);
-
161  focal(f);
-
162  center(Vector2D<double>(bmp.width() / 2, bmp.height() / 2));
-
163  }
-
164 
-
172  void reset(Bitmap<Pixel> const& bmp, double f, Vector2D<double> const& c) {
-
173  bitmap(bmp);
-
174  focal(f);
-
175  center(c);
-
176  }
-
177 
- -
182  return self->bmp_;
-
183  }
-
184 
- -
189  return self()->bmp_;
-
190  }
-
191 
- -
199  self()->bmp_.copyFrom(bmp);
-
200  return bitmap();
-
201  }
-
202 
-
206  double focal() const {
-
207  return self->proj_.focal();
-
208  }
-
209 
-
216  double focal(double f) {
-
217  self()->proj_.focal(f);
-
218  return focal();
-
219  }
-
220 
- -
225  return self->proj_;
-
226  }
-
227 
- -
232  if (p.dimension() == 3) {
-
233  self()->proj_ = p;
-
234  }
-
235  return projection();
-
236  }
-
237 
- -
244  return self->c_;
-
245  }
-
246 
- -
253  return self()->c_;
-
254  }
-
255 
- -
264  self()->c_ = c;
-
265  return center();
-
266  }
-
267 
-
271  size_t width() const {
-
272  return self->bmp_.width();
-
273  }
-
274 
-
278  size_t height() const {
-
279  return self->bmp_.height();
-
280  }
-
281 
-
285  Pixel pixel(size_t y, size_t x) const {
-
286  return self->bmp_.pixel(y, x);
-
287  }
-
288 
-
292  Pixel pixel(size_t y, size_t x, Pixel const& p) {
-
293  self()->bmp_.pixel(y, x, p);
-
294  return pixel(y, x);
-
295  }
-
296 
-
304  bool inside(Vector2D<double> const& yx) const {
-
305  Vector2D<double> c = bitmapCoord(yx);
-
306  ssize_t h_max = (ssize_t)height() - 1;
-
307  ssize_t w_max = (ssize_t)width () - 1;
-
308  return (0 <= c.y() && c.y() <= h_max && 0 <= c.x() && c.x() <= w_max);
-
309  }
-
310 
-
318  bool inside(Vector3D<double> const& p) const {
-
319  if (p.z() > 0) return false;
-
320  return inside(Vector2D<double>(self->proj_.transformate(p.matrix())));
-
321  }
-
322 
-
332  Pixel color(Vector2D<double> const& yx) const {
-
333  if (!inside(yx)) return Pixel(0);
-
334  Vector2D<double> c(bitmapCoord(yx));
-
335  int y0 = (int)c.y();
-
336  int x0 = (int)c.x();
-
337  double h[2] = {1 - (c.y() - y0), c.y() - y0};
-
338  double w[2] = {1 - (c.x() - x0), c.x() - x0};
-
339  Pixel sum(0);
-
340  for (int dy = 0; dy < 2; dy++)
-
341  for (int dx = 0; dx < 2; dx++) {
-
342  sum = sum + bitmap().pixel(
-
343  std::min(y0 + dy, (int)height() - 1),
-
344  std::min(x0 + dx, (int)width () - 1)) * (w[dy] * h[dx]);
-
345  }
-
346  return sum;
-
347  }
-
348 
-
357  Pixel color(Vector3D<double> const& p) const {
-
358  return color(Vector2D<double>(self->proj_.transformate(p.matrix())));
-
359  }
-
360 
-
364  Photo& operator=(Photo const& b) {
-
365  return copyFrom(b);
-
366  }
-
367 
-
372  bool write(FILE* f, bool bin, unsigned int fg) const {
-
373  if (bitmap().write(f, bin, fg) == false) return false;
-
374  if (bin) {
-
375  double tmp;
-
376  if (fwrite(&(tmp = center().x()), sizeof(tmp), 1, f) < 1) return false;
-
377  if (fwrite(&(tmp = center().y()), sizeof(tmp), 1, f) < 1) return false;
-
378  if (fwrite(&(tmp = focal()), sizeof(tmp), 1, f) < 1) return false;
-
379  }
-
380  else {
-
381  if (fprintf(f, "%f %f\n", center().x(), center().y()) < 2) return false;
-
382  if (fprintf(f, "%f\n", focal()) < 1) return false;
-
383  }
-
384  return true;
-
385  }
-
386 
-
391  bool read(FILE* f, bool bin, unsigned int fg) {
-
392  if (bitmapGet().read(f, bin, fg) == false) return false;
-
393  double tmp[3];
-
394  if (bin) {
-
395  if (fread(tmp, sizeof(double), 3, f) < 3) return false;
-
396  }
-
397  else {
-
398  if (fscanf(f, "%lf %lf %lf", tmp + 0, tmp + 1, tmp + 2) < 3) return false;
-
399  }
-
400  centerGet().x(tmp[0]);
-
401  centerGet().y(tmp[1]);
-
402  focal(tmp[2]);
-
403  return true;
-
404  }
-
405 
-
410  ObjBase* create() const {
-
411  return new Photo();
-
412  }
-
413 
-
423  ObjBase* copyFrom(ObjBase const* b) {
-
424  return &(copyFrom(*(Photo*)b));
-
425  }
-
426 
-
431  char const* ctype() const{
-
432  return typeid(*this).name();
-
433  }
-
434 
-
439  std::string type() const {
-
440  return std::string(ctype());
-
441  }
-
442 };
-
443 
-
444 } // meow
-
445 
-
446 #endif // gra_Photo_H__
-
PhotoProjection< double > projection(PhotoProjection< double > const &p)
設定 photo projection
Definition: Photo.h:231
-
double focal() const
回傳focal length
Definition: Photo.h:206
-
void reset(Bitmap< Pixel > const &bmp, double f)
重設bitmap, focal
Definition: Photo.h:159
-
Vector2D< double > & centerGet()
取得照片中心點底片座標 (non-constant reference)
Definition: Photo.h:252
-
PhotoProjection< double > projection() const
回傳相應的 photo projection
Definition: Photo.h:224
-
ObjBase * create() const
new一個自己
Definition: Photo.h:410
-
size_t height() const
回傳高度
Definition: Bitmap.h:153
-
Scalar const & x() const
access x
Definition: Vectors.h:70
-
char const * ctype() const
回傳class的type
Definition: Photo.h:431
-
Bitmap< Pixel > bitmap() const
回傳bitmap
Definition: Photo.h:181
-
Scalar const & z() const
access z
Definition: Vectors.h:314
-
std::string type() const
回傳class的type
Definition: Photo.h:439
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
Definition: Photo.h:391
-
double focal(double f)
設定 focal length
Definition: Photo.h:216
-
void reset(Bitmap< Pixel > const &bmp)
重設bitmap, focal 用猜的
Definition: Photo.h:145
-
Bitmap< Pixel > bitmap(Bitmap< Pixel > const &bmp)
設定bitmap
Definition: Photo.h:198
-
二維點陣資料
Definition: Bitmap.h:25
-
Pixel pixel(size_t y, size_t x) const
回傳bitmap的某pixel
Definition: Photo.h:285
-
size_t dimension() const
Get the dimension of this projection.
-
size_t width() const
回傳bitmap寬
Definition: Photo.h:271
-
Vector2D< double > center(Vector2D< double > const &c)
設定照片中心點底片座標
Definition: Photo.h:263
-
size_t width() const
回傳寬度
Definition: Bitmap.h:160
-
Photo(Bitmap< Pixel > const &bmp, double f)
constructor
Definition: Photo.h:95
-
Photo(Bitmap< Pixel > const &bmp)
constructor
Definition: Photo.h:83
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
Photo & referneceFrom(Photo const &b)
參照
Definition: Photo.h:133
-
Photo & copyFrom(Photo const &b)
複製資料
Definition: Photo.h:123
-
Matrix< Scalar > matrix() const
return a 3x1 matrix form of itself
Definition: Vectors.h:458
-
Bitmap< Pixel > & bitmapGet()
回傳bitmap 的參照(非constant)
Definition: Photo.h:188
-
Pixel color(Vector2D< double > const &yx) const
取得給照片座標中某點的色彩
Definition: Photo.h:332
-
Pixel color(Vector3D< double > const &p) const
取得給照片座標中某點的色彩
Definition: Photo.h:357
-
Photo(Bitmap< Pixel > const &bmp, double f, Vector2D< double > const &c)
constructor
Definition: Photo.h:108
- -
Vector2D< double > center() const
取得照片中心點底片座標
Definition: Photo.h:243
- -
Pixel pixel(size_t y, size_t x, Pixel const &p)
設定某pixel
Definition: Photo.h:292
-
底片
Definition: Photo.h:31
-
void reset(Bitmap< Pixel > const &bmp, double f, Vector2D< double > const &c)
重設bitmap, focal, center
Definition: Photo.h:172
- -
ObjBase * copyFrom(ObjBase const *b)
複製資料
Definition: Photo.h:423
-
Photo & operator=(Photo const &b)
same as .copyFrom(b)
Definition: Photo.h:364
- -
Photo()
constructor
Definition: Photo.h:62
-
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
Definition: Photo.h:372
-
Scalar const & y() const
access y
Definition: Vectors.h:71
-
bool inside(Vector2D< double > const &yx) const
檢查某點是否在底片範圍內
Definition: Photo.h:304
-
Photo(Photo const &b)
constructor
Definition: Photo.h:73
- -
bool inside(Vector3D< double > const &p) const
檢查某點是否在底片範圍內
Definition: Photo.h:318
-
~Photo()
destructor
Definition: Photo.h:115
- -
T squ(T const &x)
x*x
Definition: utility.h:77
-
size_t height() const
回傳bitmap高
Definition: Photo.h:278
-
-
- - - - - diff --git a/doc/html/RGB_8h.html b/doc/html/RGB_8h.html deleted file mode 100644 index 6dc9c66..0000000 --- a/doc/html/RGB_8h.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/RGB.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
RGB.h File Reference
-
-
-
#include "RGB.hpp"
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

class  meow::RGB< T >
 
class  meow::RGBf
 
class  meow::RGBi
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/RGB_8h_source.html b/doc/html/RGB_8h_source.html deleted file mode 100644 index 7d524fe..0000000 --- a/doc/html/RGB_8h_source.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/RGB.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
RGB.h
-
-
-Go to the documentation of this file.
1 #ifndef RGB_H_
-
2 #define RGB_H_
-
3 
-
4 namespace meow{
-
5  template<class T> class RGB{
-
6  protected:
-
7  T rgb_[3];
-
8  RGB();
-
9  RGB(T const& r, T const& g, T const& b);
-
10  RGB(T const* rgb);
-
11  public:
-
12  virtual ~RGB() { }
-
14  virtual T rMax() const = 0;
-
15  virtual T rMin() const = 0;
-
16  virtual T gMax() const = 0;
-
17  virtual T gMin() const = 0;
-
18  virtual T bMax() const = 0;
-
19  virtual T bMin() const = 0;
-
21  T r() const;
-
22  T g() const;
-
23  T b() const;
-
24  T rgb(size_t i) const;
-
25  T bgr(size_t i) const;
-
27  T r(T const& val);
-
28  T g(T const& val);
-
29  T b(T const& val);
-
30  T rgb(size_t i, T const& val);
-
31  T bgr(size_t i, T const& val);
-
32  };
-
33 
-
34  class RGBf: public RGB<double>{
-
35  public:
-
36  RGBf();
-
37  RGBf(double const&r,double const&g,double const&b);
-
38  RGBf(double const* rgb);
-
39  ~RGBf();
-
40  double rMin() const;
-
41  double rMax() const;
-
42  double gMin() const;
-
43  double gMax() const;
-
44  double bMin() const;
-
45  double bMax() const;
-
46  };
-
47 
-
48  class RGBi: public RGB<int32_t>{
-
49  public:
-
50  RGBi();
-
51  RGBi(int32_t const&r,int32_t const&g,int32_t const&b);
-
52  RGBi(int32_t const* rgb);
-
53  ~RGBi();
-
54  int32_t rMin() const;
-
55  int32_t rMax() const;
-
56  int32_t gMin() const;
-
57  int32_t gMax() const;
-
58  int32_t bMin() const;
-
59  int32_t bMax() const;
-
60  };
-
61 }
-
62 
-
63 #include "RGB.hpp"
-
64 
-
65 #endif // RGB_H_
-
virtual T rMax() const =0
-
virtual ~RGB()
Definition: RGB.h:12
-
double gMax() const
Definition: RGB.hpp:42
-
RGBf()
Definition: RGB.hpp:35
-
double gMin() const
Definition: RGB.hpp:41
-
double rMax() const
Definition: RGB.hpp:40
-
int32_t bMin() const
Definition: RGB.hpp:57
-
virtual T bMax() const =0
-
Definition: RGB.h:5
-
double bMin() const
Definition: RGB.hpp:43
-
int32_t rMin() const
Definition: RGB.hpp:53
-
T r() const
Definition: RGB.hpp:14
-
virtual T bMin() const =0
-
Definition: RGB.h:34
-
double rMin() const
Definition: RGB.hpp:39
-
RGBi()
Definition: RGB.hpp:49
-
T rgb_[3]
Definition: RGB.h:7
-
double bMax() const
Definition: RGB.hpp:44
-
RGB()
Definition: RGB.hpp:5
- -
~RGBf()
Definition: RGB.hpp:36
-
virtual T gMax() const =0
-
int32_t gMax() const
Definition: RGB.hpp:56
-
virtual T rMin() const =0
-
~RGBi()
Definition: RGB.hpp:50
-
T g() const
Definition: RGB.hpp:15
-
virtual T gMin() const =0
-
T b() const
Definition: RGB.hpp:16
-
T bgr(size_t i) const
Definition: RGB.hpp:20
-
T rgb(size_t i) const
Definition: RGB.hpp:17
- -
int32_t gMin() const
Definition: RGB.hpp:55
-
int32_t bMax() const
Definition: RGB.hpp:58
-
int32_t rMax() const
Definition: RGB.hpp:54
-
Definition: RGB.h:48
-
-
- - - - - diff --git a/doc/html/RGB_8hpp.html b/doc/html/RGB_8hpp.html deleted file mode 100644 index d6fd6ac..0000000 --- a/doc/html/RGB_8hpp.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/RGB.hpp File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
RGB.hpp File Reference
-
-
-
#include <algorithm>
-#include <cstdint>
-
-

Go to the source code of this file.

- - - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/RGB_8hpp_source.html b/doc/html/RGB_8hpp_source.html deleted file mode 100644 index f1974b7..0000000 --- a/doc/html/RGB_8hpp_source.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/RGB.hpp Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
RGB.hpp
-
-
-Go to the documentation of this file.
1 #include <algorithm>
-
2 #include <cstdint>
-
3 
-
4 namespace meow{
-
5  template<class T> inline RGB<T>::RGB(){ }
-
6  template<class T> inline RGB<T>::RGB(T const& r, T const& g, T const& b){
-
7  rgb_[0] = r; rgb_[1] = g; rgb_[2] = b;
-
8  }
-
9  template<class T> inline RGB<T>::RGB(T const* rgb){
-
10  for(int i = 0; i < 3; i++){
-
11  rgb_[i] = rgb[i];
-
12  }
-
13  }
-
14  template<class T> inline T RGB<T>::r() const { return rgb_[0]; }
-
15  template<class T> inline T RGB<T>::g() const { return rgb_[1]; }
-
16  template<class T> inline T RGB<T>::b() const { return rgb_[2]; }
-
17  template<class T> inline T RGB<T>::rgb(size_t i) const {
-
18  return rgb_[std::min((size_t)3 - 1, i)];
-
19  }
-
20  template<class T> inline T RGB<T>::bgr(size_t i) const { return rgb(2 - i); }
-
22  template<class T> inline T RGB<T>::r(T const& val){ return (rgb_[0] = val); }
-
23  template<class T> inline T RGB<T>::g(T const& val){ return (rgb_[1] = val); }
-
24  template<class T> inline T RGB<T>::b(T const& val){ return (rgb_[2] = val); }
-
25  template<class T> inline T RGB<T>::rgb(size_t i, T const& val){
-
26  i = std::min((size_t)3 - 1, i);
-
27  return (rgb_[i] = val);
-
28  }
-
29  template<class T> inline T RGB<T>::bgr(size_t i, T const& val){
-
30  return rgb(2 - i, val);
-
31  }
-
32 
-
33 
-
34 
-
35  inline RGBf::RGBf(): RGB(0.0, 0.0, 0.0){ }
-
36  inline RGBf::~RGBf(){ }
-
37  inline RGBf::RGBf(double const&r,double const&g,double const&b):RGB(r,g,b){}
-
38  inline RGBf::RGBf(double const* rgb): RGB(rgb){ }
-
39  inline double RGBf::rMin() const { return 0.0; }
-
40  inline double RGBf::rMax() const { return 1.0; }
-
41  inline double RGBf::gMin() const { return 0.0; }
-
42  inline double RGBf::gMax() const { return 1.0; }
-
43  inline double RGBf::bMin() const { return 0.0; }
-
44  inline double RGBf::bMax() const { return 1.0; }
-
45 
-
46 
-
47 
-
48 
-
49  inline RGBi::RGBi (): RGB(0.0, 0.0, 0.0){ }
-
50  inline RGBi::~RGBi(){ }
-
51  inline RGBi::RGBi(int32_t const&r,int32_t const&g,int32_t const&b):RGB(r,g,b){}
-
52  inline RGBi::RGBi(int32_t const* rgb): RGB(rgb){ }
-
53  inline int32_t RGBi::rMin() const { return 0; }
-
54  inline int32_t RGBi::rMax() const { return 255; }
-
55  inline int32_t RGBi::gMin() const { return 0; }
-
56  inline int32_t RGBi::gMax() const { return 255; }
-
57  inline int32_t RGBi::bMin() const { return 0; }
-
58  inline int32_t RGBi::bMax() const { return 255; }
-
59 }
-
double gMax() const
Definition: RGB.hpp:42
-
RGBf()
Definition: RGB.hpp:35
-
double gMin() const
Definition: RGB.hpp:41
-
double rMax() const
Definition: RGB.hpp:40
-
int32_t bMin() const
Definition: RGB.hpp:57
-
Definition: RGB.h:5
-
double bMin() const
Definition: RGB.hpp:43
-
int32_t rMin() const
Definition: RGB.hpp:53
-
T r() const
Definition: RGB.hpp:14
-
double rMin() const
Definition: RGB.hpp:39
-
RGBi()
Definition: RGB.hpp:49
-
double bMax() const
Definition: RGB.hpp:44
-
RGB()
Definition: RGB.hpp:5
- -
~RGBf()
Definition: RGB.hpp:36
-
int32_t gMax() const
Definition: RGB.hpp:56
-
~RGBi()
Definition: RGB.hpp:50
-
T g() const
Definition: RGB.hpp:15
-
T b() const
Definition: RGB.hpp:16
-
T bgr(size_t i) const
Definition: RGB.hpp:20
-
T rgb(size_t i) const
Definition: RGB.hpp:17
-
int32_t gMin() const
Definition: RGB.hpp:55
-
int32_t bMax() const
Definition: RGB.hpp:58
-
int32_t rMax() const
Definition: RGB.hpp:54
-
-
- - - - - diff --git a/doc/html/RGB__Space_8h.html b/doc/html/RGB__Space_8h.html deleted file mode 100644 index ae3eddd..0000000 --- a/doc/html/RGB__Space_8h.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/RGB_Space.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
RGB_Space.h File Reference
-
-
-
#include "Color3_Space.h"
-#include "../geo/Vectors.h"
-#include "../math/utility.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

class  meow::RGBi_Space
 以整數 Red, Green, Blue 三個值所組成的色彩空間 More...
 
class  meow::RGBf_Space
 以浮點數Red, Green, Blue 三個值所組成的色彩空間 More...
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - -

-Functions

void meow::colorTransformate (RGBf_Space const &in, RGBf_Space *out)
 RGBf_Space to RGBf_Space More...
 
void meow::colorTransformate (RGBi_Space const &in, RGBi_Space *out)
 RGBi_Space to RGBi_Space More...
 
void meow::colorTransformate (RGBi_Space const &a, RGBf_Space *b)
 RGBi_Space to RGBf_Space More...
 
void meow::colorTransformate (RGBf_Space const &a, RGBi_Space *b)
 RGBf_Space to RGBi_Space More...
 
-
-
- - - - - diff --git a/doc/html/RGB__Space_8h.js b/doc/html/RGB__Space_8h.js deleted file mode 100644 index 1b7ca9c..0000000 --- a/doc/html/RGB__Space_8h.js +++ /dev/null @@ -1,9 +0,0 @@ -var RGB__Space_8h = -[ - [ "RGBi_Space", "classmeow_1_1RGBi__Space.html", "classmeow_1_1RGBi__Space" ], - [ "RGBf_Space", "classmeow_1_1RGBf__Space.html", "classmeow_1_1RGBf__Space" ], - [ "colorTransformate", "RGB__Space_8h.html#a90e2ddbaa77b4c37ec1bb9a97f1f12ac", null ], - [ "colorTransformate", "RGB__Space_8h.html#a704cd28583728cff9d2b06ed1b9a686f", null ], - [ "colorTransformate", "RGB__Space_8h.html#a764c66bb63095b178107b276eb0cc24e", null ], - [ "colorTransformate", "RGB__Space_8h.html#a5612b34e84764e275631d662e5f210cb", null ] -]; \ No newline at end of file diff --git a/doc/html/RGB__Space_8h_source.html b/doc/html/RGB__Space_8h_source.html deleted file mode 100644 index cf2d751..0000000 --- a/doc/html/RGB__Space_8h_source.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/RGB_Space.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
RGB_Space.h
-
-
-Go to the documentation of this file.
1 #ifndef colors_RGB_Space_H__
-
2 #define colors_RGB_Space_H__
-
3 
-
4 #include "Color3_Space.h"
-
5 #include "../geo/Vectors.h"
-
6 #include "../math/utility.h"
-
7 
-
8 #include <cstdlib>
-
9 
-
10 namespace meow {
-
11 
-
19 class RGBi_Space: public Color3_Space<int> {
-
20 public:
- -
22  Vector3D<int>(255, 255, 255),
-
23  Vector3D<int>( 0, 0, 0)) {
-
24  }
-
25  RGBi_Space(int c): Color3_Space<int>(Vector3D<int>( 0, 0, 0),
-
26  Vector3D<int>(255, 255, 255),
-
27  Vector3D<int>( c, c, c)) {
-
28  }
- -
30  Color3_Space<int>(Vector3D<int>( 0, 0, 0),
-
31  Vector3D<int>(255, 255, 255),
-
32  Vector3D<int>(v)) {
-
33  }
- -
35  }
- -
37  }
-
38  int const& rgbMin(size_t i) const { return min(i); }
-
39  int const& rMin( ) const { return min(0); }
-
40  int const& gMin( ) const { return min(1); }
-
41  int const& bMin( ) const { return min(2); }
-
42  int const& rgbMax(size_t i) const { return max(i); }
-
43  int const& rMax( ) const { return max(0); }
-
44  int const& gMax( ) const { return max(1); }
-
45  int const& bMax( ) const { return max(2); }
-
46  int const& rgb(size_t i) const { return val(i); }
-
47  int const& r( ) const { return rgb(0); }
-
48  int const& g( ) const { return rgb(1); }
-
49  int const& b( ) const { return rgb(2); }
-
50  int const& rgb(size_t i, int c) { return val(i, c); }
-
51  int const& r( int c) { return rgb(0, c); }
-
52  int const& g( int c) { return rgb(1, c); }
-
53  int const& b( int c) { return rgb(2, c); }
-
54  int& rgbGet(size_t i) { return valGet(i); }
-
55  int& rGet( ) { return rgbGet(0); }
-
56  int& gGet( ) { return rgbGet(1); }
-
57  int& bGet( ) { return rgbGet(2); }
- -
59  copyFrom(b);
-
60  return *this;
-
61  }
-
62  RGBi_Space operator+(RGBi_Space const& b) const {
-
63  return RGBi_Space(val_ + b.val_);
-
64  }
-
65  RGBi_Space operator-(RGBi_Space const& b) const {
-
66  return RGBi_Space(val_ - b.val_);
-
67  }
-
68  RGBi_Space operator*(int c) const {
-
69  return RGBi_Space(val_ * c);
-
70  }
-
71  RGBi_Space operator/(int c) const {
-
72  return RGBi_Space(val_ / c);
-
73  }
-
74  int operator*(RGBi_Space const& b) const {
-
75  return val_ * b.val_;
-
76  }
-
77 };
-
78 
-
86 class RGBf_Space: public Color3_Space<double> {
-
87 public:
- -
89  Vector3D<double>(1.0, 1.0, 1.0),
-
90  Vector3D<double>(0.0, 0.0, 0.0)) {
-
91  }
-
92  RGBf_Space(double c): Color3_Space<double>(Vector3D<double>(0.0, 0.0, 0.0),
-
93  Vector3D<double>(1.0, 1.0, 1.0),
-
94  Vector3D<double>( c, c, c)) {
-
95  }
- -
97  Color3_Space<double>(Vector3D<double>(0.0, 0.0, 0.0),
-
98  Vector3D<double>(1.0, 1.0, 1.0),
-
99  Vector3D<double>(v)) {
-
100  }
- -
102  }
- -
104  }
-
105  double const& rgbMin(size_t i) const { return min(i); }
-
106  double const& rMin( ) const { return min(0); }
-
107  double const& gMin( ) const { return min(1); }
-
108  double const& bMin( ) const { return min(2); }
-
109  double const& rgbMax(size_t i) const { return max(i); }
-
110  double const& rMax( ) const { return max(0); }
-
111  double const& gMax( ) const { return max(1); }
-
112  double const& bMax( ) const { return max(2); }
-
113  double const& rgb(size_t i) const { return val(i); }
-
114  double const& r( ) const { return rgb(0); }
-
115  double const& g( ) const { return rgb(1); }
-
116  double const& b( ) const { return rgb(2); }
-
117  double const& rgb(size_t i, double c) { return val(i, c); }
-
118  double const& r( double c) { return rgb(0, c); }
-
119  double const& g( double c) { return rgb(1, c); }
-
120  double const& b( double c) { return rgb(2, c); }
-
121  double& rgbGet(size_t i) { return valGet(i); }
-
122  double& rGet( ) { return rgbGet(0); }
-
123  double& gGet( ) { return rgbGet(1); }
-
124  double& bGet( ) { return rgbGet(2); }
- -
126  copyFrom(b);
-
127  return *this;
-
128  }
- -
130  return RGBf_Space(val_ + b.val_);
-
131  }
- -
133  return RGBf_Space(val_ - b.val_);
-
134  }
-
135  RGBf_Space operator*(double const& c) const {
-
136  return RGBf_Space(val_ * c);
-
137  }
-
138  RGBf_Space operator/(double const& c) const {
-
139  return RGBf_Space(val_ / c);
-
140  }
-
141  double operator*(RGBf_Space const& b) const {
-
142  return val_ * b.val_;
-
143  }
-
144 };
-
145 
-
149 inline void colorTransformate(RGBf_Space const& in, RGBf_Space* out) {
-
150  *out = in;
-
151 }
-
152 
-
156 inline void colorTransformate(RGBi_Space const& in, RGBi_Space* out) {
-
157  *out = in;
-
158 }
-
159 
-
163 inline void colorTransformate(RGBi_Space const& a, RGBf_Space* b) {
-
164  for (size_t i = 0; i < 3; ++i) {
-
165  b->rgb(i, ratioMapping<double>(a.rgbMin(i), a.rgbMax(i), a.rgb(i),
-
166  b->rgbMin(i), b->rgbMax(i)));
-
167  }
-
168 }
-
169 
-
173 inline void colorTransformate(RGBf_Space const& a, RGBi_Space* b) {
-
174  for (size_t i = 0; i < 3; ++i) {
-
175  b->rgb(i, ratioMapping<double>(a.rgbMin(i), a.rgbMax(i), a.rgb(i),
-
176  b->rgbMin(i), b->rgbMax(i)));
-
177  }
-
178 }
-
179 
-
180 } // meow
-
181 
-
182 #endif // colors_RGB_Space_H__
-
int const & r(int c)
Definition: RGB_Space.h:51
-
double const & rMin() const
Definition: RGB_Space.h:106
-
int const & gMax() const
Definition: RGB_Space.h:44
-
double const & r(double c)
Definition: RGB_Space.h:118
-
double const & rgb(size_t i, double c)
Definition: RGB_Space.h:117
-
RGBi_Space(RGBi_Space const &b)
Definition: RGB_Space.h:34
-
int const & g() const
Definition: RGB_Space.h:48
-
double & rGet()
Definition: RGB_Space.h:122
-
int const & rMax() const
Definition: RGB_Space.h:43
-
int const & rgb(size_t i) const
Definition: RGB_Space.h:46
-
RGBf_Space(double c)
Definition: RGB_Space.h:92
-
以浮點數Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:86
-
int const & bMax() const
Definition: RGB_Space.h:45
-
int const & g(int c)
Definition: RGB_Space.h:52
-
double const & rgbMin(size_t i) const
Definition: RGB_Space.h:105
-
RGBi_Space operator-(RGBi_Space const &b) const
Definition: RGB_Space.h:65
-
intconst & min(size_t id) const
Return the minimum of the i -th channel.
Definition: Color3_Space.h:99
-
RGBf_Space(Vector3D< double > const &v)
Definition: RGB_Space.h:96
-
int const & gMin() const
Definition: RGB_Space.h:40
-
double & rgbGet(size_t i)
Definition: RGB_Space.h:121
- -
int & valGet(size_t id)
Get the non-constant reference of value of the i -th channel.
Definition: Color3_Space.h:139
-
double const & rgb(size_t i) const
Definition: RGB_Space.h:113
-
int const & b(int c)
Definition: RGB_Space.h:53
-
RGBi_Space & operator=(RGBi_Space const &b)
Definition: RGB_Space.h:58
-
int & gGet()
Definition: RGB_Space.h:56
-
void colorTransformate(HSLf_Space const &in, HSLf_Space *out)
HSLf_Space to HSLf_Space
Definition: HSL_Space.h:85
-
int const & bMin() const
Definition: RGB_Space.h:41
-
int & rGet()
Definition: RGB_Space.h:55
-
double const & r() const
Definition: RGB_Space.h:114
-
intconst & max(size_t id) const
Return the maximum of the i -th channel.
Definition: Color3_Space.h:107
-
int const & rgbMin(size_t i) const
Definition: RGB_Space.h:38
-
int const & rMin() const
Definition: RGB_Space.h:39
-
RGBi_Space operator+(RGBi_Space const &b) const
Definition: RGB_Space.h:62
-
RGBi_Space(int c)
Definition: RGB_Space.h:25
-
RGBi_Space operator*(int c) const
Definition: RGB_Space.h:68
-
Base class of color space with 3 channels.
Definition: Color3_Space.h:18
- -
int & rgbGet(size_t i)
Definition: RGB_Space.h:54
-
3D's vector
Definition: Vectors.h:258
-
int & bGet()
Definition: RGB_Space.h:57
-
double const & gMin() const
Definition: RGB_Space.h:107
-
int operator*(RGBi_Space const &b) const
Definition: RGB_Space.h:74
-
double operator*(RGBf_Space const &b) const
Definition: RGB_Space.h:141
-
以整數 Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:19
-
RGBf_Space operator-(RGBf_Space const &b) const
Definition: RGB_Space.h:132
- -
double & gGet()
Definition: RGB_Space.h:123
-
double const & bMax() const
Definition: RGB_Space.h:112
-
double const & rMax() const
Definition: RGB_Space.h:110
-
double const & b(double c)
Definition: RGB_Space.h:120
-
RGBf_Space(RGBf_Space const &b)
Definition: RGB_Space.h:101
-
RGBf_Space operator*(double const &c) const
Definition: RGB_Space.h:135
-
int const & rgbMax(size_t i) const
Definition: RGB_Space.h:42
-
double & bGet()
Definition: RGB_Space.h:124
-
RGBi_Space operator/(int c) const
Definition: RGB_Space.h:71
-
RGBf_Space operator+(RGBf_Space const &b) const
Definition: RGB_Space.h:129
-
double const & rgbMax(size_t i) const
Definition: RGB_Space.h:109
-
double const & gMax() const
Definition: RGB_Space.h:111
-
double const & b() const
Definition: RGB_Space.h:116
-
int const & rgb(size_t i, int c)
Definition: RGB_Space.h:50
-
double const & g() const
Definition: RGB_Space.h:115
-
double const & bMin() const
Definition: RGB_Space.h:108
- -
int const & b() const
Definition: RGB_Space.h:49
-
Color3_Space< int > & copyFrom(Color3_Space< int > const &b)
Copy method.
Definition: Color3_Space.h:54
-
double const & g(double c)
Definition: RGB_Space.h:119
-
RGBf_Space & operator=(RGBf_Space const &b)
Definition: RGB_Space.h:125
- -
int const & r() const
Definition: RGB_Space.h:47
- -
RGBf_Space operator/(double const &c) const
Definition: RGB_Space.h:138
- -
intconst & val(size_t id) const
Return the value of the i -th channel.
Definition: Color3_Space.h:117
-
Vector3D< int > val_
Definition: Color3_Space.h:22
-
RGBi_Space(Vector3D< int > const &v)
Definition: RGB_Space.h:29
-
-
- - - - - diff --git a/doc/html/Register__Implement_8h.html b/doc/html/Register__Implement_8h.html deleted file mode 100644 index 39c5bb9..0000000 --- a/doc/html/Register__Implement_8h.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/Register_Implement.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Register_Implement.h File Reference
-
-
-
#include <map>
-#include "Register_Implement.hpp"
-
-

Go to the source code of this file.

- - - - - - -

-Classes

class  meow::ImplementInterface< T >
 
class  meow::RegisterInterface< T >
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Register__Implement_8h_source.html b/doc/html/Register__Implement_8h_source.html deleted file mode 100644 index a20a3d6..0000000 --- a/doc/html/Register__Implement_8h_source.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/Register_Implement.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Register_Implement.h
-
-
-Go to the documentation of this file.
1 #ifndef REGISTER_IMPLEMENT_H_
-
2 #define REGISTER_IMPLEMENT_H_
-
3 
-
4 #include <map>
-
5 
-
6 namespace meow{
-
7  template<class T> class ImplementInterface{
-
8  private:
-
9  T identify_;
-
10  protected:
-
11  ImplementInterface(T const& id): identify_(id) { }
-
12  public:
-
13  T const& identify() const { return identify_; }
-
14  virtual ~ImplementInterface(){ }
-
15  };
-
16  //
-
17  template<class T> class RegisterInterface{
-
18  private:
-
19  std::map<T, ImplementInterface<T>*> implements;
-
20  protected:
- -
22  public:
-
23  virtual bool regImplement(ImplementInterface<T>*imp);
-
24  virtual ImplementInterface<T>*getImplement(T const& identify);
-
25  virtual ~RegisterInterface(){ }
-
26  };
-
27 }
-
28 
-
29 #include "Register_Implement.hpp"
-
30 
-
31 #endif // REGISTER_IMPLEMENT_H_
- -
virtual ImplementInterface< T > * getImplement(T const &identify)
- - - - -
virtual bool regImplement(ImplementInterface< T > *imp)
-
T const & identify() const
- - -
-
- - - - - diff --git a/doc/html/Register__Implement_8hpp.html b/doc/html/Register__Implement_8hpp.html deleted file mode 100644 index f669cdb..0000000 --- a/doc/html/Register__Implement_8hpp.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/Register_Implement.hpp File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Register_Implement.hpp File Reference
-
-
-
#include <map>
-
-

Go to the source code of this file.

- - - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Register__Implement_8hpp_source.html b/doc/html/Register__Implement_8hpp_source.html deleted file mode 100644 index 38be782..0000000 --- a/doc/html/Register__Implement_8hpp_source.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/oo/Register_Implement.hpp Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Register_Implement.hpp
-
-
-Go to the documentation of this file.
1 
-
2 #include <map>
-
3 
-
4 namespace meow{
-
5  template<class T> inline RegisterInterface<T>::RegisterInterface()
-
6  { }
-
7  template<class T> inline bool RegisterInterface<T>::regImplement(
- -
9  if(implements.find(imp->identify()) != implements.end()){
-
10  return false;
-
11  }
-
12  implements[imp->identify()] = imp;
-
13  return true;
-
14  }
-
15  template<class T> inline ImplementInterface<T>* RegisterInterface<T>::
-
16  getImplement(T const& identify){
-
17  if(implements.find(identify) == implements.end()){
-
18  return NULL;
-
19  }
-
20  return implements[identify];
-
21  }
-
22 }
-
virtual ImplementInterface< T > * getImplement(T const &identify)
- - -
virtual bool regImplement(ImplementInterface< T > *imp)
-
T const & identify() const
-
-
- - - - - diff --git a/doc/html/SegmentTree_8h.html b/doc/html/SegmentTree_8h.html deleted file mode 100644 index 589469c..0000000 --- a/doc/html/SegmentTree_8h.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/SegmentTree.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
SegmentTree.h File Reference
-
-
-
#include "../math/utility.h"
-#include <vector>
-#include <algorithm>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::SegmentTree< Value >
 中文名 線段樹 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/SegmentTree_8h_source.html b/doc/html/SegmentTree_8h_source.html deleted file mode 100644 index fd9119d..0000000 --- a/doc/html/SegmentTree_8h_source.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/SegmentTree.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
SegmentTree.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_SegmentTree_H__
-
2 #define dsa_SegmentTree_H__
-
3 
-
4 #include "../math/utility.h"
-
5 
-
6 #include <vector>
-
7 #include <algorithm>
-
8 
-
9 #include <cstdlib>
-
10 
-
11 namespace meow {
-
44 template<class Value>
-
45 class SegmentTree {
-
46 private:
-
47  struct Node {
-
48  Value value_;
-
49  Value offset_;
-
50  bool sameFlage_;
-
51  };
-
52  //
-
53  size_t size_;
-
54  std::vector<Node> nodes_;
-
55  //
-
56  void update(size_t index, size_t size, Value const& value, bool override) {
-
57  if (override) {
-
58  nodes_[index].value_ = value * size;
-
59  nodes_[index].offset_ = value;
-
60  nodes_[index].sameFlage_ = true;
-
61  }
-
62  else {
-
63  nodes_[index].value_ = nodes_[index].value_ + value * size;
-
64  nodes_[index].offset_ = nodes_[index].offset_ + value;
-
65  }
-
66  }
-
67  void update(size_t l, size_t r, size_t L, size_t R,
-
68  size_t index, Value const& value,
-
69  bool override) {
-
70  if (l == L && r == R) {
-
71  update(index, R - L + 1, value, override);
-
72  return ;
-
73  }
-
74  size_t mid = (L + R) / 2;
-
75  if (L < R) {
-
76  update(index * 2 + 1, mid - L + 1,
-
77  nodes_[index].offset_, nodes_[index].sameFlage_);
-
78  update(index * 2 + 2, R - mid,
-
79  nodes_[index].offset_, nodes_[index].sameFlage_);
-
80  nodes_[index].offset_ = Value(0);
-
81  nodes_[index].sameFlage_ = false;
-
82  }
-
83  if (r <= mid) {
-
84  update(l, r, L ,mid, index * 2 + 1, value, override);
-
85  }
-
86  else if (mid + 1 <= l) {
-
87  update(l, r, mid + 1,R, index*2 + 2, value, override);
-
88  }
-
89  else {
-
90  update(l, mid , L, mid , index * 2 + 1, value, override);
-
91  update( mid + 1, r, mid + 1, R, index * 2 + 2, value, override);
-
92  }
-
93  nodes_[index].value_ = (
-
94  (nodes_[index * 2 + 1].value_ | nodes_[index * 2 + 2].value_)
-
95  + nodes_[index].offset_
-
96  );
-
97  }
-
98  Value query(size_t l, size_t r, size_t L, size_t R, size_t index) {
-
99  if (l == L && r == R) return nodes_[index].value_;
-
100  Value off = nodes_[index].offset_ * (r - l + 1);
-
101  if (nodes_[index].sameFlage_) return off;
-
102  size_t mid = (L + R) / 2;
-
103  if (r <= mid) return query(l, r, L , mid, index * 2 + 1) + off;
-
104  else if(mid + 1 <= l) return query(l, r, mid + 1, R, index * 2 + 2) + off;
-
105  else{
-
106  return ( query(l, mid , L, mid , index * 2 + 1)
-
107  | query( mid + 1, r, mid + 1, R, index * 2 + 2)
-
108  ) + off;
-
109  }
-
110  }
-
111  //
-
112  bool rangeCorrect(ssize_t* first, ssize_t* last) const {
-
113  if (*last < *first || *last < 0 || (ssize_t)size_ - 1 < *first)
-
114  return false;
-
115  *first = inRange((ssize_t)0, (ssize_t)size_ - 1, *first);
-
116  *last = inRange((ssize_t)0, (ssize_t)size_ - 1, *last );
-
117  return true;
-
118  }
-
119 public:
- -
122  reset(1);
-
123  }
-
124 
-
126  SegmentTree(size_t size) {
-
127  reset(size);
-
128  }
-
129 
-
131  SegmentTree(SegmentTree const& tree2):
-
132  size_(tree2.size_), nodes_(tree2.nodes_) {
-
133  }
-
134 
- -
139  size_ = b.size_;
-
140  nodes_ = b.nodes_;
-
141  return *this;
-
142  }
-
143 
-
147  size_t size() const {
-
148  return size_;
-
149  }
-
150 
-
154  void reset(size_t size){
-
155  size_ = std::max(size, (size_t)1);
-
156  nodes_.resize(size * 4);
-
157  nodes_[0].sameFlage_ = true;
-
158  nodes_[0].value_ = Value(0);
-
159  nodes_[0].offset_ = Value(0);
-
160  }
-
161 
-
165  Value query(ssize_t first, ssize_t last) const {
-
166  if (rangeCorrect(&first, &last) == false) return Value();
-
167  return ((SegmentTree*)this)->query(first, last, 0, size_ - 1, 0);
-
168  }
-
169 
-
173  void override(ssize_t first, ssize_t last, Value const& value) {
-
174  if (rangeCorrect(&first, &last) == false) return ;
-
175  update(first, last, 0, size_ - 1, 0, value, true);
-
176  }
-
177 
-
181  void offset(ssize_t first, ssize_t last, Value const& delta) {
-
182  if (rangeCorrect(&first, &last) == false) return ;
-
183  update(first, last, 0, size_ - 1, 0, delta, false);
-
184  }
-
185 
- -
188  return copyFrom(b);
-
189  }
-
190 };
-
191 
-
192 } // meow
-
193 
-
194 #endif // dsa_SegmentTree_H__
-
SegmentTree()
constructor
Definition: SegmentTree.h:121
-
中文名 線段樹
Definition: SegmentTree.h:45
-
size_t size() const
回傳size
Definition: SegmentTree.h:147
-
void offset(ssize_t first, ssize_t last, Value const &delta)
將區間 [first,last] 全部都加上 delta
Definition: SegmentTree.h:181
-
SegmentTree & operator=(SegmentTree const &b)
same as copyFrom(b)
Definition: SegmentTree.h:187
-
SegmentTree copyFrom(SegmentTree const &b)
複製
Definition: SegmentTree.h:138
-
SegmentTree(SegmentTree const &tree2)
constructor, 並且複製資料
Definition: SegmentTree.h:131
-
SegmentTree(size_t size)
constructor, with size gived
Definition: SegmentTree.h:126
-
T inRange(T const &mn, T const &mx, T const &v)
std::min(mx,std::max(mn,v))
Definition: utility.h:61
-
void reset(size_t size)
將資料清空且設定維護範圍是 0~size-1
Definition: SegmentTree.h:154
-
Value query(ssize_t first, ssize_t last) const
回傳區間 [first,last] (邊界都含) 的區間值
Definition: SegmentTree.h:165
-
-
- - - - - diff --git a/doc/html/Self_8h.html b/doc/html/Self_8h.html deleted file mode 100644 index 0f4d39c..0000000 --- a/doc/html/Self_8h.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/Self.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.9 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Self.h File Reference
-
-
-
#include <cstdlib>
-#include <algorithm>
-
-

Go to the source code of this file.

- - - - -

-Classes

class  meow::Self< Data >
 
- - - -

-Namespaces

 meow
 
- - - -

-Macros

#define DO_NOT_USE_SELF
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DO_NOT_USE_SELF
-
- -

Definition at line 9 of file Self.h.

- -
-
-
-
- - - - - diff --git a/doc/html/Self_8h.js b/doc/html/Self_8h.js deleted file mode 100644 index dee81d6..0000000 --- a/doc/html/Self_8h.js +++ /dev/null @@ -1,5 +0,0 @@ -var Self_8h = -[ - [ "Self", "classmeow_1_1Self.html", "classmeow_1_1Self" ], - [ "DO_NOT_USE_SELF", "Self_8h.html#ae68c240a801c89ab2107fad7a61f94c9", null ] -]; \ No newline at end of file diff --git a/doc/html/Self_8h_source.html b/doc/html/Self_8h_source.html deleted file mode 100644 index 00dfe5b..0000000 --- a/doc/html/Self_8h_source.html +++ /dev/null @@ -1,310 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/Self.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.9 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Self.h
-
-
-Go to the documentation of this file.
1 #ifndef Self_h__
-
2 #define Self_h__
-
3 
-
4 #include <cstdlib>
-
5 #include <algorithm>
-
6 
-
7 namespace meow {
-
8 
-
9 #define DO_NOT_USE_SELF
-
10 #ifdef DO_NOT_USE_SELF
-
11 
-
12 template<class Data>
-
13 class Self {
-
14 public:
- - -
17  };
-
18 private:
-
19  Data data_;
-
20 public:
-
21  Self( ) { }
-
22  Self(Data const& d ): data_(d) { }
-
23  Self(Self const& b, DuplicateType d): data_(b.data_) { }
-
24  Self(Self const& b);
-
25  ~Self() { }
-
26  Data const* operator->() const { return &data_; }
-
27  Data * operator->() { return &data_; }
-
28  Self& operator()() const { return *((Self*)this); }
-
29  Self const& copyFrom(Self const& s) { data_ = s.data_; return *this; }
-
30  Self const& referenceFrom(Self const& s) {
-
31  return copyFrom(s);
-
32  }
-
33  Self const& duplicateFrom(Self const& s, DuplicateType t) {
-
34  return copyFrom(s);
-
35  }
-
36  bool same(Self const& s) const { return false; }
-
37  bool equal(Self const& s) const { return data_ == s.data_; }
-
38  bool referenceLess(Self const& s) const { return (this < &s); }
-
39  void operator=(Self const& a);
-
40 };
-
41 
-
42 #else
-
43 
-
139 template<class Data>
-
140 class Self {
-
141 public:
-
145  enum DuplicateType {
-
146  COPY_FROM,
-
147  REFERENCE_FROM
-
148  };
-
149 private:
-
150  class Body {
-
151  private:
-
152  struct Kernel {
-
153  Data* data_;
-
154  size_t counter_;
-
155  Body const* master_;
-
156 
-
157  Kernel(Body const* master):
-
158  data_(new Data( )), counter_(1), master_(master) {
-
159  }
-
160 
-
161  Kernel(Body const* master, Data const& d):
-
162  data_(new Data(d)), counter_(1), master_(master) {
-
163  }
-
164 
-
165  ~Kernel() {
-
166  delete data_;
-
167  }
-
168  };
-
169 
-
170  Kernel* pointer_;
-
171  size_t counter_;
-
172 
-
173  void clear() {
-
174  --(pointer_->counter_);
-
175  if (pointer_->counter_ <= 0) {
-
176  delete pointer_;
-
177  }
-
178  else if (pointer_->master_ == this) {
-
179  pointer_->master_ = NULL;
-
180  }
-
181  }
-
182  public:
-
183  Body( ): pointer_(new Kernel(this )), counter_(1) { }
-
184  Body(Data const& d): pointer_(new Kernel(this, d)), counter_(1) { }
-
185  Body(Body const& b): pointer_(b.pointer_ ), counter_(1) {
-
186  ++(pointer_->counter_);
-
187  }
-
188 
-
189  ~Body() {
-
190  clear();
-
191  }
-
192 
-
193  Body& copyFrom(Body const& b) {
-
194  clear();
-
195  pointer_ = b.pointer_;
-
196  ++(pointer_->counter_);
-
197  return *this;
-
198  }
-
199 
-
200  Data const* access() const {
-
201  return pointer_->data_;
-
202  }
-
203 
-
204  Data* modify() {
-
205  if (pointer_->counter_ > 1) {
-
206  --(pointer_->counter_);
-
207  Kernel* dupl = new Kernel(this, *pointer_->data_);
-
208  if (pointer_->master_ == this) {
-
209  std::swap(pointer_->data_, dupl->data_);
-
210  pointer_->master_ = NULL;
-
211  }
-
212  pointer_ = dupl;
-
213  }
-
214  else if (pointer_->master_ == NULL) {
-
215  pointer_->master_ = this;
-
216  }
-
217  return pointer_->data_;
-
218  }
-
219 
-
220  int attach() {
-
221  return ++counter_;
-
222  }
-
223 
-
224  int detach() {
-
225  return --counter_;
-
226  }
-
227  };
-
228 
-
229  Body* body_;
-
230 
-
231  void clear() {
-
232  if (body_->detach() <= 0) {
-
233  delete body_;
-
234  }
-
235  }
-
236 public:
-
240  Self(): body_(new Body()) {
-
241  }
-
242 
-
248  Self(Data const& d): body_(new Body(d)) {
-
249  }
-
250 
-
257  Self(Self const& b, DuplicateType d) {
-
258  switch(d) {
-
259  case COPY_FROM:
-
260  body_ = new Body(*b.body_);
-
261  break;
-
262  case REFERENCE_FROM:
-
263  body_ = b.body_;
-
264  body_->attach();
-
265  break;
-
266  }
-
267  }
-
268 
-
270  Self(Self const& b);
-
271 
-
273  ~Self() {
-
274  clear();
-
275  }
-
276 
-
278  Data const* operator->() const {
-
279  return body_->access();
-
280  }
-
281 
-
285  Data* operator->() {
-
286  return body_->modify();
-
287  }
-
288 
-
290  Self& operator()() const {
-
291  return *((Self*)this);
-
292  }
-
293 
-
300  Self const& copyFrom(Self const& s) {
-
301  if (body_->access() != s.body_->access()) {
-
302  body_->copyFrom(*s.body_);
-
303  }
-
304  return *this;
-
305  }
-
306 
-
313  Self const& referenceFrom(Self const& s) {
-
314  if (body_ != s.body_) {
-
315  clear();
-
316  body_ = s.body_;
-
317  body_->attach();
-
318  }
-
319  return *this;
-
320  }
-
321 
-
329  Self const& duplicateFrom(Self const& s, DuplicateType t) {
-
330  switch(t) {
-
331  case COPY_FROM : return copyFrom(s);
-
332  case REFERENCE_FROM: return referenceFrom(s);
-
333  }
-
334  return *this;
-
335  }
-
336 
-
344  bool same(Self const& s) const {
-
345  return (body_ == s.body_);
-
346  }
-
347 
-
356  bool equal(Self const& s) const {
-
357  if (same(s) || body_->access() == s.body_->access()) return true;
-
358  return (*body_->access() == *s.body_->access());
-
359  }
-
360 
-
366  bool referenceLess(Self const& s) const {
-
367  return (body_ < s.body_);
-
368  }
-
369 
-
371  void operator=(Self const& a);
-
372 };
-
373 
-
374 #endif
-
375 
-
376 } // meow
-
377 
-
378 #endif // Self_h__
- -
Data const * operator->() const
Definition: Self.h:26
-
Self const & copyFrom(Self const &s)
Definition: Self.h:29
-
bool referenceLess(Self const &s) const
Definition: Self.h:38
-
Self(Self const &b, DuplicateType d)
Definition: Self.h:23
-
void operator=(Self const &a)
-
Self()
Definition: Self.h:21
-
Data * operator->()
Definition: Self.h:27
-
~Self()
Definition: Self.h:25
-
bool same(Self const &s) const
Definition: Self.h:36
-
bool equal(Self const &s) const
Definition: Self.h:37
-
Self & operator()() const
Definition: Self.h:28
- -
Self const & referenceFrom(Self const &s)
Definition: Self.h:30
- -
Self const & duplicateFrom(Self const &s, DuplicateType t)
Definition: Self.h:33
-
Self(Data const &d)
Definition: Self.h:22
-
-
- - - - - diff --git a/doc/html/SplayTree_8h.html b/doc/html/SplayTree_8h.html deleted file mode 100644 index 5d1790f..0000000 --- a/doc/html/SplayTree_8h.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/SplayTree.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
SplayTree.h File Reference
-
-
-
#include <cstdlib>
-#include <utility>
-#include "../math/utility.h"
-
-

Go to the source code of this file.

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

-Classes

class  meow::SplayTree< Key, Value >
 是一種神乎其技的資料結構, 維護一堆 Key->Value . 並且支援 一些 std::map 難以快速實踐的操作, 如 split , merge , keyOffset More...
 
class  meow::SplayTree< Key, Value >::Element
 類似 stliterator ,不過這邊叫做Element More...
 
class  meow::SplayTree_Range< Key, Value >
 基本上跟SplayTree一樣, 不過這邊結合線段樹, 多了區間操作 (線段樹相關operator定義請見 SegmentTree ) More...
 
class  meow::SplayTree_Range< Key, Value >::Element
 類似 stliterator ,不過這邊叫做Element More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/SplayTree_8h_source.html b/doc/html/SplayTree_8h_source.html deleted file mode 100644 index 0f2eceb..0000000 --- a/doc/html/SplayTree_8h_source.html +++ /dev/null @@ -1,1021 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/SplayTree.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
SplayTree.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_SplayTree_h__
-
2 #define dsa_SplayTree_h__
-
3 
-
4 #include <cstdlib>
-
5 #include <utility>
-
6 
-
7 #include "../math/utility.h"
-
8 
-
9 namespace meow {
-
10 
-
36 template<class Key, class Value>
-
37 class SplayTree {
-
38 private:
-
39  struct Node {
-
40  Key key_;
-
41  Key keyOffset_;
-
42  Value value_;
-
43  size_t size_;
-
44  Node* parent_;
-
45  Node* child_[2];
-
46 
-
47  Node(Key const& key, Value const& value):
-
48  key_(key), keyOffset_(0), value_(value) {
-
49  size_ = 1;
-
50  parent_ = NULL;
-
51  child_[0] = NULL;
-
52  child_[1] = NULL;
-
53  }
-
54  //
-
55  void keyOffset(Key const& delta) {
-
56  key_ = key_ + delta;
-
57  keyOffset_ = keyOffset_ + delta;
-
58  }
-
59  void syncDown() const {
-
60  for (size_t i = 0; i < 2; i++) {
-
61  if (child_[i] == NULL) continue;
-
62  child_[i]->keyOffset(keyOffset_);
-
63  }
-
64  ((Node*)this)->keyOffset_ = Key(0);
-
65  }
-
66  void syncUp() const {
-
67  ((Node*)this)->size_ = 1;
-
68  for (size_t i = 0; i < 2; i++) {
-
69  if (child_[i] == NULL) continue;
-
70  ((Node*)this)->size_ += child_[i]->size_;
-
71  }
-
72  }
-
73  };
-
74 
-
75  Node* root_;
-
76 
-
78  void connect(Node const* parent, size_t left_right, Node const* child) const {
-
79  Node* p = (Node*)parent;
-
80  Node* c = (Node*)child;
-
81  if (p != NULL) p->child_[left_right] = c;
-
82  if (c != NULL) c->parent_ = p;
-
83  }
-
84 
-
86  Node const* splay(Node const* node) const {
-
87  if (node != NULL && node->parent_ != NULL) {
-
88  for (const Node *g_grand, *grand, *parent, *child = node; ; ) {
-
89  g_grand = (grand = parent = child->parent_)->parent_;
-
90  size_t pc = (parent->child_[0] == child ? 0 : 1);
-
91  connect(parent, pc, child->child_[!pc]);
-
92  connect(child , !pc, parent);
-
93  if (g_grand != NULL) {
-
94  g_grand = (grand = g_grand)->parent_;
-
95  size_t gp = (grand->child_[0] == parent ? 0 : 1);
-
96  Node const* who = (pc == gp ? parent : child);
-
97  connect(grand, gp, who->child_[!gp]);
-
98  connect(who , !gp, grand);
-
99  grand->syncUp();
-
100  }
-
101  parent->syncUp();
-
102  child ->syncUp();
-
103  if (g_grand == NULL) {
-
104  connect(NULL, 0, child);
-
105  break;
-
106  }
-
107  connect(g_grand, (g_grand->child_[0] == grand ? 0 : 1), child);
-
108  }
-
109  }
-
110  return (((SplayTree*)this)->root_ = (Node*)node);
-
111  }
-
112 
-
113  void clear(Node* node) {
-
114  if (node == NULL) return ;
-
115  clear(node->child_[0]);
-
116  clear(node->child_[1]);
-
117  delete node;
-
118  }
-
119 
-
120  Node* dup(Node* node2) {
-
121  if (node2 == NULL) return NULL;
-
122  node2->syncDown();
-
123  Node* node = new Node(node2->key_, node2->value_);
-
124  connect(node, 0, dup(node2->child_[0]));
-
125  connect(node, 1, dup(node2->child_[1]));
-
126  node->syncUp();
-
127  return node;
-
128  }
-
129 
-
130  Node const* findKey(Node const* node, Key const& key) const {
-
131  Node const* ret = node;
-
132  while (node != NULL) {
-
133  node->syncDown();
-
134  ret = node;
-
135  if (!(key < node->key_)) {
-
136  if (!(node->key_< key)) break;
-
137  node = node->child_[1];
-
138  }
-
139  else {
-
140  node = node->child_[0];
-
141  }
-
142  }
-
143  return ret;
-
144  }
-
145  Node const* findMinMax(Node const* node, bool minimum) const {
-
146  Node const* ret = node;
-
147  for (int i = minimum ? 0 : 1; node != NULL; node = node->child_[i]) {
-
148  node->syncDown();
-
149  ret = node;
-
150  }
-
151  return ret;
-
152  }
-
153  Node const* findOrder(Node const* node, size_t order) const {
-
154  Node const* ret = node;
-
155  while (node != NULL) {
-
156  node->syncDown();
-
157  ret = node;
-
158  size_t ord = 1 + (node->child_[0] == NULL ? 0 : node->child_[0]->size_);
-
159  if (ord == order) return ret;
-
160  else if(ord < order){ node = node->child_[1]; order -= ord; }
-
161  else { node = node->child_[0]; }
-
162  }
-
163  return ret;
-
164  }
-
165 
-
166  void split(Node* root, Node** left, Node** right) {
-
167  if (root == NULL) { *left = NULL; *right = NULL; return ; }
-
168  root->syncDown();
-
169  *left = root;
-
170  *right = root->child_[1];
-
171  if (*right != NULL) {
-
172  (*left )->child_[1] = NULL;
-
173  (*right)->parent_ = NULL;
-
174  (*left )->syncUp();
-
175  }
-
176  }
-
177  Node* merge(Node* left, Node* right) {
-
178  if (left == NULL) return right;
-
179  if (right == NULL) return left ;
-
180  left->syncDown();
-
181  connect(left, 1, right);
-
182  left->syncUp();
-
183  return left;
-
184  }
-
185 public:
-
191  class Element{
-
192  private:
-
193  typedef std::pair<Key const&, Value&> Entry;
-
194  Entry* entry_;
-
195  Node * node_;
-
196  //
-
197  void reset(Node* node) {
-
198  node_ = node;
-
199  delete entry_;
-
200  entry_ = (node == NULL ? NULL : new Entry(node->key_, node->value_));
-
201  }
-
202  public:
-
203  Element(): entry_(NULL), node_(NULL) {
-
204  }
-
205  Element(Node* node): entry_(NULL), node_(NULL) {
-
206  reset(node);
-
207  }
-
208  Element(Element const& element2): entry_(NULL), node_(NULL) {
-
209  reset(element2.node_);
-
210  }
- -
212  delete entry_;
-
213  }
-
214 
-
216  Element& copyFrom(Element const& e) {
-
217  reset(e.node_);
-
218  return *this;
-
219  }
-
220 
-
222  bool same(Element const& e2) const {
-
223  return (node_ == e2.node_);
-
224  }
-
225 
-
227  Element& operator=(Element const& e2) {
-
228  return copyFrom(e2);
-
229  }
-
230 
-
232  Entry* operator->() {
-
233  return entry_;
-
234  }
-
235 
-
237  Entry& operator*() {
-
238  return *entry_;
-
239  }
-
240 
-
242  bool operator==(Element const& e2) const{
-
243  return same(e2);
-
244  }
-
245 
-
247  bool operator!=(Element const& e2) const{
-
248  return !same(e2);
-
249  }
-
250  };
-
251 
-
253  SplayTree(): root_(NULL) {
-
254  }
-
255 
-
257  SplayTree(SplayTree const& tree2):
-
258  root_(dup((Node*)(tree2.root_))) {
-
259  }
-
260 
- -
263  clear(root_);
-
264  }
-
265 
-
269  SplayTree& copyFrom(SplayTree const& tree2) {
-
270  clear(root_);
-
271  root_ = dup((Node*)(tree2.root_));
-
272  return *this;
-
273  }
-
274 
-
278  void moveTo(SplayTree* tree2) {
-
279  tree2->clear();
-
280  tree2->root_ = root_;
-
281  root_ = NULL;
-
282  }
-
283 
-
289  Element lowerBound(Key const& key) const {
-
290  splay(findKey(root_, key));
-
291  if (root_ == NULL || !(root_->key_ < key)) return Element(root_);
-
292  if (root_->child_[1] == NULL) return Element(NULL);
-
293  splay(findMinMax(root_->child_[1], true));
-
294  return Element(root_);
-
295  }
-
296 
-
302  Element upperBound(Key const& key) const {
-
303  splay(findKey(root_, key));
-
304  if (root_ == NULL || key < root_->key_) return Element(root_);
-
305  if (root_->child_[1] == NULL) return Element(NULL);
-
306  splay(findMinMax(root_->child_[1], true));
-
307  return Element(root_);
-
308  }
-
309 
-
315  Element rLowerBound(Key const& key) const {
-
316  splay(findKey(root_, key));
-
317  if (root_ == NULL || !(key < root_->key_)) return Element(root_);
-
318  if (root_->child_[0] == NULL) return Element(NULL);
-
319  splay(findMinMax(root_->child_[0], false));
-
320  return Element(root_);
-
321  }
-
322 
-
328  Element rUpperBound(Key const& key) const {
-
329  splay(findKey(root_, key));
-
330  if (root_ == NULL || root_->key_ < key) return Element(root_);
-
331  if (root_->child_[0] == NULL) return Element(NULL);
-
332  splay(findMinMax(root_->child_[0], false));
-
333  return Element(root_);
-
334  }
-
335 
-
339  Element find(Key const& key) const {
-
340  splay(findKey(root_, key));
-
341  if (root_ != NULL && !(key < root_->key_) && !(root_->key_ < key)) {
-
342  return Element(root_);
-
343  }
-
344  return Element(NULL);
-
345  }
-
346 
-
352  Element order(size_t order) const {
-
353  if (root_ == NULL || order >= root_->size_) return Element(NULL);
-
354  splay(findOrder(root_, order + 1));
-
355  return Element(root_);
-
356  }
-
357 
-
361  Element first() const {
-
362  splay(findMinMax(root_, true));
-
363  return Element(root_);
-
364  }
-
365 
-
369  Element last() const {
-
370  splay(findMinMax(root_, false));
-
371  return Element(root_);
-
372  }
-
373 
-
379  Element end() const {
-
380  return Element(NULL);
-
381  }
-
382 
-
386  size_t size() const {
-
387  return (root_ == NULL ? 0 : root_->size_);
-
388  }
-
389 
-
393  bool empty() const{
-
394  return (size() == 0);
-
395  }
-
396 
-
400  void clear() {
-
401  clear(root_);
-
402  root_ = NULL;
-
403  }
-
404 
-
411  bool insert(Key const& key, Value const& value) {
-
412  if (root_ == NULL) {
-
413  root_ = new Node(key, value);
-
414  }
-
415  else {
-
416  Node* parent = (Node*)findKey(root_, key);
-
417  if (!(parent->key_ < key) && !(key < parent->key_)) {
-
418  splay(parent);
-
419  return false;
-
420  }
-
421  Node* new_node = new Node(key, value);
-
422  connect(parent, (parent->key_ < key ? 1 : 0), new_node);
-
423  parent->syncUp();
-
424  splay(new_node);
-
425  }
-
426  return true;
-
427  }
-
428 
-
435  bool erase(Key const& key) {
-
436  if (root_ == NULL) return false;
-
437  Node* body = (Node*)findKey(root_, key);
-
438  if (body->key_ < key || key < body->key_) {
-
439  splay(body);
-
440  return false;
-
441  }
-
442  Node* ghost;
-
443  if (body->child_[1] == NULL) {
-
444  ghost = body->child_[0];
-
445  if (ghost != NULL) ghost->syncDown();
-
446  }
-
447  else {
-
448  ghost = (Node*)findMinMax(body->child_[1], true);
-
449  connect(ghost, 0, body->child_[0]);
-
450  if (ghost != body->child_[1]) {
-
451  connect(ghost->parent_, 0, ghost->child_[1]);
-
452  connect(ghost, 1, body->child_[1]);
-
453  for (Node* a = ghost->parent_; a != ghost; a = a->parent_)
-
454  a->syncUp();
-
455  }
-
456  ghost->syncUp();
-
457  }
-
458  Node* parent = body->parent_;
-
459  connect(parent, parent != NULL && parent->child_[0] == body ? 0 : 1, ghost);
-
460  delete body;
-
461  splay(ghost != NULL ? ghost : parent);
-
462  return true;
-
463  }
-
464 
-
468  void keyOffset(Key const& delta) {
-
469  if (root_ != NULL) {
-
470  root_->keyOffset(delta);
-
471  }
-
472  }
-
473 
-
477  void splitOut(Key const& upper_bound, SplayTree* right) {
-
478  right->clear();
-
479  if (rLowerBound(upper_bound) != end()) {
-
480  split(root_, &root_, &(right->root_));
-
481  }
-
482  else {
-
483  right->root_ = root_;
-
484  root_ = NULL;
-
485  }
-
486  }
-
487 
-
494  bool mergeAfter(SplayTree* tree2) {
-
495  if (root_ == NULL || tree2->root_ == NULL ||
-
496  last()->first < tree2->first()->first) {
-
497  root_ = merge(root_, tree2->root_);
-
498  tree2->root_ = NULL;
-
499  return true;
-
500  }
-
501  return false;
-
502  }
-
503 
-
511  bool merge(SplayTree* tree2) {
-
512  if (root_ == NULL || tree2->root_ == NULL ||
-
513  last()->first < tree2->first()->first) {
-
514  root_ = merge(root_, tree2->root_);
-
515  }
-
516  else if(tree2->last()->first < first()->first) {
-
517  root_ = merge(tree2->root_, root_);
-
518  }
-
519  else {
-
520  return false;
-
521  }
-
522  tree2->root_ = NULL;
-
523  return true;
-
524  }
-
525 
-
532  Value& operator[](Key const& key) {
-
533  if (find(key) == end()) insert(key, Value());
-
534  return root_->value_;
-
535  }
-
536 
-
538  SplayTree& operator=(SplayTree const& tree2) {
-
539  return copyFrom(tree2);
-
540  }
-
541 };
-
542 
-
568 template<class Key, class Value>
- -
570 private:
-
571  struct Node {
-
572  Value valueOffset_;
-
573  Value range_;
-
574  Key key_;
-
575  Key keyOffset_;
-
576  Value value_;
-
577  bool same_;
-
578  size_t size_;
-
579  Node* parent_;
-
580  Node* child_[2];
-
581 
-
582  Node(Key const& key, Value const& value):
-
583  valueOffset_(0), range_(value),
-
584  key_(key), keyOffset_(0), value_(value) {
-
585  same_ = false;
-
586  size_ = 1;
-
587  parent_ = NULL;
-
588  child_[0] = NULL;
-
589  child_[1] = NULL;
-
590  }
-
591  //
-
592  void keyOffset(Key const& delta) {
-
593  key_ = key_ + delta;
-
594  keyOffset_ = keyOffset_ + delta;
-
595  }
-
596  void valueUpdate(Value const& delta, bool over) {
-
597  if(over) {
-
598  value_ = delta * size_;
-
599  valueOffset_ = delta;
-
600  range_ = delta * size_;
-
601  same_ = true;
-
602  }
-
603  else {
-
604  value_ = value_ + delta * size_;
-
605  valueOffset_ = valueOffset_ + delta;
-
606  range_ = range_ + delta * size_;
-
607  }
-
608  }
-
609  void syncDown() const {
-
610  for (size_t i = 0; i < 2; i++) {
-
611  if (child_[i] == NULL) continue;
-
612  child_[i]->keyOffset(keyOffset_);
-
613  child_[i]->valueUpdate(valueOffset_, same_);
-
614  }
-
615  ((Node*)this)->keyOffset_ = Key(0);
-
616  ((Node*)this)->valueOffset_ = Value(0);
-
617  ((Node*)this)->same_ = false;
-
618  }
-
619  void syncUp() const {
-
620  ((Node*)this)->size_ = 1;
-
621  Value* v[3] = {&(((Node*)this)->value_), NULL, NULL};
-
622  size_t vct = 1;
-
623  for (size_t i = 0; i < 2; i++) {
-
624  if (child_[i] == NULL) continue;
-
625  ((Node*)this)->size_ += child_[i]->size_;
-
626  v[vct++] = &(child_[i]->range_);
-
627  }
-
628  if (vct == 1) ((Node*)this)->range_ = (*v[0]);
-
629  else if(vct == 2) ((Node*)this)->range_ = (*v[0]) | (*v[1]);
-
630  else ((Node*)this)->range_ = (*v[0]) | (*v[1]) | (*v[2]);
-
631  }
-
632  };
-
633 
-
634  Node* root_;
-
635 
-
637  void connect(Node const* parent, size_t left_right, Node const* child) const {
-
638  Node* p = (Node*)parent;
-
639  Node* c = (Node*)child;
-
640  if (p != NULL) p->child_[left_right] = c;
-
641  if (c != NULL) c->parent_ = p;
-
642  }
-
643 
-
645  Node const* splay(Node const* node) const {
-
646  if (node != NULL && node->parent_ != NULL) {
-
647  for (const Node *g_grand, *grand, *parent, *child = node; ; ) {
-
648  g_grand = (grand = parent = child->parent_)->parent_;
-
649  size_t pc = (parent->child_[0] == child ? 0 : 1);
-
650  connect(parent, pc, child->child_[!pc]);
-
651  connect(child , !pc, parent);
-
652  if (g_grand != NULL) {
-
653  g_grand = (grand = g_grand)->parent_;
-
654  size_t gp = (grand->child_[0] == parent ? 0 : 1);
-
655  Node const* who = (pc == gp ? parent : child);
-
656  connect(grand, gp, who->child_[!gp]);
-
657  connect(who , !gp, grand);
-
658  grand->syncUp();
-
659  }
-
660  parent->syncUp();
-
661  child ->syncUp();
-
662  if (g_grand == NULL) {
-
663  connect(NULL, 0, child);
-
664  break;
-
665  }
-
666  connect(g_grand, (g_grand->child_[0] == grand ? 0 : 1), child);
-
667  }
-
668  }
-
669  return (((SplayTree_Range*)this)->root_ = (Node*)node);
-
670  }
-
671 
-
672  void clear(Node* node) {
-
673  if (node == NULL) return ;
-
674  clear(node->child_[0]);
-
675  clear(node->child_[1]);
-
676  delete node;
-
677  }
-
678 
-
679  Node* dup(Node* node2) {
-
680  if (node2 == NULL) return NULL;
-
681  node2->syncDown();
-
682  Node* node = new Node(node2->key_, node2->value_);
-
683  connect(node, 0, dup(node2->child_[0]));
-
684  connect(node, 1, dup(node2->child_[1]));
-
685  node->syncUp();
-
686  return node;
-
687  }
-
688 
-
689  Node const* findKey(Node const* node, Key const& key) const {
-
690  Node const* ret = node;
-
691  while (node != NULL) {
-
692  node->syncDown();
-
693  ret = node;
-
694  if (!(key < node->key_)) {
-
695  if (!(node->key_< key)) break;
-
696  node = node->child_[1];
-
697  }
-
698  else {
-
699  node = node->child_[0];
-
700  }
-
701  }
-
702  return ret;
-
703  }
-
704  Node const* findMinMax(Node const* node, bool minimum) const {
-
705  Node const* ret = node;
-
706  for (int i = minimum ? 0 : 1; node != NULL; node = node->child_[i]) {
-
707  node->syncDown();
-
708  ret = node;
-
709  }
-
710  return ret;
-
711  }
-
712  Node const* findOrder(Node const* node, size_t order) const {
-
713  Node const* ret = node;
-
714  while (node != NULL) {
-
715  node->syncDown();
-
716  ret = node;
-
717  size_t ord = 1 + (node->child_[0] == NULL ? 0 : node->child_[0]->size_);
-
718  if (ord == order) return ret;
-
719  else if(ord < order){ node = node->child_[1]; order -= ord; }
-
720  else { node = node->child_[0]; }
-
721  }
-
722  return ret;
-
723  }
-
724 
-
725  void split(Node* root, Node** left, Node** right) {
-
726  if (root == NULL) { *left = NULL; *right = NULL; return ; }
-
727  root->syncDown();
-
728  *left = root;
-
729  *right = root->child_[1];
-
730  if (*right != NULL) {
-
731  (*left )->child_[1] = NULL;
-
732  (*right)->parent_ = NULL;
-
733  (*left )->syncUp();
-
734  }
-
735  }
-
736  Node* merge(Node* left, Node* right) {
-
737  if (left == NULL) return right;
-
738  if (right == NULL) return left ;
-
739  left->syncDown();
-
740  connect(left, 1, right);
-
741  left->syncUp();
-
742  return left;
-
743  }
-
744 public:
-
750  class Element{
-
751  private:
-
752  typedef std::pair<Key const&, Value&> Entry;
-
753  Entry* entry_;
-
754  Node * node_;
-
755  //
-
756  void reset(Node* node) {
-
757  node_ = node;
-
758  delete entry_;
-
759  entry_ = (node == NULL ? NULL : new Entry(node->key_, node->value_));
-
760  }
-
761  public:
-
762  Element(): entry_(NULL), node_(NULL) {
-
763  }
-
764  Element(Node* node): entry_(NULL), node_(NULL) {
-
765  reset(node);
-
766  }
-
767  Element(Element const& element2): entry_(NULL), node_(NULL) {
-
768  reset(element2.node_);
-
769  }
- -
771  delete entry_;
-
772  }
-
773 
-
775  Element& copyFrom(Element const& e) {
-
776  reset(e.node_);
-
777  return *this;
-
778  }
-
779 
-
781  bool same(Element const& e2) const {
-
782  return (node_ == e2.node_);
-
783  }
-
784 
-
786  Element& operator=(Element const& e2) {
-
787  return copyFrom(e2);
-
788  }
-
789 
-
791  Entry* operator->() {
-
792  return entry_;
-
793  }
-
794 
-
796  Entry& operator*() {
-
797  return *entry_;
-
798  }
-
799 
-
801  bool operator==(Element const& e2) const{
-
802  return same(e2);
-
803  }
-
804 
-
806  bool operator!=(Element const& e2) const{
-
807  return !same(e2);
-
808  }
-
809  };
-
810 
-
812  SplayTree_Range(): root_(NULL) {
-
813  }
-
814 
- -
817  root_(dup((Node*)(tree2.root_))) {
-
818  }
-
819 
- -
822  clear(root_);
-
823  }
-
824 
- -
829  clear(root_);
-
830  root_ = dup((Node*)(tree2.root_));
-
831  return *this;
-
832  }
-
833 
-
837  void moveTo(SplayTree_Range* tree2) {
-
838  tree2->clear();
-
839  tree2->root_ = root_;
-
840  root_ = NULL;
-
841  }
-
842 
-
848  Element lowerBound(Key const& key) const {
-
849  splay(findKey(root_, key));
-
850  if (root_ == NULL || !(root_->key_ < key)) return Element(root_);
-
851  if (root_->child_[1] == NULL) return Element(NULL);
-
852  splay(findMinMax(root_->child_[1], true));
-
853  return Element(root_);
-
854  }
-
855 
-
861  Element upperBound(Key const& key) const {
-
862  splay(findKey(root_, key));
-
863  if (root_ == NULL || key < root_->key_) return Element(root_);
-
864  if (root_->child_[1] == NULL) return Element(NULL);
-
865  splay(findMinMax(root_->child_[1], true));
-
866  return Element(root_);
-
867  }
-
868 
-
874  Element rLowerBound(Key const& key) const {
-
875  splay(findKey(root_, key));
-
876  if (root_ == NULL || !(key < root_->key_)) return Element(root_);
-
877  if (root_->child_[0] == NULL) return Element(NULL);
-
878  splay(findMinMax(root_->child_[0], false));
-
879  return Element(root_);
-
880  }
-
881 
-
887  Element rUpperBound(Key const& key) const {
-
888  splay(findKey(root_, key));
-
889  if (root_ == NULL || root_->key_ < key) return Element(root_);
-
890  if (root_->child_[0] == NULL) return Element(NULL);
-
891  splay(findMinMax(root_->child_[0], false));
-
892  return Element(root_);
-
893  }
-
894 
-
898  Element find(Key const& key) const {
-
899  splay(findKey(root_, key));
-
900  if (root_ != NULL && !(key < root_->key_) && !(root_->key_ < key)) {
-
901  return Element(root_);
-
902  }
-
903  return Element(NULL);
-
904  }
-
905 
-
911  Element order(size_t order) const {
-
912  if (root_ == NULL || order >= root_->size_) return Element(NULL);
-
913  splay(findOrder(root_, order + 1));
-
914  return Element(root_);
-
915  }
-
916 
-
920  Element first() const {
-
921  splay(findMinMax(root_, true));
-
922  return Element(root_);
-
923  }
-
924 
-
928  Element last() const {
-
929  splay(findMinMax(root_, false));
-
930  return Element(root_);
-
931  }
-
932 
-
938  Element end() const {
-
939  return Element(NULL);
-
940  }
-
941 
-
945  size_t size() const {
-
946  return (root_ == NULL ? 0 : root_->size_);
-
947  }
-
948 
-
952  bool empty() const{
-
953  return (size() == 0);
-
954  }
-
955 
-
961  Value query() const {
-
962  if (root_ == NULL) return Value(0);
-
963  return root_->range_;
-
964  }
-
965 
-
971  Value query(Key const& first, Key const& last) const {
-
972  SplayTree_Range* self = (SplayTree_Range*)this;
-
973  Node* tmp;
-
974  rUpperBound(first);
-
975  self->split(self->root_, &tmp, &(self->root_));
-
976  upperBound(last);
-
977  Value ret(0);
-
978  if (root_ != NULL && root_->child_[0] != NULL) {
-
979  ret = root_->child_[0]->range_;
-
980  }
-
981  self->root_ = self->merge(tmp, self->root_);
-
982  return ret;
-
983  }
-
984 
-
988  void clear() {
-
989  clear(root_);
-
990  root_ = NULL;
-
991  }
-
992 
-
999  bool insert(Key const& key, Value const& value) {
-
1000  if (root_ == NULL) {
-
1001  root_ = new Node(key, value);
-
1002  }
-
1003  else {
-
1004  Node* parent = (Node*)findKey(root_, key);
-
1005  if (!(parent->key_ < key) && !(key < parent->key_)) {
-
1006  splay(parent);
-
1007  return false;
-
1008  }
-
1009  Node* new_node = new Node(key, value);
-
1010  connect(parent, (parent->key_ < key ? 1 : 0), new_node);
-
1011  parent->syncUp();
-
1012  splay(new_node);
-
1013  }
-
1014  return true;
-
1015  }
-
1016 
-
1023  bool erase(Key const& key) {
-
1024  if (root_ == NULL) return false;
-
1025  Node* body = (Node*)findKey(root_, key);
-
1026  if (body->key_ < key || key < body->key_) {
-
1027  splay(body);
-
1028  return false;
-
1029  }
-
1030  Node* ghost;
-
1031  if (body->child_[1] == NULL) {
-
1032  ghost = body->child_[0];
-
1033  if (ghost != NULL) ghost->syncDown();
-
1034  }
-
1035  else {
-
1036  ghost = (Node*)findMinMax(body->child_[1], true);
-
1037  connect(ghost, 0, body->child_[0]);
-
1038  if (ghost != body->child_[1]) {
-
1039  connect(ghost->parent_, 0, ghost->child_[1]);
-
1040  connect(ghost, 1, body->child_[1]);
-
1041  for (Node* a = ghost->parent_; a != ghost; a = a->parent_)
-
1042  a->syncUp();
-
1043  }
-
1044  ghost->syncUp();
-
1045  }
-
1046  Node* parent = body->parent_;
-
1047  connect(parent, parent != NULL && parent->child_[0] == body ? 0 : 1, ghost);
-
1048  delete body;
-
1049  splay(ghost != NULL ? ghost : parent);
-
1050  return true;
-
1051  }
-
1052 
-
1056  void keyOffset(Key const& delta) {
-
1057  if (root_ != NULL) {
-
1058  root_->keyOffset(delta);
-
1059  }
-
1060  }
-
1061 
-
1065  void valueOffset(Value const& delta){
-
1066  if (root_ != NULL) {
-
1067  root_->valueUpdate(delta, false);
-
1068  }
-
1069  }
-
1070 
-
1074  void valueOverride(Value const& value){
-
1075  if(root_ != NULL){
-
1076  root_->valueUpdate(value, true);
-
1077  }
-
1078  }
-
1079 
-
1083  void splitOut(Key const& upper_bound, SplayTree_Range* right) {
-
1084  right->clear();
-
1085  if (rLowerBound(upper_bound) != end()) {
-
1086  split(root_, &root_, &(right->root_));
-
1087  }
-
1088  else {
-
1089  right->root_ = root_;
-
1090  root_ = NULL;
-
1091  }
-
1092  }
-
1093 
- -
1101  if (root_ == NULL || tree2->root_ == NULL ||
-
1102  last()->first < tree2->first()->first) {
-
1103  root_ = merge(root_, tree2->root_);
-
1104  tree2->root_ = NULL;
-
1105  return true;
-
1106  }
-
1107  return false;
-
1108  }
-
1109 
-
1117  bool merge(SplayTree_Range* tree2) {
-
1118  if (root_ == NULL || tree2->root_ == NULL ||
-
1119  last()->first < tree2->first()->first) {
-
1120  root_ = merge(root_, tree2->root_);
-
1121  }
-
1122  else if(tree2->last()->first < first()->first) {
-
1123  root_ = merge(tree2->root_, root_);
-
1124  }
-
1125  else {
-
1126  return false;
-
1127  }
-
1128  tree2->root_ = NULL;
-
1129  return true;
-
1130  }
-
1131 
-
1138  Value& operator[](Key const& key) {
-
1139  if (find(key) == end()) insert(key, Value());
-
1140  return root_->value_;
-
1141  }
-
1142 
- -
1145  return copyFrom(tree2);
-
1146  }
-
1147 };
-
1148 
-
1149 } // meow
-
1150 
-
1151 #endif // dsa_SplayTree_h__
-
bool merge(SplayTree *tree2)
合併
Definition: SplayTree.h:511
-
bool mergeAfter(SplayTree *tree2)
合併
Definition: SplayTree.h:494
-
Element upperBound(Key const &key) const
找出第一個(最小的) Element且 k < 它的 Key, 並且回傳之.
Definition: SplayTree.h:861
-
bool operator==(Element const &e2) const
same as same(e2)
Definition: SplayTree.h:801
-
Element & operator=(Element const &e2)
same as copyFrom
Definition: SplayTree.h:227
-
Element order(size_t order) const
將Elements依照Key由小到大排序, 回傳第 ord 個Element (由0算起).
Definition: SplayTree.h:911
-
Element lowerBound(Key const &key) const
找出第一個(最小的) Element且 k <= 它的 Key, 並且回傳之.
Definition: SplayTree.h:289
-
Entry & operator*()
重導至std::pair<Key const&,Value&>&
Definition: SplayTree.h:237
- -
~SplayTree()
destructor
Definition: SplayTree.h:262
- -
size_t size() const
回傳資料個數
Definition: SplayTree.h:945
-
Entry * operator->()
重導至std::pair<Key const&,Value&>*
Definition: SplayTree.h:791
-
Element lowerBound(Key const &key) const
找出第一個(最小的) Element且 k <= 它的 Key, 並且回傳之.
Definition: SplayTree.h:848
-
bool insert(Key const &key, Value const &value)
插入一組(Key —> Value)
Definition: SplayTree.h:999
-
SplayTree & copyFrom(SplayTree const &tree2)
複製資料
Definition: SplayTree.h:269
-
Element order(size_t order) const
將Elements依照Key由小到大排序, 回傳第 ord 個Element (由0算起).
Definition: SplayTree.h:352
-
void clear()
清空
Definition: SplayTree.h:988
-
bool same(Element const &e2) const
比對兩者是否為指向同一個Entry
Definition: SplayTree.h:222
-
Element find(Key const &key) const
找出 Key= k 的Elemenet 並回傳. 找不到的話回傳 this->end()
Definition: SplayTree.h:898
-
bool same(Element const &e2) const
比對兩者是否為指向同一個Entry
Definition: SplayTree.h:781
-
Value query(Key const &first, Key const &last) const
查找
Definition: SplayTree.h:971
-
Element first() const
回傳Key最小的Element, 如果SplayTree為空, 則回傳 this->end()
Definition: SplayTree.h:920
-
void splitOut(Key const &upper_bound, SplayTree *right)
將tree2 清空, 再將所有Key > upper_bound 的Element都丟過去
Definition: SplayTree.h:477
-
Element(Element const &element2)
Definition: SplayTree.h:208
-
Element find(Key const &key) const
找出 Key= k 的Elemenet 並回傳. 找不到的話回傳 this->end()
Definition: SplayTree.h:339
-
void clear()
清空
Definition: SplayTree.h:400
-
bool operator!=(Element const &e2) const
same as !same(e2)
Definition: SplayTree.h:806
-
bool merge(SplayTree_Range *tree2)
合併
Definition: SplayTree.h:1117
-
Entry * operator->()
重導至std::pair<Key const&,Value&>*
Definition: SplayTree.h:232
-
類似 stl 的 iterator ,不過這邊叫做Element
Definition: SplayTree.h:191
-
基本上跟SplayTree一樣, 不過這邊結合線段樹, 多了區間操作 (線段樹相關operator定義請見 SegmentTree )
Definition: SplayTree.h:569
-
SplayTree_Range()
constructor
Definition: SplayTree.h:812
-
bool empty() const
回傳是否為空
Definition: SplayTree.h:393
-
SplayTree_Range & operator=(SplayTree_Range const &tree2)
same as copyFrom(tree2)
Definition: SplayTree.h:1144
-
Value & operator[](Key const &key)
就像stl::map::operator[]
Definition: SplayTree.h:1138
-
bool mergeAfter(SplayTree_Range *tree2)
合併
Definition: SplayTree.h:1100
-
Element upperBound(Key const &key) const
找出第一個(最小的) Element且 k < 它的 Key, 並且回傳之.
Definition: SplayTree.h:302
-
Element end() const
回傳一個指向NULL的Element,
Definition: SplayTree.h:938
-
void splitOut(Key const &upper_bound, SplayTree_Range *right)
將tree2 清空, 再將所有Key > upper_bound 的Element都丟過去
Definition: SplayTree.h:1083
-
bool empty() const
回傳是否為空
Definition: SplayTree.h:952
-
Element last() const
回傳Key最大的Element, 如果SplayTree為空, 則回傳 this->end()
Definition: SplayTree.h:928
-
SplayTree_Range & copyFrom(SplayTree_Range const &tree2)
複製資料
Definition: SplayTree.h:828
-
是一種神乎其技的資料結構, 維護一堆 Key->Value . 並且支援 一些 std::map 難以快速實踐的操作, 如 split , merge , keyOffset ...
Definition: SplayTree.h:37
-
bool erase(Key const &key)
刪除一組資料
Definition: SplayTree.h:435
-
bool operator==(Element const &e2) const
same as same(e2)
Definition: SplayTree.h:242
-
Element & operator=(Element const &e2)
same as copyFrom
Definition: SplayTree.h:786
-
bool operator!=(Element const &e2) const
same as !same(e2)
Definition: SplayTree.h:247
-
void moveTo(SplayTree *tree2)
將資料都丟到 tree2 身上, 並且清空自己
Definition: SplayTree.h:278
-
size_t size() const
回傳資料個數
Definition: SplayTree.h:386
-
類似 stl 的 iterator ,不過這邊叫做Element
Definition: SplayTree.h:750
-
SplayTree_Range(SplayTree_Range const &tree2)
constructor, 複製資料
Definition: SplayTree.h:816
-
Entry & operator*()
重導至std::pair<Key const&,Value&>&
Definition: SplayTree.h:796
-
void valueOffset(Value const &delta)
將所有Element的Value同加上 delta
Definition: SplayTree.h:1065
-
SplayTree(SplayTree const &tree2)
constructor, 複製資料
Definition: SplayTree.h:257
-
SplayTree()
constructor
Definition: SplayTree.h:253
-
Value & operator[](Key const &key)
就像stl::map::operator[]
Definition: SplayTree.h:532
-
void keyOffset(Key const &delta)
將所有Element的Key同加上 delta
Definition: SplayTree.h:468
-
void keyOffset(Key const &delta)
將所有Element的Key同加上 delta
Definition: SplayTree.h:1056
-
Element(Element const &element2)
Definition: SplayTree.h:767
- -
void valueOverride(Value const &value)
將所有Element的Value全部設定成value
Definition: SplayTree.h:1074
- -
Element first() const
回傳Key最小的Element, 如果SplayTree為空, 則回傳 this->end()
Definition: SplayTree.h:361
-
Element end() const
回傳一個指向NULL的Element,
Definition: SplayTree.h:379
-
bool insert(Key const &key, Value const &value)
插入一組(Key —> Value)
Definition: SplayTree.h:411
- -
Element rLowerBound(Key const &key) const
找出第一個(最小的) Element且 k >= 它的 Key, 並且回傳之.
Definition: SplayTree.h:874
-
~SplayTree_Range()
destructor
Definition: SplayTree.h:821
-
Element last() const
回傳Key最大的Element, 如果SplayTree為空, 則回傳 this->end()
Definition: SplayTree.h:369
-
bool erase(Key const &key)
刪除一組資料
Definition: SplayTree.h:1023
-
Element rUpperBound(Key const &key) const
找出第一個(最小的) Element且 k > 它的 Key, 並且回傳之.
Definition: SplayTree.h:328
-
void moveTo(SplayTree_Range *tree2)
將資料都丟到 tree2 身上, 並且清空自己
Definition: SplayTree.h:837
-
SplayTree & operator=(SplayTree const &tree2)
same as copyFrom(tree2)
Definition: SplayTree.h:538
- -
Element rUpperBound(Key const &key) const
找出第一個(最小的) Element且 k > 它的 Key, 並且回傳之.
Definition: SplayTree.h:887
-
Element & copyFrom(Element const &e)
複製資料
Definition: SplayTree.h:775
-
Value query() const
查找
Definition: SplayTree.h:961
-
Element rLowerBound(Key const &key) const
找出第一個(最小的) Element且 k >= 它的 Key, 並且回傳之.
Definition: SplayTree.h:315
-
Element & copyFrom(Element const &e)
複製資料
Definition: SplayTree.h:216
-
-
- - - - - diff --git a/doc/html/Transformation_8h.html b/doc/html/Transformation_8h.html deleted file mode 100644 index 68d0072..0000000 --- a/doc/html/Transformation_8h.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Transformation.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Transformation.h File Reference
-
-
-
#include "Matrix.h"
-#include "../Self.h"
-#include <list>
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Transformation< Scalar >
 A base class for implementing kinds of transformations. More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Transformation_8h_source.html b/doc/html/Transformation_8h_source.html deleted file mode 100644 index 6c62536..0000000 --- a/doc/html/Transformation_8h_source.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Transformation.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Transformation.h
-
-
-Go to the documentation of this file.
1 #ifndef math_Transformation_H__
-
2 #define math_Transformation_H__
-
3 
-
4 #include "Matrix.h"
-
5 #include "../Self.h"
-
6 
-
7 #include <list>
-
8 #include <cstdlib>
-
9 
-
10 namespace meow {
-
11 
-
20 template<class Scalar>
- -
22 private:
-
23  struct Myself {
-
24  size_t inputRows_;
-
25  size_t inputCols_;
-
26  size_t outputRows_;
-
27  size_t outputCols_;
-
28  size_t psize_;
-
29 
-
30  Myself(Myself const& b):
-
31  inputRows_(b.inputRows_), inputCols_(b.inputCols_),
-
32  outputRows_(b.outputRows_), outputCols_(b.outputCols_),
-
33  psize_(b.psize_) {
-
34  }
-
35 
-
36  Myself(size_t ir, size_t ic, size_t or_, size_t oc, size_t ps):
-
37  inputRows_(ir), inputCols_(ic), outputRows_(or_), outputCols_(oc),
-
38  psize_(ps) {
-
39  }
-
40 
-
41  ~Myself() {
-
42  }
-
43  };
-
44 
-
45  Self<Myself> const self;
-
46 protected:
- -
56  size_t outputRows, size_t outputCols,
-
57  size_t psize):
-
58  self(Myself(inputRows, inputCols, outputRows, outputCols, psize)) {
-
59  }
-
60 
- -
66  self(b.self, Self<Myself>::COPY_FROM) {
-
67  }
-
68 
- -
76  self().copyFrom(b.self);
-
77  return *this;
-
78  }
-
79 
- -
87  self().referenceFrom(b.self);
-
88  return *this;
-
89  }
-
90 public:
-
94  virtual ~Transformation() {
-
95  }
-
96 
-
102  size_t inputRows() const {
-
103  return self->inputRows_;
-
104  }
-
105 
-
111  size_t inputCols() const {
-
112  return self->inputCols_;
-
113  }
-
114 
-
120  size_t outputRows() const {
-
121  return self->outputRows_;
-
122  }
-
123 
-
129  size_t outputCols() const {
-
130  return self->outputCols_;
-
131  }
-
132 
-
138  size_t parameterSize() const {
-
139  return self->psize_;
-
140  }
-
141 
-
148  virtual Scalar parameter(size_t i) const = 0;
-
149 
-
157  virtual Scalar parameter(size_t i, Scalar const& s) = 0;
-
158 
-
165  virtual Matrix<Scalar> transformate(Matrix<Scalar> const& x) const = 0;
-
166 
-
177  virtual Matrix<Scalar> jacobian(Matrix<Scalar> const& x) const {
-
178  return Matrix<Scalar>();
-
179  }
-
180 
-
192  virtual Matrix<Scalar> jacobian(Matrix<Scalar> const& x, size_t i) const {
-
193  return Matrix<Scalar>();
-
194  }
-
195 
-
201  virtual bool inversable() const { return false; }
-
202 
- -
210  return Matrix<Scalar>();
-
211  }
-
212 
-
219  virtual Matrix<Scalar> jacobianInv(Matrix<Scalar> const& x) const {
-
220  return Matrix<Scalar>();
-
221  }
-
222 
-
230  virtual Matrix<Scalar> jacobianInv(Matrix<Scalar> const& x, size_t i) const {
-
231  return Matrix<Scalar>();
-
232  }
-
233 };
-
234 
-
235 } // meow
-
236 
-
237 #endif // math_Transformation_H__
-
virtual Matrix< Scalar > jacobian(Matrix< Scalar > const &x) const
Calculate the jacobian matrix (derivate by the input matrix) of the transformation.
-
virtual Matrix< Scalar > jacobian(Matrix< Scalar > const &x, size_t i) const
Calculate the jacobian matrix (derivate by the i -th parameter) of the transformation.
-
size_t parameterSize() const
Return the number of parameters.
-
size_t outputRows() const
Return the number of rows of the output matrix.
-
Transformation(size_t inputRows, size_t inputCols, size_t outputRows, size_t outputCols, size_t psize)
-
virtual Matrix< Scalar > transformateInv(Matrix< Scalar > const &x) const
Do the inverse transformation.
-
virtual Matrix< Scalar > transformate(Matrix< Scalar > const &x) const =0
Do transformate.
-
virtual Scalar parameter(size_t i) const =0
Get the i -th parameter.
-
size_t inputRows() const
Return the number of rows of the input matrix.
-
virtual Matrix< Scalar > jacobianInv(Matrix< Scalar > const &x) const
Return the jacobian matrix of the inverse transformation.
- -
Transformation & copyFrom(Transformation const &b)
Copy from the specified one.
-
Transformation(Transformation const &b)
-
size_t inputCols() const
Return the number of columns of the input matrix.
- -
virtual Matrix< Scalar > jacobianInv(Matrix< Scalar > const &x, size_t i) const
Return the jacobian matrix of the inverse transformation.
-
Transformation & referenceFrom(Transformation const &b)
reference from the specified one
- - -
A base class for implementing kinds of transformations.
-
size_t outputCols() const
Return the number of columns of the output matrix.
-
virtual bool inversable() const
Return whether this transformation is inversable or not.
-
-
- - - - - diff --git a/doc/html/Transformations_8h.html b/doc/html/Transformations_8h.html deleted file mode 100644 index d9ea64a..0000000 --- a/doc/html/Transformations_8h.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Transformations.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Transformations.h File Reference
-
-
-
#include "Transformation.h"
-#include "Matrix.h"
-#include "utility.h"
-#include "../Self.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

class  meow::BallProjection< Scalar >
 A ball projection is to project the given vector to a hyper-sphere. More...
 
class  meow::PhotoProjection< Scalar >
 A photo projection is a kind of transformation that project point/vector to a flat photo. More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Transformations_8h_source.html b/doc/html/Transformations_8h_source.html deleted file mode 100644 index d1f87f0..0000000 --- a/doc/html/Transformations_8h_source.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Transformations.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Transformations.h
-
-
-Go to the documentation of this file.
1 #ifndef math_Transformations_H__
-
2 #define math_Transformations_H__
-
3 
-
4 #include "Transformation.h"
-
5 #include "Matrix.h"
-
6 #include "utility.h"
-
7 #include "../Self.h"
-
8 
-
9 #include <cstdlib>
-
10 
-
11 namespace meow {
-
12 
-
49 template<class Scalar>
-
50 class BallProjection: public Transformation<Scalar> {
-
51 private:
-
52  struct Myself {
-
53  size_t dimension_;
-
54  Scalar radius_;
-
55 
-
56  Myself(size_t d): dimension_(1), radius_(1) {
-
57  }
-
58 
-
59  Myself(size_t d, Scalar const& r): dimension_(d), radius_(r) {
-
60  }
-
61 
-
62  Myself(Myself const& m): dimension_(m.dimension_), radius_(m.radius_) {
-
63  }
-
64  };
-
65 
-
66  Self<Myself> const self;
-
67 public:
- -
73  self(b.self, Self<Myself>::COPY_FROM) {
-
74  }
-
75 
-
80  BallProjection(size_t d): Transformation<Scalar>(d, 1, d, 1, 1),
-
81  self(Myself(d)) {
-
82  radius(1);
-
83  }
-
84 
-
90  BallProjection(size_t d, Scalar const& r): Transformation<Scalar>(d,1,d,1,1),
-
91  self(Myself(d, r)) {
-
92  radius(r);
-
93  }
-
94 
- - -
102  copyFrom(b);
-
103  return *this;
-
104  }
-
105 
- - -
113  referenceFrom(b);
-
114  return *this;
-
115  }
-
116 
-
120  Scalar parameter(size_t i) const {
-
121  return radius();
-
122  }
-
123 
-
127  Scalar parameter(size_t i, Scalar const& s) {
-
128  return radius(s);
-
129  }
-
130 
-
134  Scalar radius() const {
-
135  return self->radius_;
-
136  }
-
137 
-
144  Scalar radius(Scalar const& r) {
-
145  self()->radius_ = r;
-
146  return radius();
-
147  }
-
148 
-
152  size_t dimension() const {
-
153  return self->dimension_;
-
154  }
-
155 
-
156 
- -
173  Matrix<Scalar> ret(x);
-
174  for (size_t c = 0, C = ret.cols(); c < C; c++) {
-
175  Scalar sum(0);
-
176  for (size_t i = 0; i < self->dimension_; i++) {
-
177  sum = sum + squ(ret(i, c));
-
178  }
-
179  Scalar len(sqrt(double(sum)));
-
180  for (size_t i = 0; i < self->dimension_; i++) {
-
181  ret(i, c, ret(i, c) * radius() / len);
-
182  }
-
183  }
-
184  return ret;
-
185  }
-
186 
- -
216  Scalar sum(0);
-
217  for(size_t i = 0, I = dimension(); i < I; ++i)
-
218  sum = sum + squ(x(i, 0));
-
219  Scalar len(sqrt(double(sum)));
-
220  Matrix<Scalar> ret(dimension(), dimension(), Scalar(0.0));
-
221  for(size_t i = 0, I = dimension(); i < I; ++i)
-
222  for(size_t j = 0; j < I; ++j)
-
223  if (i == j) {
-
224  ret(i, j, radius() * (squ(len) - squ(x(i, 0))) / cub(len));
-
225  }
-
226  else {
-
227  ret(i, j, radius() * (-x(i, 0) * x(j, 0) / cub(len)));
-
228  }
-
229  return ret;
-
230  }
-
231 
-
260  Matrix<Scalar> jacobian(Matrix<Scalar> const& x, size_t i) const {
-
261  Matrix<Scalar> ret(dimension(), 1, Scalar(0.0));
-
262  Scalar sum(0);
-
263  for(size_t i = 0, I = dimension(); i < I; i++) {
-
264  sum = sum + squ(x(i, 0));
-
265  }
-
266  return ret / Scalar(sqrt(double(sum)));
-
267  }
-
268 
- -
273  return copyFrom(b);
-
274  }
-
275 
- -
280  return transformate(v);
-
281  }
-
282 };
-
283 
-
284 
-
324 template<class Scalar>
-
325 class PhotoProjection: public Transformation<Scalar> {
-
326 private:
-
327  struct Myself {
-
328  Scalar focal_;
-
329  size_t dimension_;
-
330 
-
331  Myself() {
-
332  }
-
333 
-
334  Myself(size_t d, Scalar f): focal_(f), dimension_(d) {
-
335  }
-
336 
-
337  Myself(Myself const& b): focal_(b.focal_), dimension_(b.dimension_) {
-
338  }
-
339 
-
340  ~Myself() {
-
341  }
-
342  };
-
343 
-
344  Self<Myself> const self;
-
345 public:
- -
350  Transformation<Scalar>(dimension, 1, dimension, 1, 1),
-
351  self(Myself(dimension, 1)) {
-
352  }
-
353 
-
357  PhotoProjection(size_t dimension, Scalar const& f):
-
358  Transformation<Scalar>(dimension, 1, dimension, 1, 1),
-
359  self(Myself(dimension, f)) {
-
360  }
-
361 
- -
366  self(p.self, Self<Myself>::COPY_FROM) {
-
367  }
-
368 
- - -
376  self().copyFrom(b.self);
-
377  return *this;
-
378  }
-
379 
- - -
387  self().referenceFrom(b.self);
-
388  return *this;
-
389  }
-
390 
-
394  Scalar parameter(size_t i) const {
-
395  return focal();
-
396  }
-
397 
-
401  Scalar parameter(size_t i, Scalar const& s){
-
402  return focal(s);
-
403  }
-
404 
-
409  Scalar focal() const {
-
410  return self->focal_;
-
411  }
-
412 
-
419  Scalar focal(Scalar const& f){
-
420  self()->focal_ = f;
-
421  return focal();
-
422  }
-
423 
-
427  size_t dimension() const {
-
428  return self->dimension_;
-
429  }
-
430 
- -
449  Matrix<Scalar> ret(x);
-
450  for (size_t c = 0, C = ret.cols(); c < C; c++) {
-
451  for (size_t i = 0, I = dimension(); i < I; ++i) {
-
452  ret(i, c, -ret(i, c) * focal() / ret(I - 1, c));
-
453  }
-
454  }
-
455  return ret;
-
456  }
-
457 
- -
488  Matrix<Scalar> ret(dimension(), dimension(), Scalar(0.0));
-
489  for(ssize_t i = 0, I = (ssize_t)dimension() - 1; i < I; i++){
-
490  ret(i, i, -focal() / x(I, 0) );
-
491  ret(i, dimension() - 1, focal() / squ(x(I, 0)));
-
492  }
-
493  return ret;
-
494  }
-
495 
-
525  Matrix<Scalar> jacobian(Matrix<Scalar> const& x, size_t i) const{
-
526  Matrix<Scalar> ret(dimension(), 1, Scalar(0.0));
-
527  for(size_t i = 0, I = dimension(); i < I; ++i) {
-
528  ret(i, 0, -x(i, 0) / x(I - 1, 0));
-
529  }
-
530  return ret;
-
531  }
-
532 
- -
537  return copyFrom(b);
-
538  }
-
539 
- -
544  return transformate(v);
-
545  }
-
546 };
-
547 
-
548 } // meow
-
549 
-
550 #endif // Transformations_H__
-
PhotoProjection & operator=(PhotoProjection const &b)
Same as copyFrom(b)
-
Matrix< Scalar > jacobian(Matrix< Scalar > const &x) const
Return the jacobian matrix (derivate by the input vector) of this projection.
-
Scalar parameter(size_t i) const
Same as focal()
-
PhotoProjection & copyFrom(PhotoProjection const &b)
-
Matrix< Scalar > jacobian(Matrix< Scalar > const &x, size_t i) const
Return the jacobian matrix (derivate by radius) of this projection.
-
BallProjection(BallProjection const &b)
-
BallProjection & copyFrom(BallProjection const &b)
Copy settings from another one.
-
size_t cols() const
Return number of cols.
Definition: Matrix.h:134
-
PhotoProjection & referenceFrom(PhotoProjection const &b)
-
BallProjection(size_t d, Scalar const &r)
-
PhotoProjection(PhotoProjection const &p)
-
Scalar parameter(size_t i) const
same as radius()
- -
size_t dimension() const
Get the dimension of this projection.
-
BallProjection & referenceFrom(BallProjection const &b)
Reference settings from another one.
-
A ball projection is to project the given vector to a hyper-sphere.
-
Scalar focal() const
Get the focal length.
-
Matrix< Scalar > operator()(Matrix< Scalar > const &v) const
Same as transformate(v)
-
Matrix< Scalar > transformate(Matrix< Scalar > const &x) const
Project the input vector(s) onto the plane.
-
PhotoProjection(size_t dimension)
-
Scalar radius(Scalar const &r)
Setup the radius.
-
Scalar parameter(size_t i, Scalar const &s)
Same as focal(s)
-
Scalar focal(Scalar const &f)
Set the focal length.
-
Matrix< Scalar > jacobian(Matrix< Scalar > const &x) const
Return the jacobian matrix (derivate by the input vector) of this projection.
-
Matrix< Scalar > operator()(Matrix< Scalar > const &v) const
Same as transformate(v)
- -
Transformation & copyFrom(Transformation const &b)
Copy from the specified one.
-
T cub(T const &x)
x*x*x
Definition: utility.h:85
- - -
Transformation & referenceFrom(Transformation const &b)
reference from the specified one
- -
size_t dimension() const
Get the dimension of this projection.
-
Matrix< Scalar > transformate(Matrix< Scalar > const &x) const
Project the input vector(s) onto the hyper-sphere and return it.
-
A photo projection is a kind of transformation that project point/vector to a flat photo...
-
A base class for implementing kinds of transformations.
-
PhotoProjection(size_t dimension, Scalar const &f)
-
Matrix< Scalar > jacobian(Matrix< Scalar > const &x, size_t i) const
Return the jacobian matrix (derivate by the focus length) of this projection.
-
BallProjection & operator=(BallProjection const &b)
Same as copyFrom(b)
-
Scalar radius() const
Return the value of the radius.
-
T squ(T const &x)
x*x
Definition: utility.h:77
-
Scalar parameter(size_t i, Scalar const &s)
same as radius(s)
- -
-
- - - - - diff --git a/doc/html/Usage_8h.html b/doc/html/Usage_8h.html deleted file mode 100644 index f9112d0..0000000 --- a/doc/html/Usage_8h.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/Usage.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Usage.h File Reference
-
-
-
#include "utility.h"
-#include <cstdlib>
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <map>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Usage
 管理參數設置, 自訂usage document, 分析argc, argv More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Usage_8h_source.html b/doc/html/Usage_8h_source.html deleted file mode 100644 index 2519ac0..0000000 --- a/doc/html/Usage_8h_source.html +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/Usage.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Usage.h
-
-
-Go to the documentation of this file.
1 #ifndef MEOW_USAGE_H__
-
2 #define MEOW_USAGE_H__
-
3 
-
4 #include "utility.h"
-
5 
-
6 #include <cstdlib>
-
7 
-
8 #include <algorithm>
-
9 #include <string>
-
10 #include <vector>
-
11 #include <map>
-
12 
-
13 namespace meow {
-
26 class Usage {
-
27 private:
-
28  typedef std::string String;
-
29  typedef std::vector<String> Strings;
-
31  class Value {
-
32  private:
-
33  String value_;
-
34  String description_;
-
35  public:
-
36  Value() { }
-
37  Value(String const& value, String const& description) {
-
38  value_ = value;
-
39  description_ = stringReplace(description, "<value>", value);
-
40  }
-
41  String usage() const {
-
42  return stringPrintf("%8s%s : %s\n",
-
43  " ", value_.c_str(), description_.c_str());
-
44  }
-
45  String value() const {
-
46  return value_;
-
47  }
-
48  bool operator==(Value const& b) const {
-
49  return (value_ == b.value_);
-
50  }
-
51  };
-
52  typedef std::vector<Value> Values;
-
54  class Option {
-
55  private:
-
56  Strings values_;
-
57  Values values_accept_;
-
58  String value_default_;
-
59  String value_type_;
-
60  String description_;
-
61  bool has_value_;
-
62  bool has_setup_;
-
63  bool must_setup_;
-
64  public:
-
65  Option() {
-
66  }
-
67  Option(String const& description) {
-
68  has_setup_ = false;
-
69  has_value_ = false;
-
70  description_ = description;
-
71  must_setup_ = false;
-
72  }
-
73  Option(String const& description,
-
74  String const& type,
-
75  String const& default_value,
-
76  bool must) {
-
77  has_setup_ = false;
-
78  has_value_ = true;
-
79  description_ = description;
-
80  value_type_ = type;
-
81  value_default_ = default_value;
-
82  must_setup_ = must;
-
83  }
-
84  Strings const& values() const {
-
85  return values_;
-
86  }
-
87  String value(size_t index) const {
-
88  if (!has_value_) return "";
-
89  if (!has_setup_ || index >= values_.size()) return value_default_;
-
90  return values_[index];
-
91  }
-
92  ssize_t valueAdd(String const& value) {
-
93  if (!has_value_) {
-
94  has_setup_ = true;
-
95  return 0;
-
96  }
-
97  if (values_accept_.size() > 0 &&
-
98  std::find(values_accept_.begin(), values_accept_.end(),
-
99  Value(value, "")) == values_accept_.end())
-
100  return -1;
-
101  values_.push_back(value);
-
102  has_setup_ = true;
-
103  return values_.size() - 1;
-
104  }
-
105  bool valueAcceptAdd(String const& value, String const& description) {
-
106  if (!has_value_) return false;
-
107  if (std::find(values_accept_.begin(), values_accept_.end(),
-
108  Value(value, "")) == values_accept_.end()) {
-
109  values_accept_.push_back(Value(value, description));
-
110  }
-
111  return true;
-
112  }
-
113  bool valueAcceptChk(String const& value) {
-
114  if (!has_value_) return false;
-
115  return (values_accept_.empty() ||
-
116  std::find(values_accept_.begin(), values_accept_.end(),
-
117  Value(value, "")) != values_accept_.end());
-
118  }
-
119  bool hasSetup() const{ return has_setup_; }
-
120  bool hasValue() const{ return has_value_; }
-
121  bool chkSetup() const{ return !(must_setup_ && !has_setup_); }
-
122 
-
123  String usage(String opt, bool detail) const {
-
124  String ret(stringPrintf("%s%s ", (opt.size()>1 ? "--":"-"), opt.c_str()));
-
125  if (!detail) {
-
126  if (has_value_) ret += value_type_;
-
127  if (!must_setup_) ret = "[" + ret + "]";
-
128  }
-
129  else {
-
130  if (has_value_) {
-
131  ret += value_type_ + " ";
-
132  String default_string("");
-
133  if (value_default_ != "")
-
134  default_string = "defalut='" + value_default_ + "'";
-
135  String optional_string("");
-
136  if (!must_setup_)
-
137  optional_string = "optional";
-
138  String tmp;
-
139  if (default_string.size() + optional_string.size() > 0) {
-
140  if (default_string.size() > 0 && optional_string.size() > 0) {
-
141  ret += "(" + optional_string + ", " + default_string + ")";
-
142  }
-
143  else {
-
144  ret += "(" + optional_string + default_string + ")";
-
145  }
-
146  }
-
147  }
-
148  ret += "\n";
-
149  String accept_string;
-
150  for (size_t i = 0; i < values_accept_.size(); i++) {
-
151  if (i > 0)
-
152  accept_string += (i + 1 < values_accept_.size() ? ", " : " or ");
-
153  accept_string += "'" + values_accept_[i].value() + "'";
-
154  }
-
155  if (accept_string.size() == 0) accept_string = "... (anything)";
-
156  ret += " " + stringReplace(stringReplace(description_,
-
157  "<type>",
-
158  value_type_),
-
159  "<values>",
-
160  accept_string) + "\n";
-
161  for (size_t i = 0; i < values_accept_.size(); i++) {
-
162  ret += values_accept_[i].usage();
-
163  }
-
164  ret += "\n";
-
165  }
-
166  return ret;
-
167  }
-
168  };
-
169  typedef std::map<String, Option> Options;
-
170  typedef Options:: iterator OptionsIterator;
-
171  typedef Options::const_iterator OptionsIteratorK;
-
172 
-
173  String name_;
-
174  Options options_;
-
175  Strings usage_begin_;
-
176  Strings usage_end_;
-
177  Strings proc_arguments_;
-
178 public:
-
184  Usage() {
-
185  }
-
186 
-
192  Usage(String const& name) {
-
193  name_ = name;
-
194  }
-
195 
-
196 
-
202  Usage(Usage const& usage) {
-
203  name_ = usage.name_;
-
204  options_ = usage.options_;
-
205  usage_begin_ = usage.usage_begin_;
-
206  usage_end_ = usage.usage_end_;
-
207  proc_arguments_ = usage.proc_arguments_;
-
208  }
-
209 
-
216  bool import(Usage const& usage) {
-
217  for (OptionsIteratorK
-
218  it = usage.options_.begin(); it != usage.options_.end(); ++it) {
-
219  if (options_.find(it->first) != options_.end())
-
220  return false;
-
221  }
-
222  for (OptionsIteratorK
-
223  it = usage.options_.begin(); it != usage.options_.end(); ++it) {
-
224  options_.insert(std::pair<String, Option>(it->first, it->second));
-
225  }
-
226  for (size_t i = 0; i < usage.usage_begin_.size(); ++i)
-
227  usage_begin_.push_back(usage.usage_begin_[i]);
-
228  for (size_t i = 0; i < usage.usage_end_.size(); ++i)
-
229  usage_end_.push_back(usage.usage_end_[i]);
-
230  return true;
-
231  }
-
232 
-
239  bool update(Usage const& usage) {
-
240  for (OptionsIteratorK
-
241  it = usage.options_.begin(); it != usage.options_.end(); ++it) {
-
242  OptionsIterator my = options_.find(it->first);
-
243  if (my == options_.end()) continue;
-
244  for (size_t i = 0, I = it->second.values().size(); i < I; ++i) {
-
245  my->second.valueAdd(it->second.value(i));
-
246  }
-
247  }
-
248  return true;
-
249  }
-
250 
-
258  bool optionAdd(String opt, String const& des) {
-
259  if (options_.find(opt) != options_.end()) return false;
-
260  options_.insert(std::pair<String, Option>(opt, Option(des)));
-
261  return true;
-
262  }
-
263 
-
274  bool optionAdd(String opt, String const& des,
-
275  String const& val_type,
-
276  String const& val_default,
-
277  bool must) {
-
278  if (options_.find(opt) != options_.end()) return false;
-
279  options_.insert(std::pair<String, Option>(
-
280  opt, Option(des, val_type, val_default, must)));
-
281  return true;
-
282  }
-
283 
-
292  bool optionValueAcceptAdd(String opt, String const& val, String const& des) {
-
293  OptionsIterator o = options_.find(opt);
-
294  if (o == options_.end()) return false;
-
295  return o->second.valueAcceptAdd(val, des);
-
296  }
-
297 
-
304  bool hasOptionSetup(String opt) const {
-
305  OptionsIteratorK o = options_.find(opt);
-
306  return (o != options_.end() && o->second.hasSetup());
-
307  }
-
308 
-
315  size_t optionValuesSize(String opt) const {
-
316  OptionsIteratorK o = options_.find(opt);
-
317  if (o == options_.end()) return 0;
-
318  return o->second.values().size();
-
319  }
-
320 
-
328  String optionValue(String opt, size_t index) const {
-
329  OptionsIteratorK o = options_.find(opt);
-
330  if (o == options_.end()) return String();
-
331  return o->second.value(index);
-
332  }
-
333 
-
339  size_t procArgsSize() const {
-
340  return proc_arguments_.size();
-
341  }
-
342 
-
349  String procArg(size_t index) const {
-
350  if (index >= proc_arguments_.size()) {
-
351  return String();
-
352  }
-
353  return proc_arguments_[index];
-
354  }
-
355 
-
361  Strings const& procArgs() const{
-
362  return proc_arguments_;
-
363  }
-
364 
-
370  void usageBeginAdd(String const& des) {
-
371  usage_begin_.push_back(stringReplace(des, "<name>", name_));
-
372  }
-
373 
-
379  void usageEndAdd(String const& des) {
-
380  usage_end_.push_back(stringReplace(des, "<name>", name_));
-
381  }
-
382 
-
388  String usage() const {
-
389  Usage::String out = stringPrintf("USAGE\n %s", name_.c_str());
-
390  for (OptionsIteratorK
-
391  it = options_.begin(); it != options_.end(); ++it)
-
392  out += " " + it->second.usage(it->first, false);
-
393  out += "\n\nDESCRIPTION\n";
-
394  for (size_t i = 0; i < usage_begin_.size(); ++i) {
-
395  out += " " + usage_begin_[i] + "\n\n";
-
396  }
-
397  for (OptionsIteratorK
-
398  it = options_.begin(); it != options_.end(); ++it) {
-
399  out += it->second.usage(it->first, true);
-
400  }
-
401  for (size_t i = 0; i < usage_end_.size(); ++i) {
-
402  out += " " + usage_end_[i] + "\n\n";
-
403  }
-
404  return out;
-
405  }
-
406 
-
414  bool arguments(int argc, char** argv, String* errmsg) {
-
415  String zzz;
-
416  String& err = (errmsg == NULL ? zzz : *errmsg);
-
417  for (int i = 0; i < argc; ++i) {
-
418  if (argv[i][0] == '-') {
-
419  String opt;
-
420  if (argv[i][1] == '-') { // long option
-
421  if (argv[i][2] == '\0' || argv[i][3] == '\0') {
-
422  err = stringPrintf("Invalid option '%s'", argv[i]);
-
423  return false;
-
424  }
-
425  opt = String(argv[i] + 2);
-
426  }
-
427  else { // short option
-
428  if (argv[i][1] == '\0' || argv[i][2] != '\0') {
-
429  err = stringPrintf("Invalid option '%s'", argv[i]);
-
430  return false;
-
431  }
-
432  opt = String(argv[i] + 1);
-
433  }
-
434  OptionsIterator o = options_.find(opt);
-
435  if (o == options_.end()) {
-
436  err = stringPrintf("Unknown option '%s'", argv[i]);
-
437  return false;
-
438  }
-
439  if (o->second.hasValue()) {
-
440  if (i + 1 >= argc) {
-
441  err = stringPrintf("Option '%s' need a value", argv[i]);
-
442  return false;
-
443  }
-
444  if (o->second.valueAdd(argv[i + 1]) < 0) {
-
445  err = stringPrintf("Invalid value '%s' of options '%s'",
-
446  argv[i + 1], argv[i]);
-
447  return false;
-
448  }
-
449  ++i;
-
450  }
-
451  else {
-
452  o->second.valueAdd("");
-
453  }
-
454  }
-
455  else {
-
456  if (i == 0) {
-
457  // TODO: remember who am I
-
458  }
-
459  else {
-
460  proc_arguments_.push_back(String(argv[i] + (argv[i][0]=='\\' ? 1:0)));
-
461  }
-
462  }
-
463  }
-
464  for (OptionsIteratorK it = options_.begin(); it != options_.end(); ++it) {
-
465  if (it->second.chkSetup() == false) {
-
466  err += stringPrintf("No specify argument to '%s%s'\n",
-
467  (it->first.size() > 1 ? "--" : "-"),
-
468  it->first.c_str());
-
469  return false;
-
470  }
-
471  }
-
472  return true;
-
473  }
-
474 };
-
475 
-
476 } // meow
-
477 
-
478 #endif // MEOW_USAGE_H__
-
bool optionAdd(String opt, String const &des)
新增一個沒有額外選項的選項
Definition: Usage.h:258
-
bool arguments(int argc, char **argv, String *errmsg)
給定argc, argv, 將各參數設置
Definition: Usage.h:414
-
size_t procArgsSize() const
取得有幾個process arguments
Definition: Usage.h:339
-
String procArg(size_t index) const
取得第i個process argument
Definition: Usage.h:349
-
size_t optionValuesSize(String opt) const
回傳參數 -(opt) 被設置幾次
Definition: Usage.h:315
-
void usageBeginAdd(String const &des)
新增一段usage document於每個選項逐條說明之前
Definition: Usage.h:370
-
Strings const & procArgs() const
取得process arguments array
Definition: Usage.h:361
-
bool optionValueAcceptAdd(String opt, String const &val, String const &des)
針對-(opt)新增一個可接受的額外選項
Definition: Usage.h:292
-
bool hasOptionSetup(String opt) const
回傳是否有設定此選項
Definition: Usage.h:304
-
Usage(String const &name)
constructor
Definition: Usage.h:192
-
String usage() const
回傳usage string
Definition: Usage.h:388
-
Usage()
constructor
Definition: Usage.h:184
-
Usage(Usage const &usage)
constructor
Definition: Usage.h:202
-
std::string stringReplace(std::string str, std::string const &from, std::string const &to)
將輸入字串中的某個pattern取代成另一個pattern
Definition: utility.h:61
-
管理參數設置, 自訂usage document, 分析argc, argv
Definition: Usage.h:26
- -
void usageEndAdd(String const &des)
新增一段usage document於每個選項逐條說明之後
Definition: Usage.h:379
-
bool optionAdd(String opt, String const &des, String const &val_type, String const &val_default, bool must)
新增一個有額外選項的選項
Definition: Usage.h:274
-
bool update(Usage const &usage)
將另一個usage的選項設置加進來
Definition: Usage.h:239
-
String optionValue(String opt, size_t index) const
回傳參數 -(opt) 的第 index 個額外選項
Definition: Usage.h:328
-
std::string stringPrintf(char const *fmt,...)
類似C的printf, 不過是將格式化的字串丟到 std::string 裡回傳
Definition: utility.h:43
-
-
- - - - - diff --git a/doc/html/Usage_8hpp.html b/doc/html/Usage_8hpp.html deleted file mode 100644 index b51f613..0000000 --- a/doc/html/Usage_8hpp.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/Usage.hpp File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template which is unable and also not allowed to compile to obj-file first.
-
-
- - -
-
- -
-
-
- -
-
- -
-
Usage.hpp File Reference
-
-
-
#include <string>
-#include <cstdint>
-#include <vector>
-#include <map>
-#include <algorithm>
-#include <cstdlib>
-#include "utility.h"
-#include <unistd.h>
-
-

Go to the source code of this file.

- - - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Usage_8hpp_source.html b/doc/html/Usage_8hpp_source.html deleted file mode 100644 index a38a080..0000000 --- a/doc/html/Usage_8hpp_source.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/Usage.hpp Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template which is unable and also not allowed to compile to obj-file first.
-
-
- - -
-
- -
-
-
- -
-
-
-
Usage.hpp
-
-
-Go to the documentation of this file.
1 #include <string>
-
2 #include <cstdint>
-
3 #include <vector>
-
4 #include <map>
-
5 #include <algorithm>
-
6 #include <cstdlib>
-
7 
-
8 #include "utility.h"
-
9 
-
10 extern "C"{
-
11 #include <unistd.h>
-
12 }
-
13 
-
14 namespace meow{
-
15  inline Usage::Usage(){ name = "nobody"; }
-
16  inline Usage::Usage(std::string const& _name){ name = _name; }
-
17  inline bool Usage::import(Usage const& usage){
-
18  OptionsIterator it;
-
19  for(it = usage.options.begin(); it != usage.options.end(); it++){
-
20  unsigned char const& chr = it->first;
-
21  Option const& opt = it->second;
-
22  if(options.find(chr) == options.end()){
-
23  options[chr] = opt;
-
24  }else{
-
25  return false;
-
26  }
-
27  }
-
28  for(size_t i = 0; i < usage.usage_begin.size(); i++){
-
29  usage_begin.push_back(usage.usage_begin[i]);
-
30  }
-
31  for(size_t i = 0; i < usage.usage_end.size(); i++){
-
32  usage_end.push_back(usage.usage_end[i]);
-
33  }
-
34  return true;
-
35  }
-
36  inline bool Usage::update(Usage const& usage){
-
37  OptionsIterator it;
-
38  for(it = usage.options.begin(); it != usage.options.end(); it++){
-
39  unsigned char const& chr = it->first;
-
40  if(options.find(chr) == options.end()){
-
41  continue;
-
42  }
-
43  options[chr] = it->second;
-
44  }
-
45  return true;
-
46  }
-
47  inline bool Usage::addOption(unsigned char opt, std::string const& des){
-
48  if(options.find(opt) != options.end()){
-
49  return false;
-
50  }
-
51  options[opt] = Option(des);
-
52  return true;
-
53  }
-
54  inline bool Usage::addOption(unsigned char opt, std::string const& des,
-
55  std::string const& val_type,
-
56  std::string const& val_default,
-
57  bool must){
-
58  if(options.find(opt) != options.end()){
-
59  return false;
-
60  }
-
61  options[opt] = Option(des, val_type, val_default, must);
-
62  return true;
-
63  }
-
64  inline bool Usage::addOptionValueAccept(unsigned char opt,
-
65  std::string const& val,
-
66  std::string const& des){
-
67  if(options.find(opt) == options.end()){
-
68  return false;
-
69  }
-
70  return options[opt].addValueAccept(val, des);
-
71  }
-
72  inline bool Usage::hasOptionSetup(unsigned char opt) const {
-
73  return (options.find(opt) != options.end() &&
-
74  options.find(opt)->second.hasSetup());
-
75  }
-
76  inline size_t Usage::getOptionValuesCount(unsigned char opt) const {
-
77  if(options.find(opt) == options.end()){
-
78  return 0;
-
79  }
-
80  return options.find(opt)->second.getValuesCount();
-
81  }
-
82  inline std::string Usage::getOptionValue(unsigned char opt,
-
83  size_t index) const {
-
84  if(options.find(opt) == options.end()){
-
85  return std::string();
-
86  }
-
87  return options.find(opt)->second.getValue(index);
-
88  }
-
89  inline size_t Usage::getProcArgsCount()const{return proc_arguments.size();}
-
90  inline std::string Usage::getProcArg(size_t index) const {
-
91  if(index >= proc_arguments.size()){
-
92  return std::string();
-
93  }
-
94  return proc_arguments[index];
-
95  }
-
96  inline std::vector<std::string> Usage::getProcArgs() const {
-
97  return proc_arguments;
-
98  }
-
99  inline void Usage::addUsageBegin(std::string const& des){
-
100  usage_begin.push_back(stringReplace(des, "<name>", name));
-
101  }
-
102  inline void Usage::addUsageEnd(std::string const& des){
-
103  usage_end.push_back(stringReplace(des, "<name>", name));
-
104  }
-
105  inline std::string Usage::getUsage() const {
-
106  std::string out = stringPrintf("USAGE\n %s", name.c_str());
-
107  OptionsIterator it;
-
108  for(it = options.begin(); it != options.end(); it++){
-
109  out += " " + it->second.getUsage(it->first, false);
-
110  }
-
111  out += "\n\nDESCRIPTION\n";
-
112  for(size_t i = 0; i < usage_begin.size(); i++){
-
113  out += " " + usage_begin[i] + "\n\n";
-
114  }
-
115  for(it = options.begin(); it != options.end(); it++){
-
116  out += it->second.getUsage(it->first, true);
-
117  }
-
118  for(size_t i = 0; i < usage_end.size(); i++){
-
119  out += " " + usage_end[i] + "\n\n";
-
120  }
-
121  return out;
-
122  }
-
123  inline bool Usage::setArguments(int argc, char** argv, std::string *errmsg){
-
124  opterr = 0;
-
125  std::string s;
-
126  OptionsIterator it;
-
127  std::string zzz;
-
128  std::string& err = (errmsg == NULL ? zzz : *errmsg);
-
129  for(it = options.begin(); it != options.end(); it++){
-
130  s += (char)(it->first);
-
131  if(it->second.hasValue()){
-
132  s += ":";
-
133  }
-
134  }
-
135  for(int opt; (opt = getopt(argc, argv, s.c_str())) != -1; ){
-
136  if(options.find(opt) == options.end()){
-
137  if(options.find(optopt) == options.end()){
-
138  err += stringPrintf("Unknown option '-%c'\n", optopt);
-
139  }else{
-
140  err += stringPrintf("No specify argument to '-%c'\n",
-
141  optopt);
-
142  }
-
143  opt = optopt;
-
144  return false;
-
145  }
-
146  if(options[opt].setValue(optarg == NULL ? "" : optarg) == false){
-
147  err += stringPrintf(
-
148  "Option argument '%s' to '-%c' is not allowed\n"
-
149  , optarg, opt);
-
150  return false;
-
151  }
-
152  }
-
153  for(it = options.begin(); it != options.end(); it++){
-
154  if(it->second.chkSetup() == false){
-
155  err += stringPrintf("No specify argument to '-%c'\n",
-
156  it->first);
-
157  return false;
-
158  }
-
159  }
-
160  for(int i = optind; i < argc; i++){
-
161  proc_arguments.push_back(std::string(argv[i]));
-
162  }
-
163  return true;
-
164  }
-
165  //
-
166  inline Usage::Value::Value(){ }
-
167  inline Usage::Value::Value(std::string const& v){
-
168  value = v;
-
169  description = "";
-
170  }
-
171  inline Usage::Value::Value(std::string const& v, std::string const& d){
-
172  value = v;
-
173  description = stringReplace(d, "<value>", v);
-
174  }
-
175  inline std::string Usage::Value::getUsage() const {
-
176  if(description.length() > 0)
-
177  return stringPrintf("%8s%s : %s\n",
-
178  " ", value.c_str(), description.c_str());
-
179  else
-
180  return "";
-
181  }
-
182  inline std::string Usage::Value::getValue() const { return value; }
-
183  inline bool Usage::Value::operator==(Value const& b) const {
-
184  return (value == b.value);
-
185  }
-
186  //
-
187  inline Usage::Option::Option(){ }
-
188  inline Usage::Option::Option(std::string const& des){
-
189  has_setup = false;
-
190  has_value = false;
-
191  description = des;
-
192  must_setup = false;
-
193  }
-
194  inline Usage::Option::Option(std::string const& des,
-
195  std::string const& typ,
-
196  std::string const& def,
-
197  bool must){
-
198  has_setup = false;
-
199  has_value = true;
-
200  description = des;
-
201  value_type = typ;
-
202  value_default = def;
-
203  must_setup = must;
-
204  }
-
205  inline bool Usage::Option::setValue(std::string const& str){
-
206  if(has_value){
-
207  if(values_accept.size() > 0 &&
-
208  std::find(values_accept.begin(), values_accept.end(),
-
209  Value(str, "")) == values_accept.end()){
-
210  return false;
-
211  }
-
212  values.push_back(str);
-
213  }
-
214  has_setup = true;
-
215  return true;
-
216  }
-
217  inline size_t Usage::Option::getValuesCount()const{return values.size();}
-
218  inline std::string Usage::Option::getValue(size_t index) const{
-
219  if(!has_value){
-
220  return "";
-
221  }
-
222  if(!has_setup || index >= values.size()){
-
223  return value_default;
-
224  }
-
225  return values[index];
-
226  }
-
227  inline bool Usage::Option::addValueAccept(std::string const& val,
-
228  std::string const& des){
-
229  if(!has_value){
-
230  return false;
-
231  }
-
232  if(std::find(values_accept.begin(), values_accept.end(), Value(val))
-
233  == values_accept.end()){
-
234  values_accept.push_back(Value(val, des));
-
235  }
-
236  return true;
-
237  }
-
238  inline bool Usage::Option::hasSetup() const { return has_setup; }
-
239  inline bool Usage::Option::hasValue() const { return has_value; }
-
240  inline bool Usage::Option::chkSetup() const {
-
241  return !(must_setup && !has_setup);
-
242  }
-
243  inline std::string Usage::Option::getUsage(unsigned char opt,
-
244  bool detail) const {
-
245  std::string ret;
-
246  if(!detail){
-
247  if(!has_value){
-
248  ret = stringPrintf("-%c", opt);
-
249  }else{
-
250  ret = stringPrintf("-%c %s", opt, value_type.c_str());
-
251  }
-
252  if(!must_setup){
-
253  ret = stringPrintf("[%s]", ret.c_str());
-
254  }
-
255  }else{
-
256  std::string tmp;
-
257  if(has_value){
-
258  std::string tmp2;
-
259  if(value_default != ""){
-
260  tmp2=stringPrintf("defuault='%s'",value_default.c_str());
-
261  }
-
262  std::string tmp3 = must_setup ? "" : "optional";
-
263  if(tmp2.length() + tmp3.length() > 0){
-
264  if(tmp2.length() > 0 && tmp3.length() > 0){
-
265  tmp = "(" + tmp3 + ", " + tmp2 + ")";
-
266  }else{
-
267  tmp = "(" + tmp3 + tmp2 + ")";
-
268  }
-
269  }
-
270  tmp = value_type + " " + tmp;
-
271  }
-
272  ret = stringPrintf(" -%c %s\n", opt, tmp.c_str());
-
273  tmp = stringReplace(description, "<type>", value_type);
-
274  std::string vs;
-
275  for(size_t i = 0; i < values_accept.size(); i++){
-
276  if(i > 0){
-
277  vs += (i + 1 < values_accept.size() ? ", " : " or ");
-
278  }
-
279  vs += "'" + values_accept[i].getValue() + "'";
-
280  }
-
281  if(vs.length() == 0){
-
282  vs = "... (anything)";
-
283  }
-
284  tmp = stringReplace(tmp, "<values>", vs);
-
285  ret += " " + tmp + "\n";
-
286  for(size_t i = 0; i < values_accept.size(); i++){
-
287  ret += values_accept[i].getUsage();
-
288  }
-
289  ret += "\n";
-
290  }
-
291  return ret;
-
292  }
-
293 }
-
294 
-
bool import(Usage const &usage)
將另一個usage的設置匯入
Definition: Usage.h:216
-
bool hasOptionSetup(String opt) const
回傳是否有設定此選項
Definition: Usage.h:304
-
Usage()
constructor
Definition: Usage.h:184
-
std::string stringReplace(std::string str, std::string const &from, std::string const &to)
將輸入字串中的某個pattern取代成另一個pattern
Definition: utility.h:60
- -
bool update(Usage const &usage)
將另一個usage的選項設置加進來
Definition: Usage.h:239
-
std::string stringPrintf(char const *fmt,...)
類似C的printf, 不過是將格式化的字串丟到 std::string 裡回傳
Definition: utility.h:42
-
-
- - - - - diff --git a/doc/html/VP__Tree_8h.html b/doc/html/VP__Tree_8h.html deleted file mode 100644 index 595e511..0000000 --- a/doc/html/VP__Tree_8h.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/VP_Tree.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
VP_Tree.h File Reference
-
-
-
#include "../math/utility.h"
-#include <cstdlib>
-#include <list>
-#include <vector>
-#include <stack>
-#include <queue>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::VP_Tree< Vector, Scalar >
 跟KD_Tree很像歐 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/VP__Tree_8h_source.html b/doc/html/VP__Tree_8h_source.html deleted file mode 100644 index 7c1479f..0000000 --- a/doc/html/VP__Tree_8h_source.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/dsa/VP_Tree.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
VP_Tree.h
-
-
-Go to the documentation of this file.
1 #ifndef dsa_VP_Tree_H__
-
2 #define dsa_VP_Tree_H__
-
3 
-
4 #include "../math/utility.h"
-
5 
-
6 #include <cstdlib>
-
7 
-
8 #include <list>
-
9 #include <vector>
-
10 #include <stack>
-
11 #include <queue>
-
12 
-
13 namespace meow {
-
14 
-
50 template<class Vector, class Scalar>
-
51 class VP_Tree {
-
52 public:
-
53  typedef std::vector<Vector> Vectors;
-
54 private:
-
55  struct Node {
-
56  size_t index_;
-
57  Scalar threshold_;
-
58  Node* nearChild_;
-
59  Node* farChild_;
-
60  //
-
61  Node(size_t index): index_(index), nearChild_(NULL), farChild_(NULL){
-
62  }
-
63  };
-
64  struct Answer {
-
65  size_t index_;
-
66  Scalar dist2_;
-
67  //
-
68  Answer(size_t index, Scalar const& dist2): index_(index), dist2_(dist2){
-
69  }
-
70  Answer(Answer const& answer2):
-
71  index_(answer2.index_), dist2_(answer2.dist2_){
-
72  }
-
73  };
-
74  class AnswerCompare {
-
75  private:
-
76  Vectors const* vectors_;
-
77  bool cmpValue_;
-
78  public:
-
79  AnswerCompare(Vectors const* vectors, bool cmpValue):
-
80  vectors_(vectors), cmpValue_(cmpValue){
-
81  }
-
82  bool operator()(Answer const& a, Answer const& b) const {
-
83  if (a.dist2_ < b.dist2_) return true;
-
84  if (b.dist2_ < a.dist2_) return false;
-
85  return (cmpValue_ && ((*vectors_)[a.index_] < (*vectors_)[b.index_]));
-
86  }
-
87  };
-
88  typedef std::vector<Answer> AnswerV;
-
89  typedef std::priority_queue<Answer, AnswerV, AnswerCompare> Answers;
-
90 
-
91  Vectors vectors_;
-
92  Node* root_;
-
93  size_t dimension_;
-
94  bool needRebuild_;
-
95 
-
96  Scalar distance2(Vector const& v1, Vector const& v2) const {
-
97  Scalar ret(0);
-
98  for (size_t i = 0; i < dimension_; i++) ret += squ(v1[i] - v2[i]);
-
99  return ret;
-
100  }
-
101  int distanceCompare(Scalar const& a2, Scalar const& b2,
-
102  Scalar const& c2) const {
-
103  if (b2 < 0) {
-
104  return -distanceCompare(c2, -b2, a2);
-
105  }
-
106  Scalar cab(c2 - a2 - b2);
-
107  if (cab < Scalar(0)) return 1;
-
108  Scalar ab2(Scalar(4) * a2 * b2), cab2(squ(cab));
-
109  if ( ab2 < cab2) return -1;
-
110  else if (cab2 < ab2) return 1;
-
111  else return 0;
-
112  }
-
113  Scalar split(ssize_t first, ssize_t last, size_t order,
-
114  Vector const& center) {
-
115  ssize_t first0 = first;
-
116  std::vector<Scalar> dist2(last - first + 1);
-
117  for (ssize_t i = first; i <= last; i++) {
-
118  dist2[i - first0] = distance2(vectors_[i], center);
-
119  }
-
120  while (first < last) {
-
121  size_t thresholdindex_ = first + rand() % (last - first + 1);
-
122  Scalar threshold(dist2[thresholdindex_ - first0]);
-
123  size_t large_first = last + 1;
-
124  for( ssize_t i=first; first<=(ssize_t)large_first-1; large_first--) {
-
125  if (threshold < dist2[large_first - 1 - first0]) continue;
-
126  while (i < (ssize_t)large_first-1&&!(threshold < dist2[i-first0])) i++;
-
127  if (i < (ssize_t)large_first - 1){
-
128  std::swap(dist2 [large_first - 1 - first0], dist2 [i - first0]);
-
129  std::swap(vectors_[large_first - 1 ], vectors_[i ]);
-
130  i++;
-
131  }
-
132  else {
-
133  break;
-
134  }
-
135  }
-
136  if (large_first == (size_t)last + 1) {
-
137  std::swap(dist2 [thresholdindex_-first0], dist2 [last-first0]);
-
138  std::swap(vectors_[thresholdindex_ ], vectors_[last ]);
-
139  if ((ssize_t)order == last - first) {
-
140  first = last;
-
141  break;
-
142  }
-
143  last--;
-
144  }
-
145  else {
-
146  if (order < large_first - first) {
-
147  last = large_first - 1;
-
148  }
-
149  else {
-
150  order -= large_first - first;
-
151  first = large_first;
-
152  }
-
153  }
-
154  }
-
155  return dist2[first - first0];
-
156  }
-
157  //
-
158  Node* build(ssize_t first, ssize_t last) {
-
159  if (first > last) return NULL;
-
160  Node* ret = new Node(first);
-
161  if (first < last) {
-
162  std::swap(vectors_[first],
-
163  vectors_[first + rand() % (last - first + 1)]);
-
164  ssize_t mid = (first + 1 + last + 1) / 2;
-
165  ret->threshold_ = split(first + 1, last, mid - (first + 1),
-
166  vectors_[first]);
-
167  ret->nearChild_ = build(first + 1, mid - 1 );
-
168  ret->farChild_ = build( mid , last);
-
169  }
-
170  return ret;
-
171  }
-
172  void query(Vector const& vector,
-
173  size_t k,
-
174  AnswerCompare const& cmp,
-
175  Node const* node,
-
176  Answers* out) const {
-
177  if (node == NULL) return ;
-
178  Scalar dist2 = distance2(vector, vectors_[node->index_]);
-
179  Answer my_ans(node->index_, dist2);
-
180  if (out->size() < k || cmp(my_ans, out->top())) {
-
181  out->push(my_ans);
-
182  if (out->size() > k) {
-
183  out->pop();
-
184  }
-
185  }
-
186  if (node->nearChild_ == NULL && node->farChild_ == NULL) return ;
-
187  if (out->size() < k || distanceCompare(dist2, -out->top().dist2_,
-
188  node->threshold_) <= 0) {
-
189  query(vector, k, cmp, node->nearChild_, out);
-
190  }
-
191  if (out->size() < k || distanceCompare(dist2, out->top().dist2_,
-
192  node->threshold_) >= 0) {
-
193  query(vector, k, cmp, node->farChild_, out);
-
194  }
-
195  }
-
196  void clear(Node* root) {
-
197  if(root == NULL) return ;
-
198  clear(root->nearChild_);
-
199  clear(root->farChild_);
-
200  delete root;
-
201  }
-
202  Node* dup(Node* root) {
-
203  if(root == NULL) return ;
-
204  Node* ret = new Node(root->index_);
-
205  ret->threshold_ = root->threshold_;
-
206  ret->nearChild_ = dup(root->nearChild_);
-
207  ret->farChild_ = dup(root->farChild_ );
-
208  return ret;
-
209  }
-
210 public:
-
212  VP_Tree(): root_(NULL), vectors_(0), dimension_(1), needRebuild_(false){
-
213  reset(0);
-
214  }
-
215 
-
217  VP_Tree(VP_Tree const& tree2):
-
218  vectors_(tree2.vectors_),
-
219  root_(dup(tree2.root_)),
-
220  dimension_(tree2.dimension_),
-
221  needRebuild_(tree2.needRebuild_) {
-
222  }
-
223 
-
225  VP_Tree(size_t dimension):
-
226  vectors_(0),
-
227  root_(NULL),
-
228  dimension_(0),
-
229  needRebuild_(false) {
-
230  reset(dimension);
-
231  }
-
232 
- -
235  clear(root_);
-
236  }
-
237 
-
241  VP_Tree& copyFrom(VP_Tree const& tree2) {
-
242  reset(tree2.dimension_);
-
243  vectors_ = tree2.vectors_;
-
244  root_ = dup(tree2.root_);
-
245  needRebuild_ = tree2.needRebuild_;
-
246  return *this;
-
247  }
-
248 
-
252  void insert(Vector const& vector) {
-
253  vectors_.push_back(vector);
-
254  needRebuild_ = true;
-
255  }
-
256 
-
260  bool erase (Vector const& vector) {
-
261  for (ssize_t i = 0, I = vectors_.size(); i < I; i++) {
-
262  if (vectors_[i] == vector) {
-
263  if (i != I - 1) std::swap(vectors_[i], vectors_[I - 1]);
-
264  needRebuild_ = true;
-
265  vectors_.pop_back();
-
266  return true;
-
267  }
-
268  }
-
269  return false;
-
270  }
-
271 
-
275  void build() {
-
276  if (needRebuild_) {
-
277  forceBuild();
-
278  }
-
279  }
-
280 
-
284  void forceBuild() {
-
285  root_ = build(0, (size_t)vectors_.size() - 1);
-
286  needRebuild_ = false;
-
287  }
-
288 
-
296  Vectors query(Vector const& vector,
-
297  size_t nearestNumber,
-
298  bool compareWholeVector) const {
-
299  ((VP_Tree*)this)->build();
-
300  AnswerCompare cmp(&vectors_, compareWholeVector);
-
301  Answers answers(cmp);
-
302  query(vector, nearestNumber, cmp, root_, &answers);
-
303  std::stack<Answer> rev;
-
304  for ( ; !answers.empty(); answers.pop()) rev.push(answers.top());
-
305  Vectors ret;
-
306  for ( ; !rev.empty(); rev.pop()) ret.push_back(vectors_[rev.top().index_]);
-
307  return ret;
-
308  }
-
309 
-
313  void clear() {
-
314  clear(root_);
-
315  vectors_.clear();
-
316  root_ = NULL;
-
317  needRebuild_ = false;
-
318  }
-
319 
-
323  size_t reset(size_t dimension) {
-
324  clear();
-
325  dimension_ = std::max((size_t)1, dimension);
-
326  return dimension_;
-
327  }
-
328 
-
330  VP_Tree& operator=(VP_Tree const& tree2) {
-
331  return copyFrom(tree2);
-
332  }
-
333 };
-
334 
-
335 } // meow
-
336 
-
337 #endif // dsa_VP_Tree_H__
-
VP_Tree()
constructor, with dimension = 1
Definition: VP_Tree.h:212
-
void clear()
清空所有資料
Definition: VP_Tree.h:313
-
void insert(Vector const &vector)
將給定的Vector加到set中
Definition: VP_Tree.h:252
-
VP_Tree & operator=(VP_Tree const &tree2)
same as copyFrom(tree2)
Definition: VP_Tree.h:330
-
VP_Tree & copyFrom(VP_Tree const &tree2)
複製資料
Definition: VP_Tree.h:241
-
~VP_Tree()
destructor
Definition: VP_Tree.h:234
-
std::vector< Vector > Vectors
Definition: VP_Tree.h:53
-
VP_Tree(VP_Tree const &tree2)
constructor, 複製資料
Definition: VP_Tree.h:217
-
void build()
檢查至今是否有 insert/erase 被呼叫來決定是否 rebuild()
Definition: VP_Tree.h:275
-
vector
Definition: Vector.h:19
-
跟KD_Tree很像歐
Definition: VP_Tree.h:51
-
size_t reset(size_t dimension)
清空所有資料並重新給定維度
Definition: VP_Tree.h:323
-
VP_Tree(size_t dimension)
constructor, 給定dimension
Definition: VP_Tree.h:225
-
void forceBuild()
重新建樹
Definition: VP_Tree.h:284
-
Vectors query(Vector const &vector, size_t nearestNumber, bool compareWholeVector) const
查找
Definition: VP_Tree.h:296
-
bool erase(Vector const &vector)
將給定的Vector從set移除
Definition: VP_Tree.h:260
-
T squ(T const &x)
x*x
Definition: utility.h:77
-
-
- - - - - diff --git a/doc/html/Vector_8h.html b/doc/html/Vector_8h.html deleted file mode 100644 index 71c3ce4..0000000 --- a/doc/html/Vector_8h.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Vector.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Vector.h File Reference
-
-
-
#include "../Self.h"
-#include "Matrix.h"
-#include <vector>
-#include <cmath>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::Vector< Scalar >
 vector More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Vector_8h_source.html b/doc/html/Vector_8h_source.html deleted file mode 100644 index 2670084..0000000 --- a/doc/html/Vector_8h_source.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/math/Vector.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Vector.h
-
-
-Go to the documentation of this file.
1 #ifndef math_Vector_H__
-
2 #define math_Vector_H__
-
3 
-
4 #include "../Self.h"
-
5 #include "Matrix.h"
-
6 
-
7 #include <vector>
-
8 
-
9 #include <cmath>
-
10 
-
11 namespace meow {
-
12 
-
18 template<class Scalar>
-
19 class Vector {
-
20 public:
- - -
23 private:
-
24  Matrix<Scalar> matrix_;
-
25 public:
-
31  Vector() {
-
32  }
-
33 
-
41  Vector(Vector const& v): matrix_(v.matrix_) {
-
42  }
-
43 
-
51  Vector(Matrix<Scalar> const& m): matrix_(m.col(0)) {
-
52  }
-
53 
-
61  Vector(std::vector<Scalar> const& v): matrix_(v.size(), 1, Scalar(0)) {
-
62  for (size_t i = 0, I = v.size(); i < I; i++) {
-
63  matrix_.entry(i, 0, v[i]);
-
64  }
-
65  }
-
66 
-
75  Vector(size_t d, Scalar const& e): matrix_(d, 1, e) {
-
76  }
-
77 
-
79  ~Vector() {
-
80  }
-
81 
-
83  Vector& copyFrom(Vector const& v) {
-
84  matrix_.copyFrom(v.matrix_);
-
85  return *this;
-
86  }
-
87 
- -
90  matrix_.referenceFrom(v.matrix_);
-
91  return *this;
-
92  }
-
93 
- -
96  return matrix_;
-
97  }
-
98 
-
100  size_t dimension() const {
-
101  return matrix_.rows();
-
102  }
-
103 
-
111  size_t dimension(size_t d, Scalar const& s) {
-
112  matrix_.rows(d, s);
-
113  return dimension();
-
114  }
-
115 
-
120  bool valid() const {
-
121  return (dimension() > 0);
-
122  }
-
123 
-
125  Scalar scalar(size_t i) const {
-
126  return matrix_.entry(i, 0);
-
127  }
-
128 
-
135  Scalar scalar(size_t i, Scalar const& s) {
-
136  matrix_.entry(i, 0, s);
-
137  return scalar(i);
-
138  }
-
139 
-
141  ScalarRef scalarGet(size_t i) {
-
142  return matrix_.entryGet(i);
-
143  }
-
144 
-
152  void scalars(size_t i, size_t j, Scalar const& s) {
-
153  for (size_t it = i; it <= j; ++it) {
-
154  matrix_.entry(it, 0, s);
-
155  }
-
156  }
-
157 
-
159  Vector subVector(size_t i, size_t j) {
-
160  return Vector(matrix_.subMatrix(i, 0, j, 0));
-
161  }
-
162 
-
164  Vector positive() const {
-
165  return *this;
-
166  }
-
167 
-
169  Vector negative() const {
-
170  return Vector(matrix_.negative());
-
171  }
-
172 
-
174  Vector add(Vector const& v) const {
-
175  return Vector(matrix_.add(v.matrix_));
-
176  }
-
177 
-
179  Vector sub(Vector const& v) const {
-
180  return Vector(matrix_.sub(v.matrix_));
-
181  }
-
182 
-
184  Vector mul(Scalar const& s) const {
-
185  return Vector(matrix_.mul(s));
-
186  }
-
187 
-
189  Vector div(Scalar const& s) const {
-
190  return Vector(matrix_.div(s));
-
191  }
-
192 
-
194  Scalar dot(Vector const& v) const {
-
195  return matrix_.transpose().mul(v.matrix_).entry(0, 0);
-
196  }
-
197 
-
199  Scalar length() const {
-
200  return Scalar(sqrt((double)length2()));
-
201  }
-
202 
-
204  Scalar length2() const {
-
205  return dot(*this);
-
206  }
-
207 
-
209  Vector normalize() const {
-
210  return div(length());
-
211  }
-
212 
- -
215  copyFrom(normalize());
-
216  return *this;
-
217  }
-
218 
-
220  Vector& operator=(Vector const& v) {
-
221  return copyFrom(v);
-
222  }
-
223 
-
225  Scalar operator()(size_t i) const {
-
226  return scalar(i);
-
227  }
-
228 
-
230  Vector operator+() const {
-
231  return positive();
-
232  }
-
233 
-
235  Vector operator-() const {
-
236  return negative();
-
237  }
-
238 
-
240  Vector operator+(Vector const& v) const {
-
241  return add(v);
-
242  }
-
243 
-
245  Vector operator-(Vector const& v) const {
-
246  return sub(v);
-
247  }
-
248 
-
250  Scalar operator*(Vector const& v) const {
-
251  return dot(v);
-
252  }
-
253 
-
255  Vector operator*(Scalar const& s) const {
-
256  return mul(s);
-
257  }
-
258 
-
260  Vector operator/(Scalar const& s) const {
-
261  return div(s);
-
262  }
-
263 };
-
264 
-
265 } // meow
-
266 
-
267 #endif // math_Vector_H__
-
Vector operator+() const
same as positive()
Definition: Vector.h:230
-
size_t dimension() const
return dimension
Definition: Vector.h:100
-
Matrix & referenceFrom(Matrix const &m)
reference
Definition: Matrix.h:110
-
size_t rows() const
Return number of rows.
Definition: Matrix.h:129
-
Scalar length() const
sqrt of length2
Definition: Vector.h:199
-
ScalarRef scalarGet(size_t i)
return i -th scalar with non-constant type
Definition: Vector.h:141
-
Scalar length2() const
same as (*this).dot(*this)
Definition: Vector.h:204
-
Vector mul(Scalar const &s) const
return (*this)*s , where s is a scalar
Definition: Vector.h:184
-
Matrix div(Entry const &s) const
return (*this) / s. s is a scalar
Definition: Matrix.h:347
-
Vector operator-() const
same as negative()
Definition: Vector.h:235
-
Vector(Vector const &v)
constructor
Definition: Vector.h:41
-
~Vector()
destructor
Definition: Vector.h:79
-
Vector sub(Vector const &v) const
return (*this)-v
Definition: Vector.h:179
-
size_t dimension(size_t d, Scalar const &s)
resize the dimension
Definition: Vector.h:111
-
Matrix subMatrix(size_t rFirst, size_t rLast, size_t cFirst, size_t cLast) const
Return a rLast-rFirst+1 x cLast-cFirst+1 matrix.
Definition: Matrix.h:258
-
Matrix< Scalar >::EntryRefK ScalarRefK
Definition: Vector.h:21
-
Vector & copyFrom(Vector const &v)
copy from ...
Definition: Vector.h:83
-
Matrix & copyFrom(Matrix const &m)
copy
Definition: Matrix.h:97
-
vector
Definition: Vector.h:19
-
Vector & operator=(Vector const &v)
same as copyFrom
Definition: Vector.h:220
-
Vector subVector(size_t i, size_t j)
subvector form i-th to j-th
Definition: Vector.h:159
-
Scalar operator*(Vector const &v) const
same as dot(v)
Definition: Vector.h:250
-
Vector(std::vector< Scalar > const &v)
constructor
Definition: Vector.h:61
-
Vector(size_t d, Scalar const &e)
constructor
Definition: Vector.h:75
-
Matrix transpose() const
return itself's transpose matrix
Definition: Matrix.h:435
-
Vector operator+(Vector const &v) const
same as add(v)
Definition: Vector.h:240
- -
Vector positive() const
return +(*this)
Definition: Vector.h:164
-
Scalar scalar(size_t i) const
return i -th scalar
Definition: Vector.h:125
-
Matrix mul(Matrix const &m) const
return (*this) times m.
Definition: Matrix.h:327
-
EntryRef entryGet(size_t r, size_t c)
Get the entry at r x c.
Definition: Matrix.h:223
-
Scalar operator()(size_t i) const
same as entry(i)
Definition: Vector.h:225
-
Matrix sub(Matrix const &m) const
return (*this) - m.
Definition: Matrix.h:314
-
matrix
Definition: Matrix.h:19
-
Vector(Matrix< Scalar > const &m)
constructor
Definition: Vector.h:51
-
Entry entry(size_t r, size_t c) const
Access the entry at r x c.
Definition: Matrix.h:212
-
Matrix negative() const
return -(*this)
Definition: Matrix.h:289
-
Vector negative() const
return -(*this)
Definition: Vector.h:169
-
Vector operator-(Vector const &v) const
same as sub(v)
Definition: Vector.h:245
-
Vector div(Scalar const &s) const
return (*this)/s , where s is a scalar
Definition: Vector.h:189
-
Vector add(Vector const &v) const
return (*this)+v
Definition: Vector.h:174
-
Vector operator*(Scalar const &s) const
same as mul(s)
Definition: Vector.h:255
-
Vector & normalized()
Let itself be normalize form.
Definition: Vector.h:214
-
Matrix< Scalar >::EntryRef ScalarRef
Definition: Vector.h:22
-
bool valid() const
Return whether dimension>0 is true or not.
Definition: Vector.h:120
-
Vector operator/(Scalar const &s) const
same as div(s)
Definition: Vector.h:260
-
Matrix< Scalar > matrix() const
Return a dimension x 1 matrix form of it.
Definition: Vector.h:95
-
Vector & referenceFrom(Vector const &v)
reference from ...
Definition: Vector.h:89
-
void scalars(size_t i, size_t j, Scalar const &s)
change i -th to j -th scalars
Definition: Vector.h:152
-
Scalar dot(Vector const &v) const
dot
Definition: Vector.h:194
-
Vector()
constructor
Definition: Vector.h:31
-
Matrix add(Matrix const &m) const
return (*this) + m.
Definition: Matrix.h:301
-
Scalar scalar(size_t i, Scalar const &s)
change i -th scalar
Definition: Vector.h:135
-
Vector normalize() const
return a normalize form of itself
Definition: Vector.h:209
-
-
- - - - - diff --git a/doc/html/Vectors_8h.html b/doc/html/Vectors_8h.html deleted file mode 100644 index a1c4e47..0000000 --- a/doc/html/Vectors_8h.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/geo/Vectors.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
Vectors.h File Reference
-
-
-
#include "../math/utility.h"
-#include "../math/Vector.h"
-#include "../math/Matrix.h"
-#include <cmath>
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

class  meow::Vector2D< Scalar >
 2D's vector More...
 
class  meow::Vector3D< Scalar >
 3D's vector More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/Vectors_8h_source.html b/doc/html/Vectors_8h_source.html deleted file mode 100644 index d898153..0000000 --- a/doc/html/Vectors_8h_source.html +++ /dev/null @@ -1,621 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/geo/Vectors.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
Vectors.h
-
-
-Go to the documentation of this file.
1 #ifndef geo_Vectors_H__
-
2 #define geo_Vectors_H__
-
3 
-
4 #include "../math/utility.h"
-
5 #include "../math/Vector.h"
-
6 #include "../math/Matrix.h"
-
7 
-
8 #include <cmath>
-
9 
-
10 namespace meow {
-
11 
-
17 template<class Scalar>
-
18 class Vector2D {
-
19 private:
-
20  Scalar x_, y_;
-
21 public:
-
23  Vector2D(): x_(0), y_(0) {
-
24  }
-
25 
-
27  Vector2D(Vector2D const& v): x_(v.x_), y_(v.y_) {
-
28  }
-
29 
-
31  Vector2D(Scalar const& s): x_(s), y_(s) {
-
32  }
-
33 
-
35  Vector2D(Scalar const& sx, Scalar const& sy): x_(sx), y_(sy) {
-
36  }
-
37 
-
39  Vector2D(size_t dimension, Scalar const& s): x_(s), y_(s) {
-
40  }
-
41 
-
43  Vector2D(Vector<Scalar> const& v): x_(v(0)), y_(v(1)) {
-
44  }
-
45 
-
47  Vector2D(Vector<Scalar> const& v, size_t i): x_(v(i)), y_(v(i + 1)) {
-
48  }
-
49 
-
51  Vector2D(Matrix<Scalar> const& m): x_(m(0, 0)), y_(m(1, 0)) {
-
52  }
-
53 
-
55  Vector2D(Matrix<Scalar> const& m, size_t i, size_t j):
-
56  x_(m(i, j)), y_(m(i + 1, j)) {
-
57  }
-
58 
- -
61  }
-
62 
-
64  Vector2D& copyFrom(Vector2D const& v) {
-
65  return xy(v.x(), v.y());
-
66  }
-
67 
-
68  size_t dimension() const { return 2; }
-
69 
-
70  Scalar const& x() const { return x_; }
-
71  Scalar const& y() const { return y_; }
-
72 
-
73  Scalar& xGet() { return x_; }
-
74  Scalar& yGet() { return y_; }
-
75 
-
76  Scalar const& x(Scalar const& s) { x_ = s; return x(); }
-
77  Scalar const& y(Scalar const& s) { y_ = s; return y(); }
-
78 
-
80  Vector2D& xy(Scalar const& sx, Scalar const& sy){
-
81  x(sx);
-
82  y(sy);
-
83  return *this;
-
84  }
-
85 
-
87  Scalar const& scalar(size_t i) const {
-
88  return (i == 0 ? x() : y());
-
89  }
-
90 
-
92  Scalar const& scalar(size_t i, Scalar const& s) {
-
93  return (i == 0 ? x(s) : (i == 1 ? y(s) : s));
-
94  }
-
95 
-
97  Vector2D positive() const {
-
98  return *this;
-
99  }
-
100 
-
102  Vector2D negative() const {
-
103  return Vector2D(-x(), -y());
-
104  }
-
105 
-
107  Vector2D right()const{
-
108  return Vector2D(-y(), x());
-
109  }
-
110 
-
112  Vector2D add(Vector2D const& v) const {
-
113  return Vector2D(x() + v.x(), y() + v.y());
-
114  }
-
115 
-
117  Vector2D& added(Vector2D const& v) {
-
118  return xy(x() + v.x(), y() + v.y());
-
119  }
-
120 
-
122  Vector2D sub(Vector2D const& v) const {
-
123  return Vector2D(x() - v.x(), y() - v.y());
-
124  }
-
125 
-
127  Vector2D& subed(Vector2D const& v) {
-
128  return xy(x() - v.x(), y() - v.y());
-
129  }
-
130 
-
132  Vector2D mul(Scalar const& s) const {
-
133  return Vector2D(x() * s, y() * s);
-
134  }
-
135 
-
137  Vector2D& muled(Scalar const& s) {
-
138  return xy(x() * s, y() * s);
-
139  }
-
140 
-
142  Vector2D div(Scalar const& s) const {
-
143  return Vector2D(x() / s, y() / s);
-
144  }
-
145 
-
147  Vector2D& dived(Scalar const& s) {
-
148  return xy(x() / s, y() / s);
-
149  }
-
150 
-
152  Scalar mul(Vector2D const& v) const {
-
153  return dot(v);
-
154  }
-
155 
-
157  Scalar dot(Vector2D const& v) const {
-
158  return x() * v.x() + y() * v.y();
-
159  }
-
160 
-
162  Scalar cross(Vector2D const& v) const {
-
163  return x() * v.y() - y() * v.x();
-
164  }
-
165 
-
167  Scalar length() const {
-
168  return Scalar(sqrt(double(length2())));
-
169  }
-
170 
-
172  Scalar length2() const {
-
173  return dot(*this);
-
174  }
-
175 
-
177  Vector2D normalize() const {
-
178  return div(length());
-
179  }
-
180 
- -
183  return dived(length());
-
184  }
-
185 
-
187  Vector2D rotate(Scalar const& theta) const {
-
188  Scalar cs(cos(-double(theta)));
-
189  Scalar sn(sin(-double(theta)));
-
190  Vector2D<Scalar> new_x(cs, sn);
-
191  return Vector2D(new_x.dot(*this), new_x.cross(*this));
-
192  }
-
193 
-
195  Vector2D& rotated(Scalar const& theta) {
-
196  return copyFrom(rotate(theta));
-
197  }
-
198 
-
200  Vector2D reflect(Vector2D const& v) const {
-
201  return v.mul(v.dot(*this) * 2 / v.length2()).sub(*this);
-
202  }
-
203 
- -
206  return copyFrom(reflecte(v));
-
207  }
-
208 
- -
211  static Matrix<Scalar> ret(2, 1, Scalar(0));
-
212  ret(0, 0, x());
-
213  ret(1, 0, y());
-
214  return ret;
-
215  }
-
216 
-
218  Matrix<Scalar> matrix(Scalar const& homo) const {
-
219  static Matrix<Scalar> ret(3, 1, Scalar(0));
-
220  ret(0, 0, x());
-
221  ret(1, 0, y());
-
222  ret(2, 0, homo);
-
223  return ret;
-
224  }
-
225 
-
226  Scalar const& operator()(size_t n) const {
-
227  return (n == 0 ? x() : y());
-
228  }
-
229 
-
230  Vector2D& operator()(Scalar const& sx, Scalar const& sy) {
-
231  return xy(sx, sy);
-
232  }
-
233 
-
234  Vector2D operator+() const { return positive(); }
-
235  Vector2D operator-() const { return negative(); }
-
236  Vector2D operator~() const { return right (); }
-
237 
-
238  Vector2D operator+(Vector2D const& v) const { return add(v); }
-
239  Vector2D operator-(Vector2D const& v) const { return sub(v); }
-
240  Vector2D operator*(Scalar const& s) const { return mul(s); }
-
241  Vector2D operator/(Scalar const& s) const { return div(s); }
-
242  Scalar operator*(Vector2D const& v) const { return mul(v); }
-
243 
-
244  Vector2D& operator =(Vector2D const& v) { return copyFrom(v); }
-
245  Vector2D& operator+=(Vector2D const& v) { return added(v); }
-
246  Vector2D& operator-=(Vector2D const& v) { return subed(v); }
-
247  Vector2D& operator*=(Scalar const& s) { return muled(s); }
-
248  Vector2D& operator/=(Scalar const& s) { return dived(s); }
-
249  bool operator==(Vector2D const& v) const { return x()==v.x() && y()==v.y(); }
-
250 };
-
251 
-
257 template<class Scalar>
-
258 class Vector3D{
-
259 private:
-
260  Scalar x_, y_, z_;
-
261 public:
-
263  Vector3D(): x_(0), y_(0), z_(0) {
-
264  }
-
265 
-
267  Vector3D(Vector3D const& v): x_(v.x_), y_(v.y_), z_(v.z_) {
-
268  }
-
269 
-
271  Vector3D(Scalar const& s): x_(s), y_(s), z_(s) {
-
272  }
-
273 
-
275  Vector3D(size_t dimension, Scalar const& s): x_(s), y_(s), z_(s) {
-
276  }
-
277 
-
279  Vector3D(Scalar const& sx,
-
280  Scalar const& sy,
-
281  Scalar const& sz): x_(sx), y_(sy), z_(sz) {
-
282  }
-
283 
-
285  Vector3D(Vector<Scalar> const& v): x_(v(0)), y_(v(1)), z_(v(2)) {
-
286  }
-
287 
-
289  Vector3D(Vector<Scalar> const& v, size_t i): x_(v(i)), y_(v(i+1)), z_(v(i+2)){
-
290  }
-
291 
-
293  Vector3D(Matrix<Scalar> const& m): x_(m(0, 0)), y_(m(1, 0)), z_(m(2, 0)) {
-
294  }
-
295 
-
297  Vector3D(Matrix<Scalar> const& m, size_t i, size_t j):
-
298  x_(m(i, j)), y_(m(i + 1, j)), z_(m(i + 2, j)) {
-
299  }
-
300 
- -
303  }
-
304 
- -
307  return xyz(v.x(), v.y(), v.z());
-
308  }
-
309 
-
310  size_t dimension() const { return 3; }
-
311 
-
312  Scalar const& x() const { return x_; }
-
313  Scalar const& y() const { return y_; }
-
314  Scalar const& z() const { return z_; }
-
315 
-
316  Scalar& xGet() { return x_; }
-
317  Scalar& yGet() { return y_; }
-
318  Scalar& zGet() { return z_; }
-
319 
-
320  Scalar const& x(Scalar const& s) { x_ = s; return x(); }
-
321  Scalar const& y(Scalar const& s) { y_ = s; return y(); }
-
322  Scalar const& z(Scalar const& s) { z_ = s; return z(); }
-
323 
-
325  Vector3D& xyz(Scalar const& sx, Scalar const& sy, Scalar const& sz) {
-
326  x(sx);
-
327  y(sy);
-
328  z(sz);
-
329  return *this;
-
330  }
-
331 
-
333  Scalar const& scalar(size_t i) const {
-
334  return (i == 0 ? x() : (i == 1 ? y() : z()));
-
335  }
-
336 
-
338  Scalar const& scalar(size_t i, Scalar const& s) {
-
339  return (i == 0 ? x(s) : (i == 1 ? y(s) : (i == 2 ? z(s) : s )));
-
340  }
-
341 
-
343  Vector3D positive() const {
-
344  return *this;
-
345  }
-
346 
-
348  Vector3D negative() const {
-
349  return Vector3D(-x(), -y(), -z());
-
350  }
-
351 
-
353  Vector3D add(Vector3D const& v) const {
-
354  return Vector3D(x() + v.x(), y() + v.y(), z() + v.z());
-
355  }
-
356 
-
358  Vector3D& added(Vector3D const& v) {
-
359  return xyz(x() + v.x(), y() + v.y(), z() + v.z());
-
360  }
-
361 
-
363  Vector3D sub(Vector3D const& v) const {
-
364  return Vector3D(x() - v.x(), y() - v.y(), z() - v.z());
-
365  }
-
366 
-
368  Vector3D& subed(Vector3D const& v) {
-
369  return xyz(x() - v.x(), y() - v.y(), z() - v.z());
-
370  }
-
371 
-
373  Vector3D mul(Scalar const& s) const {
-
374  return Vector3D(x() * s, y() * s, z() * s);
-
375  }
-
376 
-
378  Vector3D& muled(Scalar const& s) {
-
379  return xyz(x() * s, y() * s, z() * s);
-
380  }
-
381 
-
383  Vector3D div(Scalar const& s) const {
-
384  return Vector3D(x() / s, y() / s, z() / s);
-
385  }
-
386 
-
388  Vector3D& dived(Scalar const& s) {
-
389  return xyz(x() / s, y() / s, z() / s);
-
390  }
-
391 
-
393  Scalar mul(Vector3D const& v) const {
-
394  return dot(v);
-
395  }
-
396 
-
398  Scalar dot(Vector3D const& v) const {
-
399  return x() * v.x() + y() * v.y() + z() * v.z();
-
400  }
-
401 
-
403  Vector3D cross(Vector3D const& v) const {
-
404  return Vector3D(y() * v.z() - z() * v.y(),
-
405  z() * v.x() - x() * v.z(),
-
406  x() * v.y() - y() * v.x());
-
407  }
-
408 
-
410  Vector3D& crossed(Vector3D const& v) {
-
411  return copyFrom(cross(v));
-
412  }
-
413 
-
415  Scalar length() const {
-
416  return Scalar(sqrt(double(length2())));
-
417  }
-
418 
-
420  Scalar length2() const {
-
421  return dot(*this);
-
422  }
-
423 
-
425  Vector3D normalize() const {
-
426  return div(length());
-
427  }
-
428 
- -
431  return dived(length());
-
432  }
-
433 
-
435  Vector3D rotate(Vector3D const& axis, double theta) const {
-
436  Vector3D a(axis.normalize());
-
437  Vector3D xx(sub(a) .mul(cos(theta)));
-
438  Vector3D yy(a.cross(*this).mul(sin(theta)));
-
439  return a.mul(a.dot(*this)).add(xx).add(yy);
-
440  }
-
441 
-
443  Vector3D& rotated(Vector3D const& axis, double theta) {
-
444  return copyFrom(rotate(axis, theta));
-
445  }
-
446 
-
448  Vector3D reflect(Vector3D const& v) const {
-
449  return v.mul(v.dot(*this) * 2 / v.length2()).sub(*this);
-
450  }
-
451 
- -
454  return copyFrom(reflecte(v));
-
455  }
-
456 
- -
459  static Matrix<Scalar> ret(3, 1, Scalar(0));
-
460  ret(0, 0, x());
-
461  ret(1, 0, y());
-
462  ret(2, 0, z());
-
463  return ret;
-
464  }
-
465 
-
467  Matrix<Scalar> matrix(Scalar const& homo) const {
-
468  static Matrix<Scalar> ret(4, 1, Scalar(0));
-
469  ret(0, 0, x());
-
470  ret(1, 0, y());
-
471  ret(2, 0, z());
-
472  ret(3, 0, homo);
-
473  return ret;
-
474  }
-
475 
-
476  Scalar const& operator()(size_t n) const {
-
477  return (n == 0 ? x() : (n == 1 ? y() : z()));
-
478  }
-
479 
-
480  Vector3D& operator()(Scalar const& sx, Scalar const& sy, Scalar const& sz) {
-
481  return xyz(sx, sy, sz);
-
482  }
-
483 
-
484  Vector3D operator+() const { return positive(); }
-
485  Vector3D operator-() const { return negative(); }
-
486 
-
487  Vector3D operator+(Vector3D const& v) const { return add(v); }
-
488  Vector3D operator-(Vector3D const& v) const { return sub(v); }
-
489  Vector3D operator*(Scalar const& s) const { return mul(s); }
-
490  Vector3D operator/(Scalar const& s) const { return div(s); }
-
491  Scalar operator*(Vector3D const& v) const { return mul(v); }
-
492 
-
493  Vector3D& operator =(Vector3D const& v) { return copyFrom(v); }
-
494  Vector3D& operator+=(Vector3D const& v) { return added(v); }
-
495  Vector3D& operator-=(Vector3D const& v) { return subed(v); }
-
496  Vector3D& operator*=(Scalar const& s) { return muled(s); }
-
497  Vector3D& operator/=(Scalar const& s) { return dived(s); }
-
498  bool operator==(Vector3D const& v) const { return (x() == v.x() &&
-
499  y() == v.y() &&
-
500  z() == v.z()); }
-
501 };
-
502 
-
503 } // meow
-
504 
-
505 #endif // geo_Vectors_H__
-
Matrix< Scalar > matrix(Scalar const &homo) const
return a 4x1 matrix form of itself
Definition: Vectors.h:467
-
~Vector2D()
destructor
Definition: Vectors.h:60
-
Vector3D(size_t dimension, Scalar const &s)
constructor
Definition: Vectors.h:275
-
Vector3D & normalized()
normalize itself
Definition: Vectors.h:430
-
Vector3D & subed(Vector3D const &v)
Let itself substract v.
Definition: Vectors.h:368
-
Vector3D & operator-=(Vector3D const &v)
Definition: Vectors.h:495
-
Scalar const & z(Scalar const &s)
modify z
Definition: Vectors.h:322
-
Scalar & xGet()
access x with non-constant reference
Definition: Vectors.h:316
-
Vector2D & operator+=(Vector2D const &v)
Definition: Vectors.h:245
-
Vector3D(Vector< Scalar > const &v)
constructor (from another Vector)
Definition: Vectors.h:285
-
Scalar const & y(Scalar const &s)
modify y
Definition: Vectors.h:77
-
Scalar & zGet()
access z with non-constant reference
Definition: Vectors.h:318
-
Scalar const & x(Scalar const &s)
modify x
Definition: Vectors.h:320
-
Vector3D & crossed(Vector3D const &v)
crossed
Definition: Vectors.h:410
-
Vector2D reflect(Vector2D const &v) const
return reflect from given vector v
Definition: Vectors.h:200
-
Scalar const & x() const
access x
Definition: Vectors.h:70
-
Vector2D(Scalar const &s)
constructor (s, s)
Definition: Vectors.h:31
-
Scalar & xGet()
access x with non constant reference
Definition: Vectors.h:73
-
Vector2D(Matrix< Scalar > const &m, size_t i, size_t j)
constructor (from a Matrix, i-th row, j-th col)
Definition: Vectors.h:55
-
Scalar const & z() const
access z
Definition: Vectors.h:314
-
Vector2D rotate(Scalar const &theta) const
return rotate theta degree of itself
Definition: Vectors.h:187
-
Vector2D div(Scalar const &s) const
return (*this)/s , where s is a scalar
Definition: Vectors.h:142
-
Matrix< Scalar > matrix(Scalar const &homo) const
return a 3x1 matrix form of itself
Definition: Vectors.h:218
-
Vector2D & muled(Scalar const &s)
Let itself mulitple s.
Definition: Vectors.h:137
-
Vector3D rotate(Vector3D const &axis, double theta) const
return rotate theta degree by axis of itself
Definition: Vectors.h:435
-
Vector2D right() const
return count-clockwise rotate 90 degree of itself
Definition: Vectors.h:107
-
Scalar const & scalar(size_t i, Scalar const &s)
modivy the i -th scalar (0 => x, 1 => y, 2 => z)
Definition: Vectors.h:338
-
Vector2D negative() const
return -(*this)
Definition: Vectors.h:102
-
Vector2D positive() const
return +(*this)
Definition: Vectors.h:97
-
Vector3D & operator=(Vector3D const &v)
Definition: Vectors.h:493
-
Vector2D & dived(Scalar const &s)
Let itself divide s.
Definition: Vectors.h:147
-
Scalar operator*(Vector2D const &v) const
Definition: Vectors.h:242
-
Vector3D operator-(Vector3D const &v) const
Definition: Vectors.h:488
-
Vector3D & copyFrom(Vector3D const &v)
copy
Definition: Vectors.h:306
-
Scalar & yGet()
access y with non constant reference
Definition: Vectors.h:74
-
Vector3D div(Scalar const &s) const
return (*this)/s , where s is a scalar
Definition: Vectors.h:383
-
Vector3D(Scalar const &s)
constructor (s, s)
Definition: Vectors.h:271
-
Vector3D & xyz(Scalar const &sx, Scalar const &sy, Scalar const &sz)
modify x, y and z
Definition: Vectors.h:325
-
Vector3D & added(Vector3D const &v)
Let itself add v.
Definition: Vectors.h:358
-
Vector2D operator*(Scalar const &s) const
Definition: Vectors.h:240
-
Vector3D & dived(Scalar const &s)
Let itself divide s.
Definition: Vectors.h:388
-
Vector3D cross(Vector3D const &v) const
cross
Definition: Vectors.h:403
-
Scalar mul(Vector3D const &v) const
same as dot(v)
Definition: Vectors.h:393
-
Scalar operator*(Vector3D const &v) const
Definition: Vectors.h:491
-
Vector2D & operator-=(Vector2D const &v)
Definition: Vectors.h:246
-
bool operator==(Vector3D const &v) const
Definition: Vectors.h:498
-
Vector2D(Matrix< Scalar > const &m)
constructor (from a Matrix)
Definition: Vectors.h:51
-
Vector2D & operator*=(Scalar const &s)
Definition: Vectors.h:247
-
Vector2D(size_t dimension, Scalar const &s)
constructor
Definition: Vectors.h:39
-
Scalar mul(Vector2D const &v) const
same as dot(v)
Definition: Vectors.h:152
-
Vector3D mul(Scalar const &s) const
return (*this)*s , where s is a scalar
Definition: Vectors.h:373
-
Scalar const & operator()(size_t n) const
Definition: Vectors.h:476
-
bool operator==(Vector2D const &v) const
Definition: Vectors.h:249
-
Vector2D operator~() const
Definition: Vectors.h:236
-
Vector2D operator-(Vector2D const &v) const
Definition: Vectors.h:239
-
Scalar const & y() const
access y
Definition: Vectors.h:313
-
Vector2D add(Vector2D const &v) const
return (*this)+v
Definition: Vectors.h:112
-
Scalar const & operator()(size_t n) const
Definition: Vectors.h:226
-
Scalar const & scalar(size_t i) const
access the i -th scalar (0 => x, 1 => y)
Definition: Vectors.h:87
-
Vector3D sub(Vector3D const &v) const
return (*this)-v
Definition: Vectors.h:363
-
vector
Definition: Vector.h:19
-
Vector2D & operator()(Scalar const &sx, Scalar const &sy)
Definition: Vectors.h:230
-
Vector3D & operator/=(Scalar const &s)
Definition: Vectors.h:497
-
Matrix< Scalar > matrix() const
return a 3x1 matrix form of itself
Definition: Vectors.h:458
-
Vector2D & xy(Scalar const &sx, Scalar const &sy)
modify x and y
Definition: Vectors.h:80
-
3D's vector
Definition: Vectors.h:258
-
Vector3D(Scalar const &sx, Scalar const &sy, Scalar const &sz)
constructor (sx, sy)
Definition: Vectors.h:279
-
Vector2D mul(Scalar const &s) const
return (*this)*s , where s is a scalar
Definition: Vectors.h:132
-
Vector2D & rotated(Scalar const &theta)
Let itself rotate theta degree.
Definition: Vectors.h:195
-
Vector3D operator/(Scalar const &s) const
Definition: Vectors.h:490
-
Vector3D(Matrix< Scalar > const &m)
constructor (from a Matrix)
Definition: Vectors.h:293
-
Vector2D operator/(Scalar const &s) const
Definition: Vectors.h:241
-
Vector3D negative() const
return -(*this)
Definition: Vectors.h:348
-
Scalar const & scalar(size_t i, Scalar const &s)
modivy the i -th scalar (0 => x, 1 => y)
Definition: Vectors.h:92
-
Vector3D operator+() const
Definition: Vectors.h:484
-
Vector2D operator+(Vector2D const &v) const
Definition: Vectors.h:238
-
Vector2D(Vector< Scalar > const &v)
constructor (from another Vector)
Definition: Vectors.h:43
-
Scalar dot(Vector3D const &v) const
dot
Definition: Vectors.h:398
-
Vector3D add(Vector3D const &v) const
return (*this)+v
Definition: Vectors.h:353
-
Scalar & yGet()
access y with non-constant reference
Definition: Vectors.h:317
-
Vector2D operator+() const
Definition: Vectors.h:234
-
Scalar length2() const
same as dot(*this)
Definition: Vectors.h:172
-
Vector3D()
consturctor (0, 0)
Definition: Vectors.h:263
-
Vector3D operator+(Vector3D const &v) const
Definition: Vectors.h:487
-
Vector3D(Matrix< Scalar > const &m, size_t i, size_t j)
constructor (from a Matrix, i-th row, j-th col)
Definition: Vectors.h:297
-
Vector2D operator-() const
Definition: Vectors.h:235
-
Scalar cross(Vector2D const &v) const
cross
Definition: Vectors.h:162
-
Vector2D & copyFrom(Vector2D const &v)
copy
Definition: Vectors.h:64
-
Vector2D & operator=(Vector2D const &v)
Definition: Vectors.h:244
-
Vector2D sub(Vector2D const &v) const
return (*this)-v
Definition: Vectors.h:122
-
Vector3D positive() const
return +(*this)
Definition: Vectors.h:343
-
Vector2D & added(Vector2D const &v)
Let itself add v.
Definition: Vectors.h:117
-
Vector3D & operator*=(Scalar const &s)
Definition: Vectors.h:496
- -
Vector3D(Vector3D const &v)
consturctor (from another Vector3D)
Definition: Vectors.h:267
-
Scalar length2() const
same as dot(*this)
Definition: Vectors.h:420
-
Scalar const & x() const
access x
Definition: Vectors.h:312
-
size_t dimension() const
return 2
Definition: Vectors.h:310
-
Vector2D & subed(Vector2D const &v)
Let itself substract v.
Definition: Vectors.h:127
-
~Vector3D()
destructor
Definition: Vectors.h:302
-
Vector3D & operator+=(Vector3D const &v)
Definition: Vectors.h:494
-
Scalar length() const
sqrt of length2
Definition: Vectors.h:415
-
Vector2D & operator/=(Scalar const &s)
Definition: Vectors.h:248
-
Vector3D normalize() const
return normalize form of itself
Definition: Vectors.h:425
-
Scalar dot(Vector2D const &v) const
dot
Definition: Vectors.h:157
-
Vector2D(Vector2D const &v)
consturctor (from another Vector2D)
Definition: Vectors.h:27
-
size_t dimension() const
return 2
Definition: Vectors.h:68
-
Vector3D operator-() const
Definition: Vectors.h:485
-
Vector3D & rotated(Vector3D const &axis, double theta)
Let itself rotate theta degree.
Definition: Vectors.h:443
-
Vector2D()
consturctor (0, 0)
Definition: Vectors.h:23
-
Vector3D & reflected(Vector3D const &v)
reflect itself given vector v
Definition: Vectors.h:453
-
Vector2D & reflected(Vector2D const &v)
reflect itself given vector v
Definition: Vectors.h:205
-
Scalar const & y() const
access y
Definition: Vectors.h:71
-
Vector3D & muled(Scalar const &s)
Let itself mulitple s.
Definition: Vectors.h:378
-
Vector2D & normalized()
normalize itself
Definition: Vectors.h:182
-
Scalar const & scalar(size_t i) const
access the i -th scalar (0 => x, 1 => y, 2 => z) {
Definition: Vectors.h:333
-
Matrix< Scalar > matrix() const
return a 2x1 matrix form of itself
Definition: Vectors.h:210
-
Vector3D operator*(Scalar const &s) const
Definition: Vectors.h:489
-
Vector2D normalize() const
return normalize form of itself
Definition: Vectors.h:177
-
Vector3D & operator()(Scalar const &sx, Scalar const &sy, Scalar const &sz)
Definition: Vectors.h:480
-
Vector2D(Scalar const &sx, Scalar const &sy)
constructor (sx, sy)
Definition: Vectors.h:35
-
Scalar length() const
sqrt of length2
Definition: Vectors.h:167
-
Vector3D reflect(Vector3D const &v) const
return reflect from given vector v
Definition: Vectors.h:448
-
2D's vector
Definition: Vectors.h:18
-
Scalar const & y(Scalar const &s)
modify y
Definition: Vectors.h:321
-
Vector2D(Vector< Scalar > const &v, size_t i)
constructor (from another Vector, i-th)
Definition: Vectors.h:47
-
Vector3D(Vector< Scalar > const &v, size_t i)
constructor (from another Vector, i-th)
Definition: Vectors.h:289
-
Scalar const & x(Scalar const &s)
modify x
Definition: Vectors.h:76
-
-
- - - - - diff --git a/doc/html/ViewPort_8h.html b/doc/html/ViewPort_8h.html deleted file mode 100644 index 3fc8269..0000000 --- a/doc/html/ViewPort_8h.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/ViewPort.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
ViewPort.h File Reference
-
-
-
#include "../oo/ObjBase.h"
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::ViewPort
 未完待續 More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/ViewPort_8h_source.html b/doc/html/ViewPort_8h_source.html deleted file mode 100644 index 7a8eaf4..0000000 --- a/doc/html/ViewPort_8h_source.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/ViewPort.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
ViewPort.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_ViewPort_H__
-
2 #define gra_ViewPort_H__
-
3 
-
4 #include "../oo/ObjBase.h"
-
5 
-
6 namespace meow {
-
7 
-
11 class ViewPort: public ObjBase {
-
12 
-
13 };
-
14 
-
15 
-
16 } // meow
-
17 
-
18 #endif // gra_ViewPort_H__
-
19 
-
未完待續
Definition: ViewPort.h:11
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
-
-
- - - - - diff --git a/doc/html/WatchBall_8h.html b/doc/html/WatchBall_8h.html deleted file mode 100644 index 3f77530..0000000 --- a/doc/html/WatchBall_8h.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/WatchBall.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
WatchBall.h File Reference
-
-
-
#include "Camera.h"
-#include "../Self.h"
-#include "../geo/Vectors.h"
-#include "../math/LinearTransformations.h"
-#include "../oo/ObjBase.h"
-#include <cmath>
-#include <vector>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::WatchBall< Pixel >
 多個camera, 一個offset, 一個rotation More...
 
- - - -

-Namespaces

 meow
 
-
-
- - - - - diff --git a/doc/html/WatchBall_8h_source.html b/doc/html/WatchBall_8h_source.html deleted file mode 100644 index 732306d..0000000 --- a/doc/html/WatchBall_8h_source.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/gra/WatchBall.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
WatchBall.h
-
-
-Go to the documentation of this file.
1 #ifndef gra_WatchBall_H__
-
2 #define gra_WatchBall_H__
-
3 
-
4 #include "Camera.h"
-
5 
-
6 #include "../Self.h"
-
7 #include "../geo/Vectors.h"
-
8 #include "../math/LinearTransformations.h"
-
9 #include "../oo/ObjBase.h"
-
10 
-
11 #include <cmath>
-
12 #include <vector>
-
13 
-
14 namespace meow {
-
15 
-
21 template<class Pixel>
-
22 class WatchBall: public ObjBase {
-
23 public:
-
24  typedef std::vector<Camera<Pixel> > Cameras;
-
25 private:
-
26  struct Myself {
-
27  Cameras cameras_;
-
28  Vector3D<double> offset_;
-
29 
-
30  Myself() {
-
31  }
-
32 
-
33  Myself(Myself const& b): cameras_(b.cameras_), offset_(b.offset_) {
-
34  }
-
35 
-
36  ~Myself() {
-
37  }
-
38  };
-
39 
-
40  Self<Myself> const self;
-
41 public:
-
45  WatchBall(): self() {
-
46  }
-
47 
-
51  WatchBall(WatchBall const& b): self(b.self, Self<Myself>::COPY_FROM) {
-
52  }
-
53 
- -
58  }
-
59 
- -
64  self().copyFrom(b.self);
-
65  return *this;
-
66  }
-
67 
- -
72  self().referenceFrom(b.self);
-
73  return *this;
-
74  }
-
75 
-
79  size_t cameraSize() const {
-
80  return self->cameras_.size();
-
81  }
-
82 
-
86  Cameras cameras() const {
-
87  return self->cameras_;
-
88  }
-
89 
- -
94  return self()->cameras_;
-
95  }
-
96 
-
100  Cameras cameras(Cameras const& c) {
-
101  self()->cameras_ = c;
-
102  return cameras();
-
103  }
-
104 
-
108  Camera<Pixel> camera(size_t i) const {
-
109  return cameras()[i];
-
110  }
-
111 
- -
116  return cameras()[i];
-
117  }
-
118 
-
122  Camera<Pixel> camera(size_t i, Camera<Pixel> const& c) {
-
123  cameras()[i] = c;
-
124  return camera(i);
-
125  }
-
126 
- -
131  return self->offset_;
-
132  }
-
133 
- -
138  return self()->offset_;
-
139  }
-
140 
- -
145  self()->offset_ = ofs;
-
146  return offset();
-
147  }
-
148 
-
152  Pixel color(Vector3D<double> p) const {
-
153  Vector3D<double> p2(p - offset());
-
154  Pixel sum(0);
-
155  double ct = 0;
-
156  for (size_t i = 0, I = cameraSize(); i < I; ++i) {
-
157  if (camera(i).inside(p2)) {
-
158  sum = sum + camera(i).color(p2);
-
159  ++ct;
-
160  }
-
161  }
-
162  return (ct > 0 ? sum / ct : sum);
-
163  }
-
164 
-
170  Bitmap<Pixel> expand(double radius) const {
-
171  radius = std::max(radius, 0.5);
-
172  size_t height = std::max<size_t>(1, 2.0 * radius);
-
173  size_t width = 2.0* PI * radius;
-
174  Bitmap<Pixel> ret(height, width, Pixel(0));
-
175  for (size_t i = 0; i < height; ++i) {
-
176  for (size_t j = 0; j < width; ++j) {
-
177  double theta = (1.0 * j / width - 0.5) * 2 * PI;
-
178  double phi = asin(-(1.0 * i / height - 0.5) * 2.0);
-
179  ret.pixel(i, j, color(Vector3D<double>(
-
180  sin(theta) * cos(phi),
-
181  sin(phi),
-
182  -cos(theta) * cos(phi)
-
183  )));
-
184  }
-
185  }
-
186  return ret;
-
187  }
-
188 
- -
193  return copyFrom(b);
-
194  }
-
195 
-
200  bool write(FILE* f, bool bin, unsigned int fg) const {
-
201  return false;
-
202  }
-
203 
-
208  bool read(FILE* f, bool bin, unsigned int fg) {
-
209  return false;
-
210  }
-
211 
-
216  ObjBase* create() const {
-
217  return new WatchBall();
-
218  }
-
219 
-
229  ObjBase* copyFrom(ObjBase const* b) {
-
230  return &(copyFrom(*(WatchBall const*)b));
-
231  }
-
232 
-
237  char const* ctype() const{
-
238  return typeid(*this).name();
-
239  }
-
240 
-
245  std::string type() const {
-
246  return std::string(ctype());
-
247  }
-
248 };
-
249 
-
250 } // meow
-
251 
-
252 #endif // gra_WatchBall_H__
-
WatchBall & referenceFrom(WatchBall const &b)
reference
Definition: WatchBall.h:71
-
WatchBall()
constructor
Definition: WatchBall.h:45
-
~WatchBall()
destructor
Definition: WatchBall.h:57
-
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
Definition: WatchBall.h:200
- -
Camera< Pixel > & cameraGet(size_t i)
取得第i個camera (non-constant reference)
Definition: WatchBall.h:115
-
Camera.
Definition: Camera.h:23
-
Cameras cameras(Cameras const &c)
設定 camera
Definition: WatchBall.h:100
-
char const * ctype() const
回傳class的type
Definition: WatchBall.h:237
-
二維點陣資料
Definition: Bitmap.h:25
-
Cameras cameras() const
取得 cameras
Definition: WatchBall.h:86
-
ObjBase * create() const
new一個自己
Definition: WatchBall.h:216
-
Pixel pixel(size_t y, size_t x) const
取得 (y, x) 的pixel
Definition: Bitmap.h:212
-
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Definition: ObjBase.h:15
- -
WatchBall & copyFrom(WatchBall const &b)
copy data
Definition: WatchBall.h:63
-
多個camera, 一個offset, 一個rotation
Definition: WatchBall.h:22
-
ObjBase * copyFrom(ObjBase const *b)
複製資料
Definition: WatchBall.h:229
-
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
Definition: WatchBall.h:208
-
Pixel color(Vector3D< double > p) const
取得底片color
Definition: WatchBall.h:152
-
Bitmap< Pixel > expand(double radius) const
輸出展開圖
Definition: WatchBall.h:170
-
Vector3D< double > offset(Vector3D< double > const &ofs)
設定offset
Definition: WatchBall.h:144
-
Camera< Pixel > camera(size_t i) const
取得第i個camera
Definition: WatchBall.h:108
-
static const double PI
圓周率...
Definition: utility.h:12
- -
size_t cameraSize() const
取得有幾個camera
Definition: WatchBall.h:79
-
WatchBall(WatchBall const &b)
copy constructor
Definition: WatchBall.h:51
-
std::string type() const
回傳class的type
Definition: WatchBall.h:245
-
Camera< Pixel > camera(size_t i, Camera< Pixel > const &c)
設定第i個camera
Definition: WatchBall.h:122
-
Vector3D< double > offset() const
取得offset
Definition: WatchBall.h:130
-
WatchBall & operator=(WatchBall const &b)
same as copyFrom(b)
Definition: WatchBall.h:192
-
Vector3D< double > & offsetGet()
取得offset (non-constant reference)
Definition: WatchBall.h:137
-
Cameras & camerasGet()
取得 cameras (non-constant)
Definition: WatchBall.h:93
-
std::vector< Camera< Pixel > > Cameras
Definition: WatchBall.h:24
-
-
- - - - - diff --git a/doc/html/YUV_8h.html b/doc/html/YUV_8h.html deleted file mode 100644 index 92c8608..0000000 --- a/doc/html/YUV_8h.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/YUV.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
YUV.h File Reference
-
-
-
#include "RGB.h"
-#include "YUV.hpp"
-
-

Go to the source code of this file.

- - - - - - -

-Classes

class  meow::YUV< T >
 
class  meow::YUVf
 
- - - -

-Namespaces

 meow
 
- - - - - - - -

-Functions

template<class RGB_T , class YUV_T >
void meow::RGB_to_YUV (RGB< RGB_T > const &rgb, YUV< YUV_T > *yuv)
 
template<class YUV_T , class RGB_T >
void meow::YUV_to_RGB (YUV< YUV_T > const &yuv, RGB< RGB_T > *rgb)
 
-
-
- - - - - diff --git a/doc/html/YUV_8h.js b/doc/html/YUV_8h.js deleted file mode 100644 index ec5e4dc..0000000 --- a/doc/html/YUV_8h.js +++ /dev/null @@ -1,7 +0,0 @@ -var YUV_8h = -[ - [ "YUV", "classmeow_1_1YUV.html", "classmeow_1_1YUV" ], - [ "YUVf", "classmeow_1_1YUVf.html", "classmeow_1_1YUVf" ], - [ "RGB_to_YUV", "YUV_8h.html#a9682162b4b67148649d87c2049175820", null ], - [ "YUV_to_RGB", "YUV_8h.html#ace828526337b865be410d3a78d07d8b0", null ] -]; \ No newline at end of file diff --git a/doc/html/YUV_8h_source.html b/doc/html/YUV_8h_source.html deleted file mode 100644 index 0722af3..0000000 --- a/doc/html/YUV_8h_source.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/YUV.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
YUV.h
-
-
-Go to the documentation of this file.
1 #ifndef YUV_H_
-
2 #define YUV_H_
-
3 
-
4 #include "RGB.h"
-
5 
-
6 namespace meow{
-
7  template<class T> class YUV{
-
8  protected:
-
9  T yuv_[3];
-
10  YUV();
-
11  YUV(T const& y, T const& u, T const& v);
-
12  YUV(T const* yuv);
-
13  public:
-
14  virtual ~YUV() { }
-
16  virtual T yMax() const = 0;
-
17  virtual T yMin() const = 0;
-
18  virtual T uMax() const = 0;
-
19  virtual T uMin() const = 0;
-
20  virtual T vMax() const = 0;
-
21  virtual T vMin() const = 0;
-
23  T y() const;
-
24  T u() const;
-
25  T v() const;
-
26  T yuv(size_t i) const;
-
27  T vuy(size_t i) const;
-
29  T y(T const& val);
-
30  T u(T const& val);
-
31  T v(T const& val);
-
32  T yuv(size_t i, T const& val);
-
33  T vuy(size_t i, T const& val);
-
34  };
-
35 
-
36  class YUVf: public YUV<double>{
-
37  public:
-
38  YUVf();
-
39  ~YUVf();
-
40  YUVf(double const& y, double const& u, double const& v);
-
41  YUVf(double const* yuv);
-
42  double yMin() const;
-
43  double yMax() const;
-
44  double uMin() const;
-
45  double uMax() const;
-
46  double vMin() const;
-
47  double vMax() const;
-
48  };
-
49 
-
50  template<class RGB_T, class YUV_T> inline void RGB_to_YUV(
-
51  RGB<RGB_T> const& rgb,
-
52  YUV<YUV_T> * yuv);
-
53  template<class YUV_T, class RGB_T> inline void YUV_to_RGB(
-
54  YUV<YUV_T> const& yuv,
-
55  RGB<RGB_T> * rgb);
-
56 }
-
57 
-
58 #include "YUV.hpp"
-
59 
-
60 #endif // YUV_H_
-
double uMin() const
Definition: YUV.hpp:41
-
virtual ~YUV()
Definition: YUV.h:14
- -
double vMax() const
Definition: YUV.hpp:44
-
virtual T yMin() const =0
-
Definition: RGB.h:5
-
virtual T vMax() const =0
-
T yuv_[3]
Definition: YUV.h:9
-
Definition: YUV.h:36
-
T v() const
Definition: YUV.hpp:18
-
Definition: YUV.h:7
-
void RGB_to_YUV(RGB< RGB_T > const &rgb, YUV< YUV_T > *yuv)
Definition: YUV.hpp:47
-
T y() const
Definition: YUV.hpp:16
-
double yMin() const
Definition: YUV.hpp:39
-
virtual T yMax() const =0
-
double vMin() const
Definition: YUV.hpp:43
-
YUVf()
Definition: YUV.hpp:35
-
void YUV_to_RGB(YUV< YUV_T > const &yuv, RGB< RGB_T > *rgb)
Definition: YUV.hpp:60
-
double uMax() const
Definition: YUV.hpp:42
-
double yMax() const
Definition: YUV.hpp:40
-
virtual T vMin() const =0
-
T u() const
Definition: YUV.hpp:17
-
T yuv(size_t i) const
Definition: YUV.hpp:19
- -
T vuy(size_t i) const
Definition: YUV.hpp:22
-
~YUVf()
Definition: YUV.hpp:36
-
YUV()
Definition: YUV.hpp:6
-
virtual T uMax() const =0
-
virtual T uMin() const =0
-
-
- - - - - diff --git a/doc/html/YUV_8hpp.html b/doc/html/YUV_8hpp.html deleted file mode 100644 index c7e50c4..0000000 --- a/doc/html/YUV_8hpp.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/YUV.hpp File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
YUV.hpp File Reference
-
-
-
#include <algorithm>
-#include "RGB.h"
-#include "../utility.h"
-
-

Go to the source code of this file.

- - - - -

-Namespaces

 meow
 
- - - - - - - -

-Functions

template<class RGB_T , class YUV_T >
void meow::RGB_to_YUV (RGB< RGB_T > const &rgb, YUV< YUV_T > *yuv)
 
template<class YUV_T , class RGB_T >
void meow::YUV_to_RGB (YUV< YUV_T > const &yuv, RGB< RGB_T > *rgb)
 
-
-
- - - - - diff --git a/doc/html/YUV_8hpp.js b/doc/html/YUV_8hpp.js deleted file mode 100644 index 5382379..0000000 --- a/doc/html/YUV_8hpp.js +++ /dev/null @@ -1,5 +0,0 @@ -var YUV_8hpp = -[ - [ "RGB_to_YUV", "YUV_8hpp.html#a9682162b4b67148649d87c2049175820", null ], - [ "YUV_to_RGB", "YUV_8hpp.html#ace828526337b865be410d3a78d07d8b0", null ] -]; \ No newline at end of file diff --git a/doc/html/YUV_8hpp_source.html b/doc/html/YUV_8hpp_source.html deleted file mode 100644 index 00320e2..0000000 --- a/doc/html/YUV_8hpp_source.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/YUV.hpp Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.1.4 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
YUV.hpp
-
-
-Go to the documentation of this file.
1 #include <algorithm>
-
2 #include "RGB.h"
-
3 #include "../utility.h"
-
4 
-
5 namespace meow{
-
6  template<class T> inline YUV<T>::YUV(){ }
-
7  template<class T> inline YUV<T>::YUV(T const& y, T const& u, T const& v){
-
8  yuv_[0] = y; yuv_[1] = u; yuv_[2] = v;
-
9  }
-
10  template<class T> inline YUV<T>::YUV(T const* yuv){
-
11  for(int i = 0; i < 3; i++){
-
12  yuv_[i] = yuv[i];
-
13  }
-
14  }
-
16  template<class T> inline T YUV<T>::y() const { return yuv_[0]; }
-
17  template<class T> inline T YUV<T>::u() const { return yuv_[1]; }
-
18  template<class T> inline T YUV<T>::v() const { return yuv_[2]; }
-
19  template<class T> inline T YUV<T>::yuv(size_t i) const {
-
20  return yuv_[std::min((size_t)3 - 1, i)];
-
21  }
-
22  template<class T> inline T YUV<T>::vuy(size_t i) const {return yuv(2-i);}
-
24  template<class T> inline T YUV<T>::y(T const& val){return (yuv_[0]=val);}
-
25  template<class T> inline T YUV<T>::u(T const& val){return (yuv_[1]=val);}
-
26  template<class T> inline T YUV<T>::v(T const& val){return (yuv_[2]=val);}
-
27  template<class T> inline T YUV<T>::yuv(size_t i, T const& val){
-
28  i = std::min((size_t)3 - 1, i);
-
29  return (yuv_[i] = val);
-
30  }
-
31  template<class T> inline T YUV<T>::vuy(size_t i, T const& val){
-
32  return yuv(2 - i, val);
-
33  }
-
34 
-
35  inline YUVf:: YUVf(): YUV(0.0, 0.0, 0.0){ }
-
36  inline YUVf::~YUVf(){ }
-
37  inline YUVf::YUVf(double const& y, double const& u, double const& v): YUV(y, u, v){ }
-
38  inline YUVf::YUVf(double const* yuv): YUV(yuv){ }
-
39  inline double YUVf::yMin() const { return 0.0; }
-
40  inline double YUVf::yMax() const { return 1.0; }
-
41  inline double YUVf::uMin() const { return 0.0; }
-
42  inline double YUVf::uMax() const { return 1.0; }
-
43  inline double YUVf::vMin() const { return 0.0; }
-
44  inline double YUVf::vMax() const { return 1.0; }
-
45 
-
46 
-
47  template<class RGB_T, class YUV_T> inline void RGB_to_YUV(
-
48  RGB<RGB_T> const& rgb,
-
49  YUV<YUV_T> * yuv){
-
50  double r = normalize(rgb.rMin(), rgb.rMax(), rgb.r());
-
51  double g = normalize(rgb.gMin(), rgb.gMax(), rgb.g());
-
52  double b = normalize(rgb.bMin(), rgb.bMax(), rgb.b());
-
53  double y = 0.299 * r + 0.587 * g + 0.114 * b;
-
54  double u = -0.169 * r - 0.331 * g + 0.500 * b + 0.5;
-
55  double v = 0.500 * r - 0.419 * g - 0.081 * b + 0.5;
-
56  yuv->y(denormalize(yuv->yMin(), yuv->yMax(), y));
-
57  yuv->u(denormalize(yuv->uMin(), yuv->uMax(), u));
-
58  yuv->v(denormalize(yuv->vMin(), yuv->vMax(), v));
-
59  }
-
60  template<class YUV_T, class RGB_T> inline void YUV_to_RGB(
-
61  YUV<YUV_T> const& yuv,
-
62  RGB<RGB_T> * rgb){
-
63  double y = normalize(yuv.yMin(), yuv.yMax(), yuv.y());
-
64  double u = normalize(yuv.uMin(), yuv.uMax(), yuv.u());
-
65  double v = normalize(yuv.vMin(), yuv.vMax(), yuv.v());
-
66  double r = y - 0.00093 * (u - 0.5) + 1.401687 * (v - 0.5);
-
67  double g = y - 0.34370 * (u - 0.5) - 0.714170 * (v - 0.5);
-
68  double b = y + 1.77216 * (u - 0.5) - 0.000990 * (v - 0.5);
-
69  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), r));
-
70  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), g));
-
71  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), b));
-
72  }
-
73 }
-
74 
-
virtual T rMax() const =0
-
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
Definition: utility.h:27
-
double uMin() const
Definition: YUV.hpp:41
- -
double vMax() const
Definition: YUV.hpp:44
-
virtual T yMin() const =0
-
virtual T bMax() const =0
-
Definition: RGB.h:5
-
virtual T vMax() const =0
-
T r() const
Definition: RGB.hpp:14
-
T v() const
Definition: YUV.hpp:18
-
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
Definition: utility.h:35
-
virtual T bMin() const =0
-
Definition: YUV.h:7
-
void RGB_to_YUV(RGB< RGB_T > const &rgb, YUV< YUV_T > *yuv)
Definition: YUV.hpp:47
-
T y() const
Definition: YUV.hpp:16
-
double yMin() const
Definition: YUV.hpp:39
-
virtual T yMax() const =0
-
double vMin() const
Definition: YUV.hpp:43
-
YUVf()
Definition: YUV.hpp:35
-
void YUV_to_RGB(YUV< YUV_T > const &yuv, RGB< RGB_T > *rgb)
Definition: YUV.hpp:60
-
double uMax() const
Definition: YUV.hpp:42
-
double yMax() const
Definition: YUV.hpp:40
-
virtual T vMin() const =0
-
virtual T gMax() const =0
-
T u() const
Definition: YUV.hpp:17
-
virtual T rMin() const =0
-
T yuv(size_t i) const
Definition: YUV.hpp:19
-
T g() const
Definition: RGB.hpp:15
-
virtual T gMin() const =0
-
T b() const
Definition: RGB.hpp:16
-
T vuy(size_t i) const
Definition: YUV.hpp:22
-
~YUVf()
Definition: YUV.hpp:36
-
YUV()
Definition: YUV.hpp:6
-
virtual T uMax() const =0
-
virtual T uMin() const =0
-
-
- - - - - diff --git a/doc/html/YUV__Space_8h.html b/doc/html/YUV__Space_8h.html deleted file mode 100644 index 835dc64..0000000 --- a/doc/html/YUV__Space_8h.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/YUV_Space.h File Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
- -
-
YUV_Space.h File Reference
-
-
-
#include "Color3_Space.h"
-#include "../geo/Vectors.h"
-#include "RGB_Space.h"
-#include "../math/utility.h"
-#include <cstdlib>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  meow::YUVf_Space
 以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間 More...
 
- - - -

-Namespaces

 meow
 
- - - - - - - - - - - - - - - - -

-Functions

void meow::colorTransformate (YUVf_Space const &in, YUVf_Space *out)
 YUVf_Space to YUVf_Space More...
 
void meow::colorTransformate (RGBf_Space const &rgb, YUVf_Space *yuv)
 RGBf_Space to YUVf_Space More...
 
void meow::colorTransformate (YUVf_Space const &yuv, RGBf_Space *rgb)
 YUVf_Space to RGBf_Space More...
 
void meow::colorTransformate (RGBi_Space const &rgb, YUVf_Space *yuv)
 RGBi_Space to YUVf_Space More...
 
void meow::colorTransformate (YUVf_Space const &yuv, RGBi_Space *rgb)
 YUVf_Space to RGBi_Space More...
 
-
-
- - - - - diff --git a/doc/html/YUV__Space_8h.js b/doc/html/YUV__Space_8h.js deleted file mode 100644 index 3594a11..0000000 --- a/doc/html/YUV__Space_8h.js +++ /dev/null @@ -1,9 +0,0 @@ -var YUV__Space_8h = -[ - [ "YUVf_Space", "classmeow_1_1YUVf__Space.html", "classmeow_1_1YUVf__Space" ], - [ "colorTransformate", "YUV__Space_8h.html#a4aa5fdfb6ca24224935e27d036148618", null ], - [ "colorTransformate", "YUV__Space_8h.html#a6ebfe120c658a6320de42c449e485e54", null ], - [ "colorTransformate", "YUV__Space_8h.html#ab4756ef949554840f60a762661acc103", null ], - [ "colorTransformate", "YUV__Space_8h.html#a91f42614ccd31fdb9a3d8529f65198fd", null ], - [ "colorTransformate", "YUV__Space_8h.html#af4d344590a86168090c2f2322289f080", null ] -]; \ No newline at end of file diff --git a/doc/html/YUV__Space_8h_source.html b/doc/html/YUV__Space_8h_source.html deleted file mode 100644 index c87e9f2..0000000 --- a/doc/html/YUV__Space_8h_source.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors/YUV_Space.h Source File - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
YUV_Space.h
-
-
-Go to the documentation of this file.
1 #ifndef colors_YUV_Space_H__
-
2 #define colors_YUV_Space_H__
-
3 
-
4 #include "Color3_Space.h"
-
5 #include "../geo/Vectors.h"
-
6 
-
7 #include "RGB_Space.h"
-
8 #include "../math/utility.h"
-
9 
-
10 #include <cstdlib>
-
11 
-
12 namespace meow {
-
13 
-
21 class YUVf_Space: public Color3_Space<double> {
-
22 public:
- -
24  Vector3D<double>(1.0, 1.0, 1.0),
-
25  Vector3D<double>(0.0, 0.0, 0.0)) {
-
26  }
-
27  YUVf_Space(double c): Color3_Space<double>(Vector3D<double>(0.0, 0.0, 0.0),
-
28  Vector3D<double>(1.0, 1.0, 1.0),
-
29  Vector3D<double>( c, c, c)) {
-
30  }
- -
32  Color3_Space<double>(Vector3D<double>(0.0, 0.0, 0.0),
-
33  Vector3D<double>(1.0, 1.0, 1.0),
-
34  Vector3D<double>(v)) {
-
35  }
-
36  YUVf_Space(YUV_Space const& b): Color3_Space<double>(b) {
-
37  }
- -
39  }
-
40  double const& yuvMin(size_t i) const { return min(i); }
-
41  double const& yMin( ) const { return min(0); }
-
42  double const& uMin( ) const { return min(1); }
-
43  double const& vMin( ) const { return min(2); }
-
44  double const& yuvMax(size_t i) const { return max(i); }
-
45  double const& yMax( ) const { return max(0); }
-
46  double const& uMax( ) const { return max(1); }
-
47  double const& vMax( ) const { return max(2); }
-
48  double const& yuv(size_t i) const { return val(i); }
-
49  double const& y( ) const { return yuv(0); }
-
50  double const& u( ) const { return yuv(1); }
-
51  double const& v( ) const { return yuv(2); }
-
52  double const& yuv(size_t i, double c) { return val(i, c); }
-
53  double const& y( double c) { return yuv(0, c); }
-
54  double const& u( double c) { return yuv(1, c); }
-
55  double const& v( double c) { return yuv(2, c); }
-
56  double& yuvGet(size_t i) { return valGet(i); }
-
57  double& yGet( ) { return yuvGet(0); }
-
58  double& uGet( ) { return yuvGet(1); }
-
59  double& vGet( ) { return yuvGet(2); }
- -
61  copyFrom(b);
-
62  return *this;
-
63  }
-
64  YUVf_Space operator+(YUVf_Space const& b) const {
-
65  return YUVf_Space(val_ + b.val_);
-
66  }
-
67  YUVf_Space operator-(YUVf_Space const& b) const {
-
68  return YUVf_Space(val_ - b.val_);
-
69  }
-
70  YUVf_Space operator*(double const& c) const {
-
71  return YUVf_Space(val_ * c);
-
72  }
-
73  YUVf_Space operator/(double const& c) const {
-
74  return YUVf_Space(val_ / c);
-
75  }
-
76  double operator*(YUVf_Space const& b) const {
-
77  return val_ * b.val_;
-
78  }
-
79 };
-
80 
-
84 inline void colorTransformate(YUVf_Space const& in, YUVf_Space* out) {
-
85  *out = in;
-
86 }
-
87 
-
91 inline void colorTransformate(RGBf_Space const& rgb, YUVf_Space* yuv) {
-
92  double r = normalize(rgb.rMin(), rgb.rMax(), rgb.r());
-
93  double g = normalize(rgb.gMin(), rgb.gMax(), rgb.g());
-
94  double b = normalize(rgb.bMin(), rgb.bMax(), rgb.b());
-
95  double y = 0.299 * r + 0.587 * g + 0.114 * b;
-
96  double u = -0.169 * r - 0.331 * g + 0.500 * b + 0.5;
-
97  double v = 0.500 * r - 0.419 * g - 0.081 * b + 0.5;
-
98  yuv->y(denormalize(yuv->yMin(), yuv->yMax(), y));
-
99  yuv->u(denormalize(yuv->uMin(), yuv->uMax(), u));
-
100  yuv->v(denormalize(yuv->vMin(), yuv->vMax(), v));
-
101 }
-
102 
-
106 inline void colorTransformate(YUVf_Space const& yuv, RGBf_Space* rgb) {
-
107  double y = normalize(yuv.yMin(),yuv.yMax(),yuv.y());
-
108  double u = normalize(yuv.uMin(),yuv.uMax(),yuv.u());
-
109  double v = normalize(yuv.vMin(),yuv.vMax(),yuv.v());
-
110  double r = y - 0.00093 * (u - 0.5) + 1.401687 * (v - 0.5);
-
111  double g = y - 0.34370 * (u - 0.5) - 0.714170 * (v - 0.5);
-
112  double b = y + 1.77216 * (u - 0.5) - 0.000990 * (v - 0.5);
-
113  rgb->r(denormalize(rgb->rMin(), rgb->rMax(), r));
-
114  rgb->g(denormalize(rgb->gMin(), rgb->gMax(), g));
-
115  rgb->b(denormalize(rgb->bMin(), rgb->bMax(), b));
-
116 }
-
117 
-
121 inline void colorTransformate(RGBi_Space const& rgb, YUVf_Space* yuv) {
-
122  RGBf_Space tmp;
-
123  tmp.copyFrom(rgb);
-
124  colorTransformate(tmp, yuv);
-
125 }
-
126 
-
130 inline void colorTransformate(YUVf_Space const& yuv, RGBi_Space* rgb) {
-
131  RGBf_Space tmp;
-
132  colorTransformate(yuv, &tmp);
-
133  rgb->copyFrom(tmp);
-
134 }
-
135 
-
136 } // meow
-
137 
-
138 #endif // colors_YUV_H__
-
double const & yMax() const
Definition: YUV_Space.h:45
-
T normalize(T lower, T upper, T value)
(value-lower)/(upper-lower)
Definition: utility.h:37
-
double const & rMin() const
Definition: RGB_Space.h:106
-
double const & y() const
Definition: YUV_Space.h:49
- -
double const & v() const
Definition: YUV_Space.h:51
-
YUVf_Space(YUV_Space const &b)
Definition: YUV_Space.h:36
-
以浮點數Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:86
-
double const & u() const
Definition: YUV_Space.h:50
-
doubleconst & min(size_t id) const
Return the minimum of the i -th channel.
Definition: Color3_Space.h:99
-
double const & yuv(size_t i, double c)
Definition: YUV_Space.h:52
-
double const & v(double c)
Definition: YUV_Space.h:55
-
double & yuvGet(size_t i)
Definition: YUV_Space.h:56
-
YUVf_Space & operator=(YUVf_Space const &b)
Definition: YUV_Space.h:60
-
double const & u(double c)
Definition: YUV_Space.h:54
- -
double & valGet(size_t id)
Get the non-constant reference of value of the i -th channel.
Definition: Color3_Space.h:139
-
double & vGet()
Definition: YUV_Space.h:59
-
double const & uMin() const
Definition: YUV_Space.h:42
-
double operator*(YUVf_Space const &b) const
Definition: YUV_Space.h:76
-
T denormalize(T lower, T upper, T _ratio)
(lower+_ratio*(upper-lower))
Definition: utility.h:45
-
void colorTransformate(HSLf_Space const &in, HSLf_Space *out)
HSLf_Space to HSLf_Space
Definition: HSL_Space.h:85
-
double const & r() const
Definition: RGB_Space.h:114
-
doubleconst & max(size_t id) const
Return the maximum of the i -th channel.
Definition: Color3_Space.h:107
-
double & yGet()
Definition: YUV_Space.h:57
-
double const & yMin() const
Definition: YUV_Space.h:41
-
以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
Definition: YUV_Space.h:21
-
Base class of color space with 3 channels.
Definition: Color3_Space.h:18
-
double const & yuvMin(size_t i) const
Definition: YUV_Space.h:40
- -
double & uGet()
Definition: YUV_Space.h:58
-
3D's vector
Definition: Vectors.h:258
-
YUVf_Space operator/(double const &c) const
Definition: YUV_Space.h:73
-
double const & gMin() const
Definition: RGB_Space.h:107
- -
以整數 Red, Green, Blue 三個值所組成的色彩空間
Definition: RGB_Space.h:19
-
YUVf_Space(double c)
Definition: YUV_Space.h:27
-
double const & bMax() const
Definition: RGB_Space.h:112
-
double const & rMax() const
Definition: RGB_Space.h:110
-
YUVf_Space(Vector3D< double > const &v)
Definition: YUV_Space.h:31
-
YUVf_Space operator+(YUVf_Space const &b) const
Definition: YUV_Space.h:64
-
double const & gMax() const
Definition: RGB_Space.h:111
-
double const & b() const
Definition: RGB_Space.h:116
-
YUVf_Space operator*(double const &c) const
Definition: YUV_Space.h:70
-
double const & g() const
Definition: RGB_Space.h:115
-
double const & bMin() const
Definition: RGB_Space.h:108
-
double const & yuv(size_t i) const
Definition: YUV_Space.h:48
-
Color3_Space< double > & copyFrom(Color3_Space< double > const &b)
Copy method.
Definition: Color3_Space.h:54
-
double const & yuvMax(size_t i) const
Definition: YUV_Space.h:44
-
double const & uMax() const
Definition: YUV_Space.h:46
- -
YUVf_Space operator-(YUVf_Space const &b) const
Definition: YUV_Space.h:67
-
doubleconst & val(size_t id) const
Return the value of the i -th channel.
Definition: Color3_Space.h:117
-
Vector3D< double > val_
Definition: Color3_Space.h:22
-
double const & y(double c)
Definition: YUV_Space.h:53
-
double const & vMin() const
Definition: YUV_Space.h:43
-
double const & vMax() const
Definition: YUV_Space.h:47
-
-
- - - - - diff --git a/doc/html/annotated.html b/doc/html/annotated.html index 85e8c82..795bbd3 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -28,7 +28,7 @@ Logo
Templates -- Meow -  1.2.11 +  2.0.-1
A C++ template contains kinds of interesting classes and functions
@@ -59,64 +59,21 @@ $(document).ready(function(){initNavTree('annotated.html','');});
Here are the classes, structs, unions and interfaces with brief descriptions:
-
[detail level 123]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
[detail level 1234]
oNmeow
|oCColor3_SpaceBase class of color space with 3 channels
|oCHSLf_Space以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
|oCHSVf_Space以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
|oCRGBi_Space以整數 Red, Green, Blue 三個值所組成的色彩空間
|oCRGBf_Space以浮點數Red, Green, Blue 三個值所組成的色彩空間
|oCYUVf_Space以浮點數Y(亮度), U(色度), V(濃度) 三個值所組成的色彩空間
|oCBinaryIndexTree極度簡化的 SegmentTree 已無區間更新的操作
|oCDisjointSet用來維護一堆互斥集的資訊
|oCHashTableList一個當key相撞時會用list解決的hash_table
|oCKD_Treek-dimension tree
|oCMergeableHeap一個用 左偏樹 實作的 Maximum-Heap , 除了原本heap有的功能外, 還支援 merge 功能
|oCSegmentTree中文名 線段樹
|oCSplayTree是一種神乎其技的資料結構, 維護一堆 Key->Value . 並且支援 一些 std::map 難以快速實踐的操作, 如 split , merge , keyOffset
||\CElement類似 stliterator ,不過這邊叫做Element
|oCSplayTree_Range基本上跟SplayTree一樣, 不過這邊結合線段樹, 多了區間操作 (線段樹相關operator定義請見 SegmentTree )
||\CElement類似 stliterator ,不過這邊叫做Element
|oCVP_Tree跟KD_Tree很像歐
|oCVector2D2D's vector
|oCVector3D3D's vector
|oCBitmap二維點陣資料
|oCEyesReferenceInfo記住每個 Eye 的reference以及Flag
|oCBundleAdjustment這邊定義Bundle-Adjustment就是利用一系列場景來反推算出相機資訊 (包含拍攝座標, 角度與焦距) 或是在已知相機資訊的情況下推算出底片中 物體如何移動
|oCBundleAdjustment_LM利用 Levenberg-Marquardt Method去推估相機旋轉角度與焦距
|oCCameraCamera
|oCEye一個 Camera 加上一個offset transformation
|oCFeaturePoint特徵點
|oCFeaturePointsDetector
|oCFeaturePointsDetector_HarrisHarris-Corner-Detect algorithm for finding feature points
|oCFeaturePointsMatch
|oCFeaturePointsMatch_K_Match
|oCIdentityPoints把一個 std::map<Identity, Point > 包起來
|oCPhoto底片
|oCViewPort未完待續
|oCWatchBall多個camera, 一個offset, 一個rotation
|oCLinearTransformationA base class for implementing kinds of linear transformations
|oCRotation3DRotation a point/vector alone an axis with given angle in 3D world
|oCMatrixmatrix
|oCTransformationA base class for implementing kinds of transformations
|oCBallProjectionA ball projection is to project the given vector to a hyper-sphere
|oCPhotoProjectionA photo projection is a kind of transformation that project point/vector to a flat photo
|oCVectorvector
|oCObjArray純粹把 std::vector 包起來, 變成繼承自 ObjBase
|oCObjBase一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
|oCObjDictionary純粹把 std::map 包起來, 變成繼承自 ObjBase
|oCObjProperties目前擺爛中
|oCObjSelector利用register的概念, 達到runtime用string選擇要new的class
|oCObjType純粹把給定的 Type 包起來, 變成繼承自 ObjBase
|oCReaderWriter_int
|oCReaderWriter_size_t
|oCReaderWriter_double
|oCReaderWriter_string
|oCSelfFor developer to pack the attributes of a class
|oCUsage管理參數設置, 自訂usage document, 分析argc, argv
|\CPairToPairA structur with memember .from.first , .from.second , .to.first , .to.second
oCFeaturePointDescript
\CObjBase
+ + + + + + + + + + + + + +
\Nmeow
 oNfactory_types
 |oCBaseA base class for kinds of factory classes
 ||\CBaseData
 |oCCheckOff
 |\CCheckOn
 oCFactoryA class which contains input elements, output elements and an operation
 oCObjectThe base class
 oCBaseNumberTypeA class for number base object
 oCBaseFloatingTypeA class for floating-point base object
 oCOperationBase class for operations
 oCPointerA pointer points to the template Type
 oCSelfAn implementation for the reference mechanism
 \CStateThe base class for state
@@ -125,7 +82,7 @@ $(document).ready(function(){initNavTree('annotated.html','');});
-
B | C | D | E | F | H | I | K | L | M | O | P | R | S | T | U | V | W | Y
+
B | C | F | O | P | S
- - - - - - + - - - - - - - - - - - - + + + + +
  B  
-
EyesReferenceInfo (meow)   
  L  
-
Photo (meow)   
  U  
-
  F  
-
PhotoProjection (meow)   
BallProjection (meow)   LinearTransformation (meow)   
  R  
-
Usage (meow)   
BinaryIndexTree (meow)   FeaturePoint (meow)   
  M  
-
  V  
-
Bitmap (meow)   FeaturePointDescript   ReaderWriter_double (meow)   
BundleAdjustment (meow)   FeaturePointsDetector (meow)   Matrix (meow)   ReaderWriter_int (meow)   Vector (meow)   
BundleAdjustment_LM (meow)   FeaturePointsDetector_Harris (meow)   MergeableHeap (meow)   ReaderWriter_size_t (meow)   Vector2D (meow)   
BaseNumberType (meow)   
  F  
+
Operation (meow)   State (meow)   
  C  
-
FeaturePointsMatch (meow)   
  O  
-
ReaderWriter_string (meow)   Vector3D (meow)   
FeaturePointsMatch_K_Match (meow)   RGBf_Space (meow)   ViewPort (meow)   
Camera (meow)   
  H  
-
ObjArray (meow)   RGBi_Space (meow)   VP_Tree (meow)   
Color3_Space (meow)   ObjBase (meow)   Rotation3D (meow)   
  W  
-
  D  
-
HashTableList (meow)   ObjBase   
  S  
-
HSLf_Space (meow)   ObjDictionary (meow)   WatchBall (meow)   
DisjointSet (meow)   HSVf_Space (meow)   ObjProperties (meow)   SegmentTree (meow)   
  Y  
-
  E  
-
  I  
-
ObjSelector (meow)   Self (meow)   
ObjType (meow)   SplayTree (meow)   YUVf_Space (meow)   
SplayTree::Element (meow)   IdentityPoints (meow)   
  P  
-
SplayTree_Range (meow)   
SplayTree_Range::Element (meow)   
  K  
-
  T  
+
  P  
Eye (meow)   PairToPair (meow)   
KD_Tree (meow)   Transformation (meow)   
Base (meow::factory_types)   Factory (meow)   
Base::BaseData (meow::factory_types)   CheckOff (meow::factory_types)   
  O  
+
Pointer (meow)   
BaseFloatingType (meow)   CheckOn (meow::factory_types)   
  S  
+
Object (meow)   
Self (meow)   
-
B | C | D | E | F | H | I | K | L | M | O | P | R | S | T | U | V | W | Y
+
B | C | F | O | P | S
-

For developer to pack the attributes of a class. +

An implementation for the reference mechanism. More...

#include "self.h"

- - - - -

-Public Types

enum  DuplicateType { COPY_FROM, -REFERENCE_FROM - }
 Kind of ways of duplicating. More...
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 Self ()
 constructor with a real entity More...
 
 Self (Data const &d)
 connstructor with a real entity with it using its copy constructor More...
 
 Self (Self const &b, DuplicateType d)
 constructor with given another Self More...
 
 Self (Self const &b)
 Disallow copy constructor. More...
 
 ~Self ()
 destructor More...
 
Data const * operator-> () const
 Return the constant pointer to the data. More...
 
Data * operator-> ()
 Return the non-constant pointer to the data (COR's clone might occure here. More...
 
Selfoperator() () const
 Return the non-constant reference of *this. More...
 
Self const & copyFrom (Self const &s)
 Copy the gived Self to myself. More...
 
Self const & referenceFrom (Self const &s)
 Reference myself from given Self object. More...
 
Self const & duplicateFrom (Self const &s, DuplicateType t)
 call copyFrom() or referenceFrom() depend on your instruction More...
 
bool same (Self const &s) const
 Compare tht if the gived Self object is reference from the same object of me. More...
 
bool equal (Self const &s) const
 Compare that the data are the same. More...
 
bool referenceLess (Self const &s) const
 Order compare by reference pointer. More...
 
void operator= (Self const &a)
 Disallow default 'operator='. More...
 
 Self ()
 Creates a new one. More...
 
 Self (SelfType const &arg_body)
 Creates a new one with specifying a initial value for SelfType object. More...
 
 Self (Self const &arg_another_self)
 References from another one. More...
 
 ~Self ()
 Detatches. More...
 
Self const & ReferenceFrom (Self const &arg_another_self)
 References from another Self object. More...
 
Self const & CopyFrom (Self const &arg_another_self)
 Copies the data in SelfType object from another Self object. More...
 
Self Copy () const
 Creates a copy one of itself. More...
 
bool Is (Self const &arg_another_self) const
 Checks whether the gived instance of Self references from the same SelfType with me or not. More...
 
SelfType * operator-> ()
 Access the instance of SelfType by address. More...
 
SelfType const * operator-> () const
 Access the instance of SelfType by constant address. More...
 
Selfoperator() () const
 Access itself in non-constant mode. More...
 
Selfoperator= (Self const &b)
 Disallows the "operator=" so develops need to explicitly use CopyFrom/RefernceFrom. More...
 

Detailed Description

-

template<class Data>
-class meow::Self< Data >

- -

For developer to pack the attributes of a class.

-

The idaa comes from python. Default C++'s reference machanism is very unflexible because a reference variable can only reference to an object without changing to other object.

-
  With this technique, it can achieve Copy-On-Write(COR) mechanism at
-  background and have a reference mechanism which much more flexible
-  then the one C++ has.
-

Sample code:

-
class A {
-
private:
-
struct Myself {
-
int data;
+

template<typename SelfType>
+class meow::Self< SelfType >

+ +

An implementation for the reference mechanism.

+

Some example code:

+
-
Myself() { // Necessary
-
data = 0;
-
}
+
class A {
+
private:
-
Myself(Myself const& b): data(b.data) { // Necessary, copy constructor
-
}
+
// Data members of this class. You can also move the methods of class A
+
// into this structure if you like.
+
struct DataMember {
+
int var1;
+
int var2;
+
int counter;
-
~Myself() {
-
}
+
// The constructor "Self<DataMember>::Self()" will call the constructor
+
// "DataMember::DataMember()"
+
DataMember() : var1(0), var2(0), counter(0) {}
-
bool operator==(Myself const& b) const { // Optional (this method will
-
// be called only if you use
-
// Self::equal() method)
-
return (data == b.data);
+
// The constructor "Self<DataMember>::Self(DataMember const&)" will call
+
// the constructor "DataMember::DataMember(DataMember const&)"
+
DataMember(DataMember const& b) :
+
var1(b.var1), var2(b.var2), counter(0) {}
+
+
// Customize constructor.
+
DataMember(int var1_init_value) :
+
var1(var1_init_value), var2(0), counter(0) {}
+
+
// Destructor, will be called when nobody references to it.
+
~DataMember() {}
+
+
// The "Self<DataMember>::CopyFrom(Self<DataMember> const&)" will call
+
// "DataMember::CopyFrom(DataMember const&)" to copy data.
+
DataMember const& CopyFrom(DataMember const& b) {
+
var1 = b.var1;
+
var2 = b.var2;
}
};
-
Self<Myself> const self; // Here we use 'constant' data type in
-
// order to have a coutious coding style
-
// and allow the COR mechanism to clone
-
// data only when we really want to
-
// modify them.
-
public:
-
A(): self() { } // Default constructor
+
meow::Self<DataMember> const self_; // Use constant type to reduce the
+
// protential error caused by typing
+
// wrong.
-
A(A const& a): self(a.self, COPY_FROM) { } // Copy constructor. You must
-
// tell me which way of
-
// duplicating should I use.
-
// It strongly recommended you
-
// use COYP_FROM for keeping the
-
// C++'s original behavior.
-
~A() { }
+
public:
-
int getMemember(int wh) const {
-
return self->data; // Use 'operator->()' to get the pointer of the data
-
// The pointer is constant or not will depend on
-
// whether the left side variable of '->' is
-
// constant or not.
-
// If we just want to read the data, use
-
// 'self' instead of 'self()'
-
}
-
void setMemeber(int k) {
-
self()->data = k; // As a result of 'self()' returning a non-constant
-
// reference of itself, here we get the permission
-
// for modiying data.
-
// So now we can observe that if you type
-
// 'Self<Myself> self' instead of the one above,
-
// 'self' and 'self()' will become the same one and
-
// both of them allow you using '->' for getting
-
// writing permission. At the same time, the COR
-
// machanism will become useless because everytime
-
// you want to access the date, Self will copy the
-
// data to prevent you to modify it no matter that
-
// you might just want to read it.
-
}
+
// Here the "Self<DataMember>::Self()" will be called.
+
A() {}
+
+
// Notice! "Self<DataMember>::Self(Self const& another_self)" will let
+
// itself reference to the gived object instead of creating a new one.
+
// So here the copy constructor will not copy from the gived object, it
+
// will just reference from it.
+
A(A const& another_class_a) : self_(another_class_a.self_) {}
+
+
// Customize constructor.
+
A(int var1_init_value) : self_(DataMember(var1_init_value)) {}
+
+
// You don't need to call some extra function in destructor, because
+
// there's a counter in the Self class.
+
~A() {}
-
A referenceFrom(A const& a) {
-
self.referenceFrom(a.self);
+
// A constant method.
+
int GetVar1() const {
+
return self_->var1; // Use the operator "->" to access the address of
+
// the DataMember. Because we declare self_ be a
+
// constant type, here "self_->var1" will also be
+
// a constant.
}
-
A copyFrom(A const& a) {
-
self.copyFrom(a.self);
+
// A non-constant method.
+
void SetVar1(int new_value) {
+
int old_value = self_->var1;
+
self_()->var1 = new_value; // Use operator "()" (i.e. self_()) to
+
// access the object with non-constant type,
+
// so here "self_()->var1" will be a
+
// non-constant variable.
+
if (old_value != new_value) {
+
self_()->var2 = old_value;
+
//self_->var2 = old_value; // !! It cause an error because operator "()"
+
// is missed if you want to modify the member
+
// in the DataMember.
+
}
}
-
A& operator=(A const& b) { // If you really like to use operator=, it
-
// strongly recommended you use 'copyFrom()' for
-
// keeping C++'s original behavior.
- +
int GetVar2() const {
+
self_()->counter += 1; // !! It will not cause an error. Actually,
+
// the "const" keyword of a method will become
+
// more meanless, because inside the method, you
+
// can just use self_-> or self_()-> to determind
+
// whether you want to access the DataMember in
+
// constant mode or not. It might be dangerous
+
// but giving developer more flexable.
+
return self_->var2;
}
};
-

Note that 'referenceFrom()' will cause the two object become the same one, Which means that if you do something like 'a.referenceFrom(b); a.copyFrom(c); ', the result is that the value of a,b,c will all the same one.

-
Author
cathook
-
Warning
This class disabled the method operator= and copy constructor in order to prevent unexplicit default behavior, so if you want to have one of them (or both), you must implement yourself
- -

Definition at line 110 of file self.h.

-

Member Enumeration Documentation

- +
+

Definition at line 117 of file self.h.

+

Constructor & Destructor Documentation

+
-template<class Data>
- - - - -
enum meow::Self::DuplicateType
-
- -

Kind of ways of duplicating.

- - - -
Enumerator
COPY_FROM  -

Normal copy operation.

-
REFERENCE_FROM  -

By reference, much like pointer's copy operation.

-
- -

Definition at line 115 of file self.h.

- -
-
-

Constructor & Destructor Documentation

- -
-
-
-template<class Data>
+template<typename SelfType>
@@ -61,58 +61,15 @@ $(document).ready(function(){initNavTree('files.html','');});
Here is a list of all files with brief descriptions:
[detail level 123]
- + @@ -266,26 +231,26 @@ template<class Data>
meow::Self< Data >::Self meow::Self< SelfType >::Self ( )
-

constructor with a real entity

+

Creates a new one.

-

Definition at line 210 of file self.h.

+

Definition at line 152 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
- + - - + +
meow::Self< Data >::Self meow::Self< SelfType >::Self (Data const & d)SelfType const & arg_body)
@@ -296,43 +261,33 @@ template<class Data>
-

connstructor with a real entity with it using its copy constructor

+

Creates a new one with specifying a initial value for SelfType object.

Parameters
- +
[in]dInital data
arg_bodyThe initial value of the SelfType object.
-

Definition at line 218 of file self.h.

+

Definition at line 159 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
@@ -342,50 +297,29 @@ template<class Data>
- + - - - - - - - - - - + + - -
meow::Self< Data >::Self meow::Self< SelfType >::Self (Self< Data > const & b,
DuplicateType d 
Self< SelfType > const & arg_another_self) )
-

constructor with given another Self

+

References from another one.

Parameters
- - +
[in]bAnother Self object.
[in]dTo indicate type of way of duplicating
arg_another_selfAnother Self object.
-

Definition at line 227 of file self.h.

+

Definition at line 166 of file self.h.

- +
-template<class Data>
- - - - - - - - -
meow::Self< Data >::Self (Self< Data > const & b)
-
- -

Disallow copy constructor.

- -
-
- -
-
-
-template<class Data>
+template<typename SelfType>
- + @@ -398,28 +332,28 @@ template<class Data>
meow::Self< Data >::~Self meow::Self< SelfType >::~Self ( )
-

destructor

+

Detatches.

+

It will automatically clear the SelfType object when no one refernece from it.

-

Definition at line 243 of file self.h.

+

Definition at line 174 of file self.h.

Member Function Documentation

- +
-template<class Data>
+template<typename SelfType>
@@ -429,44 +363,27 @@ template<class Data>
- + - - - + +
Self const& meow::Self< Data >::copyFrom Self meow::Self< SelfType >::Copy (Self< Data > const & s)) const
-

Copy the gived Self to myself.

-
Parameters
- - -
[in]sgived Self
-
-
-
Returns
*this
+

Creates a copy one of itself.

-

Definition at line 270 of file self.h.

+

Definition at line 198 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
@@ -476,34 +393,32 @@ template<class Data>
- + - - - - - - - - - - + + - -
Self const& meow::Self< Data >::duplicateFrom Self const& meow::Self< SelfType >::CopyFrom (Self< Data > const & s,
DuplicateType t 
Self< SelfType > const & arg_another_self) )
-

call copyFrom() or referenceFrom() depend on your instruction

+

Copies the data in SelfType object from another Self object.

Parameters
- - +
[in]sgived Self object
[in]tinstruction
arg_another_selfAnother Self object.
-
Returns
*this
-

Definition at line 299 of file self.h.

+

Definition at line 190 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
- + - - + +
bool meow::Self< Data >::equal bool meow::Self< SelfType >::Is (Self< Data > const & s)Self< SelfType > const & arg_another_self) const
@@ -514,31 +429,30 @@ template<class Data>
-

Compare that the data are the same.

+

Checks whether the gived instance of Self references from the same SelfType with me or not.

Parameters
- +
[in]sanother Self object
arg_another_selfAnother instance of Self.
-
Returns
true if the data are same.
-
Note
This will need the method 'Data::equal()'
+
Returns
true if we references from the same thing.
-

Definition at line 326 of file self.h.

+

Definition at line 206 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
@@ -61,26 +61,9 @@ $(document).ready(function(){initNavTree('dir_92fecd8d02dd5e7a67429447fdf0f60f.h
- + @@ -551,26 +465,26 @@ template<class Data>
Self& meow::Self< Data >::operator() Self& meow::Self< SelfType >::operator() ( ) const
-

Return the non-constant reference of *this.

+

Access itself in non-constant mode.

-

Definition at line 260 of file self.h.

+

Definition at line 227 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
@@ -580,26 +494,26 @@ template<class Data>
- + - +
Data const* meow::Self< Data >::operator-> SelfType* meow::Self< SelfType >::operator-> ( ) const
-

Return the constant pointer to the data.

+

Access the instance of SelfType by address.

-

Definition at line 248 of file self.h.

+

Definition at line 213 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
@@ -609,46 +523,46 @@ template<class Data>
- + - +
Data* meow::Self< Data >::operator-> SelfType const* meow::Self< SelfType >::operator-> ( ) const
-

Return the non-constant pointer to the data (COR's clone might occure here.

+

Access the instance of SelfType by constant address.

-

Definition at line 255 of file self.h.

+

Definition at line 220 of file self.h.

- +
-template<class Data>
+template<typename SelfType>
- + - - + +
void meow::Self< Data >::operator= Self& meow::Self< SelfType >::operator= (Self< Data > const & a)Self< SelfType > const & b)
-

Disallow default 'operator='.

+

Disallows the "operator=" so develops need to explicitly use CopyFrom/RefernceFrom.

- +
-template<class Data>
+template<typename SelfType>
- + - - + +
Self const& meow::Self< Data >::referenceFrom Self const& meow::Self< SelfType >::ReferenceFrom (Self< Data > const & s)Self< SelfType > const & arg_another_self)
@@ -659,94 +573,20 @@ template<class Data>
-

Reference myself from given Self object.

-
Parameters
- - -
[in]sgiven Self
-
-
-
Returns
*this
- -

Definition at line 283 of file self.h.

- -
- - -
-
-
-template<class Data>
- - - - - -
- - - - - - - - -
bool meow::Self< Data >::referenceLess (Self< Data > const & s) const
-
-inline
-
- -

Order compare by reference pointer.

-
Parameters
- - -
[in]sanother Self object
-
-
- -

Definition at line 336 of file self.h.

- -
-
- -
-
-
-template<class Data>
- - - - - -
- - - - - - - - -
bool meow::Self< Data >::same (Self< Data > const & s) const
-
-inline
-
- -

Compare tht if the gived Self object is reference from the same object of me.

+

References from another Self object.

Parameters
- +
[in]sgived Self object
arg_another_selfAnother Self object.
-
Returns
true if we are referenced to the same object.
-

Definition at line 314 of file self.h.

+

Definition at line 180 of file self.h.


The documentation for this class was generated from the following file:
    -
  • meowpp/self.h
  • +
  • /home/cathook/Projects/template_meow/meowpp/utility/self.h
@@ -755,7 +595,7 @@ template<class Data>
Templates -- Meow -  1.2.11 +  2.0.-1
A C++ template contains kinds of interesting classes and functions
- + - - - - - - - - - - -

Directories

directory  colors
directory  debug
 
directory  dsa
 
directory  geo
 
directory  gra
 
directory  math
 
directory  oo
 
- - - - - - +

-Files

file  self.h [code]
 
file  Usage.h [code]
 
file  utility.h [code]
directory  utility
 
@@ -90,7 +73,7 @@ Files
- - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - - -
- -
-
-
- -
-
-
-
dsa Directory Reference
-
-
- - - - - - - - - - - - - - - - - - -

-Files

file  BinaryIndexTree.h [code]
 
file  DisjointSet.h [code]
 
file  HashTable.h [code]
 
file  KD_Tree.h [code]
 
file  MergeableHeap.h [code]
 
file  SegmentTree.h [code]
 
file  SplayTree.h [code]
 
file  VP_Tree.h [code]
 
-
-
- - - - - diff --git a/doc/html/dir_a17ff8dcb3a1c1b842af541700214096.js b/doc/html/dir_a17ff8dcb3a1c1b842af541700214096.js deleted file mode 100644 index dc82726..0000000 --- a/doc/html/dir_a17ff8dcb3a1c1b842af541700214096.js +++ /dev/null @@ -1,30 +0,0 @@ -var dir_a17ff8dcb3a1c1b842af541700214096 = -[ - [ "BinaryIndexTree.h", "BinaryIndexTree_8h.html", [ - [ "BinaryIndexTree", "classmeow_1_1BinaryIndexTree.html", "classmeow_1_1BinaryIndexTree" ] - ] ], - [ "DisjointSet.h", "DisjointSet_8h.html", [ - [ "DisjointSet", "classmeow_1_1DisjointSet.html", "classmeow_1_1DisjointSet" ] - ] ], - [ "HashTable.h", "HashTable_8h.html", [ - [ "HashTableList", "classmeow_1_1HashTableList.html", "classmeow_1_1HashTableList" ] - ] ], - [ "KD_Tree.h", "KD__Tree_8h.html", [ - [ "KD_Tree", "classmeow_1_1KD__Tree.html", "classmeow_1_1KD__Tree" ] - ] ], - [ "MergeableHeap.h", "MergeableHeap_8h.html", [ - [ "MergeableHeap", "classmeow_1_1MergeableHeap.html", "classmeow_1_1MergeableHeap" ] - ] ], - [ "SegmentTree.h", "SegmentTree_8h.html", [ - [ "SegmentTree", "classmeow_1_1SegmentTree.html", "classmeow_1_1SegmentTree" ] - ] ], - [ "SplayTree.h", "SplayTree_8h.html", [ - [ "SplayTree", "classmeow_1_1SplayTree.html", "classmeow_1_1SplayTree" ], - [ "Element", "classmeow_1_1SplayTree_1_1Element.html", "classmeow_1_1SplayTree_1_1Element" ], - [ "SplayTree_Range", "classmeow_1_1SplayTree__Range.html", "classmeow_1_1SplayTree__Range" ], - [ "Element", "classmeow_1_1SplayTree__Range_1_1Element.html", "classmeow_1_1SplayTree__Range_1_1Element" ] - ] ], - [ "VP_Tree.h", "VP__Tree_8h.html", [ - [ "VP_Tree", "classmeow_1_1VP__Tree.html", "classmeow_1_1VP__Tree" ] - ] ] -]; \ No newline at end of file diff --git a/doc/html/dir_a57e9e528cb28fd6752031b735908fb6.html b/doc/html/dir_a57e9e528cb28fd6752031b735908fb6.html deleted file mode 100644 index 6b65515..0000000 --- a/doc/html/dir_a57e9e528cb28fd6752031b735908fb6.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/geo Directory Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
geo Directory Reference
-
-
- - - - -

-Files

file  Vectors.h [code]
 
-
-
- - - - - diff --git a/doc/html/dir_a57e9e528cb28fd6752031b735908fb6.js b/doc/html/dir_a57e9e528cb28fd6752031b735908fb6.js deleted file mode 100644 index 25539fc..0000000 --- a/doc/html/dir_a57e9e528cb28fd6752031b735908fb6.js +++ /dev/null @@ -1,7 +0,0 @@ -var dir_a57e9e528cb28fd6752031b735908fb6 = -[ - [ "Vectors.h", "Vectors_8h.html", [ - [ "Vector2D", "classmeow_1_1Vector2D.html", "classmeow_1_1Vector2D" ], - [ "Vector3D", "classmeow_1_1Vector3D.html", "classmeow_1_1Vector3D" ] - ] ] -]; \ No newline at end of file diff --git a/doc/html/dir_f6840b2fecd08a3779df34f0add0e074.html b/doc/html/dir_f6840b2fecd08a3779df34f0add0e074.html deleted file mode 100644 index 9dc0ddd..0000000 --- a/doc/html/dir_f6840b2fecd08a3779df34f0add0e074.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - -Templates -- Meow: meowpp/colors Directory Reference - - - - - - - - - - - -
-
- - - - - - - -
-
Templates -- Meow -  1.2.11 -
-
A C++ template contains kinds of interesting classes and functions
-
-
- - -
-
- -
-
-
- -
-
-
-
colors Directory Reference
-
-
- - - - - - - - - - - - -

-Files

file  Color3_Space.h [code]
 
file  HSL_Space.h [code]
 
file  HSV_Space.h [code]
 
file  RGB_Space.h [code]
 
file  YUV_Space.h [code]
 
-
-
- - - - - diff --git a/doc/html/dir_f6840b2fecd08a3779df34f0add0e074.js b/doc/html/dir_f6840b2fecd08a3779df34f0add0e074.js deleted file mode 100644 index 40d7bf0..0000000 --- a/doc/html/dir_f6840b2fecd08a3779df34f0add0e074.js +++ /dev/null @@ -1,10 +0,0 @@ -var dir_f6840b2fecd08a3779df34f0add0e074 = -[ - [ "Color3_Space.h", "Color3__Space_8h.html", [ - [ "Color3_Space", "classmeow_1_1Color3__Space.html", "classmeow_1_1Color3__Space" ] - ] ], - [ "HSL_Space.h", "HSL__Space_8h.html", "HSL__Space_8h" ], - [ "HSV_Space.h", "HSV__Space_8h.html", "HSV__Space_8h" ], - [ "RGB_Space.h", "RGB__Space_8h.html", "RGB__Space_8h" ], - [ "YUV_Space.h", "YUV__Space_8h.html", "YUV__Space_8h" ] -]; \ No newline at end of file diff --git a/doc/html/factory_8h.html b/doc/html/factory_8h.html new file mode 100644 index 0000000..d94d305 --- /dev/null +++ b/doc/html/factory_8h.html @@ -0,0 +1,114 @@ + + + + + + + +Templates -- Meow: /home/cathook/Projects/template_meow/meowpp/utility/factory.h File Reference + + + + + + + + + + + +
+
+ + + + + + + +
+
Templates -- Meow +  2.0.-1 +
+
A C++ template contains kinds of interesting classes and functions
+
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
factory.h File Reference
+
+
+ +

Contains a base class for a factory. +More...

+
#include "operation.h"
+#include "pointer.h"
+#include "self.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + +

+Classes

class  meow::factory_types::Base
 A base class for kinds of factory classes. More...
 
struct  meow::factory_types::Base::BaseData
 
class  meow::factory_types::CheckOff
 
class  meow::factory_types::CheckOn
 
class  meow::Factory
 A class which contains input elements, output elements and an operation. More...
 
+ + + + + +

+Namespaces

 meow
 
 meow::factory_types
 
+

Detailed Description

+

Contains a base class for a factory.

+

A factory contains an array of inputs, an array of outputs and an operation. You can update some elements in the array of inputs and then call Factory::Update() to update the outputs (it will run the operation only if some input elements are changed since last update).

+
Author
cathook
+ +

Definition in file factory.h.

+
+
+ + + + + diff --git a/doc/html/factory_8h_source.html b/doc/html/factory_8h_source.html new file mode 100644 index 0000000..500a4ad --- /dev/null +++ b/doc/html/factory_8h_source.html @@ -0,0 +1,371 @@ + + + + + + + +Templates -- Meow: /home/cathook/Projects/template_meow/meowpp/utility/factory.h Source File + + + + + + + + + + + +
+
+ + + + + + + +
+
Templates -- Meow +  2.0.-1 +
+
A C++ template contains kinds of interesting classes and functions
+
+
+ + +
+
+ +
+
+
+ +
+
+
+
factory.h
+
+
+Go to the documentation of this file.
1 
+
13 #ifndef __MEOWPP_UTILITY_FACTORY_H__
+
14 #define __MEOWPP_UTILITY_FACTORY_H__
+
15 
+
16 #include "operation.h"
+
17 #include "pointer.h"
+
18 #include "self.h"
+
19 
+
20 
+
21 namespace meow {
+
22 
+
23 namespace factory_types {
+
24 
+
25 
+
29 class Base {
+
30  protected:
+
31  struct BaseData {
+ + + +
35 
+ +
39 
+ +
43 
+ +
53  Pointer<Pointer<Object const>> const& arg_inputs,
+
54  Pointer<Pointer<Object>> const& arg_outputs):
+
55  oper(arg_oper),
+
56  inputs(arg_inputs),
+
57  outputs(arg_outputs),
+
58  non_const_inputs(new Pointer<Object>[oper->inputs_size()], ARRAY, true),
+ +
60  new Pointer<Object const>[oper->outputs_size()], ARRAY, true) {
+
61  for (int i = 0, i_max = oper->inputs_size(); i < i_max; ++i) {
+ +
63  const_cast<Object*>(inputs[i].address()), SINGLE, false);
+
64  }
+
65  for (int i = 0, i_max = oper->outputs_size(); i < i_max; ++i) {
+ +
67  outputs[i].address(), SINGLE, false);
+
68  }
+
69  };
+
70  };
+
71 
+
72  Base() {}
+
73 
+
74  public:
+
75  virtual ~Base() {}
+
76 
+
80  virtual State Update() const = 0;
+
81 
+
89  virtual bool HasRedo() const = 0;
+
90 
+
94  virtual Pointer<Operation const> operation() const = 0;
+
95 
+
99  virtual Pointer<Pointer<Object>> inputs() const = 0;
+
100 
+
104  virtual Pointer<Pointer<Object const>> outputs() const = 0;
+
105 };
+
106 
+
107 
+
114 class CheckOff : public Base {
+
115  private:
+
116  struct Data : Base::BaseData {
+
117  Data(Pointer<Operation const> const& arg_oper,
+
118  Pointer<Pointer<Object const>> const& arg_inputs,
+
119  Pointer<Pointer<Object>> const& arg_outputs) :
+
120  BaseData(arg_oper, arg_inputs, arg_outputs) {}
+
121  };
+
122 
+
123  Self<Data> const self_;
+
124 
+
125  public:
+
126 
+ +
136  Pointer<Pointer<Object const>> const& arg_inputs,
+
137  Pointer<Pointer<Object>> const& arg_outputs) :
+
138  self_(Data(arg_oper, arg_inputs, arg_outputs)) {}
+
139 
+
143  State Update() const {
+
144  return self_->oper->Operate(self_->inputs, self_->outputs);
+
145  }
+
146 
+
150  bool HasRedo() const {
+
151  return true;
+
152  }
+
153 
+ +
158  return self_->oper;
+
159  }
+
160 
+ +
165  return self_->non_const_inputs;
+
166  }
+
167 
+ +
172  return self_->const_outputs;
+
173  }
+
174 
+
175 };
+
176 
+
177 
+
184 class CheckOn : public Base {
+
185  private:
+
186  struct Data : Base::BaseData {
+
189  Pointer<Pointer<Object>> old_inputs;
+
190 
+
192  State last_state;
+
193 
+
195  bool has_redo;
+
196 
+
198  bool first_time;
+
199 
+
200  Data(Pointer<Operation const> const& arg_oper,
+
201  Pointer<Pointer<Object const>> const& arg_inputs,
+
202  Pointer<Pointer<Object>> const& arg_outputs) :
+
203  BaseData(arg_oper, arg_inputs, arg_outputs),
+
204  old_inputs(new Pointer<Object>[oper->inputs_size()], ARRAY, true),
+
205  has_redo(false),
+
206  first_time(true) {
+
207  for (int i = 0, i_max = oper->inputs_size(); i < i_max; ++i) {
+
208  old_inputs[i] = Pointer<Object>(inputs[i]->Copy(), SINGLE, true);
+
209  }
+
210  }
+
211  };
+
212 
+
213  Self<Data> const self_;
+
214 
+
215  public:
+
216 
+ +
226  Pointer<Pointer<Object const>> const& arg_inputs,
+
227  Pointer<Pointer<Object>> const& arg_outputs) :
+
228  self_(Data(arg_oper, arg_inputs, arg_outputs)) {}
+
229 
+
235  State Update() const {
+
236  bool needs_to_update = self_->first_time;
+
237  if (!needs_to_update) {
+
238  for (int i = 0, i_max = self_->oper->inputs_size(); i < i_max; ++i) {
+
239  Object const* old = self_->old_inputs[i].address();
+
240  Object const* cur = self_->inputs[i].address();
+
241  if (!old->Equals(cur)) {
+
242  needs_to_update = true;
+
243  break;
+
244  }
+
245  }
+
246  }
+
247  if (!needs_to_update) {
+
248  self_()->has_redo = false;
+
249  } else {
+
250  for (int i = 0, i_max = self_->oper->inputs_size(); i < i_max; ++i) {
+
251  Object* old = self_->old_inputs[i].address();
+
252  Object const* cur = self_->inputs[i].address();
+
253  old->CopyFrom(cur);
+
254  }
+
255  self_()->last_state = self_->oper->Operate(self_->inputs, self_->outputs);
+
256  self_()->has_redo = true;
+
257  }
+
258  self_()->first_time = false;
+
259  return self_->last_state;
+
260  }
+
261 
+
268  bool HasRedo() const {
+
269  return self_->has_redo;
+
270  }
+
271 
+ +
276  return self_->oper;
+
277  }
+
278 
+ +
283  return self_->non_const_inputs;
+
284  }
+
285 
+ +
290  return self_->const_outputs;
+
291  }
+
292 
+
293 };
+
294 
+
295 } // factory_types
+
296 
+
297 
+
302 class Factory : public Object {
+
303  private:
+
304 
+ +
306 
+
307  public:
+
308 
+ +
313  Pointer<Pointer<Object const>> const& arg_inputs,
+
314  Pointer<Pointer<Object>> const& arg_outputs,
+
315  bool arg_check_before_update) {
+
316  if (arg_check_before_update) {
+
317  factory_ = Pointer<factory_types::Base>(
+ +
319  arg_oper, arg_inputs, arg_outputs), SINGLE, true);
+
320  } else {
+
321  factory_ = Pointer<factory_types::Base>(
+ +
323  arg_oper, arg_inputs, arg_outputs), SINGLE, true);
+
324  }
+
325  }
+
326 
+
330  State Update() const {
+
331  return factory_->Update();
+
332  }
+
333 
+
338  bool HasRedo() const {
+
339  return factory_->HasRedo();
+
340  }
+
341 
+ +
346  return factory_->operation();
+
347  }
+
348 
+ +
353  return factory_->inputs();
+
354  }
+
355 
+ +
360  return factory_->outputs();
+
361  }
+
362 
+
363  Object* Copy() const {
+
364  return NULL;
+
365  }
+
366 
+
367  Object* CopyFrom(Object const* another_factory) {
+
368  return NULL;
+
369  }
+
370 
+
371  bool Equals(Object const* another_factory) {
+
372  return false;
+
373  }
+
374 
+
375 #ifdef MEOWPP_UTILITY_FACTORY_TESTING
+
376  friend class FactoryTest;
+
377 #endif
+
378 
+
379 };
+
380 
+
381 } // meow
+
382 
+
383 #endif // __MEOWPP_UTILITY_FACTORY_H__
+
A pointer points to the template Type.
Definition: pointer.h:33
+
State Update() const
Updates the output elements.
Definition: factory.h:330
+ +
Pointer< Operation const > oper
Definition: factory.h:32
+
bool HasRedo() const
It will always return true.
Definition: factory.h:150
+ +
Factory(Pointer< Operation const > const &arg_oper, Pointer< Pointer< Object const >> const &arg_inputs, Pointer< Pointer< Object >> const &arg_outputs, bool arg_check_before_update)
Constructor.
Definition: factory.h:312
+
Pointer< Pointer< Object > > inputs() const
Gets the array of the input elements.
Definition: factory.h:282
+
bool HasRedo() const
Returns whether the output elements have been re-generated by running the operation again...
Definition: factory.h:268
+
Pointer< Pointer< Object > > non_const_inputs
Definition: factory.h:38
+
CheckOff(Pointer< Operation const > const &arg_oper, Pointer< Pointer< Object const >> const &arg_inputs, Pointer< Pointer< Object >> const &arg_outputs)
Constructor.
Definition: factory.h:135
+
Pointer< Pointer< Object const > > outputs() const
Gets the array of the output elements.
Definition: factory.h:359
+
virtual State Update() const =0
Updates the output elements by re-run the operation.
+
BaseData(Pointer< Operation const > const &arg_oper, Pointer< Pointer< Object const >> const &arg_inputs, Pointer< Pointer< Object >> const &arg_outputs)
Constructor.
Definition: factory.h:52
+
virtual Pointer< Operation const > operation() const
Gets the operation.
Definition: factory.h:157
+
bool Equals(Object const *another_factory)
Definition: factory.h:371
+ +
Contains a class for implementing a reference mechanism which allows variables referencing to another...
+
Pointer< Pointer< Object > > inputs() const
Gets the array of the input elements.
Definition: factory.h:352
+
Pointer< Pointer< Object const > > inputs
Definition: factory.h:33
+
Object * Copy() const
Creates a copy of itself and return the pointer to it.
Definition: factory.h:363
+
Object * CopyFrom(Object const *another_factory)
Copies data from another object.
Definition: factory.h:367
+ +
virtual bool Equals(Object const *ptr) const
Returns whether it equals to another object or not.
Definition: object.h:60
+
Pointer< Operation const > operation() const
Gets the operation.
Definition: factory.h:345
+
The base class.
Definition: object.h:20
+
A class which contains input elements, output elements and an operation.
Definition: factory.h:302
+ +
virtual Object * CopyFrom(Object const *ptr)
Copies data from another object.
Definition: object.h:52
+ +
State Update() const
Updates the output elements by running the operation.
Definition: factory.h:143
+
virtual Pointer< Pointer< Object > > inputs() const =0
Gets the pointer points to the array of input elements.
+
virtual bool HasRedo() const =0
Returns whether the last time calling Update() did update really or not.
+
virtual Pointer< Operation const > operation() const
Gets the operation.
Definition: factory.h:275
+
Pointer< Pointer< Object > > inputs() const
Gets the pointer points to the array of input elements.
Definition: factory.h:164
+
Pointer< Pointer< Object const > > outputs() const
Gets the array of the output elements.
Definition: factory.h:289
+
virtual Pointer< Operation const > operation() const =0
Gets the operation.
+
Pointer< Pointer< Object const > > const_outputs
Definition: factory.h:42
+
State Update() const
Updates the output elements if needs.
Definition: factory.h:235
+
Contains a base class for most of all operations in meowpp.
+
bool HasRedo() const
Returns whether the output elements have been re-generated by running the operation again...
Definition: factory.h:338
+
A base class for kinds of factory classes.
Definition: factory.h:29
+
virtual Pointer< Pointer< Object const > > outputs() const =0
Gets the pointer points to the array of output elements.
+ +
CheckOn(Pointer< Operation const > const &arg_oper, Pointer< Pointer< Object const >> const &arg_inputs, Pointer< Pointer< Object >> const &arg_outputs)
Constructor.
Definition: factory.h:225
+ +
Pointer< Pointer< Object const > > outputs() const
Gets the pointer points to the array of output elements.
Definition: factory.h:171
+
Contains a pointer class which has a counter-mechanism to prevent memory leak.
+
The base class for state.
Definition: state.h:51
+
Pointer< Pointer< Object > > outputs
Definition: factory.h:34
+
+
+ + + + + diff --git a/doc/html/files.html b/doc/html/files.html index 7c40181..f6cb1a7 100644 --- a/doc/html/files.html +++ b/doc/html/files.html @@ -28,7 +28,7 @@
Templates -- Meow -  1.2.11 +  2.0.-1
A C++ template contains kinds of interesting classes and functions
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +
\-meowpp
 o-colors
 |o*Color3_Space.h
 |o*HSL_Space.h
 |o*HSV_Space.h
 |o*RGB_Space.h
 |\*YUV_Space.h
 o-dsa
 |o*BinaryIndexTree.h
 |o*DisjointSet.h
 |o*HashTable.h
 |o*KD_Tree.h
 |o*MergeableHeap.h
 |o*SegmentTree.h
 |o*SplayTree.h
 |\*VP_Tree.h
 o-geo
 |\*Vectors.h
 o-gra
 |o*Bitmap.h
 |o*BitmapDescript.h
 |o*BundleAdjustment.h
 |o*BundleAdjustment_LM.h
 |o*Camera.h
 |o*Eye.h
 |o*FeaturePoint.h
 |o*FeaturePointsDetector.h
 |o*FeaturePointsDetector_Harris.h
 |o*FeaturePointsMatch.h
 |o*FeaturePointsMatch_K_Match.h
 |o*IdentityPoints.h
 |o*Photo.h
 |o*ViewPort.h
 |\*WatchBall.h
 o-math
 |o*LinearTransformation.h
 |o*LinearTransformations.h
 |o*Matrix.h
 |o*methods.h
 |o*Transformation.h
 |o*Transformations.h
 |o*utility.h
 |\*Vector.h
 o-oo
 |o*ObjArray.h
 |o*ObjBase.h
 |o*ObjDictionary.h
 |o*ObjProperties.h
 |o*ObjSelector.h
 |\*ObjTypes.h
 o*self.h
 o*Usage.h
 \*utility.h
 o-debug
 |\*assert.hContains assert macro for meowpp's debugging tools
 \-utility
  o*factory.hContains a base class for a factory
  o*object.hContains a base class for most of all the classes in meowpp
  o*operation.hContains a base class for most of all operations in meowpp
  o*pointer.hContains a pointer class which has a counter-mechanism to prevent memory leak
  o*self.hContains a class for implementing a reference mechanism which allows variables referencing to another object anytime
  \*state.hContains a base class for a state (in meowpp, most of all the return value of a function (or to say, an "operation") will be a state)
@@ -121,7 +78,7 @@ $(document).ready(function(){initNavTree('files.html','');}); @@ -97,7 +320,7 @@ $(document).ready(function(){initNavTree('functions.html','');}); @@ -97,7 +305,7 @@ $(document).ready(function(){initNavTree('functions_func.html','');});