Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
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;
....@@ -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
....@@ -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,10 @@
19661997 if (v.vertexlinks == null)
19671998 continue;
19681999
1969
- if (v.weights != null && v.weights[j] == 0) // < 0.01 * v.totalweight) // == 0)
2000
+ // Warning: faster but dangerous
2001
+ if (v.weights != null && v.weights[j]
2002
+ // == 0)
2003
+ < 0.001 * v.totalweight)
19702004 {
19712005 //testweight += v.weights[j-1];
19722006 continue;
....@@ -2247,6 +2281,8 @@
22472281
22482282 transient int lastsoundtime;
22492283
2284
+ transient boolean once = false;
2285
+
22502286 void setMasterThis0(BoundaryRep other, double[][] toRoot, boolean smooth, boolean marked)
22512287 {
22522288 if (LA.isIdentity(toRoot))
....@@ -2302,7 +2338,11 @@
23022338
23032339 if (v.totalweight == 0)
23042340 {
2305
- System.err.println("v.totalweight == 0! --> " + this + " : " + other);
2341
+ if (!once)
2342
+ {
2343
+ System.err.println("v.totalweight == 0! --> " + this + " : " + other);
2344
+ once = true;
2345
+ }
23062346 continue;
23072347 }
23082348
....@@ -3098,6 +3138,7 @@
30983138 //
30993139 // transient VertexCompare[] vertexcompare = null;
31003140
3141
+ // Check if v0 is close enough from any vertex of the given subobject of this.
31013142 boolean Contains(Vertex v0, int object)
31023143 {
31033144 int start = startvertices[object-1];
....@@ -3696,6 +3737,111 @@
36963737 */
36973738 }
36983739
3740
+ void GenerateNormals2(boolean crease)
3741
+ {
3742
+ cVector tempVector = new cVector();
3743
+
3744
+// java.util.HashMap<cVector, cVector> tableBase = new java.util.HashMap<cVector, cVector>();
3745
+//
3746
+//
3747
+// for (int i=0; i<this.VertexCount(); i++)
3748
+// {
3749
+// Vertex v = this.GetVertex(i);
3750
+//
3751
+// tempVector.set(v);
3752
+//
3753
+// cVector n = tableBase.get(tempVector.ToFloat());
3754
+//
3755
+// if (n != null)
3756
+// {
3757
+// continue;
3758
+// }
3759
+//
3760
+// tableBase.put(new cVector(tempVector), new cVector(v.norm));
3761
+// }
3762
+
3763
+ BoundaryRep tempSupport = this.support;
3764
+
3765
+ this.support = null;
3766
+
3767
+ BoundaryRep tempRep = (BoundaryRep)Grafreed.clone(this);
3768
+
3769
+ this.support = tempSupport;
3770
+
3771
+ //tempRep.Unstripify();
3772
+
3773
+ tempRep.GenerateNormals2(crease);
3774
+
3775
+ boolean keepnormal = Vertex.normalmode;
3776
+ boolean epsequal = Grafreed.epsequal;
3777
+
3778
+ Vertex.normalmode = false;
3779
+ Grafreed.epsequal = false; // A bit strange
3780
+
3781
+ // No need to have a match for vertex counts.
3782
+
3783
+ java.util.HashMap<cVector, cVector> table = new java.util.HashMap<cVector, cVector>();
3784
+
3785
+ for (int i=0; i<tempRep.VertexCount(); i++)
3786
+ {
3787
+ Vertex v = tempRep.GetVertex(i);
3788
+
3789
+ cVector n = table.get(tempVector.ToFloat());
3790
+
3791
+ if (v.norm.x == 1 && v.norm.y == 0 && v.norm.z == 0)
3792
+ {
3793
+ //continue;
3794
+ }
3795
+
3796
+ tempVector.set(v);
3797
+
3798
+ //cVector nBase = tableBase.get(tempVector);
3799
+
3800
+ //if (v.norm.dot(nBase) < 0.9)
3801
+ //{
3802
+ // continue;
3803
+ //}
3804
+
3805
+ if (n != null && n.x == 1 && n.y == 0 && n.z == 0)
3806
+ {
3807
+ //continue;
3808
+ }
3809
+
3810
+ if (n != null)
3811
+ {
3812
+// if (n.dot(v.norm) < 0)
3813
+// n.sub(v.norm);
3814
+// else
3815
+// n.add(v.norm);
3816
+//
3817
+// n.normalize();
3818
+ continue;
3819
+ }
3820
+
3821
+ table.put(new cVector(tempVector), new cVector(v.norm));
3822
+ }
3823
+
3824
+ for (int i=0; i<this.VertexCount(); i++)
3825
+ {
3826
+ Vertex v = this.GetVertex(i);
3827
+
3828
+ tempVector.set(v);
3829
+
3830
+ cVector n = table.get(tempVector.ToFloat());
3831
+
3832
+ //if (n.dot(v.norm) < 0)
3833
+ if (n == null)
3834
+ continue;
3835
+
3836
+ LA.vecCopy(n, v.norm);
3837
+
3838
+ this.SetVertex(v, i);
3839
+ }
3840
+
3841
+ Grafreed.epsequal = epsequal;
3842
+ Vertex.normalmode = keepnormal;
3843
+ }
3844
+
36993845 void GenerateNormals(boolean crease)
37003846 {
37013847 boolean wastrim = trimmed;
....@@ -3712,6 +3858,28 @@
37123858 }
37133859
37143860 Trim(true/*wastrim*/,true,crease,wasstrip,false);
3861
+ }
3862
+
3863
+ void GenerateNormalsMesh()
3864
+ {
3865
+ if (stripified)
3866
+ {
3867
+ Unstripify();
3868
+ }
3869
+
3870
+ if (trimmed)
3871
+ {
3872
+ normals = null;
3873
+ }
3874
+ else
3875
+ {
3876
+ for (int i=VertexCount(); --i>=0;)
3877
+ {
3878
+ Vertex v = GetVertex(i);
3879
+
3880
+ v.norm = null;
3881
+ }
3882
+ }
37153883 }
37163884
37173885 void GenNormalsJME()
....@@ -3836,7 +4004,7 @@
38364004 NormalGenerator ng;
38374005
38384006 if (crease)
3839
- ng = new NormalGenerator(Math.PI/6); // default is 44 degrees (or Math.PI/3); // /4);
4007
+ ng = new NormalGenerator(Math.PI/4); // default is 44 degrees (or Math.PI/3); // /4);
38404008 else
38414009 ng = new NormalGenerator(Math.PI); // (Math.PI / 3); // /4);
38424010
....@@ -3869,6 +4037,10 @@
38694037 {
38704038 triangles[i] = i;
38714039 }
4040
+
4041
+// Untrim();
4042
+ if (!trimmed)
4043
+ MergeNormals();
38724044 }
38734045 }
38744046
....@@ -3929,6 +4101,10 @@
39294101 triangles = new int[1];
39304102 triangles[0] = 3;
39314103 }
4104
+
4105
+ //Untrim();
4106
+ if (!trimmed)
4107
+ MergeNormals();
39324108 }
39334109
39344110 /*
....@@ -3978,6 +4154,42 @@
39784154 }
39794155
39804156 Vertex.normalmode = false;
4157
+ }
4158
+
4159
+ void MergeNormals()
4160
+ {
4161
+ assert(!trimmed);
4162
+
4163
+ boolean smooth = Grafreed.smoothmode;
4164
+ boolean link = Grafreed.linkUV;
4165
+ Grafreed.smoothmode = true;
4166
+ Grafreed.linkUV = true;
4167
+
4168
+ System.out.println("#Vertex = " + VertexCount());
4169
+ System.out.println("#Face = " + FaceCount());
4170
+
4171
+ java.util.HashSet<Vertex> table = new java.util.HashSet<Vertex>();
4172
+
4173
+ for (int i = 0; i < VertexCount(); i++)
4174
+ {
4175
+ Vertex v = GetVertex(i);
4176
+
4177
+ if (!table.contains(v))
4178
+ {
4179
+ table.add(v);
4180
+ }
4181
+ }
4182
+
4183
+ Grafreed.smoothmode = smooth;
4184
+ Grafreed.linkUV = link;
4185
+
4186
+// for (int i = 0; i < VertexCount(); i++)
4187
+// {
4188
+// Vertex v = GetVertex(i);
4189
+//
4190
+// table.add(v);
4191
+// }
4192
+
39814193 }
39824194
39834195 static cVector temp1 = new cVector();
....@@ -4752,16 +4964,25 @@
47524964 {
47534965 i3 = positions.length-3;
47544966 i2 = uvmap.length - 2;
4755
- new Exception().printStackTrace();
4967
+ //new Exception().printStackTrace();
47564968 }
47574969
47584970 v./*pos.*/x = positions[i3];
47594971 v./*pos.*/y = positions[i3 + 1];
47604972 v./*pos.*/z = positions[i3 + 2];
47614973
4762
- v.norm.x = normals[i3];
4763
- v.norm.y = normals[i3 + 1];
4764
- v.norm.z = normals[i3 + 2];
4974
+ if (normals == null)
4975
+ {
4976
+ v.norm.x = 0;
4977
+ v.norm.y = 0;
4978
+ v.norm.z = 0;
4979
+ }
4980
+ else
4981
+ {
4982
+ v.norm.x = normals[i3];
4983
+ v.norm.y = normals[i3 + 1];
4984
+ v.norm.z = normals[i3 + 2];
4985
+ }
47654986
47664987 v.s = uvmap[i2];
47674988 v.t = uvmap[i2 + 1];
....@@ -5476,17 +5697,27 @@
54765697
54775698 transient int nbbadfaces; // ?? = 1000000;
54785699
5479
- int ChooseTriangle()
5700
+ /*
5701
+ */
5702
+ int ChooseTriangle(boolean firstEquilateral)
54805703 {
54815704 int chosen = -1;
54825705
54835706 double minweight = 1E10;
54845707
5708
+ int step = 8; // ?
5709
+
5710
+ if (firstEquilateral)
5711
+ step = 1;
5712
+
54855713 nbbadfaces = 0;
5486
- for (int i=0; i<faces.size(); i+=8)
5714
+ for (int i=0; i<faces.size(); i+=step)
54875715 // for (int i=faces.size(); (i-=8)>=0;)
54885716 {
54895717 Face face = (Face) faces.get(i);
5718
+
5719
+ if (face.used)
5720
+ continue;
54905721
54915722 if (!Valid(face))
54925723 {
....@@ -5496,6 +5727,15 @@
54965727
54975728 if (Boundary(face))
54985729 continue;
5730
+
5731
+// if (Boundary(face.p))
5732
+// continue;
5733
+//
5734
+// if (Boundary(face.q))
5735
+// continue;
5736
+//
5737
+// if (Boundary(face.r))
5738
+// continue;
54995739
55005740 if (!ValidValence(face))
55015741 continue;
....@@ -5508,22 +5748,55 @@
55085748 //?? if (face.weight < 0)
55095749 // continue;
55105750
5511
- double K = 1; // 0.01; // .25;
5512
-
5513
- double factor = (1-K)*face.nbiterations + K; //*face.weight;
5514
-
5515
- double weight = FaceWeight(face); // *Math.pow(PerimeterMax(face),0.25)*factor;
5516
-
5517
- if (minweight > weight)
5751
+ if (firstEquilateral)
55185752 {
5519
- minweight = weight;
5753
+ if (OneFaceUsed(links.get(face.p)))
5754
+ continue;
5755
+
5756
+ if (OneFaceUsed(links.get(face.q)))
5757
+ continue;
5758
+
5759
+ if (OneFaceUsed(links.get(face.r)))
5760
+ continue;
5761
+
55205762 chosen = i;
5521
- if (minweight == 0)
5522
- break;
5763
+ break;
5764
+ }
5765
+ else
5766
+ {
5767
+ double K = 1; // 0.01; // .25;
5768
+
5769
+ double factor = (1-K)*face.nbiterations + K; //*face.weight;
5770
+
5771
+ double weight = FaceWeight(face); // *Math.pow(PerimeterMax(face),0.25)*factor;
5772
+
5773
+ if (minweight > weight)
5774
+ {
5775
+ minweight = weight;
5776
+ chosen = i;
5777
+ if (minweight == 0)
5778
+ break;
5779
+ }
55235780 }
55245781 }
55255782
55265783 return chosen;
5784
+ }
5785
+
5786
+ private boolean OneFaceUsed(Vector<Face> faces)
5787
+ {
5788
+ if (faces.size() != 6)
5789
+ return true;
5790
+
5791
+ for (int i=0; i<6; i+=1)
5792
+ {
5793
+ if (faces.get(i).used)
5794
+ {
5795
+ return true;
5796
+ }
5797
+ }
5798
+
5799
+ return false;
55275800 }
55285801
55295802 static boolean remove3valence = true;
....@@ -5559,7 +5832,7 @@
55595832 }
55605833 else
55615834 {
5562
- assert(links.size() == vertices.size());
5835
+ // TODO Grafreed.Assert(links.size() == vertices.size());
55635836
55645837 links.setSize(vertices.size());
55655838 for (int i=vertices.size(); --i>=0;)
....@@ -5567,6 +5840,7 @@
55675840 // linkstouched[i] = false;
55685841 if (links.get(i) == null) // ??
55695842 {
5843
+ new Exception().printStackTrace();
55705844 links.set(i, new Vector(8));
55715845 // linkstouched[i] = true;
55725846 }
....@@ -5577,6 +5851,8 @@
55775851 }
55785852 }
55795853
5854
+ boolean once = false;
5855
+
55805856 for (int i=faces.size(); --i>=0;)
55815857 {
55825858 Face face = (Face) faces.get(i);
....@@ -5588,6 +5864,9 @@
55885864 //if (linkstouched[face.r])
55895865 links.get(face.r).add(face);
55905866
5867
+ if (face.used)
5868
+ once = true;
5869
+
55915870 face.good = 1;
55925871 face.boundary = -1;
55935872 }
....@@ -6953,6 +7232,10 @@
69537232 return (face.boundary = 1) == 1;
69547233 }
69557234
7235
+ // June 2019
7236
+ if (true)
7237
+ return (face.boundary = 0) == 1;
7238
+
69567239 // reverse triangle test
69577240 q1.set(p);
69587241 q2.set(q);
....@@ -7402,7 +7685,7 @@
74027685 //InitWeights();
74037686 }
74047687
7405
- int chosen = ChooseTriangle(); // Best is slow and not really better
7688
+ int chosen = ChooseTriangle(true); // Best is slow and not really better
74067689
74077690 if (chosen == -1)
74087691 {
....@@ -7416,7 +7699,7 @@
74167699 //remove3valence = false;
74177700 // InitWeights();
74187701
7419
- chosen = ChooseTriangle();
7702
+ chosen = ChooseTriangle(true);
74207703 }
74217704 }
74227705
....@@ -7692,7 +7975,7 @@
76927975
76937976 // boolean lock;
76947977
7695
- void SplitInTwo(boolean reduction34, boolean onlyone)
7978
+ boolean SplitInTwo(boolean reduction34, boolean onlyone)
76967979 {
76977980 if (stripified)
76987981 {
....@@ -7729,12 +8012,12 @@
77298012 {
77308013 System.err.println("EXCEPTION CAUGHT");
77318014 e.printStackTrace();
7732
- return;
8015
+ return false;
77338016 } catch (Error e)
77348017 {
77358018 System.err.println("ERROR CAUGHT");
77368019 e.printStackTrace();
7737
- return;
8020
+ return false;
77388021 }
77398022
77408023 System.out.println("# faces = " + faces.size());
....@@ -7744,6 +8027,7 @@
77448027 {
77458028 Face face = (Face) faces.get(i);
77468029
8030
+ face.used = false;
77478031 face.nbiterations = 1;
77488032 face.weight = -1;
77498033 face.boundary = -1;
....@@ -7795,6 +8079,11 @@
77958079 nbbadfaces = faces.size();
77968080 //remove3valence = true;
77978081
8082
+ int count = 2;
8083
+
8084
+ if (onlyone)
8085
+ count = 1;
8086
+
77988087 firstpass = true;
77998088
78008089 int n = faces.size();
....@@ -7810,8 +8099,9 @@
78108099 System.out.print('.');
78118100 }
78128101 System.out.println();
8102
+ boolean atleastone = false;
78138103 int i = 0;
7814
- while (reduction34 || faces.size() > n/2)
8104
+ while (true) // reduction34 || faces.size() > n/2)
78158105 {
78168106 if (i++%100 == 0)
78178107 {
....@@ -7833,6 +8123,8 @@
78338123 {
78348124 if (!RemoveOneTriangle())
78358125 break;
8126
+
8127
+ atleastone = true;
78368128 }
78378129 // if (iterationcount == 0)
78388130 // break;
....@@ -7843,8 +8135,8 @@
78438135 break;
78448136 }
78458137 firstpass = false;
7846
- if (onlyone)
7847
- break; // one triangle only
8138
+// if (--count<0 && !reduction34)
8139
+// break; // one triangle only
78488140 }
78498141
78508142 InitLinks(false); // for further display
....@@ -7860,6 +8152,8 @@
78608152 Trim(true,false,false,false,false);
78618153
78628154 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
8155
+
8156
+ return atleastone;
78638157 }
78648158
78658159 void UpdateIndices(Face face, Face minface)
....@@ -7872,18 +8166,21 @@
78728166 face.p = minface.p;
78738167 //if (leafweights)
78748168 face.good = 0; // false;
8169
+ face.used = true;
78758170 }
78768171 if (face.q == minface.p || face.q == minface.q || face.q == minface.r)
78778172 {
78788173 face.q = minface.p;
78798174 //if (leafweights)
78808175 face.good = 0; // false;
8176
+ face.used = true;
78818177 }
78828178 if (face.r == minface.p || face.r == minface.q || face.r == minface.r)
78838179 {
78848180 face.r = minface.p;
78858181 //if (leafweights)
78868182 face.good = 0; // false;
8183
+ face.used = true;
78878184 }
78888185
78898186 if (face.p >/*=*/ minface.q && face.p < minface.r)
....@@ -7943,50 +8240,50 @@
79438240 if (v == 2)
79448241 vert = minface.r;
79458242 // Face face = (Face) faces.get(i);
7946
- Vector<Face> vertfaces = links.get(vert);
7947
- for (int i=vertfaces.size(); --i>=0;)
7948
- {
7949
- Face face = (Face) vertfaces.get(i);
7950
-
7951
- // if (face.weight == 10000)
7952
- // continue;
7953
-
7954
- if (face.p == minface.p || face.q == minface.p || face.r == minface.p ||
7955
- face.p == minface.q || face.q == minface.q || face.r == minface.q ||
7956
- face.p == minface.r || face.q == minface.r || face.r == minface.r)
8243
+ Vector<Face> vertfaces = links.get(vert);
8244
+ for (int i=vertfaces.size(); --i>=0;)
79578245 {
7958
- if (!leafweights)
8246
+ Face face = (Face) vertfaces.get(i);
8247
+
8248
+ // if (face.weight == 10000)
8249
+ // continue;
8250
+
8251
+ if (face.p == minface.p || face.q == minface.p || face.r == minface.p ||
8252
+ face.p == minface.q || face.q == minface.q || face.r == minface.q ||
8253
+ face.p == minface.r || face.q == minface.r || face.r == minface.r)
79598254 {
7960
-// if(minfaceweight <= 0)
7961
-// assert(minfaceweight > 0);
7962
-//
7963
-// //FaceWeight(face);
7964
-// if(face.weight < 0)
7965
-// assert(face.weight >= 0);
7966
-
7967
- face.weight += minfaceweight;
7968
-
7969
-// if (face.weight >= 10000)
7970
-// assert(face.weight < 10000);
8255
+ if (!leafweights)
8256
+ {
8257
+ // if(minfaceweight <= 0)
8258
+ // assert(minfaceweight > 0);
8259
+ //
8260
+ // //FaceWeight(face);
8261
+ // if(face.weight < 0)
8262
+ // assert(face.weight >= 0);
8263
+
8264
+ face.weight += minfaceweight;
8265
+
8266
+ // if (face.weight >= 10000)
8267
+ // assert(face.weight < 10000);
8268
+ }
8269
+ else
8270
+ face.weight = -1;
8271
+
8272
+ face.nbiterations += 1;
8273
+ face.boundary = -1;
8274
+
8275
+ Vertex p = (Vertex)vertices.get(face.p);
8276
+ Vertex q = (Vertex)vertices.get(face.q);
8277
+ Vertex r = (Vertex)vertices.get(face.r);
8278
+
8279
+ p.boundary = -1;
8280
+ q.boundary = -1;
8281
+ r.boundary = -1;
79718282 }
79728283 else
7973
- face.weight = -1;
7974
-
7975
- face.nbiterations += 1;
7976
- face.boundary = -1;
7977
-
7978
- Vertex p = (Vertex)vertices.get(face.p);
7979
- Vertex q = (Vertex)vertices.get(face.q);
7980
- Vertex r = (Vertex)vertices.get(face.r);
7981
-
7982
- p.boundary = -1;
7983
- q.boundary = -1;
7984
- r.boundary = -1;
8284
+ assert(false);
79858285 }
7986
- else
7987
- assert(false);
79888286 }
7989
- }
79908287
79918288 // TouchVertex(minface.p);
79928289 // TouchVertex(minface.q);
....@@ -8187,6 +8484,7 @@
81878484 for (int i=vertfaces.size(); --i>=0;)
81888485 {
81898486 Face face = (Face) vertfaces.get(i);
8487
+ face.used = true;
81908488 face.good = 0; // false;
81918489 if (leafweights)
81928490 face.weight = -1;
....@@ -8465,7 +8763,8 @@
84658763 int[] startvertices;
84668764 float[] averagepoints;
84678765 float[] extremepoints;
8468
- float[] supportsizes; // distance of closest point
8766
+ float[] supportminsize; // distance of closest point
8767
+ float[] supportmaxsize; // distance of fartest point
84698768
84708769 transient Hashtable vertextable;
84718770 /*transient*/ private Vertex[] verticesCopy;