Page MenuHome

Geometry Nodes: Curve Primitive Arc
ClosedPublic

Authored by Charlie Jolly (charlie) on Dec 21 2021, 3:09 AM.

Details

Summary

Geometry Nodes: Curve Primitive Arc

Points mode: Generates a three point curve arc from Start to End via Middle with Angle Offset and option to use shortest arc.

Radius mode: Generates a fixed radius arc on XY with controls for Angle and Sweep.

Radius and Points mode, updated with code from D13100.

Note: I didn't check before submitting and there was a previous arc node in D11713 and D13100 from @Johnny Matthews (guitargeek). Doh!

Test file:

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 19551
Build 19551: arc lint + arc unit

Event Timeline

Charlie Jolly (charlie) requested review of this revision.Dec 21 2021, 3:09 AM
Charlie Jolly (charlie) created this revision.
Charlie Jolly (charlie) updated this revision to Diff 46283.EditedDec 21 2021, 6:48 PM

Added Radius mode, updated with code from D13100.

Charlie Jolly (charlie) edited the summary of this revision. (Show Details)Dec 21 2021, 6:56 PM

Add some const and remove debug variable.

Rebase to master.

Remove use of spline->add_point.

Always draw longest line when colinear.

We discussed this in the latest geometry nodes sub-module meeting. Here are the notes from that:

  • "Invert Arc" might be a more intuitive and more consistent than "Shortest Arc", and that would even work in radius mode
  • "Radius" can be the default mode, since it's a bit easier to understand and much smaller

Also, there seems to be a special case with weird behavior here:

Charlie Jolly (charlie) updated this revision to Diff 47017.EditedJan 13 2022, 2:57 AM

Address comments.

  • Replace Shortest Arc with Invert Arc.
  • Set Radius mode as default.
  • Fix bug in points mode. Remove code based on slerp and do simple rotate around center point.
  • Set Normal to always be relative to Z axis.

Testing this, it looks good to me now, I like the options that are exposed.

I'm curious, do you think the circle primitive's create_point_circle_curve function could be easily defined in terms of this one now? It might be nice to do some cleanup after this if possible.

source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
76–84

Candidates for descriptions:

  • The center of the circle described by the three points
  • The normal direction of the plane described by the three points, pointing towards the positive Z axis
  • The radius of the circle described by the three points
192–206

I found this a little hard to follow at first, and my instinct was to separate it into a separate function, but I don't see a great way to make that work. Maybe it deserves a comment like "Find the two points that are furthest away from each other"

329–330

Use node_storage function, call the variable storage for consistency

This revision is now accepted and ready to land.Jan 20 2022, 6:39 PM
Charlie Jolly (charlie) marked 3 inline comments as done.Jan 20 2022, 7:36 PM

I'm curious, do you think the circle primitive's create_point_circle_curve function could be easily defined in terms of this one now? It might be nice to do some cleanup after this if possible.

Yes, I can take a look.

This revision was automatically updated to reflect the committed changes.