11#ifndef UTIL_GEOMETRY_OBJECTS_H
12#define UTIL_GEOMETRY_OBJECTS_H
40 std::string description =
"")
47 virtual double volume()
const {
return 0.; };
59 virtual std::pair<util::Point, util::Point>
box()
const {
68 virtual std::pair<util::Point, util::Point>
69 box(
const double &tol)
const {
124 const bool &within)
const {
168 virtual bool isNear(
const std::pair<util::Point, util::Point> &
box,
169 const double &tol)
const {
180 const std::pair<util::Point, util::Point> &
box)
const {
193 virtual std::string
printStr(
int nt,
int lvl)
const {
196 std::ostringstream oss;
198 oss << tabS <<
"------- GeomObject --------" << 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
215 virtual void print(
int nt,
int lvl)
const {
247 virtual std::string
printStr(
int nt,
int lvl)
const override {
250 std::ostringstream oss;
252 oss << tabS <<
"------- NullGeomObject --------" << std::endl
254 oss << tabS <<
"Name of GeomObject = " <<
d_name << std::endl;
262 void print(
int nt,
int lvl)
const override {
297 d_L((x1 - x2).length()),
298 d_r(0.5 * (x1 - x2).length()),
299 d_x(0.5 * (x1 + x2)),
310 std::string description =
"")
321 double volume()
const override;
331 std::pair<util::Point, util::Point>
box()
const override;
336 std::pair<util::Point, util::Point>
337 box(
const double &tol)
const override;
374 const bool &within)
const override;
395 const std::pair<util::Point, util::Point> &
box)
const override;
403 const std::pair<util::Point, util::Point> &
box)
const override;
409 bool isNear(
const std::pair<util::Point, util::Point> &
box,
410 const double &tol)
const override;
417 const std::pair<util::Point, util::Point> &
box)
const override;
424 std::string
printStr(
int nt,
int lvl)
const override;
429 void print(
int nt,
int lvl)
const override {
477 std::string description =
"uniform")
486 for (
int i = 0; i < 3; i++) {
488 d_a, i * 2. * M_PI / 3., rotate_axis);
495 double volume()
const override;
505 std::pair<util::Point, util::Point>
box()
const override;
510 std::pair<util::Point, util::Point>
511 box(
const double &tol)
const override;
548 const bool &within)
const override;
569 const std::pair<util::Point, util::Point> &
box)
const override;
577 const std::pair<util::Point, util::Point> &
box)
const override;
583 bool isNear(
const std::pair<util::Point, util::Point> &
box,
584 const double &tol)
const override;
591 const std::pair<util::Point, util::Point> &
box)
const override;
598 std::string
printStr(
int nt,
int lvl)
const override;
603 void print(
int nt,
int lvl)
const override {
663 std::string description =
"")
666 d_r(L / std::sqrt(2)),
682 d_L((x1 - x2).length() * (1. / std::sqrt(2))),
683 d_r((x1 - x2).length() / 2.),
684 d_x(0.5 * (x1 + x2)) {
695 double volume()
const override;
705 std::pair<util::Point, util::Point>
box()
const override;
710 std::pair<util::Point, util::Point>
711 box(
const double &tol)
const override;
748 const bool &within)
const override;
768 const std::pair<util::Point, util::Point> &
box)
const override;
776 const std::pair<util::Point, util::Point> &
box)
const override;
782 bool isNear(
const std::pair<util::Point, util::Point> &
box,
783 const double &tol)
const override;
790 const std::pair<util::Point, util::Point> &
box)
const override;
797 std::string
printStr(
int nt,
int lvl)
const override;
802 void print(
int nt,
int lvl)
const override {
851 std::string description =
"")
855 d_r(0.5 * std::sqrt(std::pow(Lx, 2) + std::pow(Ly, 2))),
875 std::string description =
"")
878 d_Ly(x2.d_y - x1.d_y),
880 std::sqrt(std::pow(
d_Lx, 2) + std::pow(
d_Ly, 2))),
881 d_x(0.5 * (x1 + x2)) {
892 double volume()
const override;
902 std::pair<util::Point, util::Point>
box()
const override;
907 std::pair<util::Point, util::Point>
908 box(
const double &tol)
const override;
945 const bool &within)
const override;
965 const std::pair<util::Point, util::Point> &
box)
const override;
973 const std::pair<util::Point, util::Point> &
box)
const override;
979 bool isNear(
const std::pair<util::Point, util::Point> &
box,
980 const double &tol)
const override;
987 const std::pair<util::Point, util::Point> &
box)
const override;
994 std::string
printStr(
int nt,
int lvl)
const override;
999 void print(
int nt,
int lvl)
const override {
1050 std::string description =
"")
1059 for (
int i = 0; i < 6; i++) {
1061 d_a, i * M_PI / 3., rotate_axis);
1068 double volume()
const override;
1078 std::pair<util::Point, util::Point>
box()
const override;
1083 std::pair<util::Point, util::Point>
1084 box(
const double &tol)
const override;
1121 const bool &within)
const override;
1143 const std::pair<util::Point, util::Point> &
box)
const override;
1151 const std::pair<util::Point, util::Point> &
box)
const override;
1157 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1158 const double &tol)
const override;
1165 const std::pair<util::Point, util::Point> &
box)
const override;
1172 std::string
printStr(
int nt,
int lvl)
const override;
1177 void print(
int nt,
int lvl)
const override {
1256 std::string description =
"")
1268 double w_big_edge =
d_r * std::cos(M_PI / 3.);
1291 double volume()
const override;
1301 std::pair<util::Point, util::Point>
box()
const override;
1306 std::pair<util::Point, util::Point>
1307 box(
const double &tol)
const override;
1344 const bool &within)
const override;
1364 const std::pair<util::Point, util::Point> &
box)
const override;
1372 const std::pair<util::Point, util::Point> &
box)
const override;
1378 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1379 const double &tol)
const override;
1386 const std::pair<util::Point, util::Point> &
box)
const override;
1393 std::string
printStr(
int nt,
int lvl)
const override;
1398 void print(
int nt,
int lvl)
const override {
1460 std::string description =
"")
1463 d_r(0.5 * std::sqrt(3.) * L),
1499 d_L((x2 - x1).length() / std::sqrt(3.)),
1500 d_r(0.5 * (x2 - x1).length()),
1501 d_x(0.5 * (x1 + x2)),
1530 double volume()
const override;
1540 std::pair<util::Point, util::Point>
box()
const override;
1545 std::pair<util::Point, util::Point>
1546 box(
const double &tol)
const override;
1583 const bool &within)
const override;
1603 const std::pair<util::Point, util::Point> &
box)
const override;
1611 const std::pair<util::Point, util::Point> &
box)
const override;
1617 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1618 const double &tol)
const override;
1625 const std::pair<util::Point, util::Point> &
box)
const override;
1632 std::string
printStr(
int nt,
int lvl)
const override;
1637 void print(
int nt,
int lvl)
const override {
1688 std::string description =
"")
1693 d_r(std::sqrt(std::pow(Lx, 2) + std::pow(Ly, 2) +
1731 d_Ly(x2.d_y - x1.d_y),
1732 d_Lz(x2.d_z - x1.d_z),
1734 std::pow(x2.
d_x - x1.
d_x, 2)
1735 + std::pow(x2.d_y - x1.d_y, 2)
1736 + std::pow(x2.d_z - x1.d_z, 2)
1739 d_x(0.5 * (x1 + x2)),
1768 double volume()
const override;
1778 std::pair<util::Point, util::Point>
box()
const override;
1783 std::pair<util::Point, util::Point>
1784 box(
const double &tol)
const override;
1821 const bool &within)
const override;
1841 const std::pair<util::Point, util::Point> &
box)
const override;
1849 const std::pair<util::Point, util::Point> &
box)
const override;
1855 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1856 const double &tol)
const override;
1863 const std::pair<util::Point, util::Point> &
box)
const override;
1870 std::string
printStr(
int nt,
int lvl)
const override;
1875 void print(
int nt,
int lvl)
const override {
1925 std::string description =
"")
1933 double volume()
const override;
1943 std::pair<util::Point, util::Point>
box()
const override;
1948 std::pair<util::Point, util::Point>
1949 box(
const double &tol)
const override;
1986 const bool &within)
const override;
2006 const std::pair<util::Point, util::Point> &
box)
const override;
2014 const std::pair<util::Point, util::Point> &
box)
const override;
2020 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2021 const double &tol)
const override;
2028 const std::pair<util::Point, util::Point> &
box)
const override;
2035 std::string
printStr(
int nt,
int lvl)
const override;
2040 void print(
int nt,
int lvl)
const override {
2078 std::string description =
"")
2086 double volume()
const override;
2096 std::pair<util::Point, util::Point>
box()
const override;
2101 std::pair<util::Point, util::Point>
2102 box(
const double &tol)
const override;
2139 const bool &within)
const override;
2159 const std::pair<util::Point, util::Point> &
box)
const override;
2167 const std::pair<util::Point, util::Point> &
box)
const override;
2173 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2174 const double &tol)
const override;
2181 const std::pair<util::Point, util::Point> &
box)
const override;
2188 std::string
printStr(
int nt,
int lvl)
const override;
2193 void print(
int nt,
int lvl)
const override {
2236 std::string description =
"")
2239 d_xa(xa / xa.length()),
2242 d_x(x_begin + 0.5 * l * xa) {};
2254 std::string description =
"")
2257 d_xa(xa / xa.length()),
2260 d_x(x_begin + 0.5 * xa.length() * xa) {};
2265 double volume()
const override;
2275 std::pair<util::Point, util::Point>
box()
const override;
2280 std::pair<util::Point, util::Point>
2281 box(
const double &tol)
const override;
2318 const bool &within)
const override;
2338 const std::pair<util::Point, util::Point> &
box)
const override;
2346 const std::pair<util::Point, util::Point> &
box)
const override;
2352 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2353 const double &tol)
const override;
2360 const std::pair<util::Point, util::Point> &
box)
const override;
2367 std::string
printStr(
int nt,
int lvl)
const override;
2372 void print(
int nt,
int lvl)
const override {
2430 double volume()
const override;
2440 std::pair<util::Point, util::Point>
box()
const override;
2445 std::pair<util::Point, util::Point>
2446 box(
const double &tol)
const override;
2483 const bool &
within)
const override;
2503 const std::pair<util::Point, util::Point> &
box)
const override;
2511 const std::pair<util::Point, util::Point> &
box)
const override;
2517 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2518 const double &tol)
const override;
2525 const std::pair<util::Point, util::Point> &
box)
const override;
2576 std::vector<std::shared_ptr<util::geometry::GeomObject>> &
obj,
2587 else if (
s ==
"minus")
2591 <<
"Error: Check object flag " +
s +
2592 " passed to create ComplexGeomObject\n";
2600 double volume()
const override;
2610 std::pair<util::Point, util::Point>
box()
const override;
2615 std::pair<util::Point, util::Point>
2616 box(
const double &tol)
const override;
2653 const bool &
within)
const override;
2673 const std::pair<util::Point, util::Point> &
box)
const override;
2681 const std::pair<util::Point, util::Point> &
box)
const override;
2687 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2688 const double &tol)
const override;
2695 const std::pair<util::Point, util::Point> &
box)
const override;
2717 std::vector<std::shared_ptr<util::geometry::GeomObject>>
d_obj;
Defines annulus rectangle.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
size_t d_dim
Dimension objects live in.
util::geometry::GeomObject * d_inObj_p
Inner object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
AnnulusGeomObject()
Constructor.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
util::geometry::GeomObject * d_outObj_p
Outer object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
util::Point center() const override
Computes the center of object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
void print() const override
Prints the information about the object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
void print(int nt, int lvl) const override
Prints the information about the object.
AnnulusGeomObject(GeomObject *in, GeomObject *out, size_t dim, std::string description="")
Constructor.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
void print(int nt, int lvl) const override
Prints the information about the object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
void print() const override
Prints the information about the object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
Circle(double r, util::Point x=util::Point(), std::string description="")
Constructor.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
util::Point center() const override
Computes the center of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
Defines complex geometrical object.
util::Point center() const override
Computes the center of object.
void print() const override
Prints the information about the object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
ComplexGeomObject(std::vector< std::shared_ptr< util::geometry::GeomObject > > &obj, std::vector< std::string > obj_flag, size_t dim, std::string description="")
Constructor.
void print(int nt, int lvl) const override
Prints the information about the object.
std::vector< std::shared_ptr< util::geometry::GeomObject > > d_obj
Object.
std::vector< int > d_objFlagInt
Object integer flags. Here, +1 means object is filling and -1 means object is void.
std::vector< std::string > d_objFlag
Object flag.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
ComplexGeomObject()
Constructor.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
size_t d_dim
Dimension objects live in.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
void print() const override
Prints the information about the object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Cube(util::Point x1, util::Point x2, std::string description="")
Constructor.
double d_L
Edge length of cube.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
void print(int nt, int lvl) const override
Prints the information about the object.
std::vector< util::Point > d_vertices
Vertices.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
Cube(double L, util::Point x=util::Point(), std::string description="")
Constructor.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double d_r
Radius of bounding circle.
util::Point center() const override
Computes the center of object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
util::Point center() const override
Computes the center of object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
std::vector< util::Point > d_vertices
Vertices.
void print(int nt, int lvl) const override
Prints the information about the object.
double d_Ly
Edge length of cuboid in y-direction.
double d_Lz
Edge length of cuboid in z-direction.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
Cuboid(double Lx, double Ly, double Lz, util::Point x=util::Point(), std::string description="")
Constructor.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
double d_r
Radius of bounding circle.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
void print() const override
Prints the information about the object.
Cuboid(util::Point x1, util::Point x2, std::string description="")
Constructor.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
double d_Lx
Edge length of cuboid in x-direction.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
util::Point d_xBegin
Center point of cross-section at the beginning.
void print() const override
Prints the information about the object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
util::Point d_xa
Axis of cylinder (unit vector)
void print(int nt, int lvl) const override
Prints the information about the object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
Cylinder(double r, double l, util::Point x_begin, util::Point xa, std::string description="")
Constructor.
util::Point center() const override
Computes the center of object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Cylinder(double r, util::Point x_begin, util::Point xa, std::string description="")
Constructor.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
util::Point d_a
Axis: defined as the vector pointing from center to the first vertex v3 v2.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
double d_w
Half width of neck.
void print() const override
Prints the information about the object.
double d_r
Distance between center and the farthest vertex.
std::vector< util::Point > d_vertices
Vertices.
util::Point center() const override
Computes the center of object.
void print(int nt, int lvl) const override
Prints the information about the object.
Drum2D(double r, double w, util::Point x=util::Point(0., 0., 0.), util::Point a=util::Point(1., 0., 0.), std::string description="")
Constructor.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Defines abstract geometrical domain.
virtual void print() const
Prints the information about the object.
virtual bool isInside(const std::pair< util::Point, util::Point > &box) const
Checks if box is completely inside.
virtual double boundingRadius() const
Computes the radius of smallest circle/sphere such that object can be fit into it.
std::vector< std::string > d_tags
Tags/attributes about the object.
const std::string d_description
Further description of object.
virtual void print(int nt, int lvl) const
Prints the information about the object.
virtual bool isOutside(const util::Point &x) const
Checks if point is outside of this object.
virtual bool doesIntersect(const std::pair< util::Point, util::Point > &box) const
Checks if box intersects this object.
virtual util::Point center() const
Computes the center of object.
virtual std::string printStr(int nt, int lvl) const
Returns the string containing printable information about the object.
virtual bool isNear(const util::Point &x, const double &tol) 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.
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 std::pair< util::Point, util::Point > box() const
Computes the bounding box of object.
GeomObject(std::string name="", std::string description="")
Constructor.
virtual bool isInside(const util::Point &x) const
Checks if point is inside this object.
virtual bool isOutside(const std::pair< util::Point, util::Point > &box) const
Checks if box is outside of the object.
virtual std::pair< util::Point, util::Point > box(const double &tol) const
Computes the bounding box of object.
virtual double volume() const
Computes the volume (area in 2d, length in 1d) of object.
virtual double inscribedRadius() const
Computes the radius of biggest circle/sphere completely within the object.
const std::string d_name
name of 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.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
void print() const override
Prints the information about the object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
std::vector< util::Point > d_vertices
Vertices.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
double d_r
Distance between center and the farthest vertex of hexagon.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
void print(int nt, int lvl) const override
Prints the information about the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Hexagon(double r, util::Point x=util::Point(0., 0., 0.), util::Point a=util::Point(1., 0., 0.), std::string description="")
Constructor.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
util::Point d_a
Axis: defined as the vector pointing from center to the first vertex.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
util::Point center() const override
Computes the center of object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
std::vector< util::Point > d_vertices
Vertices.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
void print() const override
Prints the information about the object.
Line(double L, util::Point x=util::Point(), std::string description="")
Constructor.
double d_L
Length of line.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
double d_r
Radius of bounding circle.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
util::Point center() const override
Computes the center of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
void print(int nt, int lvl) const override
Prints the information about the object.
Line(util::Point x1, util::Point x2, std::string description="")
Constructor.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Defines null (empty) geom object.
void print() const override
Prints the information about the object.
void print(int nt, int lvl) const override
Prints the information about the object.
NullGeomObject(std::string description="")
Constructor.
virtual std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
double d_r
Radius of bounding circle.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
double d_Ly
Edge length of a rectangle in y-direction.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
void print(int nt, int lvl) const override
Prints the information about the object.
double d_Lx
Edge length of a rectangle in x-direction.
void print() const override
Prints the information about the object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Rectangle(double Lx, double Ly, util::Point x=util::Point(), std::string description="")
Constructor.
std::vector< util::Point > d_vertices
Vertices.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
util::Point center() const override
Computes the center of object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
Rectangle(util::Point x1, util::Point x2, std::string description="")
Constructor.
util::Point center() const override
Computes the center of object.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
void print(int nt, int lvl) const override
Prints the information about the object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
void print() const override
Prints the information about the object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
Sphere(double r, util::Point x=util::Point(), std::string description="")
Constructor.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
Square(util::Point x1, util::Point x2, std::string description="")
Constructor.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
std::vector< util::Point > d_vertices
Vertices.
void print() const override
Prints the information about the object.
util::Point center() const override
Computes the center of object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
void print(int nt, int lvl) const override
Prints the information about the object.
double d_L
Edge length of a square.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
Square(double L, util::Point x=util::Point(), std::string description="")
Constructor.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
double d_r
Radius of bounding circle.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
void print() const override
Prints the information about the object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
util::Point d_a
Axis: defined as the vector pointing from center to the first vertex v2 +.
util::Point center() const override
Computes the center of object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
std::vector< util::Point > d_vertices
Vertices.
double d_r
Distance between center and the farthest vertex of triangle.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
void print(int nt, int lvl) const override
Prints the information about the object.
Triangle(double r, util::Point x=util::Point(0., 0., 0.), util::Point a=util::Point(1., 0., 0.), std::string description="uniform")
Constructor.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Collection of methods and data related to geometry.
std::string getTabS(int nt)
Returns tab spaces of given size.
Collection of methods useful in simulation.
util::Point rotate(const util::Point &p, const double &theta, const util::Point &axis)
Returns the vector after rotating by desired angle.
A structure to represent 3d vectors.
double d_y
the y coordinate
double d_z
the z coordinate
double d_x
the x coordinate