This commit changes the behavior back to TIGL 3.0. The difference to TIGL 3.0 is, that the tolerance check is size dependent and scales with the profile size.
Showing 3 of 3 files from the diff.
@@ -190,6 +190,19 @@
Loading
190 | 190 | ||
191 | 191 | // Build the B-Spline |
|
192 | 192 | auto occPoints = OccArray(points); |
|
193 | + | ||
194 | + | // we always want to include the endpoint, if it's the same as the startpoint |
|
195 | + | // we use the middle to enforce closing of the spline |
|
196 | + | gp_Pnt pStart = points.front().Get_gp_Pnt(); |
|
197 | + | gp_Pnt pEnd = points.back().Get_gp_Pnt(); |
|
198 | + | ||
199 | + | // this check allows some tolerance, based on the absolute size of the profile |
|
200 | + | if (pStart.Distance(pEnd) < 0.005*CTiglBSplineAlgorithms::scale(occPoints->Array1())) { |
|
201 | + | gp_Pnt pMiddle = 0.5 * (pStart.XYZ() + pEnd.XYZ()); |
|
202 | + | occPoints->SetValue(occPoints->Lower(), pMiddle); |
|
203 | + | occPoints->SetValue(occPoints->Upper(), pMiddle); |
|
204 | + | } |
|
205 | + | ||
193 | 206 | CTiglInterpolatePointsWithKinks interp(occPoints, kinks, params, 0.5, 3); |
|
194 | 207 | auto spline = interp.Curve(); |
|
195 | 208 |
@@ -449,6 +449,19 @@
Loading
449 | 449 | return theScale; |
|
450 | 450 | } |
|
451 | 451 | ||
452 | + | double CTiglBSplineAlgorithms::scale(const TColgp_Array1OfPnt& points) |
|
453 | + | { |
|
454 | + | double theScale = 0.; |
|
455 | + | ||
456 | + | for (int i = points.Lower(); i <= points.Upper(); ++i) { |
|
457 | + | for (int j = i + 1; j < points.Upper(); ++j) { |
|
458 | + | double dist = points.Value(i).Distance(points.Value(j)); |
|
459 | + | theScale = std::max(theScale, dist); |
|
460 | + | } |
|
461 | + | } |
|
462 | + | return theScale; |
|
463 | + | } |
|
464 | + | ||
452 | 465 | std::vector<double> CTiglBSplineAlgorithms::computeParamsBSplineCurve(const Handle(TColgp_HArray1OfPnt)& points, const double alpha) |
|
453 | 466 | { |
|
454 | 467 | return computeParamsBSplineCurve(points, 0., 1., alpha); |
@@ -242,6 +242,9 @@
Loading
242 | 242 | /// Returns the scale of the point matrix |
|
243 | 243 | TIGL_EXPORT static double scale(const TColgp_Array2OfPnt& points); |
|
244 | 244 | ||
245 | + | /// Returns the scale of the point list by searching for the largest distance between two points |
|
246 | + | TIGL_EXPORT static double scale(const TColgp_Array1OfPnt& points); |
|
247 | + | ||
245 | 248 | /** |
|
246 | 249 | * Returns positions, where the curve has kinks (C1 Discontinuities) |
|
247 | 250 | */ |
Files | Coverage |
---|---|
src | 69.44% |
Project Totals (425 files) | 69.44% |
311393497
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.