#![doc = " Multivector conversions for hyperbolic."]
#![doc = ""]
#![doc = " This file is auto-generated by clifford-codegen."]
#![doc = " Do not edit manually."]
use super::types::{HypUnit, Hyperbolic, Scalar};
use crate::algebra::Multivector;
use crate::basis::Blade;
use crate::scalar::Float;
use crate::signature::Cl1_0_0;
impl<T: Float> From<HypUnit<T>> for Multivector<T, Cl1_0_0> {
fn from(value: HypUnit<T>) -> Self {
Self::from_coeffs(&[T::zero(), value.j()])
}
}
impl<T: Float> From<Hyperbolic<T>> for Multivector<T, Cl1_0_0> {
fn from(value: Hyperbolic<T>) -> Self {
Self::from_coeffs(&[value.real(), value.hyp()])
}
}
impl<T: Float> From<Scalar<T>> for Multivector<T, Cl1_0_0> {
fn from(value: Scalar<T>) -> Self {
Self::from_coeffs(&[value.s(), T::zero()])
}
}
impl<T: Float> From<Multivector<T, Cl1_0_0>> for HypUnit<T> {
#[doc = r" Extracts this type from a multivector."]
#[doc = r""]
#[doc = r" Note: This is a lossy projection that only extracts the relevant"]
#[doc = r" grades. Other components of the multivector are discarded."]
fn from(mv: Multivector<T, Cl1_0_0>) -> Self {
Self::new_unchecked(mv.get(Blade::from_index(1usize)))
}
}
impl<T: Float> From<Multivector<T, Cl1_0_0>> for Hyperbolic<T> {
#[doc = r" Extracts this type from a multivector."]
#[doc = r""]
#[doc = r" Note: This is a lossy projection that only extracts the relevant"]
#[doc = r" grades. Other components of the multivector are discarded."]
fn from(mv: Multivector<T, Cl1_0_0>) -> Self {
Self::new_unchecked(
mv.get(Blade::from_index(0usize)),
mv.get(Blade::from_index(1usize)),
)
}
}
impl<T: Float> From<Multivector<T, Cl1_0_0>> for Scalar<T> {
#[doc = r" Extracts this type from a multivector."]
#[doc = r""]
#[doc = r" Note: This is a lossy projection that only extracts the relevant"]
#[doc = r" grades. Other components of the multivector are discarded."]
fn from(mv: Multivector<T, Cl1_0_0>) -> Self {
Self::new_unchecked(mv.get(Blade::from_index(0usize)))
}
}