diff --git a/.gitignore b/.gitignore index ba74660..dd158e4 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ docs/_build/ # PyBuilder target/ + +#IntelliJ Files +*.idea diff --git a/.idea/dictionaries/Peter.xml b/.idea/dictionaries/Peter.xml new file mode 100644 index 0000000..4be2402 --- /dev/null +++ b/.idea/dictionaries/Peter.xml @@ -0,0 +1,7 @@ + + + + zaffetti + + + \ No newline at end of file diff --git a/curves/Hulls_Trefoil_2017_09_03.curve b/curves/Hulls_Trefoil_2017_09_03.curve new file mode 100644 index 0000000..31ea6a2 --- /dev/null +++ b/curves/Hulls_Trefoil_2017_09_03.curve @@ -0,0 +1,8 @@ +% Original Trefoil Control Points +0, 4831838208, 10737418240 +-8053063680, -51002736640, -26843545600 +21474836480, 42949672960, -10737418240 +5368709120, -32212254720, 31138512896 +-32212254720, 16106127360, 10737418240 +21474836480, -32212254720, -32212254720 +0, 4831838208, 10737418240 \ No newline at end of file diff --git a/curves/Hulls_Trefoil_2017_09_03.txt b/curves/Hulls_Trefoil_2017_09_03.txt new file mode 100644 index 0000000..0c81124 --- /dev/null +++ b/curves/Hulls_Trefoil_2017_09_03.txt @@ -0,0 +1,407 @@ +(*Original Trefoil Control Points*) +VT0s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -8053063680, -51002736640,-26843545600 }, +{ 21474836480, 42949672960,-10737418240 }, +{ 5368709120, -32212254720,31138512896 }, +{ -32212254720, 16106127360,10737418240 }, +{ 21474836480, -32212254720,-32212254720 }, +{ 0, 4831838208,10737418240 } +} + + +(*Subdivision 1 *) +VT1s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -4026531840, -23085449216,-8053063680 }, +{ 1342177280, -13555990528,-13421772800 }, +{ 5704253440, -6442450944,-8858370048 }, +{ 5368709120, -3388997632,-1610612736 }, +{ 2768240640, -2952790016,3187671040 }, +{ 419430400, -3875536896,4529848320 } +} +(* Monotonicity VT l:1 h:0 = NONE *) +(* 2D Convexity VT l:1 h:0 = 0 *) + +VT1s1 = +{ +{ 419430400, -3875536896,4529848320 }, +{ -1929379840, -4798283776,5872025600 }, +{ -4026531840, -7079985152,3758096384 }, +{ -3355443200, -9462349824,-2818572288 }, +{ 2684354560, -10871635968,-10737418240 }, +{ 10737418240, -13690208256,-10737418240 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VT l:1 h:1 = NONE *) +(* 2D Convexity VT l:1 h:1 = 0 *) + +(*Subdivision 2 *) +VT2s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -2013265920, -9126805504,1342177280 }, +{ -1677721600, -13723762688,-4697620480 }, +{ -293601280, -13941866496,-7818182656 }, +{ 1258291200, -12375293952,-8690597888 }, +{ 2498232320, -10327425024,-8037335040 }, +{ 3244032000, -8410890240,-6509035520 } +} +(* Monotonicity VT l:2 h:0 = NONE *) +(* 2D Convexity VT l:2 h:0 = 1 *) + +VT2s1 = +{ +{ 3244032000, -8410890240,-6509035520 }, +{ 3989831680, -6494355456,-4980736000 }, +{ 4241489920, -4709154816,-2577399808 }, +{ 3816816640, -3667918848,50331648 }, +{ 2831155200, -3292528640,2323644416 }, +{ 1593835520, -3414163456,3858759680 }, +{ 419430400, -3875536896,4529848320 } +} +(* Monotonicity VT l:2 h:1 = Z *) +(* 2D Convexity VT l:2 h:1 = 1 *) + +VT2s2 = +{ +{ 419430400, -3875536896,4529848320 }, +{ -754974720, -4336910336,5200936960 }, +{ -1866465280, -5138022400,5007998976 }, +{ -2600468480, -6121586688,3825205248 }, +{ -2637168640, -7141851136,1784676352 }, +{ -1840250880, -8166834176,-660602880 }, +{ -530841600, -8882749440,-2734161920 } +} +(* Monotonicity VT l:2 h:2 = Y *) +(* 2D Convexity VT l:2 h:2 = 1 *) + +VT2s3 = +{ +{ -530841600, -8882749440,-2734161920 }, +{ 778567680, -9598664704,-4807720960 }, +{ 2600468480, -10005512192,-6509559808 }, +{ 4613734400, -9789505536,-7063207936 }, +{ 6039797760, -8355053568,-5368709120 }, +{ 5368709120, -4429185024,0 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VT l:2 h:3 = NONE *) +(* 2D Convexity VT l:2 h:3 = 1 *) + +(*Subdivision 3 *) +VT3s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -1006632960, -2147483648,6039797760 }, +{ -1426063360, -6786383872,2181038080 }, +{ -1420820480, -9707716608,-893386752 }, +{ -1127219200, -11385044992,-3252682752 }, +{ -655933440, -12176949248,-4975001600 }, +{ -93900800, -12353556480,-6142648320 } +} +(* Monotonicity VT l:3 h:0 = YZ *) +(* 2D Convexity VT l:3 h:0 = 1 *) + +VT3s1 = +{ +{ -93900800, -12353556480,-6142648320 }, +{ 468131840, -12530163712,-7310295040 }, +{ 1120911360, -12091473920,-7923269632 }, +{ 1777500160, -11307614208,-8063877120 }, +{ 2374696960, -10360258560,-7818575872 }, +{ 2871132160, -9369157632,-7273185280 }, +{ 3244032000, -8410890240,-6509035520 } +} +(* Monotonicity VT l:3 h:1 = X *) +(* 2D Convexity VT l:3 h:1 = 1 *) + +VT3s2 = +{ +{ 3244032000, -8410890240,-6509035520 }, +{ 3616931840, -7452622848,-5744885760 }, +{ 3866296320, -6527188992,-4761976832 }, +{ 3969351680, -5711167488,-3641638912 }, +{ 3921920000, -5037965312,-2460712960 }, +{ 3735183360, -4516569088,-1287700480 }, +{ 3431116800, -4142518272,-179855360 } +} +(* Monotonicity VT l:3 h:2 = YZ *) +(* 2D Convexity VT l:3 h:2 = 1 *) + +VT3s3 = +{ +{ 3431116800, -4142518272,-179855360 }, +{ 3127050240, -3768467456,927989760 }, +{ 2705653760, -3541762048,1970667520 }, +{ 2188902400, -3457941504,2890924032 }, +{ 1609564160, -3499098112,3642753024 }, +{ 1006632960, -3644850176,4194304000 }, +{ 419430400, -3875536896,4529848320 } +} +(* Monotonicity VT l:3 h:3 = XZ *) +(* 2D Convexity VT l:3 h:3 = 1 *) + +VT3s4 = +{ +{ 419430400, -3875536896,4529848320 }, +{ -167772160, -4106223616,4865392640 }, +{ -739246080, -4421844992,4984930304 }, +{ -1255669760, -4802740224,4872732672 }, +{ -1677393920, -5229969408,4529192960 }, +{ -1970339840, -5688508416,3972792320 }, +{ -2113228800, -6162665472,3241123840 } +} +(* Monotonicity VT l:3 h:4 = XY *) +(* 2D Convexity VT l:3 h:4 = 1 *) + +VT3s5 = +{ +{ -2113228800, -6162665472,3241123840 }, +{ -2256117760, -6636822528,2509455360 }, +{ -2248949760, -7126597632,1602519040 }, +{ -2070446080, -7616299008,557907968 }, +{ -1712128000, -8089567232,-567672832 }, +{ -1185546240, -8524791808,-1697382400 }, +{ -530841600, -8882749440,-2734161920 } +} +(* Monotonicity VT l:3 h:5 = YZ *) +(* 2D Convexity VT l:3 h:5 = 1 *) + +VT3s6 = +{ +{ -530841600, -8882749440,-2734161920 }, +{ 123863040, -9240707072,-3770941440 }, +{ 906690560, -9521397760,-4714790912 }, +{ 1777500160, -9685598208,-5468651520 }, +{ 2667560960, -9676472320,-5915246592 }, +{ 3470991360, -9407209472,-5916999680 }, +{ 4034867200, -8740884480,-5316894720 } +} +(* Monotonicity VT l:3 h:6 = X *) +(* 2D Convexity VT l:3 h:6 = 1 *) + +VT3s7 = +{ +{ 4034867200, -8740884480,-5316894720 }, +{ 4598743040, -8074559488,-4716789760 }, +{ 4923064320, -7011172352,-3514826752 }, +{ 4854906880, -5413797888,-1553989632 }, +{ 4194304000, -3095396352,1342177280 }, +{ 2684354560, 201326592,5368709120 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VT l:3 h:7 = YZ *) +(* 2D Convexity VT l:3 h:7 = 1 *) + +(*Subdivision 4 *) +VT4s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -503316480, 1342177280,8388608000 }, +{ -859832320, -1562378240,6249512960 }, +{ -1089863680, -3959685120,4313317376 }, +{ -1212088320, -5918269440,2572288000 }, +{ -1243563520, -7498398720,1017953280 }, +{ -1199764800, -8753032512,-358732160 } +} +(* Monotonicity VT l:4 h:0 = YZ *) +(* 2D Convexity VT l:4 h:0 = 1 *) + +VT4s1 = +{ +{ -1199764800, -8753032512,-358732160 }, +{ -1155966080, -10007666304,-1735417600 }, +{ -1036893440, -10936804608,-2934453760 }, +{ -858022400, -11593406976,-3964886016 }, +{ -633246720, -12023124992,-4836333568 }, +{ -374917120, -12265252864,-5558824960 }, +{ -93900800, -12353556480,-6142648320 } +} +(* Monotonicity VT l:4 h:1 = XYZ *) +(* 2D Convexity VT l:4 h:1 = 1 *) + +VT4s2 = +{ +{ -93900800, -12353556480,-6142648320 }, +{ 187115520, -12441860096,-6726471680 }, +{ 490818560, -12376339456,-7171627008 }, +{ 806341120, -12190760448,-7488402432 }, +{ 1124299520, -11913360640,-7687345664 }, +{ 1436734080, -11567678336,-7779114240 }, +{ 1737028800, -11173260096,-7774340480 } +} +(* Monotonicity VT l:4 h:2 = X *) +(* 2D Convexity VT l:4 h:2 = 1 *) + +VT4s3 = +{ +{ 1737028800, -11173260096,-7774340480 }, +{ 2037323520, -10778841856,-7769566720 }, +{ 2325478400, -10335687680,-7668250624 }, +{ 2594877440, -9863344128,-7481024512 }, +{ 2840248320, -9377366016,-7218495488 }, +{ 3057582080, -8890023936,-6891110400 }, +{ 3244032000, -8410890240,-6509035520 } +} +(* Monotonicity VT l:4 h:3 = XYZ *) +(* 2D Convexity VT l:4 h:3 = 1 *) + +VT4s4 = +{ +{ 3244032000, -8410890240,-6509035520 }, +{ 3430481920, -7931756544,-6126960640 }, +{ 3586048000, -7460831232,-5690195968 }, +{ 3707883520, -7007686656,-5208907776 }, +{ 3794304000, -6579196928,-4692981760 }, +{ 3844686080, -6180123904,-4151902720 }, +{ 3859345600, -5813581632,-3594648960 } +} +(* Monotonicity VT l:4 h:4 = XYZ *) +(* 2D Convexity VT l:4 h:4 = 1 *) + +VT4s5 = +{ +{ 3859345600, -5813581632,-3594648960 }, +{ 3874005120, -5447039360,-3037395200 }, +{ 3852942080, -5113027840,-2463966720 }, +{ 3796472320, -4814661120,-1883341824 }, +{ 3705850880, -4553405440,-1303992320 }, +{ 3583150080, -4329543680,-733777920 }, +{ 3431116800, -4142518272,-179855360 } +} +(* Monotonicity VT l:4 h:5 = YZ *) +(* 2D Convexity VT l:4 h:5 = 1 *) + +VT4s6 = +{ +{ 3431116800, -4142518272,-179855360 }, +{ 3279083520, -3955492864,374067200 }, +{ 3097717760, -3805303808,911697920 }, +{ 2889766400, -3691393536,1425880064 }, +{ 2658650880, -3612364032,1910159872 }, +{ 2408324480, -3566319744,2358877440 }, +{ 2143108800, -3551088960,2767242880 } +} +(* Monotonicity VT l:4 h:6 = XYZ *) +(* 2D Convexity VT l:4 h:6 = 1 *) + +VT4s7 = +{ +{ 2143108800, -3551088960,2767242880 }, +{ 1877893120, -3535858176,3175608320 }, +{ 1597788160, -3551440896,3543621632 }, +{ 1307115520, -3595665408,3866492928 }, +{ 1010565120, -3666083840,4140302336 }, +{ 713031680, -3760193536,4362076160 }, +{ 419430400, -3875536896,4529848320 } +} +(* Monotonicity VT l:4 h:7 = XZ *) +(* 2D Convexity VT l:4 h:7 = 1 *) + +VT4s8 = +{ +{ 419430400, -3875536896,4529848320 }, +{ 125829120, -3990880256,4697620480 }, +{ -163840000, -4127457280,4811390976 }, +{ -444661760, -4282810368,4869193728 }, +{ -711700480, -4454526976,4870070272 }, +{ -960184320, -4640339456,4814131200 }, +{ -1185710400, -4838103360,4702602880 } +} +(* Monotonicity VT l:4 h:8 = XY *) +(* 2D Convexity VT l:4 h:8 = 1 *) + +VT4s9 = +{ +{ -1185710400, -4838103360,4702602880 }, +{ -1411236480, -5035867264,4591074560 }, +{ -1613804800, -5245582592,4423956992 }, +{ -1789012480, -5465104896,4202476544 }, +{ -1932825600, -5692412928,3928975360 }, +{ -2041784320, -5925586944,3606958080 }, +{ -2113228800, -6162665472,3241123840 } +} +(* Monotonicity VT l:4 h:9 = XYZ *) +(* 2D Convexity VT l:4 h:9 = 1 *) + +VT4s10 = +{ +{ -2113228800, -6162665472,3241123840 }, +{ -2184673280, -6399744000,2875289600 }, +{ -2218603520, -6640727040,2465638400 }, +{ -2212359680, -6883653120,2016869376 }, +{ -2164081920, -7126519040,1534876160 }, +{ -2072936320, -7367136640,1026778880 }, +{ -1939361600, -7602868032,500941440 } +} +(* Monotonicity VT l:4 h:10 = YZ *) +(* 2D Convexity VT l:4 h:10 = 1 *) + +VT4s11 = +{ +{ -1939361600, -7602868032,500941440 }, +{ -1805786880, -7838599424,-24896000 }, +{ -1629783040, -8069444608,-568473600 }, +{ -1411788800, -8292765696,-1121427456 }, +{ -1153515520, -8505475072,-1674149888 }, +{ -858193920, -8703770624,-2215772160 }, +{ -530841600, -8882749440,-2734161920 } +} +(* Monotonicity VT l:4 h:11 = XYZ *) +(* 2D Convexity VT l:4 h:11 = 1 *) + +VT4s12 = +{ +{ -530841600, -8882749440,-2734161920 }, +{ -203489280, -9061728256,-3252551680 }, +{ 155893760, -9221390336,-3747708928 }, +{ 542289920, -9356832768,-4207501312 }, +{ 948894720, -9462051840,-4618532864 }, +{ 1366849280, -9529556736,-4966141440 }, +{ 1784952000, -9549861696,-5234410880 } +} +(* Monotonicity VT l:4 h:12 = XYZ *) +(* 2D Convexity VT l:4 h:12 = 1 *) + +VT4s13 = +{ +{ 1784952000, -9549861696,-5234410880 }, +{ 2203054720, -9570166656,-5502680320 }, +{ 2621305600, -9543271680,-5691610624 }, +{ 3028503040, -9459691008,-5785285632 }, +{ 3411102720, -9307943936,-5766535168 }, +{ 3752929280, -9074046976,-5616947200 }, +{ 4034867200, -8740884480,-5316894720 } +} +(* Monotonicity VT l:4 h:13 = X *) +(* 2D Convexity VT l:4 h:13 = 1 *) + +VT4s14 = +{ +{ 4034867200, -8740884480,-5316894720 }, +{ 4316805120, -8407721984,-5016842240 }, +{ 4538854400, -7975293952,-4566325248 }, +{ 4681899520, -7426484736,-3945716736 }, +{ 4723884800, -6741046528,-3134174720 }, +{ 4639505280, -5894969984,-2109669120 }, +{ 4399876800, -4859733312,-849023360 } +} +(* Monotonicity VT l:4 h:14 = YZ *) +(* 2D Convexity VT l:4 h:14 = 1 *) + +VT4s15 = +{ +{ 4399876800, -4859733312,-849023360 }, +{ 4160248320, -3824496640,411622400 }, +{ 3765370880, -2600099840,1908408320 }, +{ 3186360320, -1158021120,3664510976 }, +{ 2390753280, 534773760,5704253440 }, +{ 1342177280, 2516582400,8053063680 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VT l:4 h:15 = XYZ *) +(* 2D Convexity VT l:4 h:15 = 1 *) + diff --git a/curves/Hulls_Unknot_2017_09_03.curve b/curves/Hulls_Unknot_2017_09_03.curve new file mode 100644 index 0000000..774df69 --- /dev/null +++ b/curves/Hulls_Unknot_2017_09_03.curve @@ -0,0 +1,8 @@ +% Original Unknot Control Points +0, 4831838208, 10737418240 +-8053063680, -51002736640, -26843545600 +21474836480, 42949672960, -10737418240 +-5368709120, -32212254720, 31138512896 +-32212254720, 16106127360, 10737418240 +21474836480, -32212254720, -32212254720 +0, 4831838208, 10737418240 \ No newline at end of file diff --git a/curves/Hulls_Unknot_2017_09_03.txt b/curves/Hulls_Unknot_2017_09_03.txt new file mode 100644 index 0000000..7b0faad --- /dev/null +++ b/curves/Hulls_Unknot_2017_09_03.txt @@ -0,0 +1,407 @@ +(*Original Unknot Control Points*) +VU0s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -8053063680, -51002736640,-26843545600 }, +{ 21474836480, 42949672960,-10737418240 }, +{ -5368709120, -32212254720,31138512896 }, +{ -32212254720, 16106127360,10737418240 }, +{ 21474836480, -32212254720,-32212254720 }, +{ 0, 4831838208,10737418240 } +} + + +(*Subdivision 1 *) +VU1s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -4026531840, -23085449216,-8053063680 }, +{ 1342177280, -13555990528,-13421772800 }, +{ 4362076160, -6442450944,-8858370048 }, +{ 2684354560, -3388997632,-1610612736 }, +{ -587202560, -2952790016,3187671040 }, +{ -2936012800, -3875536896,4529848320 } +} +(* Monotonicity VU l:1 h:0 = NONE *) +(* 2D Convexity VU l:1 h:0 = 0 *) + +VU1s1 = +{ +{ -2936012800, -3875536896,4529848320 }, +{ -5284823040, -4798283776,5872025600 }, +{ -6710886400, -7079985152,3758096384 }, +{ -4697620480, -9462349824,-2818572288 }, +{ 2684354560, -10871635968,-10737418240 }, +{ 10737418240, -13690208256,-10737418240 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VU l:1 h:1 = NONE *) +(* 2D Convexity VU l:1 h:1 = 0 *) + +(*Subdivision 2 *) +VU2s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -2013265920, -9126805504,1342177280 }, +{ -1677721600, -13723762688,-4697620480 }, +{ -461373440, -13941866496,-7818182656 }, +{ 754974720, -12375293952,-8690597888 }, +{ 1554513920, -10327425024,-8037335040 }, +{ 1828454400, -8410890240,-6509035520 } +} +(* Monotonicity VU l:2 h:0 = NONE *) +(* 2D Convexity VU l:2 h:0 = 1 *) + +VU2s1 = +{ +{ 1828454400, -8410890240,-6509035520 }, +{ 2102394880, -6494355456,-4980736000 }, +{ 1850736640, -4709154816,-2577399808 }, +{ 964689920, -3667918848,50331648 }, +{ -356515840, -3292528640,2323644416 }, +{ -1761607680, -3414163456,3858759680 }, +{ -2936012800, -3875536896,4529848320 } +} +(* Monotonicity VU l:2 h:1 = Z *) +(* 2D Convexity VU l:2 h:1 = 1 *) + +VU2s2 = +{ +{ -2936012800, -3875536896,4529848320 }, +{ -4110417920, -4336910336,5200936960 }, +{ -5054136320, -5138022400,5007998976 }, +{ -5452595200, -6121586688,3825205248 }, +{ -5027921920, -7141851136,1784676352 }, +{ -3727687680, -8166834176,-660602880 }, +{ -1946419200, -8882749440,-2734161920 } +} +(* Monotonicity VU l:2 h:2 = Y *) +(* 2D Convexity VU l:2 h:2 = 1 *) + +VU2s3 = +{ +{ -1946419200, -8882749440,-2734161920 }, +{ -165150720, -9598664704,-4807720960 }, +{ 2097152000, -10005512192,-6509559808 }, +{ 4445962240, -9789505536,-7063207936 }, +{ 6039797760, -8355053568,-5368709120 }, +{ 5368709120, -4429185024,0 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VU l:2 h:3 = NONE *) +(* 2D Convexity VU l:2 h:3 = 1 *) + +(*Subdivision 3 *) +VU3s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -1006632960, -2147483648,6039797760 }, +{ -1426063360, -6786383872,2181038080 }, +{ -1441792000, -9707716608,-893386752 }, +{ -1200619520, -11385044992,-3252682752 }, +{ -816496640, -12176949248,-4975001600 }, +{ -374886400, -12353556480,-6142648320 } +} +(* Monotonicity VU l:3 h:0 = YZ *) +(* 2D Convexity VU l:3 h:0 = 1 *) + +VU3s1 = +{ +{ -374886400, -12353556480,-6142648320 }, +{ 66723840, -12530163712,-7310295040 }, +{ 565821440, -12091473920,-7923269632 }, +{ 1036943360, -11307614208,-8063877120 }, +{ 1423114240, -10360258560,-7818575872 }, +{ 1691484160, -9369157632,-7273185280 }, +{ 1828454400, -8410890240,-6509035520 } +} +(* Monotonicity VU l:3 h:1 = X *) +(* 2D Convexity VU l:3 h:1 = 1 *) + +VU3s2 = +{ +{ 1828454400, -8410890240,-6509035520 }, +{ 1965424640, -7452622848,-5744885760 }, +{ 1970995200, -6527188992,-4761976832 }, +{ 1831567360, -5711167488,-3641638912 }, +{ 1552793600, -5037965312,-2460712960 }, +{ 1154703360, -4516569088,-1287700480 }, +{ 666316800, -4142518272,-179855360 } +} +(* Monotonicity VU l:3 h:2 = YZ *) +(* 2D Convexity VU l:3 h:2 = 1 *) + +VU3s3 = +{ +{ 666316800, -4142518272,-179855360 }, +{ 177930240, -3768467456,927989760 }, +{ -400752640, -3541762048,1970667520 }, +{ -1040711680, -3457941504,2890924032 }, +{ -1703936000, -3499098112,3642753024 }, +{ -2348810240, -3644850176,4194304000 }, +{ -2936012800, -3875536896,4529848320 } +} +(* Monotonicity VU l:3 h:3 = XZ *) +(* 2D Convexity VU l:3 h:3 = 1 *) + +VU3s4 = +{ +{ -2936012800, -3875536896,4529848320 }, +{ -3523215360, -4106223616,4865392640 }, +{ -4052746240, -4421844992,4984930304 }, +{ -4485283840, -4802740224,4872732672 }, +{ -4783800320, -5229969408,4529192960 }, +{ -4919459840, -5688508416,3972792320 }, +{ -4878028800, -6162665472,3241123840 } +} +(* Monotonicity VU l:3 h:4 = Y *) +(* 2D Convexity VU l:3 h:4 = 1 *) + +VU3s5 = +{ +{ -4878028800, -6162665472,3241123840 }, +{ -4836597760, -6636822528,2509455360 }, +{ -4618076160, -7126597632,1602519040 }, +{ -4208230400, -7616299008,557907968 }, +{ -3607429120, -8089567232,-567672832 }, +{ -2837053440, -8524791808,-1697382400 }, +{ -1946419200, -8882749440,-2734161920 } +} +(* Monotonicity VU l:3 h:5 = XYZ *) +(* 2D Convexity VU l:3 h:5 = 1 *) + +VU3s6 = +{ +{ -1946419200, -8882749440,-2734161920 }, +{ -1055784960, -9240707072,-3770941440 }, +{ -44892160, -9521397760,-4714790912 }, +{ 1036943360, -9685598208,-5468651520 }, +{ 2112471040, -9676472320,-5915246592 }, +{ 3069583360, -9407209472,-5916999680 }, +{ 3753881600, -8740884480,-5316894720 } +} +(* Monotonicity VU l:3 h:6 = X *) +(* 2D Convexity VU l:3 h:6 = 1 *) + +VU3s7 = +{ +{ 3753881600, -8740884480,-5316894720 }, +{ 4438179840, -8074559488,-4716789760 }, +{ 4849664000, -7011172352,-3514826752 }, +{ 4833935360, -5413797888,-1553989632 }, +{ 4194304000, -3095396352,1342177280 }, +{ 2684354560, 201326592,5368709120 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VU l:3 h:7 = YZ *) +(* 2D Convexity VU l:3 h:7 = 1 *) + +(*Subdivision 4 *) +VU4s0 = +{ +{ 0, 4831838208,10737418240 }, +{ -503316480, 1342177280,8388608000 }, +{ -859832320, -1562378240,6249512960 }, +{ -1092485120, -3959685120,4313317376 }, +{ -1221918720, -5918269440,2572288000 }, +{ -1266603520, -7498398720,1017953280 }, +{ -1242964800, -8753032512,-358732160 } +} +(* Monotonicity VU l:4 h:0 = YZ *) +(* 2D Convexity VU l:4 h:0 = 1 *) + +VU4s1 = +{ +{ -1242964800, -8753032512,-358732160 }, +{ -1219326080, -10007666304,-1735417600 }, +{ -1127363840, -10936804608,-2934453760 }, +{ -983503360, -11593406976,-3964886016 }, +{ -802124800, -12023124992,-4836333568 }, +{ -595691520, -12265252864,-5558824960 }, +{ -374886400, -12353556480,-6142648320 } +} +(* Monotonicity VU l:4 h:1 = XYZ *) +(* 2D Convexity VU l:4 h:1 = 1 *) + +VU4s2 = +{ +{ -374886400, -12353556480,-6142648320 }, +{ -154081280, -12441860096,-6726471680 }, +{ 81095680, -12376339456,-7171627008 }, +{ 319961600, -12190760448,-7488402432 }, +{ 553614080, -11913360640,-7687345664 }, +{ 774794880, -11567678336,-7779114240 }, +{ 977745600, -11173260096,-7774340480 } +} +(* Monotonicity VU l:4 h:2 = X *) +(* 2D Convexity VU l:4 h:2 = 1 *) + +VU4s3 = +{ +{ 977745600, -11173260096,-7774340480 }, +{ 1180696320, -10778841856,-7769566720 }, +{ 1365416960, -10335687680,-7668250624 }, +{ 1526149120, -9863344128,-7481024512 }, +{ 1658634240, -9377366016,-7218495488 }, +{ 1759969280, -8890023936,-6891110400 }, +{ 1828454400, -8410890240,-6509035520 } +} +(* Monotonicity VU l:4 h:3 = XYZ *) +(* 2D Convexity VU l:4 h:3 = 1 *) + +VU4s4 = +{ +{ 1828454400, -8410890240,-6509035520 }, +{ 1896939520, -7931756544,-6126960640 }, +{ 1932574720, -7460831232,-5690195968 }, +{ 1933660160, -7007686656,-5208907776 }, +{ 1899699200, -6579196928,-4692981760 }, +{ 1831246080, -6180123904,-4151902720 }, +{ 1729745600, -5813581632,-3594648960 } +} +(* Monotonicity VU l:4 h:4 = YZ *) +(* 2D Convexity VU l:4 h:4 = 1 *) + +VU4s5 = +{ +{ 1729745600, -5813581632,-3594648960 }, +{ 1628245120, -5447039360,-3037395200 }, +{ 1493697280, -5113027840,-2463966720 }, +{ 1327546880, -4814661120,-1883341824 }, +{ 1132129280, -4553405440,-1303992320 }, +{ 910510080, -4329543680,-733777920 }, +{ 666316800, -4142518272,-179855360 } +} +(* Monotonicity VU l:4 h:5 = XYZ *) +(* 2D Convexity VU l:4 h:5 = 1 *) + +VU4s6 = +{ +{ 666316800, -4142518272,-179855360 }, +{ 422123520, -3955492864,374067200 }, +{ 155356160, -3805303808,911697920 }, +{ -130357760, -3691393536,1425880064 }, +{ -430828800, -3612364032,1910159872 }, +{ -741473920, -3566319744,2358877440 }, +{ -1057492800, -3551088960,2767242880 } +} +(* Monotonicity VU l:4 h:6 = XYZ *) +(* 2D Convexity VU l:4 h:6 = 1 *) + +VU4s7 = +{ +{ -1057492800, -3551088960,2767242880 }, +{ -1373511680, -3535858176,3175608320 }, +{ -1694904320, -3551440896,3543621632 }, +{ -2016870400, -3595665408,3866492928 }, +{ -2334392320, -3666083840,4140302336 }, +{ -2642411520, -3760193536,4362076160 }, +{ -2936012800, -3875536896,4529848320 } +} +(* Monotonicity VU l:4 h:7 = XZ *) +(* 2D Convexity VU l:4 h:7 = 1 *) + +VU4s8 = +{ +{ -2936012800, -3875536896,4529848320 }, +{ -3229614080, -3990880256,4697620480 }, +{ -3508797440, -4127457280,4811390976 }, +{ -3768647680, -4282810368,4869193728 }, +{ -4004392960, -4454526976,4870070272 }, +{ -4211589120, -4640339456,4814131200 }, +{ -4386312000, -4838103360,4702602880 } +} +(* Monotonicity VU l:4 h:8 = XY *) +(* 2D Convexity VU l:4 h:8 = 1 *) + +VU4s9 = +{ +{ -4386312000, -4838103360,4702602880 }, +{ -4561034880, -5035867264,4591074560 }, +{ -4703284480, -5245582592,4423956992 }, +{ -4809136640, -5465104896,4202476544 }, +{ -4875187200, -5692412928,3928975360 }, +{ -4898744320, -5925586944,3606958080 }, +{ -4878028800, -6162665472,3241123840 } +} +(* Monotonicity VU l:4 h:9 = YZ *) +(* 2D Convexity VU l:4 h:9 = 1 *) + +VU4s10 = +{ +{ -4878028800, -6162665472,3241123840 }, +{ -4857313280, -6399744000,2875289600 }, +{ -4792325120, -6640727040,2465638400 }, +{ -4681285120, -6883653120,2016869376 }, +{ -4523326720, -7126519040,1534876160 }, +{ -4318696320, -7367136640,1026778880 }, +{ -4068961600, -7602868032,500941440 } +} +(* Monotonicity VU l:4 h:10 = XYZ *) +(* 2D Convexity VU l:4 h:10 = 1 *) + +VU4s11 = +{ +{ -4068961600, -7602868032,500941440 }, +{ -3819226880, -7838599424,-24896000 }, +{ -3524387840, -8069444608,-568473600 }, +{ -3186012160, -8292765696,-1121427456 }, +{ -2806988800, -8505475072,-1674149888 }, +{ -2391736320, -8703770624,-2215772160 }, +{ -1946419200, -8882749440,-2734161920 } +} +(* Monotonicity VU l:4 h:11 = XYZ *) +(* 2D Convexity VU l:4 h:11 = 1 *) + +VU4s12 = +{ +{ -1946419200, -8882749440,-2734161920 }, +{ -1501102080, -9061728256,-3252551680 }, +{ -1025720320, -9221390336,-3747708928 }, +{ -526438400, -9356832768,-4207501312 }, +{ -11166720, -9462051840,-4618532864 }, +{ 510222080, -9529556736,-4966141440 }, +{ 1025668800, -9549861696,-5234410880 } +} +(* Monotonicity VU l:4 h:12 = XYZ *) +(* 2D Convexity VU l:4 h:12 = 1 *) + +VU4s13 = +{ +{ 1025668800, -9549861696,-5234410880 }, +{ 1541115520, -9570166656,-5502680320 }, +{ 2050620160, -9543271680,-5691610624 }, +{ 2542123520, -9459691008,-5785285632 }, +{ 3001379840, -9307943936,-5766535168 }, +{ 3411732480, -9074046976,-5616947200 }, +{ 3753881600, -8740884480,-5316894720 } +} +(* Monotonicity VU l:4 h:13 = X *) +(* 2D Convexity VU l:4 h:13 = 1 *) + +VU4s14 = +{ +{ 3753881600, -8740884480,-5316894720 }, +{ 4096030720, -8407721984,-5016842240 }, +{ 4369976320, -7975293952,-4566325248 }, +{ 4556418560, -7426484736,-3945716736 }, +{ 4633414400, -6741046528,-3134174720 }, +{ 4576145280, -5894969984,-2109669120 }, +{ 4356676800, -4859733312,-849023360 } +} +(* Monotonicity VU l:4 h:14 = YZ *) +(* 2D Convexity VU l:4 h:14 = 1 *) + +VU4s15 = +{ +{ 4356676800, -4859733312,-849023360 }, +{ 4137208320, -3824496640,411622400 }, +{ 3755540480, -2600099840,1908408320 }, +{ 3183738880, -1158021120,3664510976 }, +{ 2390753280, 534773760,5704253440 }, +{ 1342177280, 2516582400,8053063680 }, +{ 0, 4831838208,10737418240 } +} +(* Monotonicity VU l:4 h:15 = XYZ *) +(* 2D Convexity VU l:4 h:15 = 1 *) + diff --git a/generator/__init__.py b/generator/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/generator/generator.py b/generator/generator.py new file mode 100644 index 0000000..e69de29 diff --git a/subdivision_generator_orig.py b/subdivision_generator_orig.py new file mode 100644 index 0000000..1038849 --- /dev/null +++ b/subdivision_generator_orig.py @@ -0,0 +1,495 @@ +import math +import numpy as np + +def closestDistanceBetweenLines(a0, a1, b0, b1, clampAll=False, clampA0=False, clampA1=False, clampB0=False, clampB1=False): + ''' Given two lines defined by numpy.array pairs (a0,a1,b0,b1) + Return distance, the two closest points, and their average + ''' + # If clampAll=True, set all clamps to True + if clampAll: + clampA0 = True + clampA1 = True + clampB0 = True + clampB1 = True + + # Calculate denomitator + A = a1 - a0 + B = b1 - b0 + + normA = np.linalg.norm(B) + if normA == 0: + print("HERE", b0, b1) + + _A = A / np.linalg.norm(A) + _B = B / np.linalg.norm(B) + + cross = np.cross(_A, _B); + denom = np.linalg.norm(cross) ** 2 + + # If denominator is 0, lines are parallel: Calculate distance with a projection + # and evaluate clamp edge cases + if (denom == 0): + d0 = np.dot(_A, (b0 - a0)) + d = np.linalg.norm(((d0 * _A) + a0) - b0) + # If clamping: the only time we'll get closest points will be when lines don't overlap at all. + # Find if segments overlap using dot products. + if clampA0 or clampA1 or clampB0 or clampB1: + d1 = np.dot(_A, (b1 - a0)) + + # Is segment B before A? + if d0 <= 0 >= d1: + if clampA0 == True and clampB1 == True: + if np.absolute(d0) < np.absolute(d1): + return b0, a0, np.linalg.norm(b0 - a0) + return b1, a0, np.linalg.norm(b1 - a0) + + # Is segment B after A? + elif d0 >= np.linalg.norm(A) <= d1: + if clampA1 == True and clampB0 == True: + if np.absolute(d0) < np.absolute(d1): + return b0, a1, np.linalg.norm(b0 - a1) + return b1, a1, np.linalg.norm(b1, a1) + + # If clamping is off, or segments overlapped, we have infinite results, just return position. + return None, None, d + + # Lines criss-cross: Calculate the dereminent and return points + t = (b0 - a0); + det0 = np.linalg.det([t, _B, cross]) + det1 = np.linalg.det([t, _A, cross]) + t0 = det0 / denom; + t1 = det1 / denom; + + pA = a0 + (_A * t0); + pB = b0 + (_B * t1); + + # Clamp results to line segments if needed + if clampA0 or clampA1 or clampB0 or clampB1: + if t0 < 0 and clampA0: + pA = a0 + elif t0 > np.linalg.norm(A) and clampA1: + pA = a1 + if t1 < 0 and clampB0: + pB = b0 + elif t1 > np.linalg.norm(B) and clampB1: + pB = b1 + + d = np.linalg.norm(pA - pB) + return pA, pB, d + + +''' +Calculate the distance of the line segment between the start and end points +''' +def distanceBetweenTwoPoints(startPoint, endPoint): + x = endPoint[0] - startPoint[0] + y = endPoint[1] - startPoint[1] + z = endPoint[2] - startPoint[2] + + # return math.sqrt( x*x + y*y + z*z) + return (x * x + y * y + z * z) ** (1 / 2) + +''' +A function used to reduce a line segment between the startPoint and the endPoint +by the recduce amount. So if you have a line that is 1 distance long and you want to +move both of its end points in by .25 this function will return the two new end points +and the length of the new line will be .5. +''' +def reduceLineSegment(startPoint, endPoint, reduceAmount): + vector = [] + ''' + Parametrize the line segment so that you can subtract the distace. Since the line + is parametrized its distance will be from 0 to 1. To reduce it by the desired amount + we need to figure out the proportion of the line compared to the parameter and then + subtract that amount. + ''' + vector.append(startPoint[0] - endPoint[0]) # Calculate Vector X + vector.append(startPoint[1] - endPoint[1]) # Calculate Vector Y + vector.append(startPoint[2] - endPoint[2]) # Calculate Vector Z + dist = distanceBetweenTwoPoints(startPoint, endPoint) + + proportion = reduceAmount / dist + newX = endPoint[0] + proportion * vector[0] + newY = endPoint[1] + proportion * vector[1] + newZ = endPoint[2] + proportion * vector[2] + + newEndPoint = np.array([newX, newY, newZ]) + output = [] + newX = endPoint[0] + (1 - proportion) * vector[0] + newY = endPoint[1] + (1 - proportion) * vector[1] + newZ = endPoint[2] + (1 - proportion) * vector[2] + + newStartPoint = np.array([newX, newY, newZ]) + + output.append(newStartPoint) + output.append(newEndPoint) + return output + +''' +Generates the set of second iterated forward difference operator. This comes from Professor Peters' and +Ji Li's paper. In the paper it is define. It shows up as a triangle with a subscript 2 and and set P next to it +''' +def secondIteratedForwardDifferenceOperator(listOfControlPoints, index): + deltaSub2Set = [] + numCtrlPts = len(listOfControlPoints) + + # Need to wrap around and connect back to the first point + for i in range(0, numCtrlPts): # Add -1 to numCtrlPts to make it an open curve again + deltaSub2Ofi = listOfControlPoints[(i + 2) % numCtrlPts][index] - (2 * listOfControlPoints[(i + 1) % numCtrlPts][index]) + listOfControlPoints[i][index] + deltaSub2Set.append(deltaSub2Ofi) + return deltaSub2Set + +''' +This is the l1 - Norm for a set. The l1 norm is just the summation of the absolute value of all the +elements in the set. +''' +def l1Norm(setForNorming): + norm = 0 + i = 0 + + for element in setForNorming: + norm += abs(element) + i += 1 + + print('Terms in L1 Norm: ', i) + + return norm + +''' +This generates the Omega one value from Professor Peters' and Ji Li's paper. Omega one is used in combination with the delta from the Denne-Sullivan paper to figure out m1 +''' +def omegaOne(listOfControlPoints): + deltaSetX = secondIteratedForwardDifferenceOperator(listOfControlPoints, 0) + deltaSetY = secondIteratedForwardDifferenceOperator(listOfControlPoints, 1) + deltaSetZ = secondIteratedForwardDifferenceOperator(listOfControlPoints, 2) + + l1NormX = l1Norm(deltaSetX) + l1NormY = l1Norm(deltaSetY) + l1NormZ = l1Norm(deltaSetZ) + + return max(l1NormX, l1NormY, l1NormZ) + + +''' +This function generates the m1 value from Professor Peters' and Ji Li's paper. M1 is compared against +m2 and m3 to determine the number of iterations, j, that need to be done in order for the stick knot +to properly associate with its correct bezier curve +''' +def generateM1(omegaOne, delta): + omegaOneSquared = omegaOne * omegaOne + deltaSquared = delta * delta + intermediate = ((float(7) / float(16) * omegaOneSquared * (1 / deltaSquared)) - (float(1) / float(7))) + logResult = math.log(intermediate, 2) + return math.ceil(logResult) + +''' +Generates the hodograph delta sub 2 set from Professor Peters' and Ji Li's paper. It is defined in the paper +''' +def generateHodographDeltaTwoSet(listOfControlPoints, index): + hodographDelta2Set = [] + numControlPoints = len(listOfControlPoints) + + # Need to wrap around and connect back to the first point + for i in range(1, numControlPoints): # Add -1 to numControlPoints to make it an open curve again + hodographDeltaSub2Ofi = numControlPoints * (listOfControlPoints[(i + 2) % numControlPoints][index] - ( + 3 * listOfControlPoints[(i + 1) % numControlPoints][index]) + (3 * listOfControlPoints[i][index]) - + listOfControlPoints[i - 1][index]) + hodographDelta2Set.append(hodographDeltaSub2Ofi) + + return hodographDelta2Set + + +''' +Found the same way as Omega One but uses the hodograph sets instead +''' +def omegaTwo(listOfControlPoints): + hodographX = generateHodographDeltaTwoSet(listOfControlPoints, 0) + hodographY = generateHodographDeltaTwoSet(listOfControlPoints, 1) + hodographZ = generateHodographDeltaTwoSet(listOfControlPoints, 2) + + l1NormX = l1Norm(hodographX) + l1NormY = l1Norm(hodographY) + l1NormZ = l1Norm(hodographZ) + + return max(l1NormX, l1NormY, l1NormZ) + + +''' +The M2 value from Professor Peters' and Ji Li's paper. It is found using the hodograph set +''' + + +def generateM2(omegaTwo, lambdaVal, numCtrlPts): + j = 0 + + # This gets the next int higher to what would be an unreducible logarithm + while ((numCtrlPts * math.pow(2, 3 * j) + math.pow(2, 2 * j)) < math.pow(omegaTwo / lambdaVal, 2)): + j += 1 + return j + + +''' +The M3 value from Professor Peters' and Ji Li's paper. It is very similar to M2 except for the additional sin(pi/ 8) value +''' +def generateM3(omegaTwo, lambdaVal, numCtrlPts): + j = 0 + + # This gets the next int higher to what would be an unreducible logarithm + while ((numCtrlPts * math.pow(2, 3 * j) + math.pow(2, 2 * j)) < math.pow( + (omegaTwo / (math.sin(math.pi / 8) * lambdaVal)), 2)): + j += 1 + return j + + +if __name__ == '__main__': + [testa, testb, testdist] = closestDistanceBetweenLines(np.array([0.0, 0.0, 0.0]), np.array([5.0, 0.0, 0.0]), + np.array([6.0, 0.0, 1.0]), np.array([10.0, 0.0, 1.0]), + clampAll=True) + + print("Done: ", testdist) + ''' + Add the line segments of the control polygon to a list + ''' + segmentArray = [] + segmentArray.append(np.array([0, 4831838208, 10737418240])) + segmentArray.append(np.array([-8053063680, -51002736640, -26843545600])) + segmentArray.append(np.array([21474836480, 42949672960, -10737418240])) + segmentArray.append(np.array([-5368709120, -32212254720, 31138512896])) + segmentArray.append(np.array([-32212254720, 16106127360, 10737418240])) + segmentArray.append(np.array([21474836480, -32212254720, -32212254720])) + # segmentArray.append(np.array([0, 4831838208,10737418240])) + + [a, b, dist] = closestDistanceBetweenLines(segmentArray[0], segmentArray[1], segmentArray[2], segmentArray[3], + clampAll=True) + + print('TEST: a is: ', a, ' b is: ', b, ' dist is: ', dist) + + ''' + segmentArray = [] + segmentArray.append(np.array([1.28318923, -2.84316645, -2.25593748])) + segmentArray.append(np.array([1.139367593750000, -2.831090593750000, -2.293403687500000])) + segmentArray.append(np.array([0.971135187500000, -2.330181187500000, -2.079607375000000])) + segmentArray.append(np.array([0.802902781250000, -1.829271781250000, -1.865811062500000])) + segmentArray.append(np.array([0.634670375000000, -1.328362375000000, -1.652014750000000])) + segmentArray.append(np.array([0.466437968750000, -0.827452968750000, -1.438218437500000])) + segmentArray.append(np.array([0.298205562500000, -0.326543562500000, -1.224422125000000])) + segmentArray.append(np.array([0.129973156250000, 0.174365843750000, -1.010625812500000])) + segmentArray.append(np.array([-0.038259250000000, 0.675275250000000, -0.796829500000000])) + segmentArray.append(np.array([-0.206491656250000, 1.176184656250000, -0.583033187500000])) + segmentArray.append(np.array([-0.374724062500000, 1.677094062500000, -0.369236875000000])) + segmentArray.append(np.array([-0.542956468750000, 2.178003468750000, -0.155440562500000])) + segmentArray.append(np.array([-0.711188875000000, 2.678912875000000, 0.058355750000000])) + segmentArray.append(np.array([-0.879421281250000, 3.179822281250000, 0.272152062500000])) + segmentArray.append(np.array([-1.047653687500000, 3.680731687500000, 0.485948375000000])) + segmentArray.append(np.array([-1.215886093750000, 4.181641093750000, 0.699744687500000])) + segmentArray.append(np.array([-1.384118500000000, 4.682550500000000, 0.913541000000000])) + segmentArray.append(np.array([-1.50375, 4.13635, 1.02434])) + segmentArray.append(np.array([-1.62339, 3.59015, 1.13513])) + segmentArray.append(np.array([-1.74303, 3.04394, 1.24592])) + segmentArray.append(np.array([-1.86266, 2.49774, 1.35671])) + segmentArray.append(np.array([-1.9823, 1.95154, 1.4675])) + segmentArray.append(np.array([-2.10194, 1.40534, 1.57829])) + segmentArray.append(np.array([-2.22157, 0.859137, 1.68908])) + segmentArray.append(np.array([-2.34121, 0.312934, 1.79987])) + segmentArray.append(np.array([-2.46084, -0.233267, 1.91066])) + segmentArray.append(np.array([-2.58048, -0.779468, 2.02145])) + segmentArray.append(np.array([-2.70012, -1.32567, 2.13224])) + segmentArray.append(np.array([-2.81976, -1.87187, 2.24303])) + segmentArray.append(np.array([-2.9394, -2.41807, 2.35382])) + segmentArray.append(np.array([-3.05903, -2.96428, 2.46461])) + segmentArray.append(np.array([-3.17867, -3.51048, 2.5754])) + segmentArray.append(np.array([-3.2983075,-4.0566825,2.686189])) + segmentArray.append(np.array([-3.09987, -3.63013, 2.36433])) + segmentArray.append(np.array([-2.90143, -3.20357, 2.04247])) + segmentArray.append(np.array([-2.70299, -2.77701, 1.72061])) + segmentArray.append(np.array([-2.50455, -2.35045, 1.39875])) + segmentArray.append(np.array([-2.30611, -1.92389, 1.07689])) + segmentArray.append(np.array([-2.10767, -1.49733, 0.755026])) + segmentArray.append(np.array([-1.90924, -1.07077, 0.433165])) + segmentArray.append(np.array([-1.7108, -0.644214, 0.111303])) + segmentArray.append(np.array([-1.51236, -0.217655, -0.210558])) + segmentArray.append(np.array([-1.31393, 0.208903, -0.532419])) + segmentArray.append(np.array([-1.11549, 0.635462, -0.854279])) + segmentArray.append(np.array([-0.91705, 1.06202, -1.17614])) + segmentArray.append(np.array([-0.718613, 1.48858, -1.498])) + segmentArray.append(np.array([-0.520175, 1.91514, -1.81986])) + segmentArray.append(np.array([-0.321737, 2.3417, -2.14172])) + segmentArray.append(np.array([-0.1232995,2.768254,-2.463584])) + segmentArray.append(np.array([0.128657, 2.3119, -2.23296])) + segmentArray.append(np.array([0.380613, 1.85555, -2.00234])) + segmentArray.append(np.array([0.632569, 1.3992, -1.77172])) + segmentArray.append(np.array([0.884525, 0.942852, -1.5411])) + segmentArray.append(np.array([1.13648, 0.486501, -1.31047])) + segmentArray.append(np.array([1.38844, 0.0301505, -1.07985])) + segmentArray.append(np.array([1.64039, -0.4262, -0.849228])) + segmentArray.append(np.array([1.89235, -0.882551, -0.618607])) + segmentArray.append(np.array([2.14431, -1.3389, -0.387985])) + segmentArray.append(np.array([2.39626, -1.79525, -0.157363])) + segmentArray.append(np.array([2.64821, -2.2516, 0.0732595])) + segmentArray.append(np.array([2.90017, -2.70795, 0.303882])) + segmentArray.append(np.array([3.15212, -3.1643, 0.534504])) + segmentArray.append(np.array([3.40408, -3.62065, 0.765126])) + segmentArray.append(np.array([3.65604, -4.077, 0.995748])) + segmentArray.append(np.array([3.9079915,-4.533357,1.2263705])) + segmentArray.append(np.array([3.41775, -4.27741, 1.08826])) + segmentArray.append(np.array([2.9275, -4.02147, 0.950154])) + segmentArray.append(np.array([2.43725, -3.76553, 0.812045])) + segmentArray.append(np.array([1.947, -3.50958, 0.673937])) + segmentArray.append(np.array([1.45675, -3.25364, 0.535829])) + segmentArray.append(np.array([0.966502, -2.9977, 0.39772])) + segmentArray.append(np.array([0.476253, -2.74175, 0.259611])) + segmentArray.append(np.array([-0.0139957, -2.48581, 0.121503])) + segmentArray.append(np.array([-0.504244, -2.22986, -0.0166055])) + segmentArray.append(np.array([-0.994493, -1.97392, -0.154714])) + segmentArray.append(np.array([-1.48474, -1.71798, -0.292822])) + segmentArray.append(np.array([-1.97499, -1.46204, -0.430931])) + segmentArray.append(np.array([-2.46524, -1.2061, -0.56904])) + segmentArray.append(np.array([-2.95549, -0.950156, -0.707148])) + segmentArray.append(np.array([-3.44574, -0.694214, -0.845257])) + segmentArray.append(np.array([-3.935983,-0.438272,-0.983365])) + segmentArray.append(np.array([-3.48885, -0.142371, -0.789876])) + segmentArray.append(np.array([-3.04171, 0.153529, -0.596387])) + segmentArray.append(np.array([-2.59457, 0.449429, -0.402898])) + segmentArray.append(np.array([-2.14744, 0.745329, -0.209409])) + segmentArray.append(np.array([-1.7003, 1.04123, -0.01592])) + segmentArray.append(np.array([-1.25317, 1.33713, 0.177569])) + segmentArray.append(np.array([-0.806037, 1.63303, 0.371058])) + segmentArray.append(np.array([-0.358904, 1.92893, 0.564547])) + segmentArray.append(np.array([0.0882295, 2.22483, 0.758035])) + segmentArray.append(np.array([0.535363, 2.52073, 0.951523])) + segmentArray.append(np.array([0.982496, 2.81663, 1.14501])) + segmentArray.append(np.array([1.42963, 3.11253, 1.3385])) + segmentArray.append(np.array([1.87677, 3.40843, 1.53199])) + segmentArray.append(np.array([2.3239, 3.70433, 1.72548])) + segmentArray.append(np.array([2.77104, 4.00023, 1.91897])) + segmentArray.append(np.array([3.218174000000000, 4.296123000000000, 2.112459500000000])) + segmentArray.append(np.array([3.098763125000000, 3.819365312500000, 1.823730781250000])) + segmentArray.append(np.array([2.979352250000000, 3.342607625000000, 1.535002062500000])) + segmentArray.append(np.array([2.859941375000000, 2.865849937500000, 1.246273343750000])) + segmentArray.append(np.array([2.740530500000000, 2.389092250000000, 0.957544625000000])) + segmentArray.append(np.array([2.621119625000000, 1.912334562500000, 0.668815906250000])) + segmentArray.append(np.array([2.501708750000000, 1.435576875000000, 0.380087187500000])) + segmentArray.append(np.array([2.382297875000000, 0.958819187500000, 0.091358468750000])) + segmentArray.append(np.array([2.262887000000000, 0.482061500000000, -0.197370250000000])) + segmentArray.append(np.array([2.143476125000000, 0.005303812500000, -0.486098968750000])) + segmentArray.append(np.array([2.024065250000000, -0.471453875000000, -0.774827687500000])) + segmentArray.append(np.array([1.904654375000000, -0.948211562500000, -1.063556406250000])) + segmentArray.append(np.array([1.785243500000000, -1.424969250000000, -1.352285125000000])) + segmentArray.append(np.array([1.665832625000000, -1.901726937500000, -1.641013843750000])) + segmentArray.append(np.array([1.546421750000000, -2.378484625000000, -1.929742562500000])) + segmentArray.append(np.array([1.427010875000000, -2.855242312500000, -2.218471281250000])) + ''' + + minimums = [] + + ''' + For each line segment, compare it to all non-incident (non-adjacent) line segments. Add the distances + to the minimums list. + ''' + numCtrlPointSegments = len(segmentArray) + for i in range(0, numCtrlPointSegments): + # print'i is: ' ,i + j = i + 2 + while j < numCtrlPointSegments: + if (i == 0 and (j + 1) % numCtrlPointSegments == 0): + j += 1 + continue + + # print 'j is: ', j, ' and j + 1 mod 7 is', (j+1)% numCtrlPointSegments + [a, b, dist] = closestDistanceBetweenLines(segmentArray[i], segmentArray[i + 1], segmentArray[j], + segmentArray[(j + 1) % numCtrlPointSegments], clampAll=True) + print('a is: ', a, ' b is: ', b, ' dist is: ', dist) + + # print(dist) + minimums.append(dist) + j += 1 + ''' + Of all the distances, take the minimum. This is the r1 value from the Denne-Sullivan paper + ''' + r1 = min(minimums) + print('r1 is: ', r1) + + ''' + Epsilon is a constant that we have pre selected and can change + ''' + epsilon = 1.0 + + ''' + r2 is also from the Denne-Sullivan paper + ''' + r2 = min(r1 / 2, epsilon / 2) + print('r2 is: ', r2) + + ''' + For each line segment of the control polygon, remove r2 from each end. + ''' + adjustedSegments = [] + for i in range(0, numCtrlPointSegments): + # print 'i is: ', i, 'and the Line Segment is ', segmentArray[i], segmentArray[(i+1)%numCtrlPointSegments] + [segment1, segment2] = reduceLineSegment(segmentArray[i], segmentArray[(i + 1) % numCtrlPointSegments], r2) + adjustedSegments.append(segment1) + adjustedSegments.append(segment2) + + # print 'The new segment is: ', segment1, segment2 + i += 1 + + # At this point the segments have been reduced along the vertex. This means that the number of points is 2 times the number of control points. This is because the segments no longer share any common points between themselves + numAdjustedPoints = len(adjustedSegments) + + newMinimums = [] + + ''' + Then, for each reduced segment find the distance from that segment to all other reduced segments + ''' + + i = 0 + while i + 3 < numAdjustedPoints: + j = i + 2 + while j + 1 < numAdjustedPoints: + # print 'Comparing: ', adjustedSegments[i], adjustedSegments[i+1], 'to: ', adjustedSegments[j],adjustedSegments[j+1] + [a, b, dist] = closestDistanceBetweenLines(adjustedSegments[i], adjustedSegments[i + 1], + adjustedSegments[j], adjustedSegments[j + 1], clampAll=True) + newMinimums.append(dist) + # print dist + j += 2 + i += 2 + + ''' + Take r3 (also from Denne-Sullivan) to be the minimum distance of all distances between line segments + ''' + r3 = min(newMinimums) + print('r3 is: ', r3) + + ''' + r4 is also from Denne-Sullivan paper + ''' + r4 = r3 / 6 + print('r4 is: ', r4) + + ''' + Finally, calculate delta (from Denne-Sullivan) + ''' + delta = r4 / 3 + print('delta is: ', delta) + + omega1 = omegaOne(segmentArray) + print('Omega One is: ', omega1) + + m1 = generateM1(omega1, delta) + print('M1 is: ', m1) + + segmentLengths = [] + for i in range(0, numCtrlPointSegments): + segmentLengths.append(distanceBetweenTwoPoints(segmentArray[i], segmentArray[(i + 1) % numCtrlPointSegments])) + + lambdaVal = min(segmentLengths) + print('Lambda is: ', lambdaVal) + + omega2 = omegaTwo(segmentArray) + print('Omega Two is: ', omega2) + + m2 = generateM2(omega2, lambdaVal, numCtrlPointSegments) + print('M2 is: ', m2) + + m3 = generateM3(omega2, lambdaVal, numCtrlPointSegments) + print('M3 is: ', m3) diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/user_interface/__init__.py b/user_interface/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/user_interface/cli.py b/user_interface/cli.py new file mode 100644 index 0000000..3104f00 --- /dev/null +++ b/user_interface/cli.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +""" +@author Peter Zaffetti 2017 +""" +import logging +import argparse + + +class Cli: + + def __init__(self): + self.parser = argparse.ArgumentParser(description='Generates the required number of subdivisions for a Bezier curve to match the stick knot it was created from') + self.parser.add_argument() + pass + + def generate_m_value(self, curve_file=None): + pass + +class GenerateMValue(app.CommandLineApp): + + def setup(self): + self.add_param("-g", "--generateM", help="generates the minimum number of iterations needed for the supplied \ + stick knot's Bezier cure to match the stick knot", default=None, action="store") + + +def main(): + logging.info("Pretend to do something here...") + return True + + +if __name__ == "__main__": + GenerateMValue.run() \ No newline at end of file diff --git a/user_interface/gui.py b/user_interface/gui.py new file mode 100644 index 0000000..ae3331f --- /dev/null +++ b/user_interface/gui.py @@ -0,0 +1,5 @@ +""" +TODO: This is stubbed out for now. Eventually, the GUI will sit on top of the CLI functionality in the cli.py file +@author Peter Zaffetti 2017 +""" +from cli import GenerateMValue