Â

# Infinite UVN Range + Infinite Binding

The previous method of binding components to a nurbs surface was to find the closest point on the nurbs surface, and then create a matrix based on the position, normals, and tangents of that point. That matrix, plus the U and V coordinates of the point on the surface were recorded as the bind data for that component.

This worked perfectly fine for that iteration for that iteration of the UVN deformer but since points can now slide beyond the surface an unaccounted for fringe case has been revealed.

In the image above the black line represents the surface we are binding to, and the blue dot represents the component that is being bound. The light blue lines represent the tangents of the surface so our "imaginary infinite surface" extends along those lines. You might expect that the component would be bound to the green point on our infinite surface, but because that part of the surface doesn't actually exist it gets bound to the red point instead. This makes a noticeable difference, as the path a component bound to the green point would take (shown in green) maintains a constant offset distance from the surface. While a component bound to the red point would have a constant offset in two axis and thus creates a different path. the different between the two paths is greater the further away the component is from the actual surface.

We can resolve this using a smarter binding method. We first find the red point as normal, then we get the tangent vector of the surface at that point. Then we find the vector from the component to the red point. We then find the component of that vector that lies along the tangent (using a dot product), and compare the length of that component vector to the length of the tangent to find out how far along our "imaginary surface" the component is (being sure to take into account the +/- sign). That gives us the proper UV coordinates (which will be outside the parameter range of the actual surface) and we can just use the matrix from the red point because the normals and tangents of the red point are the same for the green point.

This will make the sliding path for points beyond the surface more intuitive and won't affect performance at all because the extra calculations only occur during the bind step.