28 for (const int i_curve : range) {
29 const IndexRange points = curves.points_for_curve(i_curve);
30 const IndexRange evaluated_points = curves.evaluated_points_for_curve(i_curve);
32 MutableSpan<float3> curve_tangents = results.as_mutable_span().slice(points);
34 switch (types[i_curve]) {
35 case CURVE_TYPE_CATMULL_ROM: {
36 Span<float3> tangents = evaluated_tangents.slice(evaluated_points);
37 const int resolution = resolutions[i_curve];
38 for (const int i : IndexRange(points.size())) {
39 curve_tangents[i] = tangents[resolution * i];
44 curve_tangents.copy_from(evaluated_tangents.slice(evaluated_points));
46 case CURVE_TYPE_BEZIER: {
47 Span<float3> tangents = evaluated_tangents.slice(evaluated_points);
48 curve_tangents.first() = tangents.first();
49 const Span<int> offsets = curves.bezier_evaluated_offsets_for_curve(i_curve);
50 for (const int i : IndexRange(points.size()).drop_front(1)) {
51 curve_tangents[i] = tangents[offsets[i - 1]];
55 case CURVE_TYPE_NURBS: {
56 const Span<float3> curve_positions = positions.slice(points);
57 bke::curves::poly::calculate_tangents(curve_positions, cyclic[i_curve], curve_tangents);
100 category_ = Category::Generated;
128 Field<float3> tangent_field{std::make_shared<TangentFieldInput>()};
129 params.set_output(
"Tangent", std::move(tangent_field));
Low-level operations for curves.
@ GEO_COMPONENT_TYPE_CURVE
#define GEO_NODE_INPUT_TANGENT
void nodeRegisterType(struct bNodeType *ntype)
static uint8 component(Color32 c, uint i)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static struct PartialUpdateUser * wrap(PartialUpdateUserImpl *user)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
MutableSpan< float3 > positions
MutableSpan< float3 > tangents
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
unsigned __int64 uint64_t
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare