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

Code before:
			PUSH_QUARTER_XY(previous_x, previous_y, x, y, y_value);
			PUSH_QUARTER_XY(previous_y, previous_x, y, x, y_value);

			// Up and Low circle in Y-Z plane.
			PUSH_QUARTER_YZ(previous_x, previous_y, x, y, y_value);
			PUSH_QUARTER_YZ(previous_y, previous_x, y, x, y_value)

			previous_x = x;
			previous_y = y;
		}

#undef PUSH_QUARTER
#undef PUSH_QUARTER_XY
#undef PUSH_QUARTER_YZ

		p_gizmo->add_lines(points, material, false, collision_color);
		p_gizmo->add_collision_segments(points);

		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();

		Vector<Vector3> points;

		Vector3 d(0, height * 0.5, 0);
		for (int i = 0; i < 360; i++) {
			float ra = Math::deg_to_rad((float)i);
			float rb = Math::deg_to_rad((float)i + 1);
			Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
			Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;

			points.push_back(Vector3(a.x, 0, a.y) + d);
			points.push_back(Vector3(b.x, 0, b.y) + d);

			points.push_back(Vector3(a.x, 0, a.y) - d);
			points.push_back(Vector3(b.x, 0, b.y) - d);

			if (i % 90 == 0) {
				points.push_back(Vector3(a.x, 0, a.y) + d);
				points.push_back(Vector3(a.x, 0, a.y) - d);
			}
		}


Review comment (suggestion):
This has the same gaps as the cylinder (https://github.com/godotengine/godot/pull/103903#issuecomment-2712086721).

![godot windows editor x86_64_Tfji0gABxd](https://github.com/user-attachments/assets/b8d0ea11-2ea6-4882-af5a-271fcd777f6c)|![godot windows editor x86_64_OL3N3q9Srf](https://github.com/user-attachments/assets/c1706759-3d16-46b3-a614-d67b6ab8e542)
-|-


A fix would be as easy as someting like this:
```suggestion
			real_t y = (i == points_in_octant - 1) ? x : Math::sqrt(radius_squared - (x * x));
```

Code after:
	points_ptrw[index++] = Vector3(from_x, -from_y - y, 0);  \
	points_ptrw[index++] = Vector3(to_x, -to_y - y, 0);      \
	points_ptrw[index++] = Vector3(from_x, from_y + y, 0);   \
	points_ptrw[index++] = Vector3(to_x, to_y + y, 0);       \
	points_ptrw[index++] = Vector3(-from_x, -from_y - y, 0); \
	points_ptrw[index++] = Vector3(-to_x, -to_y - y, 0);     \
	points_ptrw[index++] = Vector3(-from_x, from_y + y, 0);  \
	points_ptrw[index++] = Vector3(-to_x, to_y + y, 0);

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

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

		for (uint32_t i = 0; i < points_in_octant; ++i) {
			r += inc;
			real_t x = Math::cos((i == points_in_octant - 1) ? octant_angle : r) * radius;
			real_t y = Math::sqrt(radius_squared - (x * x));

			// High circle ring.
			PUSH_QUARTER(previous_x, previous_y, x, y, y_value);
			PUSH_QUARTER(previous_y, previous_x, y, x, y_value);

			// Low circle ring.
			PUSH_QUARTER(previous_x, previous_y, x, y, -y_value);
			PUSH_QUARTER(previous_y, previous_x, y, x, -y_value);

			// Up and Low circle in X-Y plane.
			PUSH_QUARTER_XY(previous_x, previous_y, x, y, y_value);
			PUSH_QUARTER_XY(previous_y, previous_x, y, x, y_value);

			// Up and Low circle in Y-Z plane.
			PUSH_QUARTER_YZ(previous_x, previous_y, x, y, y_value);
			PUSH_QUARTER_YZ(previous_y, previous_x, y, x, y_value)

			previous_x = x;
			previous_y = y;
		}

#undef PUSH_QUARTER
#undef PUSH_QUARTER_XY
#undef PUSH_QUARTER_YZ