The Persistence of Vision Raytracer (POV-Ray).
This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.
Opened by Simon - 2012-05-27
Last edited by William F Pokorny - 2017-04-30
FS#243 - Sphere sweep behaves wrong when scaled
The sphere_sweep renders well when specified directly, but when it is scaled, its bounding box is calculated incorrectly, which clips the object so it almost disappears.
The effect is present for all three types of splines.
I’m attaching a test scene and the rendering result. The saving of the object with #declare has no effect, I just wanted to show both transformed and untransformed version.
I don’t think this issue is related to other artifacts occuring with sphere_sweep, as it is obviously an issue of the internal bounding box.
The bounding of spline-based sphere sweeps never worked right and it known to have many bugs, in particular because the bounding box does not correctly consider splines were the curve extends beyond the control points. Transformations just make the problems more apparent. The best solution is to manually bound sphere-sweeps.
Found the error. It's an easy fix. The SphereSweep::Scale has a special case for scaling if scaling is uniform: it simply multiplies all vectors AND ALL RADII by the scaling factor. This makes radius negative for negative scaling factors, which makes the bounding box shrink instead of grow. The code should be
This fixes the bounding box for linear_spline (linear splines never stick out of their bounding box, so they don't have the same problems as the other types).
As for other problems with bounding boxes: for cubic_spline and b_spline, the bounding box in the code is heuristically made a bit bigger, but may still be too small in some cases. It is possible to find roots of the derivatives of cubic polynomials that describe the spline to get exact bounding values.
I agree, the scaling of the radius should use the absolute value. scale -1 is traditional, it shouldn't break the sphere_sweep when used alone or first.
Now tracked on github as issue #285.