Walking along a B-Spline in uniform steps.

40 views
Skip to first unread message

Burtski

unread,
Jan 22, 2021, 11:04:29 AM1/22/21
to NURBS-Python
Hello all:
I have a (3D) B-spline that I wish to walk along in even steps and extract information at each step.
i.e.. walk along a 1500mm path and extract XYZ at each mm.
I have found that my step lengths are not uniform even through the points I am evaluating at uniform intervals.

In the attached code is the definition of a typical path.
The overall length of this path is ~1875 mm
Therefore my uniform evaluation step size is 1 / 1875 ~ 0.00053
When I evaluate the distance between two points that are the same evaluation distance apart I get different distances at one then of the spline than the other.

(Where I am evaluating these test points are in sections of the spline that are quite straight.)

So, when I run the attached code I get:
Overall Length:  1874.6444
Uniform Evaluation step size:  0.0005334344983524545
Distance along spline at beginning = : 1.6960869944763601
Distance along spline at end = : 0.6328986978217062

I expect both distances to be very nearly 1.000.
I also expect the distances to be the same.

What am I doing wrong?

Thanks



Uneven_NURBS.py

Onur Bingol

unread,
Jan 30, 2021, 3:40:47 PM1/30/21
to nurbs-python
I don't think using uniform steps in the parametric space would mean to result in uniform steps in the XYZ space. Maybe, if the degree is 1, it could be expected.





---- On Fri, 22 Jan 2021 08:04:29 -0800 Burtski <burt.p...@nevisgroup.com> wrote ----

--
You received this message because you are subscribed to the Google Groups "NURBS-Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nurbs-python...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nurbs-python/f489932c-6653-44d2-87c5-64d61b6769d7n%40googlegroups.com.


Burtski

unread,
Jan 31, 2021, 10:30:44 AM1/31/21
to NURBS-Python
Onur:
Thank you very much for your response,

I 'think' I understand what you are telling me. ( I am well and truly in over my head here )
Does this mean that I will need to search for the point that is 1mm distant from my current point?

My current measure of distance is the straight line distance between the two points.
I know that I am going around a curve so there will be error between the chord and the true distance traveled.
Is there a function that will tell me distance along the curve between two evaluation points?
( Or the distance along the curve at an evaluation point?)

Although it is ideal for me to walk in exactly 1mm steps, it is indeed more important that I know what the step was as long as it is near 1 mm.

Again, Thank you for your time and your Library ( and your patients ;-)

Onur Bingol

unread,
Jan 31, 2021, 11:46:49 AM1/31/21
to nurbs-python
> Does this mean that I will need to search for the point that is 1mm distant from my current point?

Yes.

>  My current measure of distance is the straight line distance between the two points.
> I know that I am going around a curve so there will be error between the chord and the true distance traveled.
> Is there a function that will tell me distance along the curve between two evaluation points?
> ( Or the distance along the curve at an evaluation point?)

I am sure there are better and smarter methods, but if you are planning to use a straight line, the following might help:

1. Evaluate curve point at u = k. You will find P1 = C(k)
2. Evaluate curve point at u = k + t, where t is the infinitesimal step size. You will find P2 = C(k+t)
3. Find the absolute distance between P1 and P2
4. If it is bigger than, let's say 1.0, then decrease t.

It will probably fail in some cases (e.g. big t, sharp turns, self-intersection, ...)

An alternative could be determining step size for each knot interval. Decomposition might help in this case.




---- On Sun, 31 Jan 2021 07:30:44 -0800 Burtski <burt.p...@nevisgroup.com> wrote ----

Reply all
Reply to author
Forward
0 new messages