Skip to content

Curve intersection and closest point on spline precision #332

@MangoSister

Description

@MangoSister

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions