# Using geometry nodes to calculate curve angle

I am currently trying to make a race track generator with geometry nodes and I came to a halt because I don't really understand how I can calculate the turn angle in various points of the curve and set a threshold for where to put kerbs and run offs. I haven't really been able to find any resource on it and using the sample curve tangent hasn't yielded any results so far. I started with a drawn curve that then i resampled, converted to a mesh and then extruded. Thank you very much.

The grease pencil lines are where ideally the kerbs should go.

• So, you want to get an approximation if curvature in XY (not including up/down).. or ore there other constraints on these features? Oct 15, 2023 at 11:17
• can you please add a sketch/image, what angle you are talking of? Oct 15, 2023 at 11:51
• the constraints are only X and Y, the only other constraint is the turn angle, Ideally I would like to be able to control the depth of each kerbs based on how narrow the angle is. Oct 15, 2023 at 12:20

This is how you can calculate a signed angle for each point of a curve:

It doesn't use Tangents, so the angle is clearly defined as an angle between the evaluated line segments:

• segment 1: between the previous point and currently evaluated point
• segment 2: between currently evaluated point, and the next point

The angle is $$0$$ if either segment is missing because it's the first or the last point. If you want an angle spanning across multiple points, just pass the calculated value to Accumulate Field node, capture it again, and now you can compare currently evaluated point's value with any other point to check the angle between those.

• sorry, why are the two offset point in curve different? Also I plugged it in the original geometry but it doesnt seem to be working. What do i need to plug in the point index? Oct 16, 2023 at 9:52
• "why are the two offset point in curve different" - one represents the previous point, one the next point. This is why one has negative offset, one positive. "it doesnt seem to be working." - it's not clear what your geometry is exactly and how you want it to work exactly. Maybe upload your .blend file using blend-exchange.com Oct 16, 2023 at 11:35
• my geometry currently is a bezier curve, my current goal is to be able to add an additional extrusion along the side of the track but only in the areas where there is a turn that meets a specific threshold in order to create the kerbs. Oct 17, 2023 at 20:14
• Resample Curve, "Evaluated" mode. Oct 17, 2023 at 20:38