Skip to content
Snippets Groups Projects
Commit 187c1b2d authored by Malte Nyhuis's avatar Malte Nyhuis
Browse files

improved tele extraction algorithm. refactored, redesigned

parent 3e2df84a
No related branches found
No related tags found
1 merge request!50Profilereading
data is distributed by
https://how5.cenaero.be/content/cs2-t106-lpt-cascades
data description
https://how5.cenaero.be/sites/how5.cenaero.be/files/CS2_DNSLEST106_0.pdf
1.125954811 -0.041859818
1.126141463 -0.042323727
1.126328914 -0.042787312
1.126515998 -0.043251045
1.126703660 -0.043714451
1.126891014 -0.044177716
1.127077620 -0.044641642
1.127264242 -0.045105562
1.127449161 -0.045570163
1.127633154 -0.046034930
1.127693024 -0.046523758
1.127462842 -0.046960774
1.127030384 -0.047185256
1.126540082 -0.047124122
1.126170497 -0.046796359
1.125947192 -0.046349897
1.125722566 -0.045903137
1.125499312 -0.045456740
1.125276941 -0.045008889
1.125055538 -0.044560526
1.124834664 -0.044111901
1.124615680 -0.043662351
1.124396894 -0.043212704
1.124180517 -0.042761938
1.123964860 -0.042310941
1.123749680 -0.041859606
1.123534760 -0.041408094
1.123320477 -0.040956286
1.123106508 -0.040504326
1.122891687 -0.040052771
1.122677251 -0.039601033
1.122462453 -0.039149467
1.122248132 -0.038697674
1.122032954 -0.038246290
1.121816908 -0.037795320
1.121601281 -0.037344150
1.121384247 -0.036893658
1.121166476 -0.036443522
1.120949337 -0.035993077
1.120731546 -0.035542947
1.120514453 -0.035092480
1.120296416 -0.034642469
1.120077637 -0.034192818
1.119858612 -0.033743287
1.119638990 -0.033294048
1.119417893 -0.032845537
1.119197381 -0.032396719
1.118974723 -0.031949113
1.118751592 -0.031501977
1.118528969 -0.031054381
1.118301778 -0.030608961
1.118071650 -0.030165005
1.117841333 -0.029721163
1.117611401 -0.029277116
1.117380493 -0.028833570
1.117147097 -0.028391332
1.116910720 -0.027950680
1.116673638 -0.027510407
1.116436536 -0.027070145
1.116197742 -0.026630793
1.115955477 -0.026193354
1.115710478 -0.025757434
1.115466091 -0.025321171
1.115220576 -0.024885547
1.114971473 -0.024451958
1.114719323 -0.024020136
1.114465793 -0.023589123
1.114212199 -0.023158148
1.113956715 -0.022728290
1.113697695 -0.022300550
1.113434958 -0.021875089
1.113170949 -0.021450412
1.112907627 -0.021025310
1.112642170 -0.020601538
1.112372431 -0.020180473
1.112098383 -0.019762209
1.111823336 -0.019344595
1.111549649 -0.018926086
1.111272978 -0.018509558
1.110990876 -0.018096671
1.110704740 -0.017686574
1.110417787 -0.017277053
1.110132245 -0.016866540
1.109844015 -0.016457927
1.109550410 -0.016053141
1.109253013 -0.015651130
1.108954013 -0.015250322
1.108655141 -0.014849421
1.108354989 -0.014449462
1.108051137 -0.014052302
1.107741260 -0.013659863
1.107427312 -0.013270640
1.107114523 -0.012880483
1.106801203 -0.012490788
1.106483499 -0.012104679
1.106160903 -0.011722601
1.105835630 -0.011343557
1.105511743 -0.010965484
1.105183576 -0.010588809
1.104850891 -0.010215500
1.104517586 -0.009842718
1.104180331 -0.009473528
1.103841528 -0.009105746
1.103500078 -0.008740426
1.103154361 -0.008379138
1.102807906 -0.008018557
1.102456841 -0.007662468
1.102103720 -0.007308410
1.101747342 -0.006957642
1.101387906 -0.006609998
1.101027367 -0.006263499
1.100662840 -0.005921204
1.100297171 -0.005580134
1.099929486 -0.005241230
1.099557891 -0.004906615
1.099184830 -0.004573642
1.098805579 -0.004247735
1.098425123 -0.003923234
1.098038985 -0.003605516
1.097650310 -0.003290902
1.097258918 -0.002979680
1.096863698 -0.002673343
1.096467897 -0.002367746
1.096067987 -0.002067558
1.095667295 -0.001768400
1.095261763 -0.001475844
1.094854461 -0.001185756
1.094443260 -0.000901230
1.094028952 -0.000621232
1.093611865 -0.000345406
1.093190838 -0.000075625
1.092768121 0.000191487
1.092340659 0.000450962
1.091911565 0.000707710
1.091477666 0.000956262
1.091042023 0.001201725
1.090602032 0.001439336
1.090160159 0.001673416
1.089714662 0.001900530
1.089267976 0.002125272
1.088816594 0.002340448
1.088363286 0.002551513
1.087905818 0.002750742
1.087447479 0.002950093
1.086986145 0.003142920
1.086521245 0.003326972
1.086055366 0.003508695
1.085589692 0.003690880
1.085120945 0.003865016
1.084648856 0.004029856
1.084176147 0.004192973
1.083702885 0.004354396
1.083226482 0.004506342
1.082748402 0.004652945
1.082270372 0.004799695
1.081791740 0.004944474
1.081310767 0.005081267
1.080827662 0.005210291
1.080344857 0.005340468
1.079860351 0.005464009
1.079372492 0.005573784
1.078883417 0.005677959
1.078394212 0.005781520
1.077902835 0.005874257
1.077409216 0.005953860
1.076915545 0.006032452
1.076419795 0.006097610
1.075923005 0.006154618
1.075425333 0.006203270
1.074927283 0.006247801
1.074428709 0.006286218
1.073929796 0.006319703
1.073430555 0.006347745
1.072931108 0.006372236
1.072431275 0.006386398
1.071931252 0.006390625
1.071431208 0.006394192
1.070931170 0.006395999
1.070431206 0.006387533
1.069931498 0.006369111
1.069431806 0.006350592
1.068932418 0.006325335
1.068433312 0.006294590
1.067934620 0.006257945
1.067436267 0.006216775
1.066938793 0.006166208
1.066441675 0.006112144
1.065945704 0.006048535
1.065450275 0.005980717
1.064956328 0.005902941
1.064463189 0.005820091
1.063971711 0.005727967
1.063481413 0.005629707
1.062992813 0.005523383
1.062505822 0.005409833
1.062020836 0.005288118
1.061537967 0.005158176
1.061056335 0.005023763
1.060578274 0.004877121
1.060101080 0.004727699
1.059627847 0.004566176
1.059155509 0.004402032
1.058686681 0.004228176
1.058220361 0.004047625
1.057755964 0.003862226
1.057295809 0.003666530
1.056836207 0.003469520
1.056381068 0.003262437
1.055927127 0.003052705
1.055475799 0.002837431
1.055029386 0.002612144
1.054582971 0.002386859
1.054140589 0.002153731
1.053699952 0.001917315
1.053260689 0.001678427
1.052825059 0.001433165
1.052392433 0.001184333
1.051962253 0.000929357
1.051534232 0.000670809
1.051107269 0.000410517
1.050678929 0.000152500
1.050248650 -0.000102231
1.049811658 -0.000345102
1.049356150 -0.000547946
1.048872191 -0.000670975
1.048375617 -0.000658540
1.047966875 -0.000390627
1.047805900 0.000076595
1.047835580 0.000574422
1.047962637 0.001057481
1.048148864 0.001521215
1.048371656 0.001968681
1.048627168 0.002398475
1.048910744 0.002810241
1.049203395 0.003215700
1.049502721 0.003616245
1.049808748 0.004010518
1.050120029 0.004401809
1.050435649 0.004789706
1.050758753 0.005169697
1.051083307 0.005549594
1.051415365 0.005923397
1.051753905 0.006291425
1.052091927 0.006659922
1.052436625 0.007022178
1.052787308 0.007378643
1.053138571 0.007734533
1.053496709 0.008083513
1.053859096 0.008428078
1.054222557 0.008771513
1.054591955 0.009108536
1.054965118 0.009441407
1.055340598 0.009771628
1.055723452 0.010093309
1.056107638 0.010413386
1.056494917 0.010729710
1.056889175 0.011037288
1.057283735 0.011344491
1.057683810 0.011644453
1.058089780 0.011936410
1.058495528 0.012228668
1.058907918 0.012511477
1.059323867 0.012789030
1.059741620 0.013063842
1.060165967 0.013328370
1.060592244 0.013589790
1.061021759 0.013845829
1.061457632 0.014090898
1.061894084 0.014334945
1.062335505 0.014569856
1.062781633 0.014795736
1.063228270 0.015020571
1.063681202 0.015232459
1.064136253 0.015439774
1.064593664 0.015641798
1.065056345 0.015831448
1.065519866 0.016019060
1.065987502 0.016196119
1.066458571 0.016363887
1.066930559 0.016528993
1.067407114 0.016680441
1.067885002 0.016827661
1.068365034 0.016967676
1.068848976 0.017093537
1.069333051 0.017218914
1.069820235 0.017331487
1.070309486 0.017434879
1.070799590 0.017533996
1.071292454 0.017618410
1.071785781 0.017700137
1.072280691 0.017771475
1.072777202 0.017830875
1.073273971 0.017887919
1.073772252 0.017929749
1.074270949 0.017966555
1.074770161 0.017995096
1.075269978 0.018010247
1.075769835 0.018023778
1.076269861 0.018022126
1.076769833 0.018013198
1.077269642 0.017998197
1.077768714 0.017967185
1.078267775 0.017935807
1.078765652 0.017889529
1.079262768 0.017835422
1.079759314 0.017776566
1.080253749 0.017701904
1.080747953 0.017625666
1.081240011 0.017536775
1.081730213 0.017438010
1.082219720 0.017335938
1.082705746 0.017218426
1.083191002 0.017097686
1.083673869 0.016967824
1.084153681 0.016826992
1.084632864 0.016684125
1.085107612 0.016527097
1.085581250 0.016366730
1.086051925 0.016197915
1.086518814 0.016018847
1.086984633 0.015837034
1.087445141 0.015642192
1.087904164 0.015443821
1.088359812 0.015237866
1.088810512 0.015021258
1.089260632 0.014803473
1.089704597 0.014573390
1.090146218 0.014338824
1.090584876 0.014098778
1.091017442 0.013847916
1.091449234 0.013595729
1.091874567 0.013332788
1.092296998 0.013065204
1.092716573 0.012793173
1.093128742 0.012510052
1.093540104 0.012225744
1.093946539 0.011934454
1.094347022 0.011635012
1.094745970 0.011333536
1.095137919 0.011023030
1.095527197 0.010709162
1.095913188 0.010391266
1.096291259 0.010063993
1.096669353 0.009736740
1.097041325 0.009402557
1.097407773 0.009062312
1.097773510 0.008721300
1.098132458 0.008373172
1.098488672 0.008022224
1.098841783 0.007668164
1.099187934 0.007307294
1.099534169 0.006946502
1.099874107 0.006579773
1.100210148 0.006209469
1.100545655 0.005838678
1.100874787 0.005462227
1.101201820 0.005083939
1.101526292 0.004703467
1.101845365 0.004318441
1.102163813 0.003932902
1.102478174 0.003544025
1.102787582 0.003151194
1.103097631 0.002758868
1.103402699 0.002362660
1.103704225 0.001963745
1.104005239 0.001564445
1.104301825 0.001161849
1.104596586 0.000757908
1.104888786 0.000352120
1.105177197 -0.000056385
1.105465782 -0.000464727
1.105751032 -0.000875218
1.106030768 -0.001287343
1.106311190 -0.001700356
1.106590797 -0.002114867
1.106867184 -0.002531562
1.107139565 -0.002950883
1.107409286 -0.003371954
1.107679613 -0.003792646
1.107949772 -0.004213433
1.108216387 -0.004636473
1.108479007 -0.005062018
1.108738753 -0.005489315
1.108997715 -0.005917086
1.109257138 -0.006344578
1.109515317 -0.006772825
1.109770590 -0.007202814
1.110022232 -0.007634929
1.110271603 -0.008068363
1.110521772 -0.008501338
1.110772077 -0.008934231
1.111019794 -0.009368613
1.111264316 -0.009804803
1.111506312 -0.010242395
1.111748016 -0.010680151
1.111990232 -0.011117625
1.112230361 -0.011556242
1.112467279 -0.011996608
1.112702019 -0.012438138
1.112936192 -0.012879966
1.113171195 -0.013321355
1.113405418 -0.013763156
1.113636854 -0.014206427
1.113865563 -0.014651111
1.114092806 -0.015096543
1.114320900 -0.015541543
1.114548825 -0.015986627
1.114773342 -0.016433434
1.114995387 -0.016881487
1.115217057 -0.017329720
1.115438688 -0.017777969
1.115660067 -0.018226345
1.115880637 -0.018675121
1.116099547 -0.019124708
1.116316235 -0.019575368
1.116532319 -0.020026320
1.116748720 -0.020477119
1.116963808 -0.020928546
1.117176769 -0.021380982
1.117387959 -0.021834245
1.117599141 -0.022287513
1.117810810 -0.022740554
1.118020449 -0.023194534
1.118228213 -0.023649381
1.118435822 -0.024104297
1.118643037 -0.024559388
1.118850089 -0.025014557
1.119057769 -0.025469450
1.119262713 -0.025925558
1.119463338 -0.026383584
1.119664059 -0.026841568
1.119865362 -0.027299296
1.120065473 -0.027757557
1.120264535 -0.028216280
1.120463070 -0.028675228
1.120661321 -0.029134299
1.120859505 -0.029593400
1.121057710 -0.030052492
1.121255037 -0.030511960
1.121450873 -0.030972067
1.121646869 -0.031432106
1.121843613 -0.031891825
1.122039549 -0.032351889
1.122234360 -0.032812431
1.122428716 -0.033273166
1.122623108 -0.033733884
1.122817601 -0.034194559
1.123011407 -0.034655527
1.123204156 -0.035116933
1.123396148 -0.035578625
1.123588178 -0.036040268
1.123780670 -0.036501706
1.123971698 -0.036963795
1.124161049 -0.037426614
1.124350017 -0.037889583
1.124539152 -0.038352484
1.124727672 -0.038815637
1.124915118 -0.039279225
1.125102114 -0.039742995
1.125289238 -0.040206713
1.125476276 -0.040670466
1.125662851 -0.041134405
......@@ -5,7 +5,7 @@ from scipy.interpolate import splprep, splev
from scipy.spatial import KDTree
from ntrfc.geometry.line import lines_from_points, polyline_from_points
from ntrfc.geometry.plane import inside_poly
from ntrfc.math.vectorcalc import findNearest, vecDir, compute_minmax_distance_in_pointcloud
from ntrfc.math.vectorcalc import findNearest, vecDir, compute_minmax_distance_in_pointcloud, randomUnitVec
def clean_sites(sites, boundary, tolerance_factor =3e-2):
......@@ -39,8 +39,6 @@ def clean_sites(sites, boundary, tolerance_factor =3e-2):
radii.append(r)
print(f"ratio of cleaned sites: {len(cleaned)/len(sites)}")
cleaned = np.array(cleaned)
return np.array(cleaned), np.array(radii)
......@@ -50,14 +48,18 @@ def extract_vk_hk(sortedPoly, verbose=False):
points_2d_closed_refined = pointcloud_to_profile(points)
x_center, y_center = voronoi_skeleton(points_2d_closed_refined)
sites_raw_clean, radii= voronoi_skeleton_sites(points_2d_closed_refined)
tck, u = splprep(sites_raw_clean.T, u=None, s=0.000005, per=0, k=3)
res = 10000
u_new = np.linspace(u.min(), u.max(), res)
x_center, y_center = splev(u_new, tck, der=0)
le_ind, te_ind = skeletonline_completion(x_center, y_center, points)
return le_ind, te_ind
def voronoi_skeleton(points_2d_closed_refined):
def voronoi_skeleton_sites(points_2d_closed_refined):
vor = Voronoi(points_2d_closed_refined)
voronoi_sites_inside = vor.vertices[inside_poly(points_2d_closed_refined, vor.vertices)]
......@@ -65,12 +67,8 @@ def voronoi_skeleton(points_2d_closed_refined):
sites_inside_sorted = voronoi_sites_inside[sort_indices]
clean_sites_inside, radii = clean_sites(sites_inside_sorted, points_2d_closed_refined)
tck, u = splprep(clean_sites_inside.T, u=None, s=0.000005, per=0, k=3)
res = 10000
u_new = np.linspace(u.min(), u.max(), res)
x_center, y_center = splev(u_new, tck, der=0)
return clean_sites_inside, radii
return x_center, y_center
def skeletonline_completion(x_center, y_center, points):
......@@ -104,7 +102,7 @@ def skeletonline_completion(x_center, y_center, points):
def pointcloud_to_profile(points):
points_2d_closed = np.vstack((points[:, :2], points[:, :2][0]))
tck, u = splprep(points_2d_closed.T, u=None, s=0.0, per=1, k=3)
res = 10000
res = 30000
u_new = np.linspace(u.min(), u.max(), res)
x_new, y_new = splev(u_new, tck, der=0)
points_2d_closed_refined = np.stack([x_new, y_new]).T
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment