pub mod engine;
pub mod wavefront_propagator;
pub mod hologram_generator;
pub mod volume_capture;
pub mod holographic_storage;
use hologram_generator::{GeneratorConfig, HologramEncoding, HologramGenerator, HologramType};
use holographic_storage::{CompressionMode, HolographicStorage, StorageConfig};
use std::collections::{BTreeMap, HashMap};
use volume_capture::{CaptureConfig, ColorFormat, VolumeCapture};
use wavefront_propagator::{PropagationMethod, WavefrontPropagator};
#[derive(Debug, Clone, Copy, Default)]
pub struct Complex {
pub re: f64,
pub im: f64,
}
impl Complex {
pub fn new(re: f64, im: f64) -> Self {
Self { re, im }
}
pub fn zero() -> Self {
Self { re: 0.0, im: 0.0 }
}
pub fn one() -> Self {
Self { re: 1.0, im: 0.0 }
}
pub fn abs(&self) -> f64 {
(self.re * self.re + self.im * self.im).sqrt()
}
pub fn arg(&self) -> f64 {
self.im.atan2(self.re)
}
pub fn conj(&self) -> Self {
Self {
re: self.re,
im: -self.im,
}
}
pub fn mul(&self, other: &Complex) -> Self {
Self {
re: self.re * other.re - self.im * other.im,
im: self.re * other.im + self.im * other.re,
}
}
pub fn add(&self, other: &Complex) -> Self {
Self {
re: self.re + other.re,
im: self.im + other.im,
}
}
pub fn from_polar(r: f64, theta: f64) -> Self {
Self {
re: r * theta.cos(),
im: r * theta.sin(),
}
}
}
impl std::ops::Add for Complex {
type Output = Self;
fn add(self, other: Self) -> Self {
Self {
re: self.re + other.re,
im: self.im + other.im,
}
}
}
impl std::ops::Mul for Complex {
type Output = Self;
fn mul(self, other: Self) -> Self {
Self {
re: self.re * other.re - self.im * other.im,
im: self.re * other.im + self.im * other.re,
}
}
}
impl std::ops::Mul<f64> for Complex {
type Output = Self;
fn mul(self, scalar: f64) -> Self {
Self {
re: self.re * scalar,
im: self.im * scalar,
}
}
}