BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
anonymous_namespace{MagneticMaterialImpl.cpp} Namespace Reference

Functions

cvector_t OrthogonalToBaseVector (cvector_t base, const kvector_t vector)
 

Function Documentation

◆ OrthogonalToBaseVector()

cvector_t anonymous_namespace{MagneticMaterialImpl.cpp}::OrthogonalToBaseVector ( cvector_t  base,
const kvector_t  vector 
)

Definition at line 30 of file MagneticMaterialImpl.cpp.

31 {
32  if (base.mag2() == 0.0)
33  return cvector_t{};
34  cvector_t projection = (base.dot(vector) / base.mag2()) * base;
35  return vector.complex() - projection;
36 }
double mag2() const
Returns magnitude squared of the vector.
auto dot(const BasicVector3D< U > &v) const
Returns dot product of vectors (antilinear in the first [=self] argument).
BasicVector3D< std::complex< double > > complex() const
Returns this, trivially converted to complex type.

References BasicVector3D< T >::complex(), BasicVector3D< T >::dot(), and BasicVector3D< T >::mag2().

Referenced by MagneticMaterialImpl::polarizedSubtrSLD().

Here is the call graph for this function: