Repository: godotengine/godot
File: editor/scene/3d/gizmos/spring_bone_3d_gizmo_plugin.cpp (C++)

Code before:
		p_surface_tool->set_color(p_color);
		p_surface_tool->add_vertex(bottom + (Vector3::FORWARD * p_radius).rotated(Vector3::UP, SPPI * (i % STEP)));
	}
	LocalVector<Vector3> directions;
	directions.resize(4);
	directions[0] = Vector3::RIGHT;
	directions[1] = Vector3::LEFT;
	directions[2] = Vector3::FORWARD;
	directions[3] = Vector3::BACK;
	for (int i = 0; i < 4; i++) {
		Vector3 dir = directions[i] * p_radius;
		p_surface_tool->set_color(p_color);
		p_surface_tool->add_vertex(top + dir);
		p_surface_tool->add_vertex(bottom + dir);
	}
}

void SpringBoneCollision3DGizmoPlugin::draw_plane(Ref<SurfaceTool> &p_surface_tool, const Color &p_color) {
	static constexpr float HALF_PI = Math::PI * 0.5;
	static constexpr float ARROW_LENGTH = 0.3;
	static constexpr float ARROW_HALF_WIDTH = 0.05;
	static constexpr float ARROW_TOP_HALF_WIDTH = 0.1;
	static constexpr float ARROW_TOP = 0.5;
	static constexpr float RECT_SIZE = 1.0;
	static constexpr int RECT_STEP_COUNT = 9;
	static constexpr float RECT_HALF_SIZE = RECT_SIZE * 0.5;
	static constexpr float RECT_STEP = RECT_SIZE / (float)RECT_STEP_COUNT;

	p_surface_tool->set_color(p_color);

	// Draw arrow of the normal.
	LocalVector<Vector3> arrow;
	arrow.resize(7);
	arrow[0] = Vector3(0, ARROW_TOP, 0);
	arrow[1] = Vector3(-ARROW_TOP_HALF_WIDTH, ARROW_LENGTH, 0);
	arrow[2] = Vector3(-ARROW_HALF_WIDTH, ARROW_LENGTH, 0);
	arrow[3] = Vector3(-ARROW_HALF_WIDTH, 0, 0);
	arrow[4] = Vector3(ARROW_HALF_WIDTH, 0, 0);
	arrow[5] = Vector3(ARROW_HALF_WIDTH, ARROW_LENGTH, 0);
	arrow[6] = Vector3(ARROW_TOP_HALF_WIDTH, ARROW_LENGTH, 0);
	for (int i = 0; i < 2; i++) {
		Basis ma(Vector3::UP, HALF_PI * i);
		for (uint32_t j = 0; j < arrow.size(); j++) {
			Vector3 v1 = arrow[j];
			Vector3 v2 = arrow[(j + 1) % arrow.size()];
			p_surface_tool->add_vertex(ma.xform(v1));
			p_surface_tool->add_vertex(ma.xform(v2));
		}
	}

	// Draw dashed line of the rect.

Review comment (suggestion):
```suggestion
	static constexpr float HALF_PI = Math::PI * 0.5f;
	static constexpr float ARROW_LENGTH = 0.3f;
	static constexpr float ARROW_HALF_WIDTH = 0.05f;
	static constexpr float ARROW_TOP_HALF_WIDTH = 0.1f;
	static constexpr float ARROW_TOP = 0.5f;
	static constexpr float RECT_SIZE = 1.0f;
	static constexpr int RECT_STEP_COUNT = 9;
	static constexpr float RECT_HALF_SIZE = RECT_SIZE * 0.5f;
```

Code after:
		p_surface_tool->set_color(p_color);
		p_surface_tool->add_vertex(bottom + (Vector3::FORWARD * p_radius).rotated(Vector3::UP, SPPI * (i % STEP)));
	}
	LocalVector<Vector3> directions;
	directions.resize(4);
	directions[0] = Vector3::RIGHT;
	directions[1] = Vector3::LEFT;
	directions[2] = Vector3::FORWARD;
	directions[3] = Vector3::BACK;
	for (int i = 0; i < 4; i++) {
		Vector3 dir = directions[i] * p_radius;
		p_surface_tool->set_color(p_color);
		p_surface_tool->add_vertex(top + dir);
		p_surface_tool->add_vertex(bottom + dir);
	}
}

void SpringBoneCollision3DGizmoPlugin::draw_plane(Ref<SurfaceTool> &p_surface_tool, const Color &p_color) {
	static constexpr float HALF_PI = (float)Math::PI * 0.5f;
	static constexpr float ARROW_LENGTH = 0.3f;
	static constexpr float ARROW_HALF_WIDTH = 0.05f;
	static constexpr float ARROW_TOP_HALF_WIDTH = 0.1f;
	static constexpr float ARROW_TOP = 0.5f;
	static constexpr float RECT_SIZE = 1.0f;
	static constexpr int RECT_STEP_COUNT = 9;
	static constexpr float RECT_HALF_SIZE = RECT_SIZE * 0.5f;
	static constexpr float RECT_STEP = RECT_SIZE / RECT_STEP_COUNT;

	p_surface_tool->set_color(p_color);

	// Draw arrow of the normal.
	LocalVector<Vector3> arrow;
	arrow.resize(7);
	arrow[0] = Vector3(0, ARROW_TOP, 0);
	arrow[1] = Vector3(-ARROW_TOP_HALF_WIDTH, ARROW_LENGTH, 0);
	arrow[2] = Vector3(-ARROW_HALF_WIDTH, ARROW_LENGTH, 0);
	arrow[3] = Vector3(-ARROW_HALF_WIDTH, 0, 0);
	arrow[4] = Vector3(ARROW_HALF_WIDTH, 0, 0);
	arrow[5] = Vector3(ARROW_HALF_WIDTH, ARROW_LENGTH, 0);
	arrow[6] = Vector3(ARROW_TOP_HALF_WIDTH, ARROW_LENGTH, 0);
	for (int i = 0; i < 2; i++) {
		Basis ma(Vector3::UP, HALF_PI * i);
		for (uint32_t j = 0; j < arrow.size(); j++) {
			Vector3 v1 = arrow[j];
			Vector3 v2 = arrow[(j + 1) % arrow.size()];
			p_surface_tool->add_vertex(ma.xform(v1));
			p_surface_tool->add_vertex(ma.xform(v2));
		}
	}

	// Draw dashed line of the rect.