Implementar sistema polimórfico de figuras 3D (Sphere + Cube)

- Crear interfaz abstracta Shape con métodos virtuales
- Refactorizar RotoBall → SphereShape (clase polimórfica)
- Implementar CubeShape con triple rotación (X/Y/Z)
- Distribución inteligente en cubo: vértices/centros/grid 3D
- Cambiar controles: F=toggle, Q/W/E/R/T/Y/U/I=figuras, B=temas
- Actualizar SimulationMode: ROTOBALL → SHAPE
- Añadir enum ShapeType (8 figuras: Sphere/Cube/Helix/Torus/etc.)
- Incluir source/shapes/*.cpp en CMakeLists.txt
- Física compartida escalable entre todas las figuras
- Roadmap: 6 figuras pendientes (Helix/Torus/Wave/Cylinder/Icosahedron/Atom)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 20:20:10 +02:00
parent b196683e4a
commit a7ec764ebc
9 changed files with 484 additions and 137 deletions

View File

@@ -0,0 +1,21 @@
#pragma once
#include "shape.h"
// Figura: Esfera 3D con distribución uniforme (Fibonacci Sphere Algorithm)
// Comportamiento: Rotación dual en ejes X e Y
// Uso anterior: RotoBall
class SphereShape : public Shape {
private:
float angle_x_ = 0.0f; // Ángulo de rotación en eje X (rad)
float angle_y_ = 0.0f; // Ángulo de rotación en eje Y (rad)
float radius_ = 0.0f; // Radio de la esfera (píxeles)
int num_points_ = 0; // Cantidad de puntos generados
public:
void generatePoints(int num_points, float screen_width, float screen_height) override;
void update(float delta_time, float screen_width, float screen_height) override;
void getPoint3D(int index, float& x, float& y, float& z) const override;
const char* getName() const override { return "SPHERE"; }
float getScaleFactor(float screen_height) const override;
};