diff --git a/app/src/components/three/ResizableBox3D.tsx b/app/src/components/three/ResizableBox3D.tsx index d93d63c..b04cb8c 100644 --- a/app/src/components/three/ResizableBox3D.tsx +++ b/app/src/components/three/ResizableBox3D.tsx @@ -7,6 +7,7 @@ interface ResizableBox3DProps { l1: number; l2: number; h: number; + viewMode?: 'solid' | 'airflow'; } function WindParticles({ l1, l2, h }: { l1: number, l2: number, h: number }) { @@ -79,7 +80,7 @@ function WindParticles({ l1, l2, h }: { l1: number, l2: number, h: number }) { ); } -export function ResizableBox3D({ l1, l2, h }: ResizableBox3DProps) { +export function ResizableBox3D({ l1, l2, h, viewMode = 'solid' }: ResizableBox3DProps) { const meshRef = useRef(null); // Create target scale and position based on inputs @@ -109,12 +110,12 @@ export function ResizableBox3D({ l1, l2, h }: ResizableBox3DProps) { {/* The Animated Box */} - + {/* Wind Flow Animation */} - + {viewMode === 'airflow' && } ); } diff --git a/app/src/pages/CalcCaModule.tsx b/app/src/pages/CalcCaModule.tsx index ed3d78c..e3f9c85 100644 --- a/app/src/pages/CalcCaModule.tsx +++ b/app/src/pages/CalcCaModule.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import React, { useState } from 'react'; import { getDragCoefficient } from '@/lib/drag'; import { useI18n } from '@/store/i18nStore'; import { DragCoefficientChart } from '@/components/DragCoefficientChart'; @@ -7,8 +7,8 @@ import SceneCanvas from '@/components/SceneCanvas'; import { Environment } from '@react-three/drei'; import { ViewerOrbitControls as OrbitControls } from '@/components/three/ViewerOrbitControls'; import { EducationalManual } from '@/components/EducationalManual'; -import { Calculator, Info } from 'lucide-react'; -import { Input } from '@/components/ui/input'; +import { Wind, Box } from 'lucide-react'; +import { Slider } from '@/components/ui/slider'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; export default function CalcCaModule() { @@ -16,6 +16,7 @@ export default function CalcCaModule() { const [l1, setL1] = useState(20); const [l2, setL2] = useState(40); const [h, setH] = useState(10); + const [viewMode, setViewMode] = useState<'solid' | 'airflow'>('solid'); // Clamp inputs to avoid Infinity or negative values breaking the UI const safeL1 = Math.max(0.1, l1 || 1); @@ -26,128 +27,120 @@ export default function CalcCaModule() { const caHigh = getDragCoefficient(safeL1, safeL2, safeH, 'high'); return ( -
-
-
- -
-
-

{t('nav_calc_ca')}

-

- Cálculo rápido de Coeficiente de Arrasto (Ca) - NBR 6123:2023, Fig. 4 e 5. -

-
-
+
+ {/* Coluna Esquerda: Controles */} +
+ + +
+ Calc_Ca + Cálculo rápido de Coeficiente de Arrasto (Ca) +
+
+ +
+
+ + {l1} m +
+ setL1(v[0])} /> +
+ +
+
+ + {l2} m +
+ setL2(v[0])} /> +
+ +
+
+ + {h} m +
+ setH(v[0])} /> +
+
+
+
-
- {/* Left Column: Inputs & Results */} -
- - - Entrada de Dados - Dimensões da edificação retangular - - -
- - setL1(parseFloat(e.target.value))} - /> -
-
- - setL2(parseFloat(e.target.value))} - /> -
-
- - setH(parseFloat(e.target.value))} - /> -
-
-
- - - - - - Resultados (Ca) - - - -
-
- Baixa Turbulência - {caLow.toFixed(2)} -
-
- Alta Turbulência - {caHigh.toFixed(2)} -
-
- H/L₁ = {(safeH / safeL1).toFixed(2)} - L₁/L₂ = {(safeL1 / safeL2).toFixed(2)} -
-
-
-
+ {/* Coluna Central: 3D */} +
+
+
+ + +
- - {/* Center Column: 3D Visualization */} -
- - - Visualização 3D - Proporções dinâmicas - - -
- -
- } frameloop="always"> - - - - - - -
- Arraste para rotacionar, role para aproximar -
-
-
+
+
- - {/* Right Column: Chart */} -
- - - Ábaco NBR 6123 - Curvas isotermas aproximadas - - - - - + + } + frameloop={viewMode === 'airflow' ? 'always' : 'demand'} + > + + + + + + + +
+ Arraste para rotacionar, role para aproximar
+ + {/* Coluna Direita: Resultados */} +
+ + + Resultados (Ca) + Valores baseados nas tabelas 4 e 5 + + +
+ Baixa Turbulência + {caLow.toFixed(2)} +
+
+ Alta Turbulência + {caHigh.toFixed(2)} +
+
+ H/L₁ = {(safeH / safeL1).toFixed(2)} + L₁/L₂ = {(safeL1 / safeL2).toFixed(2)} +
+
+
+ + {/* Ábaco */} + + + Ábaco NBR 6123 + Curvas isotermas aproximadas + + + + + +
); }