Celeritas 0.7-develop+a3e14d7
Loading...
Searching...
No Matches
Functions
BumpPosition.hh File Reference
#include <cmath>
#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "corecel/cont/Array.hh"

Functions

void celeritas::bump_position (real_type dist, Real3 const &dir, Real3 *pos)
 Bump each component of a position by a distance toward a direction.
 

Function Documentation

◆ bump_position()

void celeritas::bump_position ( real_type  dist,
Real3 const &  dir,
Real3 *  pos 
)
inline

Bump each component of a position by a distance toward a direction.

Each component with a nonzero direction moves by the full distance toward the sign of that direction component, regardless of its magnitude. Unlike a linear move along the direction, this moves the position off a surface that the direction is nearly tangent to, and it moves a component near zero by the same absolute distance as a large one. The displacement is not parallel to the direction, but it is always in the same octant and at most \( \sqrt{3} \) times the distance. A zero direction component is not moved.