Fix #647 Helix mesh defects.
Use the grid spacing algorithm for helical curve PWL creation. This makes the grid and trim curves have similar spacing.pull/653/head
parent
f0623fa5ba
commit
c75b2e473e
|
@ -817,7 +817,7 @@ void SCurve::RemoveShortSegments(SSurface *srfA, SSurface *srfB) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// if the curve is exact and points are >0.1 appart wrt t, point is there
|
||||
// if the curve is exact and points are >0.05 appart wrt t, point is there
|
||||
// deliberately regardless of chord tolerance (ex: small circles)
|
||||
tprev = t = tnext = 0;
|
||||
if (isExact) {
|
||||
|
@ -825,7 +825,7 @@ void SCurve::RemoveShortSegments(SSurface *srfA, SSurface *srfB) {
|
|||
exact.ClosestPointTo(sct->p, &t, /*mustconverge=*/ true);
|
||||
exact.ClosestPointTo(scn->p, &tnext, /*mustconverge=*/ true);
|
||||
}
|
||||
if ( (t - tprev > 0.1) && (tnext - t > 0.1) ) {
|
||||
if ( (t - tprev > 0.05) && (tnext - t > 0.05) ) {
|
||||
prev = sct->p;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -732,6 +732,15 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
|
|||
|
||||
sb = &(sbl->l[i]);
|
||||
|
||||
// we will need the grid t-values for this entire row of surfaces
|
||||
List<double> t_values;
|
||||
t_values = {};
|
||||
if (revs[0].v) {
|
||||
double ps = 0.0;
|
||||
t_values.Add(&ps);
|
||||
(surface.FindById(revs[0]))->MakeTriangulationGridInto(
|
||||
&t_values, 0.0, 1.0, true, 0);
|
||||
}
|
||||
// we generate one more curve than we did surfaces
|
||||
for(j = 0; j <= sections; j++) {
|
||||
SCurve sc;
|
||||
|
@ -746,11 +755,16 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
|
|||
sc = {};
|
||||
sc.isExact = true;
|
||||
sc.exact = sb->TransformedBy(ts, qs, 1.0);
|
||||
double max_dt = 0.5;
|
||||
if (sc.exact.deg > 1) max_dt = 0.25;
|
||||
(sc.exact).MakePwlInto(&(sc.pts), 0.0, max_dt);
|
||||
// make the PWL for the curve based on t value list
|
||||
for(int x = 0; x < t_values.n; x++) {
|
||||
SCurvePt scpt;
|
||||
scpt.tag = 0;
|
||||
scpt.p = sc.exact.PointAt(t_values[x]);
|
||||
scpt.vertex = (x == 0) || (x == (t_values.n - 1));
|
||||
sc.pts.Add(&scpt);
|
||||
}
|
||||
|
||||
// the surfaces already exist so trim with this curve
|
||||
// the surfaces already exists so trim with this curve
|
||||
if(j < sections) {
|
||||
sc.surfA = revs[j];
|
||||
} else {
|
||||
|
@ -762,6 +776,7 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
|
|||
} else {
|
||||
sc.surfB = hs0; // staring cap
|
||||
}
|
||||
|
||||
hSCurve hcb = curve.AddAndAssignId(&sc);
|
||||
|
||||
STrimBy stb;
|
||||
|
@ -773,9 +788,7 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
|
|||
sc = {};
|
||||
sc.isExact = true;
|
||||
sc.exact = sb->TransformedBy(ts, qs, 1.0);
|
||||
double max_dt = 0.5;
|
||||
if (sc.exact.deg > 1) max_dt = 0.25;
|
||||
(sc.exact).MakePwlInto(&(sc.pts), 0.0, max_dt);
|
||||
(sc.exact).MakePwlInto(&(sc.pts));
|
||||
sc.surfA = hs1; // end cap
|
||||
sc.surfB = hs0; // staring cap
|
||||
hSCurve hcb = curve.AddAndAssignId(&sc);
|
||||
|
@ -812,6 +825,7 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
|
|||
(surface.FindById(sc.surfB))->trim.Add(&stb);
|
||||
}
|
||||
}
|
||||
t_values.Clear();
|
||||
}
|
||||
|
||||
hsl.Clear();
|
||||
|
|
|
@ -429,7 +429,7 @@ void SSurface::MakeTriangulationGridInto(List<double> *l, double vs, double vf,
|
|||
|
||||
double step = 1.0/SS.GetMaxSegments();
|
||||
if( ((vf - vs) < step || worst < SS.ChordTolMm())
|
||||
&& ((worst_twist > 0.999) || (depth > 4)) ) {
|
||||
&& ((worst_twist > 0.999) || (depth > 3)) ) {
|
||||
l->Add(&vf);
|
||||
} else {
|
||||
MakeTriangulationGridInto(l, vs, (vs+vf)/2, swapped, depth+1);
|
||||
|
|
Loading…
Reference in New Issue