Repository: godotengine/godot
File: editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp (C++)

Code before:
		p_gizmo->add_collision_segments(collision_segments);

		Vector<Vector3> handles = {
			Vector3(cs2->get_radius(), 0, 0),
			Vector3(0, cs2->get_height() * 0.5, 0)
		};
		p_gizmo->add_handles(handles, handles_material);
	}

	if (Object::cast_to<CylinderShape3D>(*s)) {
		Ref<CylinderShape3D> cs2 = s;
		float radius = cs2->get_radius();
		float height = cs2->get_height();

#define PUSH_QUARTER(from_x, from_y, to_x, to_y, y)      \
	points_ptrw[index++] = Vector3(from_x, y, from_y);   \
	points_ptrw[index++] = Vector3(to_x, y, to_y);       \
	points_ptrw[index++] = Vector3(from_x, y, -from_y);  \
	points_ptrw[index++] = Vector3(to_x, y, -to_y);      \
	points_ptrw[index++] = Vector3(-from_x, y, from_y);  \
	points_ptrw[index++] = Vector3(-to_x, y, to_y);      \
	points_ptrw[index++] = Vector3(-from_x, y, -from_y); \
	points_ptrw[index++] = Vector3(-to_x, y, -to_y);

		// Number of points in an octant. So there will be 8 * points_in_octant * 2 points in total for one circle.
		// Correspond to the smoothness of the circle.
		const uint32_t points_in_octant = 16;
		const real_t inc = (Math_PI / (4 * points_in_octant));
		const real_t radius_squared = radius * radius;
		real_t r = 0;

		Vector<Vector3> points;
		uint32_t index = 0;
		//  4 vertical Lines and 2 fullCircles.
		points.resize(4 * 2 + 2 * 8 * points_in_octant * 2);
		Vector3 *points_ptrw = points.ptrw();
		float y_value = height * 0.5;

		// Vertical Lines.
		points_ptrw[index++] = Vector3(0.f, y_value, radius);
		points_ptrw[index++] = Vector3(0.f, -y_value, radius);
		points_ptrw[index++] = Vector3(0.f, y_value, -radius);
		points_ptrw[index++] = Vector3(0.f, -y_value, -radius);
		points_ptrw[index++] = Vector3(radius, y_value, 0.f);
		points_ptrw[index++] = Vector3(radius, -y_value, 0.f);
		points_ptrw[index++] = Vector3(-radius, y_value, 0.f);
		points_ptrw[index++] = Vector3(-radius, -y_value, 0.f);

		float previous_x = radius;
		float previous_y = 0.f;


Review comment (suggestion):
```suggestion
		// This corresponds to the smoothness of the circle.
```

Code after:
		p_gizmo->add_collision_segments(collision_segments);

		Vector<Vector3> handles = {
			Vector3(cs2->get_radius(), 0, 0),
			Vector3(0, cs2->get_height() * 0.5, 0)
		};
		p_gizmo->add_handles(handles, handles_material);
	}

	if (Object::cast_to<CylinderShape3D>(*s)) {
		Ref<CylinderShape3D> cs2 = s;
		float radius = cs2->get_radius();
		float height = cs2->get_height();

#define PUSH_QUARTER(from_x, from_y, to_x, to_y, y)      \
	points_ptrw[index++] = Vector3(from_x, y, from_y);   \
	points_ptrw[index++] = Vector3(to_x, y, to_y);       \
	points_ptrw[index++] = Vector3(from_x, y, -from_y);  \
	points_ptrw[index++] = Vector3(to_x, y, -to_y);      \
	points_ptrw[index++] = Vector3(-from_x, y, from_y);  \
	points_ptrw[index++] = Vector3(-to_x, y, to_y);      \
	points_ptrw[index++] = Vector3(-from_x, y, -from_y); \
	points_ptrw[index++] = Vector3(-to_x, y, -to_y);

		// Number of points in an octant. So there will be 8 * points_in_octant * 2 points in total for one circle.
		// This corresponds to the smoothness of the circle.
		const uint32_t points_in_octant = 16;
		const real_t inc = (Math_PI / (4 * points_in_octant));
		const real_t radius_squared = radius * radius;
		real_t r = 0;

		Vector<Vector3> points;
		uint32_t index = 0;
		// 4 vertical lines and 2 full circles.
		points.resize(4 * 2 + 2 * 8 * points_in_octant * 2);
		Vector3 *points_ptrw = points.ptrw();
		float y_value = height * 0.5;

		// Vertical lines.
		points_ptrw[index++] = Vector3(0.f, y_value, radius);
		points_ptrw[index++] = Vector3(0.f, -y_value, radius);
		points_ptrw[index++] = Vector3(0.f, y_value, -radius);
		points_ptrw[index++] = Vector3(0.f, -y_value, -radius);
		points_ptrw[index++] = Vector3(radius, y_value, 0.f);
		points_ptrw[index++] = Vector3(radius, -y_value, 0.f);
		points_ptrw[index++] = Vector3(-radius, y_value, 0.f);
		points_ptrw[index++] = Vector3(-radius, -y_value, 0.f);

		float previous_x = radius;
		float previous_y = 0.f;