Files
vibe3_physics/source/shapes/torus_shape.h
Sergio Valor 8b642f6903 Implementar figura TORUS (toroide/donut 3D) - Tecla R
- Nueva clase TorusShape con ecuaciones paramétricas
- Distribución uniforme en anillos y puntos por anillo
- Rotación triple simultánea (X, Y, Z)
- Radios: major=0.25, minor=0.12 (proporción altura)
- Compatible con física spring-damper y z-sorting
- Escalable con Numpad +/-

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 06:36:46 +02:00

24 lines
1.1 KiB
C++

#pragma once
#include "shape.h"
// Figura: Torus/Toroide 3D (donut/rosquilla)
// Comportamiento: Superficie toroidal con rotación triple (X, Y, Z)
// Ecuaciones: x = (R + r*cos(v))*cos(u), y = (R + r*cos(v))*sin(u), z = r*sin(v)
class TorusShape : 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 angle_z_ = 0.0f; // Ángulo de rotación en eje Z (rad)
float major_radius_ = 0.0f; // Radio mayor R (del centro al tubo)
float minor_radius_ = 0.0f; // Radio menor r (grosor del tubo)
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 "TORUS"; }
float getScaleFactor(float screen_height) const override;
};