PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
util::geometry::GeomObject Class Reference

Defines abstract geometrical domain. More...

#include <geomObjects.h>

Inheritance diagram for util::geometry::GeomObject:
Collaboration diagram for util::geometry::GeomObject:

Public Member Functions

 GeomObject (std::string name="", std::string description="")
 Constructor.
 
virtual double volume () const
 Computes the volume (area in 2d, length in 1d) of object.
 
virtual util::Point center () const
 Computes the center of object.
 
virtual std::pair< util::Point, util::Pointbox () const
 Computes the bounding box of object.
 
virtual std::pair< util::Point, util::Pointbox (const double &tol) const
 Computes the bounding box of object.
 
virtual double inscribedRadius () const
 Computes the radius of biggest circle/sphere completely within the object.
 
virtual double boundingRadius () const
 Computes the radius of smallest circle/sphere such that object can be fit into it.
 
virtual std::string printStr (int nt, int lvl) const
 Returns the string containing printable information about the object.
 
virtual void print (int nt, int lvl) const
 Prints the information about the object.
 
virtual void print () const
 Prints the information about the object.
 
Interaction with point
virtual bool isInside (const util::Point &x) const
 Checks if point is inside this object.
 
virtual bool isOutside (const util::Point &x) const
 Checks if point is outside of this object.
 
virtual bool isNear (const util::Point &x, const double &tol) const
 Checks if point is within given distance of this object.
 
virtual bool isNearBoundary (const util::Point &x, const double &tol, const bool &within) const
 Checks if point is within given distance of this object.
 
virtual bool doesIntersect (const util::Point &x) const
 Checks if point lies exactly on the boundary.
 
Interaction with box
virtual bool isInside (const std::pair< util::Point, util::Point > &box) const
 Checks if box is completely inside.
 
virtual bool isOutside (const std::pair< util::Point, util::Point > &box) const
 Checks if box is outside of the object.
 
virtual bool isNear (const std::pair< util::Point, util::Point > &box, const double &tol) const
 Checks if box is within given distance of this object.
 
virtual bool doesIntersect (const std::pair< util::Point, util::Point > &box) const
 Checks if box intersects this object.
 

Data Fields

const std::string d_name
 name of object
 
const std::string d_description
 Further description of object.
 
std::vector< std::string > d_tags
 Tags/attributes about the object.
 

Detailed Description

Defines abstract geometrical domain.

Definition at line 31 of file geomObjects.h.

Constructor & Destructor Documentation

◆ GeomObject()

util::geometry::GeomObject::GeomObject ( std::string  name = "",
std::string  description = "" 
)
inlineexplicit

Constructor.

Parameters
nameName of the geometric object
descriptionDescription of object (e.g., further classification or any tag)

Definition at line 39 of file geomObjects.h.

41 : d_name(name), d_description(description) {};
const std::string d_description
Further description of object.
const std::string d_name
name of object

Member Function Documentation

◆ boundingRadius()

virtual double util::geometry::GeomObject::boundingRadius ( ) const
inlinevirtual

Computes the radius of smallest circle/sphere such that object can be fit into it.

Returns
Radius Radius of bounding circle/sphere

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 85 of file geomObjects.h.

85{ return 0.; };

◆ box() [1/2]

virtual std::pair< util::Point, util::Point > util::geometry::GeomObject::box ( ) const
inlinevirtual

Computes the bounding box of object.

Returns
Pair Left-bottom-back and right-top-front corner points of box

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 59 of file geomObjects.h.

59 {
60 return {util::Point(), util::Point()};
61 };
A structure to represent 3d vectors.
Definition point.h:30

◆ box() [2/2]

virtual std::pair< util::Point, util::Point > util::geometry::GeomObject::box ( const double &  tol) const
inlinevirtual

Computes the bounding box of object.

Parameters
tolTolerance/padding used in creating bounding box
Returns
Pair Left-bottom-back and right-top-front corner points of box

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 69 of file geomObjects.h.

69 {
70 return {util::Point(), util::Point()};
71 };

◆ center()

◆ doesIntersect() [1/2]

virtual bool util::geometry::GeomObject::doesIntersect ( const std::pair< util::Point, util::Point > &  box) const
inlinevirtual

◆ doesIntersect() [2/2]

virtual bool util::geometry::GeomObject::doesIntersect ( const util::Point x) const
inlinevirtual

◆ inscribedRadius()

virtual double util::geometry::GeomObject::inscribedRadius ( ) const
inlinevirtual

Computes the radius of biggest circle/sphere completely within the object.

Returns
Radius Radius of inscribed circle/sphere

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 78 of file geomObjects.h.

78{ return 0.; };

◆ isInside() [1/2]

virtual bool util::geometry::GeomObject::isInside ( const std::pair< util::Point, util::Point > &  box) const
inlinevirtual

◆ isInside() [2/2]

virtual bool util::geometry::GeomObject::isInside ( const util::Point x) const
inlinevirtual

◆ isNear() [1/2]

virtual bool util::geometry::GeomObject::isNear ( const std::pair< util::Point, util::Point > &  box,
const double &  tol 
) const
inlinevirtual

Checks if box is within given distance of this object.

Parameters
boxBox
tolTolerance used in checking the nearness
Returns
True True if box is inside within the tol distance

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 168 of file geomObjects.h.

169 {
170 return false;
171 };

◆ isNear() [2/2]

virtual bool util::geometry::GeomObject::isNear ( const util::Point x,
const double &  tol 
) const
inlinevirtual

Checks if point is within given distance of this object.

Parameters
xPoint
tolTolerance used in checking the nearness
Returns
True True if within the tol distance

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 112 of file geomObjects.h.

112 {
113 return false;
114 };

◆ isNearBoundary()

virtual bool util::geometry::GeomObject::isNearBoundary ( const util::Point x,
const double &  tol,
const bool &  within 
) const
inlinevirtual

Checks if point is within given distance of this object.

Parameters
xPoint
tolTolerance used in checking the nearness
withinCheck if the point is within (inside) the object
Returns
True True if it is near within tol distance

Reimplemented in util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 123 of file geomObjects.h.

124 {
125 return false;
126 };

◆ isOutside() [1/2]

virtual bool util::geometry::GeomObject::isOutside ( const std::pair< util::Point, util::Point > &  box) const
inlinevirtual

◆ isOutside() [2/2]

virtual bool util::geometry::GeomObject::isOutside ( const util::Point x) const
inlinevirtual

◆ print() [1/2]

virtual void util::geometry::GeomObject::print ( ) const
inlinevirtual

Prints the information about the object.

Reimplemented in util::geometry::NullGeomObject, util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 220 of file geomObjects.h.

220{ print(0, 0); };
virtual void print() const
Prints the information about the object.

References print().

Referenced by print().

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

◆ print() [2/2]

virtual void util::geometry::GeomObject::print ( int  nt,
int  lvl 
) const
inlinevirtual

Prints the information about the object.

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

Reimplemented in util::geometry::NullGeomObject, util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 215 of file geomObjects.h.

215 {
216 std::cout << printStr(nt, lvl);
217 };
virtual std::string printStr(int nt, int lvl) const
Returns the string containing printable information about the object.

References printStr().

Here is the call graph for this function:

◆ printStr()

virtual std::string util::geometry::GeomObject::printStr ( int  nt,
int  lvl 
) const
inlinevirtual

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

Reimplemented in util::geometry::NullGeomObject, util::geometry::Line, util::geometry::Triangle, util::geometry::Square, util::geometry::Rectangle, util::geometry::Hexagon, util::geometry::Drum2D, util::geometry::Cube, util::geometry::Cuboid, util::geometry::Circle, util::geometry::Sphere, util::geometry::Cylinder, util::geometry::AnnulusGeomObject, and util::geometry::ComplexGeomObject.

Definition at line 193 of file geomObjects.h.

193 {
194
195 auto tabS = util::io::getTabS(nt);
196 std::ostringstream oss;
197
198 oss << tabS << "------- GeomObject --------" << std::endl
199 << std::endl;
200 oss << tabS << "Base geometrical object" << std::endl;
201 oss << tabS << "Base implementation of GeomObject." << std::endl;
202 oss << tabS << "Name of GeomObject = " << d_name << std::endl;
203 oss << tabS << "Description of GeomObject = " << d_description
204 << std::endl;
205
206 return oss.str();
207 };
std::string getTabS(int nt)
Returns tab spaces of given size.
Definition io.h:40

References d_description, d_name, and util::io::getTabS().

Referenced by print().

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

◆ volume()

virtual double util::geometry::GeomObject::volume ( ) const
inlinevirtual

Field Documentation

◆ d_description

const std::string util::geometry::GeomObject::d_description

Further description of object.

Definition at line 227 of file geomObjects.h.

Referenced by printStr().

◆ d_name

const std::string util::geometry::GeomObject::d_name

name of object

Definition at line 224 of file geomObjects.h.

Referenced by printStr(), and util::geometry::NullGeomObject::printStr().

◆ d_tags

std::vector<std::string> util::geometry::GeomObject::d_tags

Tags/attributes about the object.

Definition at line 230 of file geomObjects.h.


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