18 .structure_type(StructureType::Field)
20 "The shortest angle in radians between two faces where they meet at an edge. Flat edges "
21 "and Non-manifold edges have an angle of zero. Computing this value is faster than the "
24 .structure_type(StructureType::Field)
26 "The signed angle in radians between two faces where they meet at an edge. Flat edges "
27 "and Non-manifold edges have an angle of zero. Concave angles are positive and convex "
28 "angles are negative. Computing this value is slower than the unsigned angle");
33 const int total_edges)
38 for (
const int edge : corner_edges.
slice(faces[i_face])) {
39 int2 &entry = edge_map[edge];
43 else if (entry[1] == -1) {
69 [edge_map = std::move(edge_map), positions, faces, corner_verts](
const int i) ->
float {
70 if (edge_map[i][0] < 0 || edge_map[i][1] < 0) {
73 const IndexRange face_1 = faces[edge_map[i][0]];
74 const IndexRange face_2 = faces[edge_map[i][1]];
81 return mesh.attributes().adapt_domain<
float>(std::move(angles), AttrDomain::Edge, domain);
86 static constexpr int8_t id = 0;
92 return AttrDomain::Edge;
104 const int3 &tri = corner_tris[tri_index];
105 const int3 vert_tri(corner_verts[tri[0]], corner_verts[tri[1]], corner_verts[tri[2]]);
106 if (ordered_edge ==
OrderedEdge(vert_tri[0], vert_tri[1])) {
109 if (ordered_edge ==
OrderedEdge(vert_tri[1], vert_tri[2])) {
112 if (ordered_edge ==
OrderedEdge(vert_tri[2], vert_tri[0])) {
137 [edge_map = std::move(edge_map), positions, edges, faces, corner_verts, corner_tris](
138 const int i) ->
float {
139 if (edge_map[i][0] < 0 || edge_map[i][1] < 0) {
142 const int face_index_1 = edge_map[i][0];
143 const int face_index_2 = edge_map[i][1];
144 const IndexRange face_1 = faces[face_index_1];
145 const IndexRange face_2 = faces[face_index_2];
149 corner_verts.
slice(face_1));
151 corner_verts.
slice(face_2));
155 positions[edges[i][1]]);
160 faces, corner_verts, corner_tris, face_index_2, edges[i]);
162 const float concavity =
math::dot(face_1_normal, face_2_tangent);
174 return mesh.attributes().adapt_domain<
float>(std::move(angles), AttrDomain::Edge, domain);
179 static constexpr int8_t id = 0;
185 return AttrDomain::Edge;
205 ntype.
ui_description =
"The angle between the normals of connected manifold faces";
#define GEO_NODE_INPUT_MESH_EDGE_ANGLE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define BLI_assert_unreachable()
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
constexpr Span slice(int64_t start, int64_t size) const
static VArray from_func(const int64_t size, GetFunc get_func)
static Field from_input(Args &&...args)
bool output_is_required(const UString identifier) const
void set_output(const UString identifier, T &&value)
IndexRange index_range() const
float3 face_normal_calc(Span< float3 > vert_positions, Span< int > face_verts)
IndexRange face_triangles_range(OffsetIndices< int > faces, int face_i)
void node_register_type(bNodeType &ntype)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T midpoint(const T &a, const T &b)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
VecBase< int32_t, 2 > int2
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
OrderedEdge(const int v1, const int v2)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare