0
$\begingroup$

I am trying to detect the curvature radius of a closed bézier curve and translate those changes into moving a cube and its position. So, performing a mapping between the curve radius and the position/translation of the cube.

In order for this to work, I am trying to retrieve index n n+1 and n+2, subtract both position vertices vectors and get the dot product, so that we get the angle between the two vectors. Then, I would take the sinus of this angle and multiply it by a factor in the "y" position of the cube translation.

Here I offer snapshots of my geometry nodes network. Im kind of stuck. Plus, im trying to make it get evaluated at each frame in the timeline. Nothing happens.

enter image description here

enter image description here

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Could you provide your Blender file using blend-exchange.com ? $\endgroup$ Commented Apr 22 at 10:42
  • $\begingroup$ I don't quite understand your node tree. Maybe this answer helps you with your question ? blender.stackexchange.com/questions/315859/… $\endgroup$
    – Lutzi
    Commented Apr 22 at 10:43
  • 1
    $\begingroup$ If I understand your node tree, you would like the cube (close to origin ?) to move along the Y axis when you are sampling one point at a time (i.e. frame number) ? You do not want to compute the radius of curvature of all points, just a single one, but different between frames. $\endgroup$ Commented Apr 22 at 10:47

3 Answers 3

0
$\begingroup$

in answer to @StefLAncien not exactly. What im trying to do is the equivalent in code to:

for(int i = 0; i < length; i++)
{
     vertex_n = vertices[i];
     vertex_n1 = vertices[i+1];
     vertex_n2 = vertices[i+2];
}

Which means: i want to compute the tangent vector at three consecutive control points/evaluation points and for this i need first to retrieve the three "generic" indices at n, n+1 and n+2.

I guess a shorter answer and the first one to make is, how i translate the meaning of this for loop into something manageable in the Geometry nodes. Excuse me, i am relatively new to blender and geometry nodes and i still dont understand quite well the meaning of some nodes like storedAttribute, captureAttribute and so on.

$\endgroup$
1
  • 1
    $\begingroup$ You should add this in your original question, not as an "Answer". BSE is not a discussion forum, but a Q&A resource. $\endgroup$ Commented Apr 25 at 9:43
0
$\begingroup$

(Using Blender 3.6.8)

The following graph is designed to replace the "GET_INDICES_N_1_2" framed nodes, assuming a cyclic curve:

GN Graph

As an example, a line is drawn from point (n), aligned to the vector connecting points (n+1) and (n).

Resources:

$\endgroup$
0
$\begingroup$

enter image description here

enter image description here

enter image description here

enter image description here

The following Geometry Nodes Network accomplishes what I wanted, which is: mapping the curvature radius amount to a translation in the Y-axis. The angle amount varies from 0 to 1 as I take the arcsine of the angle between two consecutive position vectors. Note that the angle between two consecutive tangents cannot exceed 90 degrees, so the curve must be smoothed enough to have soft transitions. It is not meant to be for curves with derivatives to zero.

The rest of the work is just tweak and decide how much this "angle Factor multiplication" will affect the translation.

$\endgroup$
3
  • $\begingroup$ using Blender 4.1.1 $\endgroup$ Commented Apr 25 at 16:50
  • $\begingroup$ Be careful that with a Resample Curve Count of 200 and a Frame range from 1 to 250, you are exceeding the max index in the Sample Index nodes of the "POSITIONS_AT_N_1_2" frame. $\endgroup$ Commented Apr 28 at 8:41
  • $\begingroup$ You are completely right @StefLAncien! Thanks $\endgroup$ Commented Apr 28 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .