Skip to content

Commit

Permalink
reworking RectangularPlane distance method
Browse files Browse the repository at this point in the history
  • Loading branch information
jmpearl committed Nov 1, 2023
1 parent 2b47b2e commit 38e8fe1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/DEM/SolidBoundary/RectangularPlaneSolidBoundary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "DataBase/DataBase.hh"
#include "DataBase/State.hh"
#include "DataBase/StateDerivatives.hh"

#include "DEM/SolidBoundary/RectangularPlaneSolidBoundary.hh"

namespace Spheral {
Expand All @@ -34,13 +33,8 @@ typename Dimension::Vector
RectangularPlaneSolidBoundary<Dimension>::
distance(const Vector& position) const {
const auto q = mBasis*(position-mPoint);
const double signX = (q.x() > 0.0 ? 1. : -1.);
const double signY = (q.y() > 0.0 ? 1. : -1.);
const double signZ = (q.z() > 0.0 ? 1. : -1.);
const auto signedExtent = Vector(signX*std::min(signX*q.x(),mExtent.x()),
signY*std::min(signY*q.y(),mExtent.y()),
signZ*std::min(signZ*q.z(),mExtent.z()));
return mBasis.Transpose()*(q-signedExtent);
const auto q0 = elementWiseMax(elementWiseMin(q,mExtent),-mExtent);
return mBasis.Transpose()*(q-q0);
}

template<typename Dimension>
Expand Down

0 comments on commit 38e8fe1

Please sign in to comment.