Page MenuHome

Geometry Nodes: Edge Angle Node: Add Signed Angle Output
ClosedPublic

Authored by Johnny Matthews (guitargeek) on Jan 11 2022, 3:59 AM.

Details

Summary

This patch adds a second socket to output the signed angle from edge in addition to the unsigned angle.

When the mesh is concave the angle is -pi to 0, when it is convex, it is the angle from 0 to pi.

The second output was added as calculating a consistent reference angle was more computationally expensive than expected. So if unsigned works for a given task, it can still be used with an added speed benefit.

Diff Detail

Repository
rB Blender
Branch
new_edge (branched from master)
Build Status
Buildable 20010
Build 20010: arc lint + arc unit

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Jan 11 2022, 3:59 AM
Johnny Matthews (guitargeek) created this revision.
Johnny Matthews (guitargeek) retitled this revision from Geometry Nodes: Edge Angle Node - Return Signed Angle to Geometry Nodes: Edge Angle Node - Add Return Signed Angle Output.Jan 11 2022, 3:43 PM
Johnny Matthews (guitargeek) edited the summary of this revision. (Show Details)
Johnny Matthews (guitargeek) edited the summary of this revision. (Show Details)
  • Merge branch 'master' into new_edge
  • Update to new math::normalize
Hans Goudey (HooglyBoogly) requested changes to this revision.EditedJan 14 2022, 10:53 PM

Works well! This needs versioning to rename the Unsigned Angle output.

I did some performance testing: I found the unsigned output is slower faster than the signed output, though not by that much. (42 ms vs 47 ms in my test).

However, I think some things like using cached poly normals if they are available could help make this node faster.

source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc
34

No need for the newline here, IMO

145–161

Share this edge map calculation as a static function

164

I'd suggest returning early here instead of indenting the rest of the lambda

174

const

174–175

Use float3(...) instead of the C-style casts

174–176

A bit arbitrary, but I'd stick with float math and use * 0.5f.

183–186

const

This revision now requires changes to proceed.Jan 14 2022, 10:53 PM
Johnny Matthews (guitargeek) marked 7 inline comments as done.
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/blenloader/intern/versioning_300.c
2547

I think I'm going to add a node here too, so it's hopeless to list them all. Maybe this:
Rename sockets on multiple nodes.

Hans Goudey (HooglyBoogly) retitled this revision from Geometry Nodes: Edge Angle Node - Add Return Signed Angle Output to Geometry Nodes: Edge Angle Node: Add Signed Angle Output.Jan 17 2022, 4:22 PM
Jacques Lucke (JacquesLucke) requested changes to this revision.Jan 18 2022, 3:39 PM

Only got some small comments. Besides that, looks good.

source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc
32

Computing this value is faster [...]

38

What does "fully concave" vs. "fully convex" even mean? Aren't they practically the same. Might be better to say "convex angles are positive".

48

Pass Span by value instead of by reference.

This revision now requires changes to proceed.Jan 18 2022, 3:39 PM
Johnny Matthews (guitargeek) marked 4 inline comments as done.
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc
50

mesh could be a reference here rather than a pointer, to show that it won't be NULL

This revision is now accepted and ready to land.Jan 18 2022, 4:00 PM