Implementar figura CYLINDER (cilindro 3D) - Tecla Y
- Nueva clase CylinderShape con ecuaciones paramétricas - Distribución uniforme en anillos y circunferencia - Rotación simple en eje Y - Dimensiones: radius=0.25, height=0.5 (proporción altura) - Compatible con física spring-damper y z-sorting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
21
source/shapes/cylinder_shape.h
Normal file
21
source/shapes/cylinder_shape.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "shape.h"
|
||||
|
||||
// Figura: Cilindro 3D rotante
|
||||
// Comportamiento: Superficie cilíndrica con rotación en eje Y
|
||||
// Ecuaciones: x = r*cos(u), y = v, z = r*sin(u)
|
||||
class CylinderShape : public Shape {
|
||||
private:
|
||||
float angle_y_ = 0.0f; // Ángulo de rotación en eje Y (rad)
|
||||
float radius_ = 0.0f; // Radio del cilindro (píxeles)
|
||||
float height_ = 0.0f; // Altura del cilindro (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 "CYLINDER"; }
|
||||
float getScaleFactor(float screen_height) const override;
|
||||
};
|
||||
Reference in New Issue
Block a user