11#ifndef GEOM_GEOMOBJECTS_H
12#define GEOM_GEOMOBJECTS_H
40 {
"open_rect_channel_2d", 2},
41 {
"open_cuboid_channel_3d", 3},
58 const util::Point &p = (rotationPoint !=
nullptr) ? *rotationPoint : pivotDefault;
68std::pair<util::Point, util::Point>
d_box;
141 std::string description =
"")
149 virtual double volume()
const {
return 0.; };
161 virtual std::pair<util::Point, util::Point>
box()
const {
170 virtual std::pair<util::Point, util::Point>
171 box(
const double &tol)
const {
226 const bool &within)
const {
270 virtual bool isNear(
const std::pair<util::Point, util::Point> &
box,
271 const double &tol)
const {
282 const std::pair<util::Point, util::Point> &
box)
const {
295 virtual std::string
printStr(
int nt,
int lvl)
const {
297 std::ostringstream oss;
299 oss << tabS <<
"------- GeomObject --------" << std::endl
301 oss << tabS <<
"Base geometrical object" << std::endl;
302 oss << tabS <<
"Base implementation of GeomObject." << std::endl;
303 oss << tabS <<
"Name of GeomObject = " <<
d_name << std::endl;
304 oss << tabS <<
"Description of GeomObject = " <<
d_description
316 virtual void print(
int nt,
int lvl)
const {
379 if (
this != &other) {
399 virtual std::string
printStr(
int nt,
int lvl)
const override {
401 std::ostringstream oss;
403 oss << tabS <<
"------- NullGeomObject --------" << std::endl
405 oss << tabS <<
"Name of GeomObject = " <<
d_name << std::endl;
413 void print(
int nt,
int lvl)
const override {
453 if (
this != &other) {
466 (rotationPoint !=
nullptr) ? *rotationPoint :
d_p;
474 double volume()
const override {
return 0.; }
476 std::pair<util::Point, util::Point>
box()
const override {
479 std::pair<util::Point, util::Point>
box(
const double &tol)
const override {
486 return (x -
d_p) *
d_n < 0.;
492 return std::abs((x -
d_p) *
d_n) <= tol;
495 const bool & )
const override {
505 std::string
printStr(
int nt,
int lvl)
const override {
507 std::ostringstream oss;
508 oss << tabS <<
"------- Plane --------\n\n";
509 oss << tabS <<
"Normal = " <<
d_n.
printStr(0, lvl) <<
"\n";
510 oss << tabS <<
"Point = " <<
d_p.
printStr(0, lvl) <<
"\n";
513 void print(
int nt,
int lvl)
const override {
557 d_L((x1 - x2).length()),
558 d_r(0.5 * (x1 - x2).length()),
559 d_x(0.5 * (x1 + x2)),
571 std::string description =
"")
601 if (
this != &other) {
623 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
625 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
638 double volume()
const override;
648 std::pair<util::Point, util::Point>
box()
const override;
653 std::pair<util::Point, util::Point>
654 box(
const double &tol)
const override;
691 const bool &within)
const override;
712 const std::pair<util::Point, util::Point> &
box)
const override;
720 const std::pair<util::Point, util::Point> &
box)
const override;
726 bool isNear(
const std::pair<util::Point, util::Point> &
box,
727 const double &tol)
const override;
734 const std::pair<util::Point, util::Point> &
box)
const override;
741 std::string
printStr(
int nt,
int lvl)
const override;
746 void print(
int nt,
int lvl)
const override {
808 std::string description =
"uniform")
816 for (
int i = 0; i < 3; i++) {
818 d_a, i * 2. * M_PI / 3., rotate_axis);
827 std::string description =
"vertices")
833 d_x = (v0 + v1 + v2) / 3.0;
834 d_r = (v0 -
d_x).length();
836 const double r1 = (v1 -
d_x).length();
837 const double r2 = (v2 -
d_x).length();
867 if (
this != &other) {
887 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
889 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
896 double volume()
const override;
906 std::pair<util::Point, util::Point>
box()
const override;
911 std::pair<util::Point, util::Point>
912 box(
const double &tol)
const override;
949 const bool &within)
const override;
970 const std::pair<util::Point, util::Point> &
box)
const override;
978 const std::pair<util::Point, util::Point> &
box)
const override;
984 bool isNear(
const std::pair<util::Point, util::Point> &
box,
985 const double &tol)
const override;
992 const std::pair<util::Point, util::Point> &
box)
const override;
999 std::string
printStr(
int nt,
int lvl)
const override;
1004 void print(
int nt,
int lvl)
const override {
1055 std::string description =
"")
1058 d_r(L / std::sqrt(2)),
1077 d_L((x1 - x2).length() * (1. / std::sqrt(2))),
1078 d_r((x1 - x2).length() / 2.),
1079 d_x(0.5 * (x1 + x2)) {
1105 if (
this != &other) {
1126 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
1128 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
1134 double volume()
const override;
1144 std::pair<util::Point, util::Point>
box()
const override;
1149 std::pair<util::Point, util::Point>
1150 box(
const double &tol)
const override;
1187 const bool &within)
const override;
1207 const std::pair<util::Point, util::Point> &
box)
const override;
1215 const std::pair<util::Point, util::Point> &
box)
const override;
1221 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1222 const double &tol)
const override;
1229 const std::pair<util::Point, util::Point> &
box)
const override;
1236 std::string
printStr(
int nt,
int lvl)
const override;
1241 void print(
int nt,
int lvl)
const override {
1296 std::string description =
"")
1300 d_r(0.5 * std::sqrt(std::pow(Lx, 2) + std::pow(Ly, 2))),
1333 std::string description =
"")
1336 d_Ly(x2.d_y - x1.d_y),
1338 std::sqrt(std::pow(
d_Lx, 2) + std::pow(
d_Ly, 2))),
1339 d_x(0.5 * (x1 + x2)) {
1352 if (
this != &other) {
1377 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
1379 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
1389 double volume()
const override;
1399 std::pair<util::Point, util::Point>
box()
const override;
1404 std::pair<util::Point, util::Point>
1405 box(
const double &tol)
const override;
1442 const bool &within)
const override;
1462 const std::pair<util::Point, util::Point> &
box)
const override;
1470 const std::pair<util::Point, util::Point> &
box)
const override;
1476 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1477 const double &tol)
const override;
1484 const std::pair<util::Point, util::Point> &
box)
const override;
1491 std::string
printStr(
int nt,
int lvl)
const override;
1496 void print(
int nt,
int lvl)
const override {
1557 std::string description =
"")
1565 for (
int i = 0; i < 6; i++) {
1567 d_a, i * M_PI / 3., rotate_axis);
1590 if (
this != &other) {
1610 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
1612 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
1619 double volume()
const override;
1629 std::pair<util::Point, util::Point>
box()
const override;
1634 std::pair<util::Point, util::Point>
1635 box(
const double &tol)
const override;
1672 const bool &within)
const override;
1694 const std::pair<util::Point, util::Point> &
box)
const override;
1702 const std::pair<util::Point, util::Point> &
box)
const override;
1708 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1709 const double &tol)
const override;
1716 const std::pair<util::Point, util::Point> &
box)
const override;
1723 std::string
printStr(
int nt,
int lvl)
const override;
1728 void print(
int nt,
int lvl)
const override {
1812 std::string description =
"")
1840 if (
this != &other) {
1862 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
1864 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
1871 double volume()
const override;
1881 std::pair<util::Point, util::Point>
box()
const override;
1886 std::pair<util::Point, util::Point>
1887 box(
const double &tol)
const override;
1924 const bool &within)
const override;
1944 const std::pair<util::Point, util::Point> &
box)
const override;
1952 const std::pair<util::Point, util::Point> &
box)
const override;
1958 bool isNear(
const std::pair<util::Point, util::Point> &
box,
1959 const double &tol)
const override;
1966 const std::pair<util::Point, util::Point> &
box)
const override;
1973 std::string
printStr(
int nt,
int lvl)
const override;
1978 void print(
int nt,
int lvl)
const override {
2025 std::string description =
"")
2028 d_r(0.5 * std::sqrt(3.) * L),
2077 d_L((x2 - x1).length() / std::sqrt(3.)),
2078 d_r(0.5 * (x2 - x1).length()),
2079 d_x(0.5 * (x1 + x2)),
2111 if (
this != &other) {
2133 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
2135 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
2141 double volume()
const override;
2151 std::pair<util::Point, util::Point>
box()
const override;
2156 std::pair<util::Point, util::Point>
2157 box(
const double &tol)
const override;
2194 const bool &within)
const override;
2214 const std::pair<util::Point, util::Point> &
box)
const override;
2222 const std::pair<util::Point, util::Point> &
box)
const override;
2228 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2229 const double &tol)
const override;
2236 const std::pair<util::Point, util::Point> &
box)
const override;
2243 std::string
printStr(
int nt,
int lvl)
const override;
2248 void print(
int nt,
int lvl)
const override {
2306 std::string description =
"")
2311 d_r(std::sqrt(std::pow(Lx, 2) + std::pow(Ly, 2) +
2364 d_Ly(x2.d_y - x1.d_y),
2365 d_Lz(x2.d_z - x1.d_z),
2367 std::pow(x2.
d_x - x1.
d_x, 2)
2368 + std::pow(x2.d_y - x1.d_y, 2)
2369 + std::pow(x2.d_z - x1.d_z, 2)
2372 d_x(0.5 * (x1 + x2)),
2404 if (
this != &other) {
2429 v =
mapSimilarity(v, c0, translation, scale, angle, axis, rotationPoint);
2431 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
2437 double volume()
const override;
2447 std::pair<util::Point, util::Point>
box()
const override;
2452 std::pair<util::Point, util::Point>
2453 box(
const double &tol)
const override;
2490 const bool &within)
const override;
2510 const std::pair<util::Point, util::Point> &
box)
const override;
2518 const std::pair<util::Point, util::Point> &
box)
const override;
2524 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2525 const double &tol)
const override;
2532 const std::pair<util::Point, util::Point> &
box)
const override;
2539 std::string
printStr(
int nt,
int lvl)
const override;
2544 void print(
int nt,
int lvl)
const override {
2583 std::string description =
"")
2606 if (
this != &other) {
2621 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
2627 double volume()
const override;
2637 std::pair<util::Point, util::Point>
box()
const override;
2642 std::pair<util::Point, util::Point>
2643 box(
const double &tol)
const override;
2680 const bool &within)
const override;
2700 const std::pair<util::Point, util::Point> &
box)
const override;
2708 const std::pair<util::Point, util::Point> &
box)
const override;
2714 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2715 const double &tol)
const override;
2722 const std::pair<util::Point, util::Point> &
box)
const override;
2729 std::string
printStr(
int nt,
int lvl)
const override;
2734 void print(
int nt,
int lvl)
const override {
2776 std::string description =
"")
2793 if (
this != &other) {
2810 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
2813 double volume()
const override;
2815 std::pair<util::Point, util::Point>
box()
const override;
2816 std::pair<util::Point, util::Point>
box(
const double &tol)
const override;
2826 bool isInside(
const std::pair<util::Point, util::Point> &
box)
const override;
2827 bool isOutside(
const std::pair<util::Point, util::Point> &
box)
const override;
2828 bool isNear(
const std::pair<util::Point, util::Point> &
box,
const double &tol)
const override;
2829 bool doesIntersect(
const std::pair<util::Point, util::Point> &
box)
const override;
2831 std::string
printStr(
int nt,
int lvl)
const override;
2865 std::string description =
"")
2888 if (
this != &other) {
2903 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
2909 double volume()
const override;
2919 std::pair<util::Point, util::Point>
box()
const override;
2924 std::pair<util::Point, util::Point>
2925 box(
const double &tol)
const override;
2962 const bool &within)
const override;
2982 const std::pair<util::Point, util::Point> &
box)
const override;
2990 const std::pair<util::Point, util::Point> &
box)
const override;
2996 bool isNear(
const std::pair<util::Point, util::Point> &
box,
2997 const double &tol)
const override;
3004 const std::pair<util::Point, util::Point> &
box)
const override;
3011 std::string
printStr(
int nt,
int lvl)
const override;
3016 void print(
int nt,
int lvl)
const override {
3058 std::string description =
"")
3072 std::string description =
"")
3081 if (std::abs(theta) > 1.0e-12 and axis.
length() > 1.0e-12) {
3098 if (
this != &other) {
3113 double volume()
const override;
3115 std::pair<util::Point, util::Point>
box()
const override;
3116 std::pair<util::Point, util::Point>
box(
const double &tol)
const override;
3126 bool isInside(
const std::pair<util::Point, util::Point> &
box)
const override;
3127 bool isOutside(
const std::pair<util::Point, util::Point> &
box)
const override;
3128 bool isNear(
const std::pair<util::Point, util::Point> &
box,
const double &tol)
const override;
3129 bool doesIntersect(
const std::pair<util::Point, util::Point> &
box)
const override;
3131 std::string
printStr(
int nt,
int lvl)
const override;
3179 std::string description =
"")
3182 d_xa(xa / xa.length()),
3185 d_x(x_begin + 0.5 * l * (xa / xa.length())) {
3198 std::string description =
"")
3201 d_xa(xa / xa.length()),
3204 d_x(x_begin + 0.5 * xa) {};
3226 if (
this != &other) {
3249 d_x =
mapSimilarity(c0, c0, translation, scale, angle, axis, rotationPoint);
3255 double volume()
const override;
3265 std::pair<util::Point, util::Point>
box()
const override;
3270 std::pair<util::Point, util::Point>
3271 box(
const double &tol)
const override;
3308 const bool &within)
const override;
3328 const std::pair<util::Point, util::Point> &
box)
const override;
3336 const std::pair<util::Point, util::Point> &
box)
const override;
3342 bool isNear(
const std::pair<util::Point, util::Point> &
box,
3343 const double &tol)
const override;
3350 const std::pair<util::Point, util::Point> &
box)
const override;
3357 std::string
printStr(
int nt,
int lvl)
const override;
3362 void print(
int nt,
int lvl)
const override {
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
void print(int nt, int lvl) const override
Prints the information about the object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
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.
Circle(const Circle &other)
Copy constructor.
Circle & operator=(const Circle &other)
Assignment operator.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
void print() const override
Prints the 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.
Circle(double r, util::Point x=util::Point(), 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.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
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.
util::Point center() const override
Computes the center of object.
void print(int nt, int lvl) const override
Prints the information about the object.
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.
Cube(const Cube &other)
Copy constructor.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
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.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Cube & operator=(const Cube &other)
Assignment operator.
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.
Cube(double L, util::Point x=util::Point(), std::string description="")
Constructor.
std::vector< util::Point > d_vertices
Vertices.
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() 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 isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
double d_L
Edge length of cube.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
double d_Ly
Edge length of cuboid in y-direction.
Cuboid(double Lx, double Ly, double Lz, util::Point x=util::Point(), 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 isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
std::vector< util::Point > d_vertices
Vertices.
util::Point center() const override
Computes the center of object.
double d_Lx
Edge length of cuboid in x-direction.
Cuboid(const Cuboid &other)
Copy constructor.
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.
void print(int nt, int lvl) const override
Prints the information about the object.
Cuboid & operator=(const Cuboid &other)
Assignment operator.
bool isInside(const util::Point &x) const override
Checks if point is inside 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.
Cuboid(util::Point x1, util::Point x2, std::string description="")
Constructor.
double d_Lz
Edge length of cuboid in z-direction.
void print() const override
Prints the information about the object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
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.
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.
Cylinder(const Cylinder &other)
Copy constructor.
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
util::Point d_xBegin
Center point of cross-section at the beginning.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
util::Point d_xa
Axis of cylinder (unit vector)
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Cylinder & operator=(const Cylinder &other)
Assignment operator.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
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.
Cylinder(double r, double l, util::Point x_begin, util::Point xa, std::string description="")
Constructor.
Cylinder(double r, util::Point x_begin, util::Point xa, 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.
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.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
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 inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
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.
void print() const override
Prints the information about the object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
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.
util::Point d_a
Axis: defined as the vector pointing from center to the first vertex v3 v2.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
Drum2D & operator=(const Drum2D &other)
Assignment operator.
std::vector< util::Point > d_vertices
Vertices.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
double d_r
Distance between center and the farthest vertex.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
double d_w
Half width of neck.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Filled ellipse in the plane z = center.d_z, semi-axes in the xy plane.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double d_a
Semi-axis along local x before rotation (in-plane)
void print(int nt, int lvl) const override
Prints the information about the object.
util::Point center() const override
Computes the center of object.
double d_b
Semi-axis along local y before rotation (in-plane)
void print() const override
Prints the information about the object.
double d_theta
Counter-clockwise rotation about +z through the center (radians)
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this 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 doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Ellipse(const Ellipse &other)
Ellipse & operator=(const Ellipse &other)
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
Ellipse(double a, double b, double theta, util::Point x=util::Point(), std::string description="")
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
Checks if point is within given distance of this object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
Ellipsoid: center , semi-axes in a body frame rotated from world by axis–angle (Rodrigues)....
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double d_theta
Rotation angle (radians) about d_axis.
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.
Ellipsoid(double a, double b, double c, util::Point x=util::Point(), std::string description="")
Ellipsoid & operator=(const Ellipsoid &other)
Ellipsoid(double a, double b, double c, double theta, util::Point x, util::Point axis, std::string description="")
General orientation: same semi-axes, rotation about unit axis (normalized internally; zero axis with...
bool isOutside(const util::Point &x) const override
Checks if point is outside of 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.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
util::Point d_axis
Unit rotation axis (axis–angle); default (0,0,1) when .
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) 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.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
void print() const override
Prints the 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.
Ellipsoid(const Ellipsoid &other)
Defines abstract geometrical domain.
virtual std::pair< util::Point, util::Point > box() const
Computes the bounding box of object.
virtual bool isOutside(const std::pair< util::Point, util::Point > &box) const
Checks if box is outside of the 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 std::pair< util::Point, util::Point > &box) const
Checks if box intersects this object.
virtual bool isOutside(const util::Point &x) const
Checks if point is outside of this object.
virtual void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint=nullptr)
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
virtual bool isNear(const util::Point &x, const double &tol) const
Checks if point is within given distance of this object.
std::vector< std::string > d_tags
Tags/attributes about the object.
virtual void print(int nt, int lvl) 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 std::pair< util::Point, util::Point > box(const double &tol) const
Computes the bounding box of object.
virtual std::string printStr(int nt, int lvl) const
Returns the string containing printable information about the object.
virtual bool isInside(const util::Point &x) const
Checks if point is inside this object.
virtual bool doesIntersect(const util::Point &x) const
Checks if point lies exactly on the boundary.
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 bool wallContactQuery(const util::Point &x, WallContactHit &hit) const
Closest-point / signed-gap query for analytical wall contact. Default: unsupported (returns false,...
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.
GeomObject(std::string name="", std::string description="")
Constructor.
const std::string d_name
name of object
virtual double boundingRadius() const
Computes the radius of smallest circle/sphere such that object can be fit into it.
virtual double inscribedRadius() const
Computes the radius of biggest circle/sphere completely within the object.
const std::string d_description
Further description of object.
virtual void print() const
Prints the information about the object.
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.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
Hexagon(double r, util::Point x=util::Point(0., 0., 0.), util::Point a=util::Point(1., 0., 0.), std::string description="")
Constructor.
Hexagon(const Hexagon &other)
Copy constructor.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
void print() const override
Prints the information about the object.
Hexagon & operator=(const Hexagon &other)
Assignment operator.
util::Point center() const override
Computes the center of object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
util::Point d_a
Axis: defined as the vector pointing from center to the first vertex.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
double d_r
Distance between center and the farthest vertex of hexagon.
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.
std::vector< util::Point > d_vertices
Vertices.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
std::vector< util::Point > d_vertices
Vertices.
Line(double L, util::Point x=util::Point(), std::string description="")
Constructor.
Line & operator=(const Line &other)
Assignment operator.
double d_r
Radius of bounding circle.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool wallContactQuery(const util::Point &x, WallContactHit &hit) const override
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.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
Line(const Line &other)
Copy constructor.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
void print(int nt, int lvl) 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 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.
void print() const override
Prints the information about the object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Line(util::Point x1, util::Point x2, std::string description="")
Constructor.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
Defines null (empty) geom object.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
NullGeomObject(const NullGeomObject &other)
Copy constructor.
void print() const override
Prints the information about the object.
virtual std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
NullGeomObject(std::string description="")
Constructor.
void print(int nt, int lvl) const override
Prints the information about the object.
NullGeomObject & operator=(const NullGeomObject &other)
Assignment operator.
Infinite plane: free space is the half-space in the normal direction.
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 &) const override
Checks if point is within given distance of this object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
Plane(util::Point n, util::Point p, std::string description="")
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
util::Point d_p
a point on the plane
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the 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.
Plane(const Plane &other)
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
Plane & operator=(const Plane &other)
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
std::pair< util::Point, util::Point > box(const double &tol) const override
Computes the bounding box of object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
void print() const override
Prints the information about the object.
util::Point d_n
outward (free-space) normal, stored unit-length when possible
void print(int nt, int lvl) const override
Prints the information about the object.
bool wallContactQuery(const util::Point &x, WallContactHit &hit) const override
Closest-point / signed-gap query for analytical wall contact. Default: unsupported (returns false,...
std::vector< util::Point > d_vertices
Vertices.
Rectangle(const Rectangle &other)
Copy constructor.
Rectangle(util::Point x1, util::Point x2, std::string description="")
Constructor.
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 doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
Rectangle(double Lx, double Ly, util::Point x=util::Point(), std::string description="")
Constructor.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
double d_r
Radius of bounding circle.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
void print(int nt, int lvl) const override
Prints the information about the object.
bool wallContactQuery(const util::Point &x, WallContactHit &hit) const override
bool isInside(const util::Point &x) const override
Checks if point is inside this 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.
Rectangle & operator=(const Rectangle &other)
Assignment operator.
double d_Lx
Edge length of a rectangle in x-direction.
double d_Ly
Edge length of a rectangle in y-direction.
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.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isInside(const util::Point &x) const override
Checks if point is inside 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.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
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.
util::Point center() const override
Computes the center of object.
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.
Sphere(const Sphere &other)
Copy constructor.
Sphere(double r, 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.
Sphere & operator=(const Sphere &other)
Assignment operator.
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.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
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 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.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
Square & operator=(const Square &other)
Assignment operator.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
Square(util::Point x1, util::Point x2, std::string description="")
Constructor.
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.
std::vector< util::Point > d_vertices
Vertices.
void print(int nt, int lvl) const override
Prints the information about the object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
double d_L
Edge length of a square.
double d_r
Radius of bounding circle.
void print() const override
Prints the information about the object.
Square(const Square &other)
Copy constructor.
void print() 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.
Triangle(util::Point v0, util::Point v1, util::Point v2, std::string description="vertices")
Constructor from three vertices (arbitrary triangle, e.g. a V-notch). Params in decks: x1,...
util::Point d_a
Axis: defined as the vector pointing from center to the first vertex v2 +.
void print(int nt, int lvl) const override
Prints the information about the object.
std::vector< util::Point > d_vertices
Vertices.
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.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
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.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
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.
Triangle & operator=(const Triangle &other)
Assignment operator.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
double d_r
Distance between center and the farthest vertex of triangle.
Triangle(const Triangle &other)
Copy constructor.
util::Point mapSimilarity(const util::Point &x, const util::Point &pivotDefault, const util::Point &t, double scale, double angle, const util::Point &axis, const util::Point *rotationPoint)
const std::map< std::string, size_t > geom_type_to_dim
Geometry type to dimension map.
size_t getGeomTypeToDim(std::string type)
Returns list of acceptable geometries for PeriDEM simulation.
std::string getTabS(int nt)
Returns tab spaces of a given size.
Collection of methods useful in simulation.
bool isGreater(const double &a, const double &b)
Returns true if a > b.
bool isLess(const double &a, const double &b)
Returns true if a < b.
util::Point rotate(const util::Point &p, const double &theta, const util::Point &axis)
Returns the vector after rotating by desired angle.
Defines simple rectangle domain.
bool isNear(const BoxPartition &box, const double &tol) const
bool isNear(const util::Point &x, const double &tol) const
std::pair< util::Point, util::Point > d_box
void addNode(const size_t &i)
std::vector< size_t > d_nodes
A structure to represent 3d vectors.
double d_y
the y coordinate
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
double d_z
the z coordinate
double length() const
Computes the Euclidean length of the vector.
double d_x
the x coordinate