PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
openRectChannel2D.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2026 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0.
8 */
9
10#ifndef GEOM_OPEN_RECT_CHANNEL_2D_H
11#define GEOM_OPEN_RECT_CHANNEL_2D_H
12
13#include "geomObjects.h"
14#include <string>
15#include <utility>
16#include <vector>
17
18namespace geom {
19
31public:
32 double d_x0 = 0.;
33 double d_y0 = 0.;
34 double d_x1 = 0.;
35 double d_y1 = 0.;
36 double d_t = 0.;
37 double d_z = 0.;
39 std::vector<util::Point> d_vertices;
40
43
45
46 OpenRectChannel2D(double x0, double y0, double x1, double y1, double t, double z,
47 std::string description = "");
48
50
52
53 void buildVertices();
54
55 void transform(const util::Point &translation, const double &scale, const double &angle,
56 const util::Point &axis, const util::Point *rotationPoint) override;
57
58 double volume() const override;
59 util::Point center() const override;
60 std::pair<util::Point, util::Point> box() const override;
61 std::pair<util::Point, util::Point> box(const double &tol) const override;
62 double inscribedRadius() const override;
63 double boundingRadius() const override;
64
65 bool isInside(const util::Point &x) const override;
66 bool isOutside(const util::Point &x) const override;
67 bool isNear(const util::Point &x, const double &tol) const override;
68 bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override;
69 bool doesIntersect(const util::Point &x) const override;
70
71 bool isInside(const std::pair<util::Point, util::Point> &bx) const override;
72 bool isOutside(const std::pair<util::Point, util::Point> &bx) const override;
73 bool isNear(const std::pair<util::Point, util::Point> &bx, const double &tol) const override;
74 bool doesIntersect(const std::pair<util::Point, util::Point> &bx) const override;
75
76 std::string printStr(int nt = 0, int lvl = 0) const override;
77 void print(int nt = 0, int lvl = 0) const override { std::cout << printStr(nt, lvl); };
78 void print() const override { print(0, 0); };
79
80private:
81 bool pointInPolygon2D(const util::Point &p) const;
82 double polygonArea2D() const;
84};
85
86} // namespace geom
87
88#endif
Defines abstract geometrical domain.
2D U-shaped cavity: thick rectangular frame with the top (+y) side open.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
bool pointInPolygon2D(const util::Point &p) const
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.
util::Point center() const override
Computes the center of object.
util::Point polygonCentroid2D() const
OpenRectChannel2D & operator=(const OpenRectChannel2D &other)
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::vector< util::Point > d_vertices
CCW boundary of the U-shaped solid (10 vertices, uniform thickness t).
std::string printStr(int nt=0, int lvl=0) const override
Returns the string containing printable 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.
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
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.
util::Point d_x
Area centroid of the polygon (same convention as d_x on other GeomObjects).
void print(int nt=0, int lvl=0) 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.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
A structure to represent 3d vectors.
Definition point.h:30