-
Notifications
You must be signed in to change notification settings - Fork 412
Description
Hello. I am new to embree, and I am using embree for ray-round curve intersection (RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE or RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE). For each intersection I would like to get the closest point on the spline to the intersection point. This seems to be as simple as performing an interpolation:
RTCRayHit rayhit; // filled by rtcIntersect
float P[4];
rtcInterpolate1(rtcGetGeometry(scene, rayhit.hit.geomID), rayhit.hit.primID, rayhit.hit.u, rayhit.hit.v,
RTC_BUFFER_TYPE_VERTEX, 0, P, nullptr, nullptr, 4);
To verify this, when I calculate the distance between the intersection point and (P[0], P[1], P[2]), I should get something close to P[3]. However, in my test I observed quite non-negligible deviation when the curve radius is small. Each curve in my test has a constant radius of 0.00375 (so actually cylinders) and length of around 1.0. I trace rays from several units away. The actual results I got varies from 0.0036 to 0.0038. The error can be close to 5%.
Am I doing anything wrong, or is this kind of numerical precision normal (seems much larger than I expect), or is it because my curves are too thin? Thanks.