use std::ops::RangeInclusive;
pub enum CoordinateSystem {
Cartesian,
Spherical,
Cylindrical,
Polar,
Parametric(ParametricDomain),
}
pub enum ParametricDomain {
Curve { t: RangeInclusive<f64> },
Surface {
u: RangeInclusive<f64>,
v: RangeInclusive<f64>,
},
}
pub fn spherical_to_cartesian(r: f64, theta: f64, phi: f64) -> (f64, f64, f64) {
(
r * theta.sin() * phi.cos(),
r * theta.sin() * phi.sin(),
r * theta.cos(),
)
}
pub fn cylindrical_to_cartesian(r: f64, theta: f64, z: f64) -> (f64, f64, f64) {
(r * theta.cos(), r * theta.sin(), z)
}
pub fn polar_to_cartesian(r: f64, theta: f64) -> (f64, f64, f64) {
(r * theta.cos(), r * theta.sin(), 0.0)
}