using ViewerGL, LinearAlgebra
GL = ViewerGL
using LinearAlgebraicRepresentation
Lar = LinearAlgebraicRepresentation

# julia> tstarrangmnt(V,CV,FV,V); # pr-congrunc
faces2D =[
([-1.2798097711002834 -0.7175836704026446 -0.9273018142005801 -0.33575271353647373 -0.8888313802786274 -0.9234061838793065 -0.5515947470915735; -0.8529755793428437 -0.39350484584391116 -0.4216332551791834 -0.17487851279515618 -0.852196385854468 -0.4165123613451497 -0.17530866605859877], [[4, 7], [1, 5], [5, 4], [6, 1], [7, 2], [3, 6], [2, 3]]),
([0.4090297017807793 1.0911767094214293 1.1620015095819656 0.489477678628799 0.8016133264659618 0.7803006368816129; 0.6927213209798023 1.2289485323795242 1.6505941305087972 1.1716577255753056 1.0396095639207596 0.9571211278136456], [[1, 6], [3, 4], [4, 1], [2, 3], [6, 5], [5, 2]]),
([-1.0385711979250456 -0.7132409306523589 -1.0218142003120991 -1.0384325424416172 -0.7191489025549408; -0.41534838517272094 -0.3927141758263955 -0.1744935610128188 -0.4204698531446064 -0.17449353259972233], [[5, 3], [3, 1], [2, 5], [1, 4], [4, 2]]),
([-0.7258691288852619 -0.6448476135357281 -0.7529733231311402 -0.6448475748797735; -0.9414365540939522 -0.9488527179167867 -0.645323503925401 -0.6467259137115772], [[4, 2], [2, 1], [3, 4], [1, 3]]),
([-1.0121267711184847 -0.33480840100420095 -0.3348084695672869 -1.0121267493199877; -0.2597056379767005 0.21923078518196468 0.6981670688632455 0.2192306971122646], [[2, 1], [4, 3], [3, 2], [1, 4]]),
([0.6448476063306642 1.3221658778195489 1.322165901959854 0.6448475232354451; -0.1463457735868241 0.3325905535984814 0.8115269773474794 0.3325905612647395], [[4, 1], [2, 3], [3, 4], [1, 2]]),
([-0.06604591075614946 0.18807124440577458 0.1905165467536977 -0.04021340022048541 0.14217000611740668; -0.04713960699351189 0.2068955875876711 0.209505626479912 -0.02326566448216332 0.16361675908761078], [[4, 2], [1, 4], [2, 3], [3, 5], [5, 1]]),
([-0.6697247396897046 -0.2086932468973245 -0.5052490695995919 0.006994807111632216 -0.24632547950176553 -0.24927887576058852 0.15179576190233096; 0.644847403065945 0.7568013675147519 1.322165656894694 0.7258689440961424 0.6448474196145497 0.6502453745761758 1.3221657898108872], [[5, 1], [3, 7], [7, 4], [1, 3], [6, 5], [2, 6], [4, 2]]),
([-0.6503139392786357 -0.29398729456104555 -0.37586972830149784 -0.5732109629805938 -0.41272353233912057 -0.5233786186832611 -0.46562652421258094; -0.7396197100048467 -0.3972361696037834 -0.45399913155911314 -0.6186936367403125 -0.5834586434704805 -0.6758077398003293 -0.5948847636314626], [[1, 7], [7, 6], [2, 3], [5, 2], [4, 1], [6, 5], [3, 4]]),
([0.6467332598875593 0.7851007085073018 0.7851007074696446 0.6776070311248275; 0.018049561024192355 0.09608628388193051 0.2633898315127631 0.21470523454981943], [[4, 1], [3, 4], [1, 2], [2, 3]]),
([-0.779895602742659 -0.4553408517346448 -0.652509317340201 -0.7650426585272763 -0.6534665149433275 -0.6579726462257522 -0.4560220120135956 -0.4411690677982131; -0.1673539149934392 -0.046897891072995655 0.17587361979499583 0.13889993356702787 0.1708238266062496 0.17407860148447787 -0.06094278034815384 0.24531106821231316], [[3, 5], [5, 6], [1, 7], [6, 4], [8, 3], [4, 1], [7, 2], [2, 8]]),
([0.7622970369442709 0.7692584135831895 0.76553099855101; 0.31581372865520774 0.3201890192230694 0.32095917543894364], [[1, 3], [2, 1], [3, 2]]),
([-1.0541060033025456 -0.7283956506338671 -1.0546135163471562 -0.7416434996459378 -1.0535823727283933; 0.5846207610275508 0.583084917238596 0.6922503610772871 0.7208776421538298 0.5791744063734227], [[2, 5], [1, 3], [4, 2], [5, 1], [3, 4]]),
([0.46088661668800884 0.6467332598875607 0.4608866167915211 0.6724489914908843; 0.6695507645610579 0.6695507646203934 0.9937648018995732 0.9937648018377638], [[4, 2], [2, 1], [3, 4], [1, 3]]),
([-0.36557656064828625 0.5922962739322862 0.11335982892788275 0.11335982101674907; -0.8518116882414981 -0.17449331351230066 -0.17449334847177042 -0.8518116436467215], [[3, 2], [4, 1], [1, 3], [2, 4]]),
([-0.3899181623603573 -0.06555604191791929 -0.3896220982289381 -0.15929960118731126 -0.07535116145235445 -0.1969108414411048; 0.9839649649611354 0.9937645583723279 0.9937645541302548 0.9642674642570118 0.6695505212320305 0.6695505196407963], [[6, 4], [4, 1], [5, 6], [3, 2], [2, 5], [1, 3]]),
([0.2696522928626458 0.5018086808859741 0.47513192706916185 0.2732636209749537; -0.6421317134295561 -0.514805620005238 -0.26747630378962917 -0.3925646287592917], [[1, 4], [2, 1], [4, 3], [3, 2]]),
([-0.6922503610772871 -0.5846207610275508 -0.6913581132960885; 0.9839649649611354 0.9937645871879821 0.9937645541302549], [[1, 2], [2, 3], [3, 1]]),
([-0.0003558289156989935 0.7475543240956147 0.7475543193661965 -0.00035575654402898125; -0.3986377043306246 0.13021464464356017 0.6590669546828719 0.1302146396995053], [[3, 2], [1, 4], [4, 3], [2, 1]]),
([-0.5634030165076495 0.18450710897255157 -0.5634030323319841 0.1845070931482169; -0.8054012465702503 -0.8054012623945849 -0.057491114354159815 -0.05749113017849419], [[4, 3], [1, 2], [2, 4], [3, 1]]),
([0.057491069890257734 0.8054012021063481 0.8054012179306865 0.057491085714595935; -0.3577337617253023 0.17111858272300895 0.699970876589569 0.17111853214125755], [[4, 1], [2, 3], [3, 4], [1, 2]]),
([-0.8054012623945846 -0.057491130178494144 -0.8054012179306864 -0.05749108571459594; -0.7475543709919092 -0.7475543265280078 0.0003557049183168017 0.0003557493822183141], [[2, 4], [3, 1], [1, 2], [4, 3]]),
([-0.9453779886878261 -0.047691586676358796 -0.9347162589906084 -0.6706800769589929 -0.6181290860595076 -0.6202522863734578 -1.0845096880603842 -0.46152119777774997 -0.9453833058121955; -0.48963784662390314 0.0008336133858533825 -0.4701241938398577 0.00704930012507864 -0.3787325971054617 -0.28454624337107204 -0.7408350235914223 -0.7470507103306474 -0.48940197600963187], [[8, 2], [9, 7], [4, 3], [7, 8], [2, 4], [5, 1], [3, 6], [6, 5], [1, 9]]),
([-0.4768341894077711 0.0003557844517982159 0.0003557120801280599 -0.7475543685595155 -0.7475543638300972 -0.47941960720940857 -0.4961126373643564; -0.7314398673985791 -0.4747709995961227 0.15573526438373286 -0.8770536599771404 -0.24654733005280857 -0.7278644368281862 -0.7418092751419646], [[5, 4], [2, 3], [3, 5], [4, 7], [1, 2], [7, 6], [6, 1]]),
([-0.32426714810061874 -0.3178339849732556 -0.31651935101416007; 0.47683418940777095 0.47941960720940846 0.49611263736435623], [[3, 1], [2, 3], [1, 2]]),
([-0.48963784662390314 -0.4701241938398577 -0.48940197600963187 -0.28454624337107204 -0.3787325971054617; 0.049730280157139754 0.06587213039119212 0.050015420782415755 0.07643840590530138 -0.03742213531979252], [[2, 3], [1, 5], [4, 2], [5, 4], [3, 1]]),
([0.6695507643553293 0.9837550033206118 0.9937648017030808 0.6695507644234329; 0.6733097772450742 0.9871959122403988 0.9978523852459957 0.6781379408931124], [[3, 2], [1, 4], [2, 1], [4, 3]]),
([0.9837550033206085 0.9937648016938412 0.9937648017030773; 0.6376220802367375 0.6432822564072982 0.6553240139833155], [[1, 3], [2, 1], [3, 2]]),
([-0.818745341363344 -0.5007131023573861 -0.5215884382582039 -0.49437881059673994 -0.49472235965758204 -0.8076180014889325; -1.2645868510036822 -1.0460582901346591 -0.8321240422303853 -1.0425221183871403 -1.050026387139559 -1.0215261503271076], [[2, 4], [3, 2], [6, 3], [5, 1], [1, 6], [4, 5]]),
([0.6787799844049875 0.992143482099084 0.9929193167327109 0.6795526588743764; 0.6695507643553293 0.9828495290877188 0.9837550033206118 0.6695507643674667], [[3, 2], [2, 4], [4, 1], [1, 3]]),
([0.46088661502747014 0.4989025303730048 0.4608866155771692; 0.09562318959388295 0.09562318978859051 0.20294985482814365], [[3, 2], [2, 1], [1, 3]]),
([0.6695507645610579 0.9937648018995732 0.9937648017030811 0.6695507644234331; 0.19436405547083296 0.42883649062481927 0.6426672510025468 0.3441542736299178], [[4, 1], [1, 2], [2, 3], [3, 4]])
];

for (V,EV) in faces2D
	VV = [[k] for k=1:size(V,2)]
	model = (V, [VV,EV])::Lar.LARmodel
	println(EV,“\n”)
	GL.VIEW(GL.numbering(.1)(model, GL.COLORS[1], 0.1));
end
