Repository navigation
Conversation
In ConeGeometry::isInsideCappedCone and ConeGeometryIntersector::intersectCone, the axial coordinate y along the unnormalized tangent vector dP = p1 - p0 has units of g = ||p1 - p0||^2 - (r1 - r0)^2 and spans [0, g]. Scale the ulp tolerance by g so the bounds remain invariant to geometric scale.
dongclin
force-pushed
the
fix-roundline-ulp-scale
branch
from
October 17, 2026 05:36
4edf17e to
582f1be
Compare
svenwoop
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a scale-invariance bug in
kernels/geometry/roundline_intersector.h(RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE) where threeulpepsilon bounds inConeGeometry::isInsideCappedConeandConeGeometryIntersector::intersectConewere not scaled by the squared tangent slant lengthg = dPdP - drdr.Root Cause
Unlike
Cone(kernels/geometry/cone.h) andCylinder(kernels/geometry/cylinder.h), which normalize the segment axis byrl = rcp_length(p1 - p0)so that axial projections areO(L)and unitless parameters lie in[0, 1],ConeGeometryinroundline_intersector.havoids the square root by scaling the axial parameter domain byg = ||p1 - p0||^2 - (r1 - r0)^2(O(L^2)):y in [0, g], with normalized curve parameteru = clamp(y / g, 0.0f, 1.0f).ConeGeometryIntersector::intersectCone):lower = select((y_cone_front > -(float)ulp) & (y_cone_front <= g) & (g > 0.0f), ...)upper = select((y_cone_back > -(float)ulp) & (y_cone_back <= g) & (g > 0.0f), ...)Because
y_cone_frontandy_cone_backhave units ofg(O(L^2)), testing> -(float)ulpadmits phantom cylinder/cone hits behindp0over physical distanceulp / L(u in [-ulp / g, 0)). Furthermore, becauset_first = select(valid_lower, t_cone_sphere_lower, t_cone_sphere_upper), an external ray hits the back wallt_cone_upperift_cone_loweris rejected—so both front and back bounds must be scaled byg.ConeGeometry::isInsideCappedCone):cap0 = -r0dr + vfloat<M>(ulp)cap1 = -r1*dr + dPdP = -r0dr + gBecause
cap1 - (-r0dr) = g, comparing against an unscaledulp(1.1920929e-7f) causescap0 >= cap1wheneverg <= ulp(segment lengthL <= sqrt(ulp) ~= 3.45e-4), collapsing(cap0, cap1)to the empty set so neighbor-cone clipping (coneL.isInsideCappedCone/coneR.isInsideCappedCone) unconditionally returnsfalse.Before vs. After Fix (
rtcIntersect1on L-Shaped 2-Segment Curve(-L,0,0) -> (0,0,0) -> (0,L,0),r = 0.35*L)L = 1.0)L = 1e-4)L = 1e-4,ulp * g)At
L = 1e-4(g = 1e-8 < ulp), both segments grow aulp / L = 11.92 * Lphantom cylinder backward past their start vertices (Seg 0extends11.92 * Lto the left of(-L,0,0), andSeg 1extends11.92 * Ldownward through the(0,0,0)corner), whileisInsideCappedConefails to clip internal overlap at the(0,0,0)joint. Scalingulpbygin all three places restores exact scale invariance.At
L = 1e-4(g = 1e-8 < ulp), both segments grow aulp / L = 11.92 * Lphantom cylinder backward past their start vertices (Seg 0extends11.92 * Lto the left of(-L,0,0), andSeg 1extends11.92 * Ldownward through the(0,0,0)corner), whileisInsideCappedConefails to clip internal overlap at the(0,0,0)joint. Scalingulpbygin all three places restores exact scale invariance.Reproduce with embree_viewer and RoundLineSegments XML
l_curve_1.xml(L = 1.0):l_curve_1e-4.xml(L = 1e-4):Render and compare with
embree_viewer: