use crate::conventions::{EastCoastMetric, WestCoastMetric};
use crate::errors::MetricError;
use crate::types::Metric;
pub fn west_to_east(metric: &Metric) -> Result<EastCoastMetric, MetricError> {
EastCoastMetric::from_west_coast(*metric)
}
pub fn east_to_west(metric: &Metric) -> Result<WestCoastMetric, MetricError> {
WestCoastMetric::from_east_coast(*metric)
}
pub fn detect_convention(metric: &Metric) -> Option<bool> {
let dim = metric.dimension();
if dim < 2 {
return None;
}
let time_sign = metric.sign_of_sq(0);
let space_sign = metric.sign_of_sq(1);
match (time_sign, space_sign) {
(-1, 1) => Some(true), (1, -1) => Some(false), _ => None, }
}
pub fn is_lorentzian(metric: &Metric) -> bool {
let (p, q, _r) = metric.signature();
(p == 1 && q >= 1) || (q == 1 && p >= 1)
}