1use scirs2_core::ndarray::Array2;
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct NativePlotConfig {
10 pub width: usize,
12 pub height: usize,
14 pub enable_interactivity: bool,
16 pub enable_animations: bool,
18 pub animation_fps: f64,
20 pub color_scheme: PlotColorScheme,
22 pub export_quality: ExportQuality,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28pub enum PlotColorScheme {
29 Quantum,
31 Neuromorphic,
33 AI,
35 Scientific,
37 Custom(Vec<[u8; 3]>),
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
43pub enum ExportQuality {
44 Draft,
46 Standard,
48 High,
50 Publication,
52}
53
54#[derive(Debug)]
56pub struct SvgCanvas {
57 pub(crate) width: usize,
59 pub(crate) height: usize,
60 pub(crate) elements: Vec<SvgElement>,
62 pub(crate) styles: HashMap<String, String>,
64}
65
66#[derive(Debug, Clone)]
68pub enum SvgElement {
69 Circle {
71 cx: f64,
72 cy: f64,
73 r: f64,
74 fill: String,
75 stroke: String,
76 stroke_width: f64,
77 opacity: f64,
78 },
79 Line {
81 x1: f64,
82 y1: f64,
83 x2: f64,
84 y2: f64,
85 stroke: String,
86 stroke_width: f64,
87 opacity: f64,
88 },
89 Path {
91 d: String,
92 fill: String,
93 stroke: String,
94 stroke_width: f64,
95 opacity: f64,
96 },
97 Text {
99 x: f64,
100 y: f64,
101 content: String,
102 font_size: f64,
103 fill: String,
104 text_anchor: String,
105 },
106 Group {
108 id: String,
109 elements: Vec<SvgElement>,
110 transform: String,
111 },
112}
113
114#[derive(Debug)]
116pub struct AnimationEngine {
117 pub(crate) frames: Vec<AnimationFrame>,
119 pub(crate) current_frame: usize,
121 pub(crate) frame_duration: f64,
123 pub(crate) total_duration: f64,
125}
126
127#[derive(Debug, Clone)]
129pub struct AnimationFrame {
130 pub timestamp: f64,
132 pub elements: Vec<SvgElement>,
134 pub transformations: Vec<Transformation>,
136}
137
138#[derive(Debug, Clone)]
140pub enum Transformation {
141 Translate { dx: f64, dy: f64 },
143 Rotate { angle: f64, cx: f64, cy: f64 },
145 Scale { sx: f64, sy: f64 },
147 Fade { from: f64, to: f64 },
149 ColorTransition { from: String, to: String },
151}
152
153#[derive(Debug)]
155pub struct InteractiveController {
156 pub(crate) zoom_level: f64,
158 pub(crate) pan_offset: (f64, f64),
160 pub(crate) selected_elements: Vec<String>,
162 pub(crate) hover_element: Option<String>,
164}
165
166#[derive(Debug, Serialize, Deserialize)]
168pub struct NativeDendrogramPlot {
169 pub tree: DendrogramTree,
171 pub node_positions: HashMap<String, (f64, f64)>,
173 pub branch_lengths: HashMap<String, f64>,
175 pub quantum_enhancements: HashMap<String, f64>,
177 pub interactive_features: Vec<InteractiveFeature>,
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize)]
183pub struct DendrogramTree {
184 pub root: DendrogramNode,
186 pub height: f64,
188 pub leaf_count: usize,
190}
191
192#[derive(Debug, Clone, Serialize, Deserialize)]
194pub struct DendrogramNode {
195 pub id: String,
197 pub height: f64,
199 pub children: Vec<DendrogramNode>,
201 pub data_indices: Vec<usize>,
203 pub quantum_coherence: f64,
205 pub neuromorphic_activity: f64,
207}
208
209#[derive(Debug, Clone, Serialize, Deserialize)]
211pub enum InteractiveFeature {
212 ZoomPan,
214 NodeSelection,
216 Tooltip,
218 RealTimeFilter,
220 AnimationControls,
222 ExportOptions,
224}
225
226#[derive(Debug, Serialize, Deserialize)]
228pub struct Native3DClusterPlot {
229 pub points_3d: Array2<f64>,
231 pub point_colors: Vec<[u8; 3]>,
233 pub centroids_3d: Array2<f64>,
235 pub camera: Camera3D,
237 pub lighting: Lighting3D,
239 pub quantum_field: QuantumField3D,
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245pub struct Camera3D {
246 pub position: [f64; 3],
248 pub target: [f64; 3],
250 pub up: [f64; 3],
252 pub fov: f64,
254 pub near: f64,
256 pub far: f64,
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261pub struct Lighting3D {
262 pub ambient: f64,
264 pub directional_lights: Vec<DirectionalLight>,
266 pub point_lights: Vec<PointLight>,
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272pub struct DirectionalLight {
273 pub direction: [f64; 3],
275 pub intensity: f64,
277 pub color: [f64; 3],
279}
280
281#[derive(Debug, Clone, Serialize, Deserialize)]
283pub struct PointLight {
284 pub position: [f64; 3],
286 pub intensity: f64,
288 pub color: [f64; 3],
290 pub attenuation: f64,
292}
293
294#[derive(Debug, Clone, Serialize, Deserialize)]
296pub struct QuantumField3D {
297 pub field_strength: Array2<f64>,
299 pub coherence: Array2<f64>,
301 pub phase: Array2<f64>,
303 pub entanglement_lines: Vec<([f64; 3], [f64; 3], f64)>,
305}
306
307#[derive(Debug)]
311pub struct NativeClusterPlot {
312 pub data: Array2<f64>,
314 pub point_elements: Vec<SvgElement>,
316 pub centroid_elements: Vec<SvgElement>,
318 pub quantum_enhancements: Vec<f64>,
320 pub bounds: (f64, f64, f64, f64),
322 pub scale: (f64, f64),
324}
325
326#[derive(Debug)]
328pub struct NativeVisualizationOutput {
329 pub cluster_plot: NativeClusterPlot,
331 pub dendrogram: Option<NativeDendrogramPlot>,
333 pub plot_3d: Option<Native3DClusterPlot>,
335 pub quantum_animation: Option<QuantumCoherenceAnimation>,
337 pub neuromorphic_plot: NeuromorphicActivityPlot,
339 pub performance_dashboard: InteractivePerformanceDashboard,
341 pub svg_content: String,
343 pub interactive_script: String,
345}
346
347#[derive(Debug)]
349pub struct QuantumCoherenceAnimation {
350 pub frames: Vec<QuantumCoherenceFrame>,
352 pub duration: f64,
354 pub fps: f64,
356}
357
358#[derive(Debug, Clone)]
360pub struct QuantumCoherenceFrame {
361 pub timestamp: f64,
363 pub elements: Vec<SvgElement>,
365 pub field_strength: Array2<f64>,
367}
368
369#[derive(Debug)]
371pub struct NeuromorphicActivityPlot {
372 pub activity_matrix: Array2<f64>,
374 pub spike_trains: Array2<f64>,
376 pub plasticity_changes: Array2<f64>,
378 pub time_resolution: f64,
380}
381
382#[derive(Debug)]
384pub struct InteractivePerformanceDashboard {
385 pub performance_metrics: HashMap<String, f64>,
387 pub improvements: HashMap<String, f64>,
389 pub metrics_timeline: Vec<MetricTimelinePoint>,
391 pub execution_summary: ExecutionSummary,
393}
394
395#[derive(Debug, Clone)]
397pub struct MetricTimelinePoint {
398 pub timestamp: f64,
400 pub quantum_coherence: f64,
402 pub neural_adaptation: f64,
404 pub ai_confidence: f64,
406}
407
408#[derive(Debug, Clone)]
410pub struct ExecutionSummary {
411 pub total_time: f64,
413 pub memory_usage: f64,
415 pub iterations: usize,
417 pub algorithm: String,
419 pub confidence: f64,
421}
422
423impl Default for NativePlotConfig {
424 fn default() -> Self {
425 Self {
426 width: 1200,
427 height: 800,
428 enable_interactivity: true,
429 enable_animations: true,
430 animation_fps: 30.0,
431 color_scheme: PlotColorScheme::Quantum,
432 export_quality: ExportQuality::High,
433 }
434 }
435}