Implementar figura HELIX (espiral helicoidal 3D) - Tecla E
- Nueva clase HelixShape con ecuaciones paramétricas - Distribución uniforme en 3 vueltas completas - Rotación en eje Y + animación de fase vertical - Pitch ajustado a 0.25 para evitar clipping (180px altura total) - 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>
This commit is contained in:
23
source/shapes/helix_shape.h
Normal file
23
source/shapes/helix_shape.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "shape.h"
|
||||
|
||||
// Figura: Espiral helicoidal 3D con distribución uniforme
|
||||
// Comportamiento: Rotación en eje Y + animación de fase vertical
|
||||
// Ecuaciones: x = r*cos(t), y = pitch*t + phase, z = r*sin(t)
|
||||
class HelixShape : public Shape {
|
||||
private:
|
||||
float angle_y_ = 0.0f; // Ángulo de rotación en eje Y (rad)
|
||||
float phase_offset_ = 0.0f; // Offset de fase para animación vertical (rad)
|
||||
float radius_ = 0.0f; // Radio de la espiral (píxeles)
|
||||
float pitch_ = 0.0f; // Separación vertical entre vueltas (píxeles)
|
||||
float total_height_ = 0.0f; // Altura total de la espiral (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 "HELIX"; }
|
||||
float getScaleFactor(float screen_height) const override;
|
||||
};
|
||||
Reference in New Issue
Block a user