23 "The distance a point can be from the surface before the face is no longer "
36 :
bke::MeshFieldInput(
CPPType::get<bool>(),
"Planar"), threshold_(threshold)
47 const Span<int> corner_verts = mesh.corner_verts();
52 evaluator.
add(threshold_);
57 [positions,
faces, corner_verts, thresholds, face_normals](
const int i) ->
bool {
59 if (face.
size() <= 3) {
62 const float3 &reference_normal = face_normals[
i];
67 for (
const int vert : corner_verts.
slice(face)) {
68 float dot =
math::dot(reference_normal, positions[vert]);
72 return max -
min < thresholds[
i] / 2.0f;
75 return mesh.attributes().adapt_domain<
bool>(
81 threshold_.node().for_each_field_input_recursive(
fn);
97 return AttrDomain::Face;
104 Field<bool> planar_field{std::make_shared<PlanarFieldInput>(threshold)};
105 params.set_output(
"Planar", std::move(planar_field));
114 ntype.
ui_name =
"Is Face Planar";
116 "Retrieve whether all triangles in a face are on the same plane, i.e. whether they have the "
#define GEO_NODE_INPUT_MESH_FACE_IS_PLANAR
#define BLT_I18NCONTEXT_ID_NODETREE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
unsigned long long int uint64_t
constexpr int64_t size() const
constexpr Span slice(int64_t start, int64_t size) const
static VArray from_func(const int64_t size, GetFunc get_func)
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
void node_register_type(bNodeType &ntype)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare