ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
Shapes::Shape Class Referenceabstract

#include <Shape.hpp>

+ Inheritance diagram for Shapes::Shape:

Public Member Functions

virtual void calculate_dist (const Utils::Vector3d &pos, double &dist, Utils::Vector3d &vec) const =0
 Calculate the minimum distance and the corresponding distance vector between a given position and the shape.
 
virtual bool is_inside (Utils::Vector3d const &pos) const
 Check whether the given point is inside the shape or not.
 
std::vector< int > rasterize (Utils::Vector3i const &grid_size, double grid_spacing, double grid_offset) const
 Rasterize a shape on a regular grid.
 
virtual ~Shape ()=default
 

Detailed Description

Definition at line 29 of file shapes/include/shapes/Shape.hpp.

Constructor & Destructor Documentation

◆ ~Shape()

virtual Shapes::Shape::~Shape ( )
virtualdefault

Member Function Documentation

◆ calculate_dist()

virtual void Shapes::Shape::calculate_dist ( const Utils::Vector3d pos,
double &  dist,
Utils::Vector3d vec 
) const
pure virtual

Calculate the minimum distance and the corresponding distance vector between a given position and the shape.

Parameters
[in]posPosition for which to calculate the distance.
[out]distMinimum distance between pos and the shape. Value is negative when pos is inside the shape, zero if pos is on the shape surface or positive if pos is outside the shape.
[out]vecDistance vector.

Implemented in Shapes::NoWhere, Shapes::Cylinder, Shapes::Ellipsoid, Shapes::HollowConicalFrustum, Shapes::Rhomboid, Shapes::SimplePore, Shapes::Slitpore, Shapes::Sphere, Shapes::SpheroCylinder, Shapes::Torus, Shapes::Wall, and Shapes::Union.

Referenced by is_inside().

◆ is_inside()

virtual bool Shapes::Shape::is_inside ( Utils::Vector3d const &  pos) const
inlinevirtual

Check whether the given point is inside the shape or not.

For the edge case where the point is on the surface (zero distance), it is considered to be inside the shape.

Parameters
posPosition to check.

Reimplemented in Shapes::Union.

Definition at line 49 of file shapes/include/shapes/Shape.hpp.

References calculate_dist().

Referenced by rasterize().

◆ rasterize()

std::vector< int > Shapes::Shape::rasterize ( Utils::Vector3i const &  grid_size,
double  grid_spacing,
double  grid_offset 
) const

Rasterize a shape on a regular grid.

Parameters
grid_sizeNumber of grid points in every direction.
grid_spacingLattice distance.
grid_offsetLattice offset.
Returns
Flattened 3D matrix with 1's inside the shape and 0's outside.

Definition at line 29 of file Shape.cpp.

References is_inside().


The documentation for this class was generated from the following files: