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

Code before:
				lines.append(end_position + Vector3(b.x, b.y, 0));
				break;
		}
	}

	const Vector3 link_segment = end_position - start_position;
	const Vector3 up = Vector3(0.0, 1.0, 0.0);
	const float arror_len = 0.5;

	{
		Vector3 anchor = start_position + (link_segment * 0.75);
		Vector3 direction = start_position.direction_to(end_position);
		Vector3 arrow_dir = direction.cross(up);
		lines.push_back(anchor);
		lines.push_back(anchor + (arrow_dir - direction) * arror_len);

		arrow_dir = -direction.cross(up);
		lines.push_back(anchor);
		lines.push_back(anchor + (arrow_dir - direction) * arror_len);
	}

	if (link->is_bidirectional()) {
		Vector3 anchor = start_position + (link_segment * 0.25);
		Vector3 direction = end_position.direction_to(start_position);
		Vector3 arrow_dir = direction.cross(up);
		lines.push_back(anchor);
		lines.push_back(anchor + (arrow_dir - direction) * arror_len);

		arrow_dir = -direction.cross(up);
		lines.push_back(anchor);
		lines.push_back(anchor + (arrow_dir - direction) * arror_len);
	}

	p_gizmo->add_lines(lines, link->is_enabled() ? link_material : link_material_disabled);
	p_gizmo->add_collision_segments(lines);

	Vector<Vector3> handles;
	handles.append(start_position);
	handles.append(end_position);
	p_gizmo->add_handles(handles, handles_material);
}

String NavigationLink3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
	return p_id == 0 ? TTR("Start Location") : TTR("End Location");
}

Variant NavigationLink3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
	NavigationLink3D *link = Object::cast_to<NavigationLink3D>(p_gizmo->get_node_3d());
	return p_id == 0 ? link->get_start_position() : link->get_end_position();
}


Review comment (suggestion):
You could use initializer lists here: 
```c++
p_gizmo->add_handles(Vector({ start_position, end_position }), handles_material);
```


Code after:
	lines_ptrw[index++] = _position + Vector3(a.x, 0, a.y);   \
	lines_ptrw[index++] = _position + Vector3(x, 0, y);       \
	lines_ptrw[index++] = _position + Vector3(-a.x, 0, a.y);  \
	lines_ptrw[index++] = _position + Vector3(-x, 0, y);      \
	lines_ptrw[index++] = _position + Vector3(a.x, 0, -a.y);  \
	lines_ptrw[index++] = _position + Vector3(x, 0, -y);      \
	lines_ptrw[index++] = _position + Vector3(-a.x, 0, -a.y); \
	lines_ptrw[index++] = _position + Vector3(-x, 0, -y);     \
	lines_ptrw[index++] = _position + Vector3(a.y, 0, a.x);   \
	lines_ptrw[index++] = _position + Vector3(y, 0, x);       \
	lines_ptrw[index++] = _position + Vector3(-a.y, 0, a.x);  \
	lines_ptrw[index++] = _position + Vector3(-y, 0, x);      \
	lines_ptrw[index++] = _position + Vector3(a.y, 0, -a.x);  \
	lines_ptrw[index++] = _position + Vector3(y, 0, -x);      \
	lines_ptrw[index++] = _position + Vector3(-a.y, 0, -a.x); \
	lines_ptrw[index++] = _position + Vector3(-y, 0, -x);

				PUSH_OCTANT(start_position, a, b)
				PUSH_OCTANT(end_position, a, b)
#undef PUSH_OCTANT
				break;
			case Vector3::AXIS_Z:
#define PUSH_OCTANT(_position, a, b)                          \
	lines_ptrw[index++] = _position + Vector3(a.x, a.y, 0);   \
	lines_ptrw[index++] = _position + Vector3(x, y, 0);       \
	lines_ptrw[index++] = _position + Vector3(-a.x, a.y, 0);  \
	lines_ptrw[index++] = _position + Vector3(-x, y, 0);      \
	lines_ptrw[index++] = _position + Vector3(a.x, -a.y, 0);  \
	lines_ptrw[index++] = _position + Vector3(x, -y, 0);      \
	lines_ptrw[index++] = _position + Vector3(-a.x, -a.y, 0); \
	lines_ptrw[index++] = _position + Vector3(-x, -y, 0);     \
	lines_ptrw[index++] = _position + Vector3(a.y, a.x, 0);   \
	lines_ptrw[index++] = _position + Vector3(y, x, 0);       \
	lines_ptrw[index++] = _position + Vector3(-a.y, a.x, 0);  \
	lines_ptrw[index++] = _position + Vector3(-y, x, 0);      \
	lines_ptrw[index++] = _position + Vector3(a.y, -a.x, 0);  \
	lines_ptrw[index++] = _position + Vector3(y, -x, 0);      \
	lines_ptrw[index++] = _position + Vector3(-a.y, -a.x, 0); \
	lines_ptrw[index++] = _position + Vector3(-y, -x, 0);

				PUSH_OCTANT(start_position, a, b)
				PUSH_OCTANT(end_position, a, b)
#undef PUSH_OCTANT
				break;
		}
		a.x = x;
		a.y = y;
	}

	const Vector3 link_segment = end_position - start_position;
	const Vector3 up = Vector3(0.0, 1.0, 0.0);