Point on a bspline with a condition

Technical discussions
Post Reply
Samuel Verma
Posts: 1
Joined: Thu Feb 10, 2022 5:27 am

Point on a bspline with a condition

Post by Samuel Verma »

Hello,

I need to compute a point on a bspline curve which has the tangential vector parallel to the straight segment (chord) connecting another two points on the same curve.

Is there a way to do it with the current v7? It would be awesome to see any ideas.

Thank you.

highrev
Posts: 2
Joined: Tue Aug 20, 2013 9:27 am

Re: Point on a bspline with a condition

Post by highrev »

I assume the curve is 2D? In 3D this problem generally does not have a solution (on a 3D spiral a chord parallel to the axis between two full turns is never parallel to a tangent).

So you will probably need to construct the curve as IBSplineCurve2d_DG and query ICurve2d_DG from it to access points and tangents.

I doubt there is finite equations solution. I suggest using a numerical method for finding a root of a function of the parameter u along the curve. As the function in the case, you could take 2D cross product between the chord and the tangent:

You will have two vectors: c (chord) and the tangent t as T2DDg, So the function returning cross product c.CrossProduct(t(u)); should do. It changes sign when the two are parallel and are rotating relatively to each other.

Coding finding the root is normally like 20 lines of code. See https://en.wikipedia.org/wiki/Root-finding_algorithms

Regards

Post Reply