Retrieve the exact position on path in a beziered point

Typically: "How do I... ", "How can I... " questions
Post Reply
faiz ulurrasyadi
Posts: 5
Joined: 11 Apr 2020, 08:17

Retrieve the exact position on path in a beziered point

Post by faiz ulurrasyadi »

Hi,

I'm currently using vrep to build a walking humanoid robot by following a certain path, and I need to do some checking in each point of path. I know, we can return the exact position of each point on the path by using sim.getPositionOnPath and insert the second parameter of the function by writing -ctrlPtIndex-1. But how if my control point of path contain a bezier value? How to get that position?

As example if one of the control point in the middle of the path have a bezier value, i can easily get that position by inserting the second parameter with a value of 0.5. But how if the control point with bezier value isn't in the middle of the path? How to get the exact position inside the beziered path? Here I include the image for my illustration of what I'm actually wanted to achieve. I'm sorry for my bad english and if it's too complicated.

Links for image:
https://ibb.co/4NVZwSz

coppelia
Site Admin
Posts: 10366
Joined: 14 Dec 2012, 00:25

Re: Retrieve the exact position on path in a beziered point

Post by coppelia »

Hello,

I am afraid you won't be able to exactly retrieve that position. The best you can do is get quite close to it by using sim.getClosestPositionOnPath, i.e. you frist determine the position of the control point, then using that position, find its closest counterpart on the path.

Cheers

faiz ulurrasyadi
Posts: 5
Joined: 11 Apr 2020, 08:17

Re: Retrieve the exact position on path in a beziered point

Post by faiz ulurrasyadi »

Thanks for your reply, I don't know that function exist (sim.getClosestPositionOnPath), actually i did the same too by detecting where is the nearest point on path relative to the one of the control point but with some mathemathic program (ecludian distance). Perhaps, I have to use sim.getClosestPositionOnPath to make my program much simpler....😊

Thanks again

Post Reply