Skip to content
  • Mark OLESEN's avatar
    ENH: additional Field normalise method (#2444) · 8e6f2ca5
    Mark OLESEN authored
    - for most field types this is a no-op, but for a field of floatVector
      or doubleVector (eg, vector and solveVector) it will normalise each
      element with divide-by-zero protection.
    
      More reliable and efficient than dividing a field by the mag of itself
      (even with VSMALL protection).
      Applied to FieldField and GeometricField as well.
    
      Eg,
          fld.normalise();
      vs.
          fld /= mag(fld) + VSMALL;
    
    ENH: support optional tolerance for vector::normalise
    
    - for cases where tolerances larger than ROOTVSMALL are preferable.
      Not currently available for the field method (a templating question).
    
    ENH: vector::removeCollinear method
    
    - when working with geometries it is frequently necessary to have a
      normal vector without any collinear components. The removeCollinear
      method provides for clearer, compacter code.
    
      Eg,
          vector edgeNorm = ...;
    
          const vector edgeDirn = e.unitVec(points());
    
          edgeNorm.removeCollinear(edgeDirn);
          edgeNor...
    8e6f2ca5