38 .description(
"The number of points on the arc");
40 .default_value({-1.0f, 0.0f, 0.0f})
43 .make_available(enable_points);
45 .default_value({0.0f, 2.0f, 0.0f})
47 .
description(
"Position of the middle control point")
48 .make_available(enable_points);
50 .default_value({1.0f, 0.0f, 0.0f})
53 .make_available(enable_points);
58 .description(
"Distance of the points from the origin")
59 .make_available(enable_radius);
60 auto &start_angle =
b.add_input<
decl::Float>(
"Start Angle")
63 .description(
"Starting angle of the arc")
64 .make_available(enable_radius);
65 auto &sweep_angle =
b.add_input<
decl::Float>(
"Sweep Angle")
66 .default_value(1.75f *
M_PI)
70 .description(
"Length of the arc")
71 .make_available(enable_radius);
72 auto &offset_angle =
b.add_input<
decl::Float>(
"Offset Angle")
75 .description(
"Offset angle of the arc")
76 .make_available(enable_points);
86 .description(
"The center of the circle described by the three points")
90 "The normal direction of the plane described by the three points, "
91 "pointing towards the positive Z axis")
94 .description(
"The radius of the circle described by the three points")
97 const bNode *node =
b.node_or_null();
98 if (node !=
nullptr) {
105 start.available(points_mode);
106 middle.available(points_mode);
107 end.available(points_mode);
109 radius.available(radius_mode);
110 start_angle.available(radius_mode);
111 sweep_angle.available(radius_mode);
113 offset_angle.available(points_mode);
115 center_out.available(points_mode);
116 normal_out.available(points_mode);
117 radius_out.available(points_mode);
131 node->storage =
data;
147 return ELEM(a,
b,
b * -1.0f);
155 const bool connect_center,
156 const bool invert_arc,
161 const int size = connect_center ? resolution + 1 : resolution;
165 const int stepcount = resolution - 1;
166 const int centerpoint = resolution;
177 if (is_colinear || a == c || a ==
b ||
b == c || resolution == 2) {
185 if (ab > ac && ab > bc) {
189 else if (bc > ab && bc > ac) {
198 const float step = 1.0f / stepcount;
200 const float factor = step * i;
219 float plane_1[4], plane_2[4], plane_3[4];
241 float angle = (angle_ac > angle_ab) ? angle_ac : angle_ab;
242 angle -= 2.0f *
M_PI;
248 const float step = angle / stepcount;
250 const float factor = step * i + angle_offset;
252 positions[i] = out * radius + center;
256 if (connect_center) {
257 curves.cyclic_for_write().first() =
true;
258 positions[centerpoint] = center;
274 const float start_angle,
275 const float sweep_angle,
276 const bool connect_center,
277 const bool invert_arc)
279 const int size = connect_center ? resolution + 1 : resolution;
283 const int stepcount = resolution - 1;
284 const int centerpoint = resolution;
287 const float sweep = (invert_arc) ? -(2.0f *
M_PI - sweep_angle) : sweep_angle;
289 const float theta_step = sweep /
float(stepcount);
291 const float theta = theta_step * i + start_angle;
292 const float x = radius *
cos(theta);
293 const float y = radius * sin(theta);
294 positions[i] =
float3(x, y, 0.0f);
297 if (connect_center) {
298 curves.cyclic_for_write().first() =
true;
299 positions[centerpoint] =
float3(0.0f, 0.0f, 0.0f);
313 float3 r_center, r_normal;
316 std::max(
params.extract_input<
int>(
"Resolution"), 2),
320 params.extract_input<
float>(
"Offset Angle"),
321 params.extract_input<
bool>(
"Connect Center"),
322 params.extract_input<
bool>(
"Invert Arc"),
327 params.set_output(
"Center", r_center);
328 params.set_output(
"Normal", r_normal);
329 params.set_output(
"Radius", r_radius);
334 std::max(
params.extract_input<
int>(
"Resolution"), 2),
335 params.extract_input<
float>(
"Radius"),
336 params.extract_input<
float>(
"Start Angle"),
337 params.extract_input<
float>(
"Sweep Angle"),
338 params.extract_input<
bool>(
"Connect Center"),
339 params.extract_input<
bool>(
"Invert Arc"));
354 "Define arc by 3 points on circle. Arc is calculated between start and end points"},
359 "Define radius with a float"},
360 {0,
nullptr, 0,
nullptr,
nullptr},
366 "Method used to determine radius and placement",
378 "NodeGeometryCurvePrimitiveArc",
Low-level operations for curves.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
bool isect_plane_plane_plane_v3(const float plane_a[4], const float plane_b[4], const float plane_c[4], float r_isect_co[3]) ATTR_WARN_UNUSED_RESULT
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_m3_v3(const float M[3][3], float r[3])
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
GeometryNodeCurvePrimitiveArcMode
@ GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_POINTS
@ GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_RADIUS
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
void make_available(bNode &node) const
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
ccl_device_inline float3 cos(float3 v)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
Curves * curves_new_nomain_single(int points_num, CurveType type)
T distance(const T &a, const T &b)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T midpoint(const T &a, const T &b)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
T distance_squared(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
static Curves * create_arc_curve_from_points(const int resolution, const float3 a, const float3 b, const float3 c, float angle_offset, const bool connect_center, const bool invert_arc, float3 &r_center, float3 &r_normal, float &r_radius)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_rna(StructRNA *srna)
static Curves * create_arc_curve_from_radius(const int resolution, const float radius, const float start_angle, const float sweep_angle, const bool connect_center, const bool invert_arc)
static float3 rotate_vector_around_axis(const float3 vector, const float3 axis, const float angle)
static void node_init(bNodeTree *, bNode *node)
static void node_register()
static bool colinear_f3_f3_f3(const float3 p1, const float3 p2, const float3 p3)
static void node_geo_exec(GeoNodeExecParams params)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare