Normand Briere
2019-06-03 e24558ddeacfc945b9e9ba0a32b552d04e2ed4dd
BoundaryRep.java
....@@ -161,6 +161,7 @@
161161 || FaceCount() != other.FaceCount()
162162 || !(indices == null ^ other.indices != null)) // july 2014
163163 {
164
+ // The meshes have different structures.
164165 //new Exception().printStackTrace();
165166 trimmed = other.trimmed;
166167 stripified = other.stripified;
....@@ -172,16 +173,16 @@
172173 bufV = other.bufV;
173174 bufF = other.bufF;
174175
175
- positions = (float[]) GrafreeD.clone(other.positions);
176
- normals = (float[]) GrafreeD.clone(other.normals);
177
- colors = (float[]) GrafreeD.clone(other.colors);
178
- uvmap = (float[]) GrafreeD.clone(other.uvmap);
179
- triangles = (int[]) GrafreeD.clone(other.triangles);
176
+ positions = (float[]) Grafreed.clone(other.positions);
177
+ normals = (float[]) Grafreed.clone(other.normals);
178
+ colors = (float[]) Grafreed.clone(other.colors);
179
+ uvmap = (float[]) Grafreed.clone(other.uvmap);
180
+ triangles = (int[]) Grafreed.clone(other.triangles);
180181
181
- indices = (int[]) GrafreeD.clone(other.indices);
182
+ indices = (int[]) Grafreed.clone(other.indices);
182183
183
- vertices = (Vector<Vertex>) GrafreeD.clone(other.vertices);
184
- faces = (Vector<Face>) GrafreeD.clone(other.faces);
184
+ vertices = (Vector<Vertex>) Grafreed.clone(other.vertices);
185
+ faces = (Vector<Face>) Grafreed.clone(other.faces);
185186 }
186187 else
187188 {
....@@ -239,9 +240,16 @@
239240 }
240241 }
241242
242
- Support[] InitConnections(BoundaryRep other)
243
+ transient Support[] cachesupports = null;
244
+
245
+ Support[] InitConnections()
243246 {
244
- int n = other.startvertices.length-1;
247
+ if (cachesupports != null)
248
+ {
249
+ return cachesupports;
250
+ }
251
+
252
+ int n = this.startvertices.length-1;
245253
246254 Support[] supports = new Support[n];
247255
....@@ -253,38 +261,60 @@
253261
254262 for (int object=1; object<=n; object++)
255263 {
256
- int start = other.startvertices[object-1];
257
- int end = other.startvertices[object];
264
+ int start = this.startvertices[object-1];
265
+ int end = this.startvertices[object];
258266
259267 if (start == end)
260268 continue; // ??
261269
270
+ /**
271
+ Vertex v2 = vertextemp;
272
+ v2.x = averagepoints[object*3];
273
+ v2.y = averagepoints[object*3+1];
274
+ v2.z = averagepoints[object*3+2];
275
+
276
+ //v2.set(GetVertex(this.startvertices[subsupport]));
277
+
278
+ // projected point
279
+ Vertex v3 = vertextemp2;
280
+ //GetVertex(this.startvertices[subsupport]);
281
+ v3.x = extremepoints[object*3];
282
+ v3.y = extremepoints[object*3+1];
283
+ v3.z = extremepoints[object*3+2];
284
+
285
+ vect3.set(v3); // "X" axis apex
286
+ vect3.sub(v2); // origin (center)
287
+ vect3.normalize();
288
+ /**/
289
+
262290 int linkcount = 0;
263291
264292 int objectinlist = -1;
293
+
294
+ Support subsupport = supports[object-1];
265295
266296 for (int object2=1; object2<=n; object2++)
267297 {
268298 for (int i = start; i < end; i++)
269299 {
270
- Vertex v = other.GetVertex(i);
300
+ Vertex v = this.GetVertex(i);
271301
272
- //
273
- if (other.Contains(v, object2))
302
+ // Check if v is close enough from any vertex of the given subobject.
303
+ if (this.Contains(v, object2))
274304 {
275
- if (linkcount == supports[object-1].links.length)
305
+ if (linkcount == subsupport.links.length)
276306 break;
277307
278308 if (object2 == object)
279309 objectinlist = linkcount;
280310
281
- supports[object-1].links[linkcount++] = object2;
311
+ subsupport.links[linkcount++] = object2;
282312 break;
283313 }
284314 }
285315 }
286316
287
- supports[object-1].links[linkcount] = -1;
317
+ subsupport.links[linkcount] = -1;
288318
289319 if (objectinlist == -1)
290320 assert(objectinlist != -1);
....@@ -293,9 +323,9 @@
293323 // assert(linkcount > 1);
294324
295325 // show main support as blue
296
- int first = supports[object-1].links[0];
297
- supports[object-1].links[0] = supports[object-1].links[objectinlist];
298
- supports[object-1].links[objectinlist] = first;
326
+ int first = subsupport.links[0];
327
+ subsupport.links[0] = subsupport.links[objectinlist];
328
+ subsupport.links[objectinlist] = first;
299329 }
300330
301331 for (int loop = 0; --loop>=0;)
....@@ -353,7 +383,7 @@
353383 supports = supports2;
354384 }
355385
356
- return supports;
386
+ return cachesupports = supports;
357387 }
358388
359389 double Distance2(Vertex v, Vertex v2, double dist2beat, double[][] toRoot, int k)
....@@ -500,7 +530,7 @@
500530 static Vertex vertextemp = new Vertex(true);
501531 static Vertex vertextemp2 = new Vertex(true);
502532
503
- static double SEUIL = 0.1f; // 0.1 for rag doll; 0.07;
533
+ static double SEUIL = 0.05f; // 0.1 for rag doll; 0.07;
504534
505535 // Compute weight of point w/r to this
506536 float ComputeWeight(Vertex v, double[][] toRoot, int k)
....@@ -598,7 +628,7 @@
598628 // ;
599629 //
600630
601
- supportsize = supportsizes[subsupport];
631
+ supportsize = supportminsize[subsupport];
602632
603633 double K = supportsize / distmax;
604634
....@@ -650,7 +680,8 @@
650680 // if (supportsize * fadefactor > 1)
651681 // return 1;
652682
653
- return supportsize * fadefactor;
683
+ return //supportsize *
684
+ supportsize * fadefactor;
654685 }
655686
656687 void RecomputeBasis(BoundaryRep other, double[][] toRoot, Vertex v)
....@@ -952,7 +983,7 @@
952983
953984 // sept 2017 SEUIL = 0.1; // aout 2013
954985
955
- supports = InitConnections(other);
986
+ supports = other.InitConnections();
956987
957988 other.supports = supports; // should be the other way around...
958989
....@@ -1518,7 +1549,7 @@
15181549 InitFaceIndices();
15191550 }
15201551
1521
- BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this);
1552
+ BoundaryRep rep = (BoundaryRep) Grafreed.clone(this);
15221553 //float[] v = new float[100];
15231554
15241555 for (int loops=1; --loops>=0;)
....@@ -1548,7 +1579,7 @@
15481579 InitFaceIndices();
15491580 }
15501581
1551
- BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this);
1582
+ BoundaryRep rep = (BoundaryRep) Grafreed.clone(this);
15521583 //float[] v = new float[100];
15531584
15541585 for (int loops=10; --loops>=0;)
....@@ -1895,7 +1926,7 @@
18951926 return;
18961927 }
18971928
1898
- // System.exit(0);
1929
+ // System.exit(0);
18991930
19001931 cVector vect = new cVector();
19011932 cVector normal = new cVector();
....@@ -1966,7 +1997,7 @@
19661997 if (v.vertexlinks == null)
19671998 continue;
19681999
1969
- if (v.weights != null && v.weights[j] == 0) // < 0.01 * v.totalweight) // == 0)
2000
+ if (v.weights != null && v.weights[j] < 0.001 * v.totalweight) // == 0)
19702001 {
19712002 //testweight += v.weights[j-1];
19722003 continue;
....@@ -2247,6 +2278,8 @@
22472278
22482279 transient int lastsoundtime;
22492280
2281
+ transient boolean once = false;
2282
+
22502283 void setMasterThis0(BoundaryRep other, double[][] toRoot, boolean smooth, boolean marked)
22512284 {
22522285 if (LA.isIdentity(toRoot))
....@@ -2302,7 +2335,11 @@
23022335
23032336 if (v.totalweight == 0)
23042337 {
2305
- System.err.println("v.totalweight == 0! --> " + this + " : " + other);
2338
+ if (!once)
2339
+ {
2340
+ System.err.println("v.totalweight == 0! --> " + this + " : " + other);
2341
+ once = true;
2342
+ }
23062343 continue;
23072344 }
23082345
....@@ -2670,7 +2707,7 @@
26702707
26712708 if (Globals.framecount - lastsoundtime > 30) // 0.25 secs
26722709 {
2673
- GrafreeD.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1);
2710
+ Grafreed.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1);
26742711
26752712 lastsoundtime = Globals.framecount;
26762713 }
....@@ -3098,6 +3135,7 @@
30983135 //
30993136 // transient VertexCompare[] vertexcompare = null;
31003137
3138
+ // Check if v0 is close enough from any vertex of the given subobject of this.
31013139 boolean Contains(Vertex v0, int object)
31023140 {
31033141 int start = startvertices[object-1];
....@@ -3403,7 +3441,7 @@
34033441 k /= x*x + y*y;
34043442 }
34053443 else
3406
- GrafreeD.Assert(z == 1);
3444
+ Grafreed.Assert(z == 1);
34073445
34083446 if (k < 0)
34093447 k = 0;
....@@ -3696,6 +3734,111 @@
36963734 */
36973735 }
36983736
3737
+ void GenerateNormals2(boolean crease)
3738
+ {
3739
+ cVector tempVector = new cVector();
3740
+
3741
+// java.util.HashMap<cVector, cVector> tableBase = new java.util.HashMap<cVector, cVector>();
3742
+//
3743
+//
3744
+// for (int i=0; i<this.VertexCount(); i++)
3745
+// {
3746
+// Vertex v = this.GetVertex(i);
3747
+//
3748
+// tempVector.set(v);
3749
+//
3750
+// cVector n = tableBase.get(tempVector.ToFloat());
3751
+//
3752
+// if (n != null)
3753
+// {
3754
+// continue;
3755
+// }
3756
+//
3757
+// tableBase.put(new cVector(tempVector), new cVector(v.norm));
3758
+// }
3759
+
3760
+ BoundaryRep tempSupport = this.support;
3761
+
3762
+ this.support = null;
3763
+
3764
+ BoundaryRep tempRep = (BoundaryRep)Grafreed.clone(this);
3765
+
3766
+ this.support = tempSupport;
3767
+
3768
+ //tempRep.Unstripify();
3769
+
3770
+ tempRep.GenerateNormals2(crease);
3771
+
3772
+ boolean keepnormal = Vertex.normalmode;
3773
+ boolean epsequal = Grafreed.epsequal;
3774
+
3775
+ Vertex.normalmode = false;
3776
+ Grafreed.epsequal = false; // A bit strange
3777
+
3778
+ // No need to have a match for vertex counts.
3779
+
3780
+ java.util.HashMap<cVector, cVector> table = new java.util.HashMap<cVector, cVector>();
3781
+
3782
+ for (int i=0; i<tempRep.VertexCount(); i++)
3783
+ {
3784
+ Vertex v = tempRep.GetVertex(i);
3785
+
3786
+ cVector n = table.get(tempVector.ToFloat());
3787
+
3788
+ if (v.norm.x == 1 && v.norm.y == 0 && v.norm.z == 0)
3789
+ {
3790
+ //continue;
3791
+ }
3792
+
3793
+ tempVector.set(v);
3794
+
3795
+ //cVector nBase = tableBase.get(tempVector);
3796
+
3797
+ //if (v.norm.dot(nBase) < 0.9)
3798
+ //{
3799
+ // continue;
3800
+ //}
3801
+
3802
+ if (n != null && n.x == 1 && n.y == 0 && n.z == 0)
3803
+ {
3804
+ //continue;
3805
+ }
3806
+
3807
+ if (n != null)
3808
+ {
3809
+// if (n.dot(v.norm) < 0)
3810
+// n.sub(v.norm);
3811
+// else
3812
+// n.add(v.norm);
3813
+//
3814
+// n.normalize();
3815
+ continue;
3816
+ }
3817
+
3818
+ table.put(new cVector(tempVector), new cVector(v.norm));
3819
+ }
3820
+
3821
+ for (int i=0; i<this.VertexCount(); i++)
3822
+ {
3823
+ Vertex v = this.GetVertex(i);
3824
+
3825
+ tempVector.set(v);
3826
+
3827
+ cVector n = table.get(tempVector.ToFloat());
3828
+
3829
+ //if (n.dot(v.norm) < 0)
3830
+ if (n == null)
3831
+ continue;
3832
+
3833
+ LA.vecCopy(n, v.norm);
3834
+
3835
+ this.SetVertex(v, i);
3836
+ }
3837
+
3838
+ Grafreed.epsequal = epsequal;
3839
+ Vertex.normalmode = keepnormal;
3840
+ }
3841
+
36993842 void GenerateNormals(boolean crease)
37003843 {
37013844 boolean wastrim = trimmed;
....@@ -3869,6 +4012,9 @@
38694012 {
38704013 triangles[i] = i;
38714014 }
4015
+
4016
+ Untrim();
4017
+ MergeNormals();
38724018 }
38734019 }
38744020
....@@ -3902,6 +4048,11 @@
39024048 tsa.getNormals(0, normals);
39034049 tsa.getTextureCoordinates(0, 0, uvmap);
39044050 // tsa.getColors(0, colors);
4051
+
4052
+ for (int i=colors.length; --i>=0;)
4053
+ {
4054
+ colors[i] = 1;
4055
+ }
39054056
39064057 int stripcount = tsa.getNumStrips();
39074058 triangles = new int[stripcount];
....@@ -3924,6 +4075,9 @@
39244075 triangles = new int[1];
39254076 triangles[0] = 3;
39264077 }
4078
+
4079
+ Untrim();
4080
+ MergeNormals();
39274081 }
39284082
39294083 /*
....@@ -3973,6 +4127,40 @@
39734127 }
39744128
39754129 Vertex.normalmode = false;
4130
+ }
4131
+
4132
+ void MergeNormals()
4133
+ {
4134
+ boolean smooth = Grafreed.smoothmode;
4135
+ boolean link = Grafreed.linkUV;
4136
+ Grafreed.smoothmode = true;
4137
+ Grafreed.linkUV = true;
4138
+
4139
+ System.out.println("#Vertex = " + VertexCount());
4140
+ System.out.println("#Face = " + FaceCount());
4141
+
4142
+ java.util.HashSet<Vertex> table = new java.util.HashSet<Vertex>();
4143
+
4144
+ for (int i = 0; i < VertexCount(); i++)
4145
+ {
4146
+ Vertex v = GetVertex(i);
4147
+
4148
+ if (!table.contains(v))
4149
+ {
4150
+ table.add(v);
4151
+ }
4152
+ }
4153
+
4154
+ Grafreed.smoothmode = smooth;
4155
+ Grafreed.linkUV = link;
4156
+
4157
+// for (int i = 0; i < VertexCount(); i++)
4158
+// {
4159
+// Vertex v = GetVertex(i);
4160
+//
4161
+// table.add(v);
4162
+// }
4163
+
39764164 }
39774165
39784166 static cVector temp1 = new cVector();
....@@ -4747,7 +4935,7 @@
47474935 {
47484936 i3 = positions.length-3;
47494937 i2 = uvmap.length - 2;
4750
- new Exception().printStackTrace();
4938
+ //new Exception().printStackTrace();
47514939 }
47524940
47534941 v./*pos.*/x = positions[i3];
....@@ -5471,17 +5659,27 @@
54715659
54725660 transient int nbbadfaces; // ?? = 1000000;
54735661
5474
- int ChooseTriangle()
5662
+ /*
5663
+ */
5664
+ int ChooseTriangle(boolean firstEquilateral)
54755665 {
54765666 int chosen = -1;
54775667
54785668 double minweight = 1E10;
54795669
5670
+ int step = 8; // ?
5671
+
5672
+ if (firstEquilateral)
5673
+ step = 1;
5674
+
54805675 nbbadfaces = 0;
5481
- for (int i=0; i<faces.size(); i+=8)
5676
+ for (int i=0; i<faces.size(); i+=step)
54825677 // for (int i=faces.size(); (i-=8)>=0;)
54835678 {
54845679 Face face = (Face) faces.get(i);
5680
+
5681
+ if (face.used)
5682
+ continue;
54855683
54865684 if (!Valid(face))
54875685 {
....@@ -5491,6 +5689,15 @@
54915689
54925690 if (Boundary(face))
54935691 continue;
5692
+
5693
+// if (Boundary(face.p))
5694
+// continue;
5695
+//
5696
+// if (Boundary(face.q))
5697
+// continue;
5698
+//
5699
+// if (Boundary(face.r))
5700
+// continue;
54945701
54955702 if (!ValidValence(face))
54965703 continue;
....@@ -5503,22 +5710,55 @@
55035710 //?? if (face.weight < 0)
55045711 // continue;
55055712
5506
- double K = 1; // 0.01; // .25;
5507
-
5508
- double factor = (1-K)*face.nbiterations + K; //*face.weight;
5509
-
5510
- double weight = FaceWeight(face); // *Math.pow(PerimeterMax(face),0.25)*factor;
5511
-
5512
- if (minweight > weight)
5713
+ if (firstEquilateral)
55135714 {
5514
- minweight = weight;
5715
+ if (OneFaceUsed(links.get(face.p)))
5716
+ continue;
5717
+
5718
+ if (OneFaceUsed(links.get(face.q)))
5719
+ continue;
5720
+
5721
+ if (OneFaceUsed(links.get(face.r)))
5722
+ continue;
5723
+
55155724 chosen = i;
5516
- if (minweight == 0)
5517
- break;
5725
+ break;
5726
+ }
5727
+ else
5728
+ {
5729
+ double K = 1; // 0.01; // .25;
5730
+
5731
+ double factor = (1-K)*face.nbiterations + K; //*face.weight;
5732
+
5733
+ double weight = FaceWeight(face); // *Math.pow(PerimeterMax(face),0.25)*factor;
5734
+
5735
+ if (minweight > weight)
5736
+ {
5737
+ minweight = weight;
5738
+ chosen = i;
5739
+ if (minweight == 0)
5740
+ break;
5741
+ }
55185742 }
55195743 }
55205744
55215745 return chosen;
5746
+ }
5747
+
5748
+ private boolean OneFaceUsed(Vector<Face> faces)
5749
+ {
5750
+ if (faces.size() != 6)
5751
+ return true;
5752
+
5753
+ for (int i=0; i<6; i+=1)
5754
+ {
5755
+ if (faces.get(i).used)
5756
+ {
5757
+ return true;
5758
+ }
5759
+ }
5760
+
5761
+ return false;
55225762 }
55235763
55245764 static boolean remove3valence = true;
....@@ -5554,7 +5794,7 @@
55545794 }
55555795 else
55565796 {
5557
- assert(links.size() == vertices.size());
5797
+ // TODO Grafreed.Assert(links.size() == vertices.size());
55585798
55595799 links.setSize(vertices.size());
55605800 for (int i=vertices.size(); --i>=0;)
....@@ -5562,6 +5802,7 @@
55625802 // linkstouched[i] = false;
55635803 if (links.get(i) == null) // ??
55645804 {
5805
+ new Exception().printStackTrace();
55655806 links.set(i, new Vector(8));
55665807 // linkstouched[i] = true;
55675808 }
....@@ -5572,6 +5813,8 @@
55725813 }
55735814 }
55745815
5816
+ boolean once = false;
5817
+
55755818 for (int i=faces.size(); --i>=0;)
55765819 {
55775820 Face face = (Face) faces.get(i);
....@@ -5583,6 +5826,9 @@
55835826 //if (linkstouched[face.r])
55845827 links.get(face.r).add(face);
55855828
5829
+ if (face.used)
5830
+ once = true;
5831
+
55865832 face.good = 1;
55875833 face.boundary = -1;
55885834 }
....@@ -6948,6 +7194,10 @@
69487194 return (face.boundary = 1) == 1;
69497195 }
69507196
7197
+ // June 2019
7198
+ if (true)
7199
+ return (face.boundary = 0) == 1;
7200
+
69517201 // reverse triangle test
69527202 q1.set(p);
69537203 q2.set(q);
....@@ -7397,7 +7647,7 @@
73977647 //InitWeights();
73987648 }
73997649
7400
- int chosen = ChooseTriangle(); // Best is slow and not really better
7650
+ int chosen = ChooseTriangle(true); // Best is slow and not really better
74017651
74027652 if (chosen == -1)
74037653 {
....@@ -7411,7 +7661,7 @@
74117661 //remove3valence = false;
74127662 // InitWeights();
74137663
7414
- chosen = ChooseTriangle();
7664
+ chosen = ChooseTriangle(true);
74157665 }
74167666 }
74177667
....@@ -7687,7 +7937,7 @@
76877937
76887938 // boolean lock;
76897939
7690
- void SplitInTwo(boolean reduction34, boolean onlyone)
7940
+ boolean SplitInTwo(boolean reduction34, boolean onlyone)
76917941 {
76927942 if (stripified)
76937943 {
....@@ -7724,12 +7974,12 @@
77247974 {
77257975 System.err.println("EXCEPTION CAUGHT");
77267976 e.printStackTrace();
7727
- return;
7977
+ return false;
77287978 } catch (Error e)
77297979 {
77307980 System.err.println("ERROR CAUGHT");
77317981 e.printStackTrace();
7732
- return;
7982
+ return false;
77337983 }
77347984
77357985 System.out.println("# faces = " + faces.size());
....@@ -7739,6 +7989,7 @@
77397989 {
77407990 Face face = (Face) faces.get(i);
77417991
7992
+ face.used = false;
77427993 face.nbiterations = 1;
77437994 face.weight = -1;
77447995 face.boundary = -1;
....@@ -7790,6 +8041,11 @@
77908041 nbbadfaces = faces.size();
77918042 //remove3valence = true;
77928043
8044
+ int count = 2;
8045
+
8046
+ if (onlyone)
8047
+ count = 1;
8048
+
77938049 firstpass = true;
77948050
77958051 int n = faces.size();
....@@ -7805,8 +8061,9 @@
78058061 System.out.print('.');
78068062 }
78078063 System.out.println();
8064
+ boolean atleastone = false;
78088065 int i = 0;
7809
- while (reduction34 || faces.size() > n/2)
8066
+ while (true) // reduction34 || faces.size() > n/2)
78108067 {
78118068 if (i++%100 == 0)
78128069 {
....@@ -7828,6 +8085,8 @@
78288085 {
78298086 if (!RemoveOneTriangle())
78308087 break;
8088
+
8089
+ atleastone = true;
78318090 }
78328091 // if (iterationcount == 0)
78338092 // break;
....@@ -7838,8 +8097,8 @@
78388097 break;
78398098 }
78408099 firstpass = false;
7841
- if (onlyone)
7842
- break; // one triangle only
8100
+// if (--count<0 && !reduction34)
8101
+// break; // one triangle only
78438102 }
78448103
78458104 InitLinks(false); // for further display
....@@ -7855,6 +8114,8 @@
78558114 Trim(true,false,false,false,false);
78568115
78578116 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
8117
+
8118
+ return atleastone;
78588119 }
78598120
78608121 void UpdateIndices(Face face, Face minface)
....@@ -7867,18 +8128,21 @@
78678128 face.p = minface.p;
78688129 //if (leafweights)
78698130 face.good = 0; // false;
8131
+ face.used = true;
78708132 }
78718133 if (face.q == minface.p || face.q == minface.q || face.q == minface.r)
78728134 {
78738135 face.q = minface.p;
78748136 //if (leafweights)
78758137 face.good = 0; // false;
8138
+ face.used = true;
78768139 }
78778140 if (face.r == minface.p || face.r == minface.q || face.r == minface.r)
78788141 {
78798142 face.r = minface.p;
78808143 //if (leafweights)
78818144 face.good = 0; // false;
8145
+ face.used = true;
78828146 }
78838147
78848148 if (face.p >/*=*/ minface.q && face.p < minface.r)
....@@ -7938,50 +8202,50 @@
79388202 if (v == 2)
79398203 vert = minface.r;
79408204 // Face face = (Face) faces.get(i);
7941
- Vector<Face> vertfaces = links.get(vert);
7942
- for (int i=vertfaces.size(); --i>=0;)
7943
- {
7944
- Face face = (Face) vertfaces.get(i);
7945
-
7946
- // if (face.weight == 10000)
7947
- // continue;
7948
-
7949
- if (face.p == minface.p || face.q == minface.p || face.r == minface.p ||
7950
- face.p == minface.q || face.q == minface.q || face.r == minface.q ||
7951
- face.p == minface.r || face.q == minface.r || face.r == minface.r)
8205
+ Vector<Face> vertfaces = links.get(vert);
8206
+ for (int i=vertfaces.size(); --i>=0;)
79528207 {
7953
- if (!leafweights)
8208
+ Face face = (Face) vertfaces.get(i);
8209
+
8210
+ // if (face.weight == 10000)
8211
+ // continue;
8212
+
8213
+ if (face.p == minface.p || face.q == minface.p || face.r == minface.p ||
8214
+ face.p == minface.q || face.q == minface.q || face.r == minface.q ||
8215
+ face.p == minface.r || face.q == minface.r || face.r == minface.r)
79548216 {
7955
-// if(minfaceweight <= 0)
7956
-// assert(minfaceweight > 0);
7957
-//
7958
-// //FaceWeight(face);
7959
-// if(face.weight < 0)
7960
-// assert(face.weight >= 0);
7961
-
7962
- face.weight += minfaceweight;
7963
-
7964
-// if (face.weight >= 10000)
7965
-// assert(face.weight < 10000);
8217
+ if (!leafweights)
8218
+ {
8219
+ // if(minfaceweight <= 0)
8220
+ // assert(minfaceweight > 0);
8221
+ //
8222
+ // //FaceWeight(face);
8223
+ // if(face.weight < 0)
8224
+ // assert(face.weight >= 0);
8225
+
8226
+ face.weight += minfaceweight;
8227
+
8228
+ // if (face.weight >= 10000)
8229
+ // assert(face.weight < 10000);
8230
+ }
8231
+ else
8232
+ face.weight = -1;
8233
+
8234
+ face.nbiterations += 1;
8235
+ face.boundary = -1;
8236
+
8237
+ Vertex p = (Vertex)vertices.get(face.p);
8238
+ Vertex q = (Vertex)vertices.get(face.q);
8239
+ Vertex r = (Vertex)vertices.get(face.r);
8240
+
8241
+ p.boundary = -1;
8242
+ q.boundary = -1;
8243
+ r.boundary = -1;
79668244 }
79678245 else
7968
- face.weight = -1;
7969
-
7970
- face.nbiterations += 1;
7971
- face.boundary = -1;
7972
-
7973
- Vertex p = (Vertex)vertices.get(face.p);
7974
- Vertex q = (Vertex)vertices.get(face.q);
7975
- Vertex r = (Vertex)vertices.get(face.r);
7976
-
7977
- p.boundary = -1;
7978
- q.boundary = -1;
7979
- r.boundary = -1;
8246
+ assert(false);
79808247 }
7981
- else
7982
- assert(false);
79838248 }
7984
- }
79858249
79868250 // TouchVertex(minface.p);
79878251 // TouchVertex(minface.q);
....@@ -8182,6 +8446,7 @@
81828446 for (int i=vertfaces.size(); --i>=0;)
81838447 {
81848448 Face face = (Face) vertfaces.get(i);
8449
+ face.used = true;
81858450 face.good = 0; // false;
81868451 if (leafweights)
81878452 face.weight = -1;
....@@ -8228,7 +8493,7 @@
82288493 if (!trimmed)
82298494 return;
82308495
8231
- GrafreeD.linkUV = false;
8496
+ Grafreed.linkUV = false;
82328497
82338498 try
82348499 {
....@@ -8460,7 +8725,8 @@
84608725 int[] startvertices;
84618726 float[] averagepoints;
84628727 float[] extremepoints;
8463
- float[] supportsizes; // distance of closest point
8728
+ float[] supportminsize; // distance of closest point
8729
+ float[] supportmaxsize; // distance of fartest point
84648730
84658731 transient Hashtable vertextable;
84668732 /*transient*/ private Vertex[] verticesCopy;