**THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED**

*On 31/05/2010 at 12:52, xxxxxxxx wrote:*

User Information:

Cinema 4D Version: r11

Platform:

Language(s) : C++ ;

---------

Hi there,

i am trying to check for a spline if a point is within a certain range to the spline.. this is what i thought should work, but it doesnt. so i guess my approach is wrong.

the idea was to cycle thru all points of the spline and compare them to an ajustable number of points of the spline (the more points the more accuracy)..

can anyone point out some source of information which may help me to get it work as i dont know what to look for?

```
Real distance (Vector from, Vector to)
{
Real d = Abs(Len(from - to));
return d;
}
...
//check if spline intersects
//accuracy defines how many points should be taken for the test
for (int i=1; i<steps; i++)
{
for(int sCheck=0; sCheck<accuracy; sCheck++)
{
cpos = (1.0/accuracy)*sCheck;
vPosition = splineObj->GetSplinePoint(splineObj->UniformToNatural(cpos), 0, NULL);
tempVec = splineObj->GetSplinePoint(splineObj->UniformToNatural((1.0/steps)*i), 0, NULL);
if (distance(vPosition,tempVec)<sRange)
{
//just add some random value for now...
padr[i] = tempVec + Vector(0.1*zufall(sRange,seed*i/100));
}
}
}
```

thanks,

ello