Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/stlgeom/stlgeomchart.cpp
3206 views
1
//20.11.1999 third part of stlgeom.cc, functions with chart and atlas
2
3
#include <mystdlib.h>
4
5
#include <myadt.hpp>
6
#include <linalg.hpp>
7
#include <gprim.hpp>
8
9
#include <meshing.hpp>
10
11
#include "stlgeom.hpp"
12
13
namespace netgen
14
{
15
16
int chartdebug = 0;
17
18
19
20
void STLGeometry :: MakeAtlas(Mesh & mesh)
21
{
22
23
double h, h2;
24
25
h = mparam.maxh;
26
27
28
PushStatusF("Make Atlas");
29
30
int i,j,k,l;
31
32
double atlasminh = 5e-3 * Dist (boundingbox.PMin(), boundingbox.PMax());
33
PrintMessage(5, "atlasminh = ", atlasminh);
34
35
//speedup for make atlas
36
if (GetNT() > 50000)
37
{
38
mesh.SetGlobalH(0.05*Dist (boundingbox.PMin(), boundingbox.PMax()));
39
}
40
41
42
atlas.SetSize(0);
43
ClearSpiralPoints();
44
BuildSmoothEdges();
45
46
47
double chartangle = stlparam.chartangle;
48
double outerchartangle = stlparam.outerchartangle;
49
50
chartangle = chartangle/180.*M_PI;
51
outerchartangle = outerchartangle/180.*M_PI;
52
53
double coschartangle = cos(chartangle);
54
double cosouterchartangle = cos(outerchartangle);
55
double cosouterchartanglehalf = cos(0.5*outerchartangle);
56
double sinchartangle = sin(chartangle);
57
double sinouterchartangle = sin(outerchartangle);
58
59
ARRAY<int> outermark(GetNT()); //marks all trigs form actual outer region
60
ARRAY<int> outertested(GetNT()); //marks tested trigs for outer region
61
ARRAY<int> pointstochart(GetNP()); //point in chart becomes chartnum
62
ARRAY<int> innerpointstochart(GetNP()); //point in chart becomes chartnum
63
ARRAY<int> chartpoints; //point in chart becomes chartnum
64
ARRAY<int> innerchartpoints;
65
ARRAY<int> dirtycharttrigs;
66
ARRAY<int> chartpointchecked;
67
68
ARRAY<int> chartdistacttrigs; //outercharttrigs
69
chartdistacttrigs.SetSize(GetNT());
70
for (i = 1; i <= GetNT(); i++)
71
{
72
chartdistacttrigs.Elem(i) = 0;
73
}
74
75
STLBoundary chartbound(this); //knows the actual chart boundary
76
//int chartboundarydivisions = 10;
77
markedsegs.SetSize(0); //for testing!!!
78
79
chartpointchecked.SetSize(GetNP()); //for dirty-chart-trigs
80
81
outermark.SetSize(GetNT());
82
outertested.SetSize(GetNT());
83
pointstochart.SetSize(GetNP());
84
innerpointstochart.SetSize(GetNP());
85
chartmark.SetSize(GetNT());
86
87
for (i = 1; i <= GetNP(); i++)
88
{
89
innerpointstochart.Elem(i) = 0;
90
pointstochart.Elem(i) = 0;
91
chartpointchecked.Elem(i) = 0;
92
}
93
94
double eps = 1e-12 * Dist (boundingbox.PMin(), boundingbox.PMax());
95
96
int spiralcheckon = stldoctor.spiralcheck;
97
if (!spiralcheckon) {PrintWarning("++++++++++++\nspiral deactivated by user!!!!\n+++++++++++++++"); }
98
99
for (i = 1; i <= GetNT(); i++)
100
{
101
chartmark.Elem(i) = 0;
102
}
103
104
for (i = 1; i <= GetNT(); i++)
105
{
106
outermark.Elem(i) = 0;
107
outertested.Elem(i) = 0;
108
}
109
110
int markedtrigcnt = 0;
111
int found = 1;
112
double atlasarea = Area();
113
double workedarea = 0;
114
double showinc = 100.*5000./(double)GetNT();
115
double nextshow = 0;
116
Point<3> startp;
117
int lastunmarked = 1;
118
int prelastunmarked;
119
120
PrintMessage(5,"one dot per 5000 triangles: ");
121
122
while(markedtrigcnt < GetNT() && found)
123
{
124
if (multithread.terminate)
125
{PopStatus();return;}
126
127
if (workedarea / atlasarea*100. >= nextshow)
128
{PrintDot(); nextshow+=showinc;}
129
130
SetThreadPercent(100.0 * workedarea / atlasarea);
131
132
/*
133
for (j = 1; j <= GetNT(); j++)
134
{
135
outermark.Elem(j) = 0;
136
}
137
*/
138
STLChart * chart = new STLChart(this);
139
atlas.Append(chart);
140
141
//find unmarked trig
142
prelastunmarked = lastunmarked;
143
j = lastunmarked;
144
found = 0;
145
while (!found && j <= GetNT())
146
{
147
if (!GetMarker(j)) {found = 1; lastunmarked = j;}
148
else {j++;}
149
}
150
151
chartpoints.SetSize(0);
152
innerchartpoints.SetSize(0);
153
chartbound.Clear();
154
chartbound.SetChart(chart);
155
156
if (!found) {PrintSysError("Make Atlas, no starttrig found"); return;}
157
158
//find surrounding trigs
159
int starttrig = j;
160
161
double tdist;
162
startp = GetPoint(GetTriangle(starttrig).PNum(1));
163
164
int accepted;
165
int chartnum = GetNOCharts();
166
167
Vec<3> sn = GetTriangle(starttrig).Normal();
168
chart->SetNormal (startp, sn);
169
170
171
SetMarker(starttrig, chartnum);
172
markedtrigcnt++;
173
chart->AddChartTrig(starttrig);
174
chartbound.AddTriangle(GetTriangle(starttrig));
175
176
workedarea += GetTriangle(starttrig).Area(points);
177
178
for (i = 1; i <= 3; i++)
179
{
180
innerpointstochart.Elem(GetTriangle(starttrig).PNum(i)) = chartnum;
181
pointstochart.Elem(GetTriangle(starttrig).PNum(i)) = chartnum;
182
chartpoints.Append(GetTriangle(starttrig).PNum(i));
183
innerchartpoints.Append(GetTriangle(starttrig).PNum(i));
184
}
185
186
Vec<3> n2, n3;
187
int changed = 1;
188
int nt;
189
int ic;
190
int oldstartic = 1;
191
int oldstartic2;
192
int np1, np2;
193
194
while (changed)
195
{
196
changed = 0;
197
oldstartic2 = oldstartic;
198
oldstartic = chart->GetNT();
199
// for (ic = oldstartic2; ic <= chart->GetNT(); ic++)
200
for (ic = oldstartic2; ic <= oldstartic; ic++)
201
{
202
i = chart->GetTrig(ic);
203
if (GetMarker(i) == chartnum)
204
{
205
for (j = 1; j <= NONeighbourTrigs(i); j++)
206
{
207
nt = NeighbourTrig(i,j);
208
GetTriangle(i).GetNeighbourPoints(GetTriangle(nt),np1,np2);
209
if (GetMarker(nt) == 0 && !IsEdge(np1,np2))
210
{
211
n2 = GetTriangle(nt).Normal();
212
if ( (n2 * sn) >= coschartangle )
213
{
214
215
accepted = 1;
216
/*
217
//alter spiralentest, schnell, aber ungenau
218
for (k = 1; k <= 3; k++)
219
{
220
//find overlapping charts:
221
Point3d pt = GetPoint(GetTriangle(nt).PNum(k));
222
if (innerpointstochart.Get(GetTriangle(nt).PNum(k)) != chartnum)
223
{
224
for (l = 1; l <= chartpoints.Size(); l++)
225
{
226
Vec3d vptpl(GetPoint(chartpoints.Get(l)), pt);
227
double vlen = vptpl.Length();
228
if (vlen > 0)
229
{
230
vptpl /= vlen;
231
if ( fabs( vptpl * sn) > sinchartangle )
232
{
233
accepted = 0;
234
break;
235
}
236
}
237
}
238
239
}
240
}
241
*/
242
243
int nnp1, nnp2;
244
int nnt;
245
//find overlapping charts exacter:
246
for (k = 1; k <= 3; k++)
247
{
248
nnt = NeighbourTrig(nt,k);
249
if (GetMarker(nnt) != chartnum)
250
{
251
GetTriangle(nt).GetNeighbourPoints(GetTriangle(nnt),nnp1,nnp2);
252
253
accepted = chartbound.TestSeg(GetPoint(nnp1),
254
GetPoint(nnp2),
255
sn,sinchartangle,1 /*chartboundarydivisions*/ ,points, eps);
256
257
258
n3 = GetTriangle(nnt).Normal();
259
if ( (n3 * sn) >= coschartangle &&
260
IsSmoothEdge (nnp1, nnp2) )
261
accepted = 1;
262
}
263
if (!accepted) {break;}
264
}
265
266
/*
267
mindist = 1E50;
268
for (int ii = 1; ii <= 3; ii++)
269
{
270
tdist = Dist(GetPoint(GetTriangle(nt).PNum(ii)),startp);
271
if (tdist < mindist) {mindist = tdist;}
272
}
273
if (mindist > maxdist1) {accepted = 0;}
274
*/
275
276
if (accepted)
277
{
278
SetMarker(nt, chartnum);
279
changed = 1;
280
markedtrigcnt++;
281
workedarea += GetTriangle(nt).Area(points);
282
chart->AddChartTrig(nt);
283
284
chartbound.AddTriangle(GetTriangle(nt));
285
286
for (k = 1; k <= 3; k++)
287
{
288
if (innerpointstochart.Get(GetTriangle(nt).PNum(k))
289
!= chartnum)
290
{
291
innerpointstochart.Elem(GetTriangle(nt).PNum(k)) = chartnum;
292
pointstochart.Elem(GetTriangle(nt).PNum(k)) = chartnum;
293
chartpoints.Append(GetTriangle(nt).PNum(k));
294
innerchartpoints.Append(GetTriangle(nt).PNum(k));
295
}
296
}
297
}
298
}
299
}
300
}
301
}
302
}
303
}
304
305
306
//find outertrigs
307
308
// chartbound.Clear();
309
// warum, ic-bound auf edge macht Probleme js ???
310
311
312
outermark.Elem(starttrig) = chartnum;
313
//chart->AddOuterTrig(starttrig);
314
changed = 1;
315
oldstartic = 1;
316
while (changed)
317
{
318
changed = 0;
319
oldstartic2 = oldstartic;
320
oldstartic = chart->GetNT();
321
//for (ic = oldstartic2; ic <= chart->GetNT(); ic++)
322
for (ic = oldstartic2; ic <= oldstartic; ic++)
323
{
324
i = chart->GetTrig(ic);
325
326
if (outermark.Get(i) == chartnum)
327
{
328
for (j = 1; j <= NONeighbourTrigs(i); j++)
329
{
330
nt = NeighbourTrig(i,j);
331
if (outermark.Get(nt) == chartnum)
332
continue;
333
334
const STLTriangle & ntrig = GetTriangle(nt);
335
GetTriangle(i).GetNeighbourPoints(GetTriangle(nt),np1,np2);
336
337
if (IsEdge (np1, np2))
338
continue;
339
340
341
/*
342
if (outertested.Get(nt) == chartnum)
343
continue;
344
*/
345
outertested.Elem(nt) = chartnum;
346
347
348
n2 = GetTriangle(nt).Normal();
349
/*
350
double ang;
351
ang = Angle(n2,sn);
352
if (ang < -M_PI*0.5) {ang += 2*M_PI;}
353
354
(*testout) << "ang < ocharang = " << (fabs(ang) <= outerchartangle);
355
(*testout) << " = " << ( (n2 * sn) >= cosouterchartangle) << endl;
356
357
// if (fabs(ang) <= outerchartangle)
358
*/
359
//abfragen, ob noch im tolerierten Winkel
360
if ( (n2 * sn) >= cosouterchartangle )
361
{
362
accepted = 1;
363
364
int isdirtytrig = 0;
365
Vec<3> gn = GetTriangle(nt).GeomNormal(points);
366
double gnlen = gn.Length();
367
368
if (n2 * gn <= cosouterchartanglehalf * gnlen)
369
{isdirtytrig = 1;}
370
371
//zurueckweisen, falls eine Spiralartige outerchart entsteht
372
int nnp1, nnp2;
373
int nnt;
374
//find overlapping charts exacter:
375
//do not check dirty trigs!
376
377
378
if (spiralcheckon && !isdirtytrig)
379
for (k = 1; k <= 3; k++)
380
{
381
nnt = NeighbourTrig(nt,k);
382
383
if (outermark.Elem(nnt) != chartnum)
384
{
385
GetTriangle(nt).GetNeighbourPoints(GetTriangle(nnt),nnp1,nnp2);
386
387
accepted =
388
chartbound.TestSeg(GetPoint(nnp1),GetPoint(nnp2),
389
sn,sinouterchartangle, 0 /*chartboundarydivisions*/ ,points, eps);
390
391
392
n3 = GetTriangle(nnt).Normal();
393
if ( (n3 * sn) >= cosouterchartangle &&
394
IsSmoothEdge (nnp1, nnp2) )
395
accepted = 1;
396
}
397
if (!accepted) {break;}
398
}
399
400
//}
401
402
403
// outer chart is only small environment of
404
// inner chart:
405
if (accepted)
406
{
407
accepted = 0;
408
409
for (k = 1; k <= 3; k++)
410
{
411
if (innerpointstochart.Get(ntrig.PNum(k)) == chartnum)
412
{
413
accepted = 1;
414
break;
415
}
416
}
417
418
if (!accepted)
419
for (k = 1; k <= 3; k++)
420
{
421
Point<3> pt = GetPoint(ntrig.PNum(k));
422
h2 = sqr(mesh.GetH(pt));
423
424
for (l = 1; l <= innerchartpoints.Size(); l++)
425
{
426
tdist = Dist2(pt, GetPoint (innerchartpoints.Get(l)));
427
if (tdist < 4 * h2)
428
{
429
accepted = 1;
430
break;
431
}
432
}
433
if (accepted) {break;}
434
}
435
}
436
437
438
if (accepted)
439
{
440
changed = 1;
441
outermark.Elem(nt) = chartnum;
442
443
if (GetMarker(nt) != chartnum)
444
{
445
chartbound.AddTriangle(GetTriangle(nt));
446
chart->AddOuterTrig(nt);
447
for (k = 1; k <= 3; k++)
448
{
449
if (pointstochart.Get(GetTriangle(nt).PNum(k))
450
!= chartnum)
451
{
452
pointstochart.Elem(GetTriangle(nt).PNum(k)) = chartnum;
453
chartpoints.Append(GetTriangle(nt).PNum(k));
454
}
455
}
456
}
457
}
458
}
459
}
460
}
461
}
462
}
463
//end of while loop for outer chart
464
GetDirtyChartTrigs(chartnum, *chart, outermark, chartpointchecked, dirtycharttrigs);
465
//dirtycharttrigs are local (chart) point numbers!!!!!!!!!!!!!!!!
466
467
if (dirtycharttrigs.Size() != 0 &&
468
(dirtycharttrigs.Size() != chart->GetNChartT() || dirtycharttrigs.Size() != 1))
469
{
470
if (dirtycharttrigs.Size() == chart->GetNChartT() && dirtycharttrigs.Size() != 1)
471
{
472
//if all trigs would be eliminated -> leave 1 trig!
473
dirtycharttrigs.SetSize(dirtycharttrigs.Size() - 1);
474
}
475
for (k = 1; k <= dirtycharttrigs.Size(); k++)
476
{
477
int tn = chart->GetChartTrig(dirtycharttrigs.Get(k));
478
outermark.Elem(tn) = 0; //not necessary, for later use
479
SetMarker(tn, 0);
480
markedtrigcnt--;
481
workedarea -= GetTriangle(tn).Area(points);
482
}
483
chart->MoveToOuterChart(dirtycharttrigs);
484
lastunmarked = 1;
485
lastunmarked = prelastunmarked;
486
}
487
488
//calculate an estimate meshsize, not to produce to large outercharts, with factor 2 larger!
489
RestrictHChartDistOneChart(chartnum, chartdistacttrigs, mesh, h, 0.5, atlasminh);
490
}
491
492
PrintMessage(5,"");
493
PrintMessage(5,"NO charts=", atlas.Size());
494
495
int cnttrias = 0;
496
//int found2;
497
outerchartspertrig.SetSize(GetNT());
498
499
for (i = 1; i <= atlas.Size(); i++)
500
{
501
//found2 = 1;
502
for (j = 1; j <= GetChart(i).GetNT(); j++)
503
{
504
int tn = GetChart(i).GetTrig(j);
505
AddOCPT(tn,i);
506
507
}
508
509
cnttrias += GetChart(i).GetNT();
510
}
511
PrintMessage(5, "NO outer chart trias=", cnttrias);
512
513
//sort outerchartspertrig
514
for (i = 1; i <= GetNT(); i++)
515
{
516
int swap;
517
for (k = 1; k < GetNOCPT(i); k++)
518
{
519
520
for (j = 1; j < GetNOCPT(i); j++)
521
{
522
swap = GetOCPT(i,j);
523
if (GetOCPT(i,j+1) < swap)
524
{
525
SetOCPT(i,j,GetOCPT(i,j+1));
526
SetOCPT(i,j+1,swap);
527
}
528
}
529
}
530
531
// check make atlas
532
if (GetChartNr(i) <= 0 || GetChartNr(i) > GetNOCharts())
533
{
534
PrintSysError("Make Atlas: chartnr(", i, ")=0!!");
535
};
536
}
537
538
mesh.SetGlobalH(mparam.maxh);
539
mesh.SetMinimalH(mparam.minh);
540
541
542
AddConeAndSpiralEdges();
543
544
PrintMessage(5,"Make Atlas finished");
545
546
PopStatus();
547
}
548
549
550
int STLGeometry::TrigIsInOC(int tn, int ocn) const
551
{
552
if (tn < 1 || tn > GetNT())
553
{
554
// assert (1);
555
abort ();
556
PrintSysError("STLGeometry::TrigIsInOC illegal tn: ", tn);
557
558
return 0;
559
}
560
561
/*
562
int firstval = 0;
563
int i;
564
for (i = 1; i <= GetNOCPT(tn); i++)
565
{
566
if (GetOCPT(tn, i) == ocn) {firstval = 1;}
567
}
568
*/
569
570
int found = 0;
571
572
int inc = 1;
573
while (inc <= GetNOCPT(tn)) {inc *= 2;}
574
inc /= 2;
575
576
int start = inc;
577
578
while (!found && inc > 0)
579
{
580
if (GetOCPT(tn,start) > ocn) {inc = inc/2; start -= inc;}
581
else if (GetOCPT(tn,start) < ocn) {inc = inc/2; if (start+inc <= GetNOCPT(tn)) {start += inc;}}
582
else {found = 1;}
583
}
584
585
return GetOCPT(tn, start) == ocn;
586
}
587
588
int STLGeometry :: GetChartNr(int i) const
589
{
590
if (i > chartmark.Size())
591
{
592
PrintSysError("GetChartNr(", i, ") not possible!!!");
593
i = 1;
594
}
595
return chartmark.Get(i);
596
}
597
/*
598
int STLGeometry :: GetMarker(int i) const
599
{
600
return chartmark.Get(i);
601
}
602
*/
603
void STLGeometry :: SetMarker(int nr, int m)
604
{
605
chartmark.Elem(nr) = m;
606
}
607
int STLGeometry :: GetNOCharts() const
608
{
609
return atlas.Size();
610
}
611
const STLChart& STLGeometry :: GetChart(int nr) const
612
{
613
if (nr > atlas.Size())
614
{
615
PrintSysError("GetChart(", nr, ") not possible!!!");
616
nr = 1;
617
}
618
return *(atlas.Get(nr));
619
}
620
621
int STLGeometry :: AtlasMade() const
622
{
623
return chartmark.Size() != 0;
624
}
625
626
627
//return 1 if not exists
628
int AddIfNotExists(ARRAY<int>& list, int x)
629
{
630
int i;
631
for (i = 1; i <= list.Size(); i++)
632
{
633
if (list.Get(i) == x) {return 0;}
634
}
635
list.Append(x);
636
return 1;
637
}
638
639
void STLGeometry :: GetInnerChartLimes(ARRAY<twoint>& limes, int chartnum)
640
{
641
int j, k;
642
643
int t, nt, np1, np2;
644
645
limes.SetSize(0);
646
647
STLChart& chart = GetChart(chartnum);
648
649
for (j = 1; j <= chart.GetNChartT(); j++)
650
{
651
t = chart.GetChartTrig(j);
652
const STLTriangle& tt = GetTriangle(t);
653
for (k = 1; k <= 3; k++)
654
{
655
nt = NeighbourTrig(t,k);
656
if (GetChartNr(nt) != chartnum)
657
{
658
tt.GetNeighbourPoints(GetTriangle(nt),np1,np2);
659
if (!IsEdge(np1,np2))
660
{
661
limes.Append(twoint(np1,np2));
662
/*
663
p3p1 = GetPoint(np1);
664
p3p2 = GetPoint(np2);
665
if (AddIfNotExists(limes,np1))
666
{
667
plimes1.Append(p3p1);
668
//plimes1trigs.Append(t);
669
//plimes1origin.Append(np1);
670
}
671
if (AddIfNotExists(limes1,np2))
672
{
673
plimes1.Append(p3p2);
674
//plimes1trigs.Append(t);
675
//plimes1origin.Append(np2);
676
}
677
//chart.AddILimit(twoint(np1,np2));
678
679
for (int di = 1; di <= divisions; di++)
680
{
681
double f1 = (double)di/(double)(divisions+1.);
682
double f2 = (divisions+1.-(double)di)/(double)(divisions+1.);
683
684
plimes1.Append(Point3d(p3p1.X()*f1+p3p2.X()*f2,
685
p3p1.Y()*f1+p3p2.Y()*f2,
686
p3p1.Z()*f1+p3p2.Z()*f2));
687
//plimes1trigs.Append(t);
688
//plimes1origin.Append(0);
689
}
690
*/
691
}
692
}
693
}
694
}
695
}
696
697
698
699
void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
700
const ARRAY<int>& outercharttrigs,
701
ARRAY<int>& chartpointchecked,
702
ARRAY<int>& dirtytrigs)
703
{
704
dirtytrigs.SetSize(0);
705
int j,k,n;
706
707
int np1, np2, nt;
708
int cnt = 0;
709
710
for (j = 1; j <= chart.GetNChartT(); j++)
711
{
712
int t = chart.GetChartTrig(j);
713
const STLTriangle& tt = GetTriangle(t);
714
715
for (k = 1; k <= 3; k++)
716
{
717
nt = NeighbourTrig(t,k);
718
if (GetChartNr(nt) != chartnum && outercharttrigs.Get(nt) != chartnum)
719
{
720
tt.GetNeighbourPoints(GetTriangle(nt),np1,np2);
721
if (!IsEdge(np1,np2))
722
{
723
dirtytrigs.Append(j); //local numbers!!!
724
cnt++;
725
break; //only once per trig!!!
726
}
727
}
728
}
729
}
730
cnt = 0;
731
732
int ap1, ap2, tn1, tn2, l, problem, pn;
733
ARRAY<int> trigsaroundp;
734
735
for (j = chart.GetNChartT(); j >= 1; j--)
736
{
737
int t = chart.GetChartTrig(j);
738
const STLTriangle& tt = GetTriangle(t);
739
740
for (k = 1; k <= 3; k++)
741
{
742
pn = tt.PNum(k);
743
//if (chartpointchecked.Get(pn) == chartnum)
744
//{continue;}
745
746
int checkpoint = 0;
747
for (n = 1; n <= trigsperpoint.EntrySize(pn); n++)
748
{
749
if (trigsperpoint.Get(pn,n) != t && //ueberfluessig???
750
GetChartNr(trigsperpoint.Get(pn,n)) != chartnum &&
751
outercharttrigs.Get(trigsperpoint.Get(pn,n)) != chartnum) {checkpoint = 1;};
752
}
753
if (checkpoint)
754
{
755
chartpointchecked.Elem(pn) = chartnum;
756
757
GetSortedTrianglesAroundPoint(pn,t,trigsaroundp);
758
trigsaroundp.Append(t); //ring
759
760
problem = 0;
761
//forward:
762
for (l = 2; l <= trigsaroundp.Size()-1; l++)
763
{
764
tn1 = trigsaroundp.Get(l-1);
765
tn2 = trigsaroundp.Get(l);
766
const STLTriangle& t1 = GetTriangle(tn1);
767
const STLTriangle& t2 = GetTriangle(tn2);
768
t1.GetNeighbourPoints(t2, ap1, ap2);
769
if (IsEdge(ap1,ap2)) break;
770
771
if (GetChartNr(tn2) != chartnum && outercharttrigs.Get(tn2) != chartnum) {problem = 1;}
772
}
773
774
//backwards:
775
for (l = trigsaroundp.Size()-1; l >= 2; l--)
776
{
777
tn1 = trigsaroundp.Get(l+1);
778
tn2 = trigsaroundp.Get(l);
779
const STLTriangle& t1 = GetTriangle(tn1);
780
const STLTriangle& t2 = GetTriangle(tn2);
781
t1.GetNeighbourPoints(t2, ap1, ap2);
782
if (IsEdge(ap1,ap2)) break;
783
784
if (GetChartNr(tn2) != chartnum && outercharttrigs.Get(tn2) != chartnum) {problem = 1;}
785
}
786
if (problem && !IsInArray(j,dirtytrigs))
787
{
788
dirtytrigs.Append(j);
789
cnt++;
790
break; //only once per triangle
791
}
792
}
793
}
794
}
795
796
}
797
798
}
799
800