PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
geom::ParticleTransform Struct Reference

A struct that stores transformation parameters and provides method to transform the particle. Basically, given a reference particle, this provides method to translate, rotate, and scale the reference particle. More...

#include <particleTransform.h>

Collaboration diagram for geom::ParticleTransform:

Public Member Functions

 ParticleTransform ()
 Constructor.
 
 ParticleTransform (util::Point translate, util::Point axis, double theta, double scale=1.)
 Constructor with pivot at origin (reference mesh centered at origin).
 
 ParticleTransform (util::Point translate, util::Point axis, double theta, double scale, util::Point rotation_point)
 Constructor with explicit rotation pivot (consistent with GeomObject::transform).
 
 ParticleTransform (const ParticleTransform &t)
 Copy constructor.
 
util::Point apply (const util::Point &v) const
 Maps a reference-configuration point \(\mathbf v\) to world coordinates using the same rule as geom::mapSimilarity / GeomObject::transform: \(\mathbf y = \mathbf p + s\,\mathbf R(\mathbf v-\mathbf p) + \mathbf t\).
 
std::string printStr (int nt=0, int lvl=0) const
 Returns the string containing printable information about the object.
 
void print (int nt=0, int lvl=0) const
 Prints the information about the object.
 

Data Fields

util::Point d_translation
 Rigid translation \(\mathbf t\) after rotate+scale about the pivot (matches GeomObject::transform).
 
util::Point d_axis
 Unit axis of rotation.
 
double d_theta
 Angle of rotation (radians)
 
double d_scale
 Uniform scale factor.
 
util::Point d_rotationPoint
 Pivot \(\mathbf p\) for rotation and scale (same role as rotationPoint in GeomObject::transform). Default origin for legacy meshes centered at zero.
 

Detailed Description

A struct that stores transformation parameters and provides method to transform the particle. Basically, given a reference particle, this provides method to translate, rotate, and scale the reference particle.

Definition at line 26 of file particleTransform.h.

Constructor & Destructor Documentation

◆ ParticleTransform() [1/4]

geom::ParticleTransform::ParticleTransform ( )
inline

Constructor.

Default constructor creates identity transformation, i.e. transform(x) = x.

Definition at line 48 of file particleTransform.h.

double d_theta
Angle of rotation (radians)
util::Point d_rotationPoint
Pivot for rotation and scale (same role as rotationPoint in GeomObject::transform)....
util::Point d_translation
Rigid translation after rotate+scale about the pivot (matches GeomObject::transform).
double d_scale
Uniform scale factor.
util::Point d_axis
Unit axis of rotation.
A structure to represent 3d vectors.
Definition point.h:30

◆ ParticleTransform() [2/4]

geom::ParticleTransform::ParticleTransform ( util::Point  translate,
util::Point  axis,
double  theta,
double  scale = 1. 
)
inline

Constructor with pivot at origin (reference mesh centered at origin).

Parameters
translateTranslation vector \(\mathbf t\)
axisAxis of rotation
thetaAngle of rotation
scaleUniform scale

Definition at line 60 of file particleTransform.h.

62 : d_translation(translate), d_axis(axis / axis.length()), d_theta(theta),
double length() const
Computes the Euclidean length of the vector.
Definition point.h:124

◆ ParticleTransform() [3/4]

geom::ParticleTransform::ParticleTransform ( util::Point  translate,
util::Point  axis,
double  theta,
double  scale,
util::Point  rotation_point 
)
inline

Constructor with explicit rotation pivot (consistent with GeomObject::transform).

Definition at line 68 of file particleTransform.h.

70 : d_translation(translate), d_axis(axis / axis.length()), d_theta(theta),
71 d_scale(scale), d_rotationPoint(rotation_point){};

◆ ParticleTransform() [4/4]

geom::ParticleTransform::ParticleTransform ( const ParticleTransform t)
inline

Copy constructor.

Parameters
tAnother ParticleTransform object

Definition at line 77 of file particleTransform.h.

78 : d_translation(t.d_translation), d_axis(t.d_axis),
79 d_theta(t.d_theta), d_scale(t.d_scale), d_rotationPoint(t.d_rotationPoint){};

Member Function Documentation

◆ apply()

util::Point geom::ParticleTransform::apply ( const util::Point v) const
inline

Maps a reference-configuration point \(\mathbf v\) to world coordinates using the same rule as geom::mapSimilarity / GeomObject::transform: \(\mathbf y = \mathbf p + s\,\mathbf R(\mathbf v-\mathbf p) + \mathbf t\).

When \(\mathbf p = \mathbf 0\), this reduces to \(\mathbf y = s\,\mathbf R(\mathbf v) + \mathbf t\) (legacy reference-mesh-at-origin case).

Parameters
vNode position in reference particle frame
Returns
Transformed position

Definition at line 92 of file particleTransform.h.

92 {
93 return d_rotationPoint +
96 };
util::Point rotate(const util::Point &p, const double &theta, const util::Point &axis)
Returns the vector after rotating by desired angle.

References d_axis, d_rotationPoint, d_scale, d_theta, d_translation, and util::rotate().

Referenced by particle::BaseParticle::BaseParticle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print()

void geom::ParticleTransform::print ( int  nt = 0,
int  lvl = 0 
) const
inline

Prints the information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)

Definition at line 126 of file particleTransform.h.

126{ std::cout << printStr(nt, lvl); }
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.

References printStr().

Here is the call graph for this function:

◆ printStr()

std::string geom::ParticleTransform::printStr ( int  nt = 0,
int  lvl = 0 
) const
inline

Returns the string containing printable information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
string String containing printable information about the object

Definition at line 105 of file particleTransform.h.

105 {
106
107 auto tabS = util::io::getTabS(nt);
108 std::ostringstream oss;
109 oss << tabS << "------- ParticleTransform --------" << std::endl << std::endl;
110 oss << tabS << "Scale = " << d_scale << std::endl;
111 oss << tabS << "Angle = " << d_theta << std::endl;
112 oss << tabS << "Translation = " << d_translation.printStr() << std::endl;
113 oss << tabS << "Rotation pivot = " << d_rotationPoint.printStr() << std::endl;
114 oss << tabS << "Axis = " << d_axis.printStr() << std::endl;
115 oss << tabS << std::endl;
116
117 return oss.str();
118 }
std::string getTabS(int nt)
Returns tab spaces of a given size.
Definition io.h:39
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
Definition point.h:94

References d_axis, d_rotationPoint, d_scale, d_theta, d_translation, util::io::getTabS(), and util::Point::printStr().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ d_axis

util::Point geom::ParticleTransform::d_axis

Unit axis of rotation.

Definition at line 32 of file particleTransform.h.

Referenced by apply(), and printStr().

◆ d_rotationPoint

util::Point geom::ParticleTransform::d_rotationPoint

Pivot \(\mathbf p\) for rotation and scale (same role as rotationPoint in GeomObject::transform). Default origin for legacy meshes centered at zero.

Definition at line 41 of file particleTransform.h.

Referenced by apply(), and printStr().

◆ d_scale

double geom::ParticleTransform::d_scale

Uniform scale factor.

Definition at line 38 of file particleTransform.h.

Referenced by apply(), particle::BaseParticle::BaseParticle(), and printStr().

◆ d_theta

double geom::ParticleTransform::d_theta

Angle of rotation (radians)

Definition at line 35 of file particleTransform.h.

Referenced by apply(), and printStr().

◆ d_translation

util::Point geom::ParticleTransform::d_translation

Rigid translation \(\mathbf t\) after rotate+scale about the pivot (matches GeomObject::transform).

Definition at line 29 of file particleTransform.h.

Referenced by apply(), and printStr().


The documentation for this struct was generated from the following file: