21 "The distance a point can be from the surface before the face is no longer "
34 : bke::MeshFieldInput(
CPPType::get<bool>(),
"Planar"), threshold_(threshold)
40 const AttrDomain domain,
45 const Span<int> corner_verts = mesh.corner_verts();
50 evaluator.
add(threshold_);
52 const VArray<float> thresholds = evaluator.get_evaluated<
float>(0);
55 [positions,
faces, corner_verts, thresholds, face_normals](
const int i) ->
bool {
57 if (face.size() <= 3) {
60 const float3 &reference_normal = face_normals[i];
65 for (
const int vert : corner_verts.
slice(face)) {
66 float dot =
math::dot(reference_normal, positions[vert]);
74 return max -
min < thresholds[i] / 2.0f;
77 return mesh.attributes().adapt_domain<
bool>(
99 return AttrDomain::Face;
106 Field<bool> planar_field{std::make_shared<PlanarFieldInput>(threshold)};
107 params.set_output(
"Planar", std::move(planar_field));
115 &ntype, GEO_NODE_INPUT_MESH_FACE_IS_PLANAR,
"Is Face Planar",
NODE_CLASS_INPUT);
#define BLT_I18NCONTEXT_ID_NODETREE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
constexpr Span slice(int64_t start, int64_t size) const
static VArray ForFunc(const int64_t size, GetFunc get_func)
int add(GField field, GVArray *varray_ptr)
virtual void for_each_field_input_recursive(FunctionRef< void(const FieldInput &)> fn) const
const FieldNode & node() const
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
unsigned __int64 uint64_t
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare