18 .description(
"Number of points in one rotation of the spiral");
22 .
description(
"Number of times the spiral makes a full rotation")
27 .description(
"Horizontal Distance from the Z axis at the start of the spiral");
31 .description(
"Horizontal Distance from the Z axis at the end of the spiral");
35 .description(
"The height perpendicular to the base of the spiral");
37 "Switch the direction from clockwise to counterclockwise");
43 const float start_radius,
44 const float end_radius,
48 const int totalpoints = std::max(
int(resolution * rotations), 1);
49 const float delta_radius = (end_radius - start_radius) /
float(totalpoints);
50 const float delta_height = height /
float(totalpoints);
51 const float delta_theta = (
M_PI * 2 * rotations) /
float(totalpoints) *
52 (direction ? 1.0f : -1.0f);
59 for (
const int i :
IndexRange(totalpoints + 1)) {
60 const float theta = i * delta_theta;
61 const float radius = start_radius + i * delta_radius;
62 const float x = radius *
cos(theta);
63 const float y = radius * sin(theta);
64 const float z = delta_height * i;
66 positions[i] = {
x,
y,
z};
74 const float rotations = std::max(
params.extract_input<
float>(
"Rotations"), 0.0f);
75 if (rotations == 0.0f) {
76 params.set_default_remaining_outputs();
81 std::max(
params.extract_input<
int>(
"Resolution"), 1),
82 params.extract_input<
float>(
"Start Radius"),
83 params.extract_input<
float>(
"End Radius"),
84 params.extract_input<
float>(
"Height"),
85 params.extract_input<
bool>(
"Reverse"));
Low-level operations for curves.
#define NODE_CLASS_GEOMETRY
#define BLT_I18NCONTEXT_ID_NODETREE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
ccl_device_inline float3 cos(float3 v)
void node_register_type(bNodeType *ntype)
Curves * curves_new_nomain_single(int points_num, CurveType type)
static Curves * create_spiral_curve(const float rotations, const int resolution, const float start_radius, const float end_radius, const float height, const bool direction)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare