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

Hollow axis-aligned cuboid shell with uniform wall thickness and one outer face open. More...

#include <openCuboidChannel3D.h>

Inheritance diagram for geom::OpenCuboidChannel3D:
Collaboration diagram for geom::OpenCuboidChannel3D:

Public Member Functions

 OpenCuboidChannel3D ()
 
 OpenCuboidChannel3D (double x0, double y0, double z0, double x1, double y1, double z1, double t, int open_face, std::string description="")
 
 OpenCuboidChannel3D (const OpenCuboidChannel3D &other)
 
OpenCuboidChannel3Doperator= (const OpenCuboidChannel3D &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 \(\mathbf p\) (default: old center d_x), then rigid displacement \(\mathbf t\) = translation: \(\mathbf y = \mathbf p + s\,\mathbf R(\mathbf x-\mathbf p) + \mathbf t\). When \(\theta=0\) and \(s=1\), \(\mathbf y = \mathbf x + \mathbf t\) for every point and the center.
 
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.
 
std::pair< util::Point, util::Pointbox () const override
 Computes the bounding box of object.
 
std::pair< util::Point, util::Pointbox (const double &tol) const override
 Computes the bounding box of object.
 
double inscribedRadius () const override
 Computes the radius of biggest circle/sphere completely within the 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.
 
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.
 
bool isNearBoundary (const util::Point &x, const double &tol, const bool &within) 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 std::pair< util::Point, util::Point > &bx) const override
 Checks if box is completely inside.
 
bool isOutside (const std::pair< util::Point, util::Point > &bx) const override
 Checks if box is outside of the object.
 
bool isNear (const std::pair< util::Point, util::Point > &bx, const double &tol) const override
 Checks if box is within given distance of this object.
 
bool doesIntersect (const std::pair< util::Point, util::Point > &bx) const override
 Checks if box intersects this object.
 
std::string printStr (int nt=0, int lvl=0) const override
 Returns the string containing printable information about the object.
 
void print (int nt=0, int lvl=0) const override
 Prints the information about the object.
 
void print () const override
 Prints the information about the object.
 
- Public Member Functions inherited from geom::GeomObject
 GeomObject (std::string name="", std::string description="")
 Constructor.
 
virtual bool wallContactQuery (const util::Point &x, WallContactHit &hit) const
 Closest-point / signed-gap query for analytical wall contact. Default: unsupported (returns false, clears hit).
 

Data Fields

util::Point d_lo
 Outer AABB low corner.
 
util::Point d_hi
 Outer AABB high corner.
 
double d_t = 0.
 Wall thickness.
 
int d_openFace = 0
 Which outer face is open: 0=+x, 1=−x, 2=+y, 3=−y, 4=+z, 5=−z (world axes after transform).
 
util::Point d_x
 Centroid of the open shell (cached).
 
- Data Fields inherited from geom::GeomObject
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.
 

Private Member Functions

void validateAndRefreshCenter ()
 
bool inClosedShell (const util::Point &p) const
 
bool inRemovedFaceSlab (const util::Point &p) const
 
util::Point computeCenter () const
 

Detailed Description

Hollow axis-aligned cuboid shell with uniform wall thickness and one outer face open.

Deck / GeomObject::d_name: **open_cuboid_channel_3d** (pairs with 2D open_rect_channel_2d, which uses a rectangular footprint in the plane).

Parameters (createGeomObject): x0,y0,z0,x1,y1,z1,t,open_face — outer AABB [x0,x1]×[y0,y1]×[z0,z1], wall thickness t, and open_face ∈ {0,…,5}: 0 = +x, 1 = −x, 2 = +y, 3 = −y, 4 = +z, 5 = −z (world axes).

The solid is the closed shell (outer minus inner cavity) with the corresponding outer face slab removed (the “roof” / lid of that side), so the cavity connects to the exterior through that opening.

Definition at line 34 of file openCuboidChannel3D.h.

Constructor & Destructor Documentation

◆ OpenCuboidChannel3D() [1/3]

geom::OpenCuboidChannel3D::OpenCuboidChannel3D ( )

Definition at line 62 of file openCuboidChannel3D.cpp.

63 : GeomObject("open_cuboid_channel_3d", "") {}
GeomObject(std::string name="", std::string description="")
Constructor.

◆ OpenCuboidChannel3D() [2/3]

geom::OpenCuboidChannel3D::OpenCuboidChannel3D ( double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1,
double  t,
int  open_face,
std::string  description = "" 
)

Definition at line 65 of file openCuboidChannel3D.cpp.

67 : GeomObject("open_cuboid_channel_3d", std::move(description)),
68 d_lo(x0, y0, z0),
69 d_hi(x1, y1, z1),
70 d_t(t),
71 d_openFace(open_face) {
72 validateParams(x0, y0, z0, x1, y1, z1, t, open_face);
74}
int d_openFace
Which outer face is open: 0=+x, 1=−x, 2=+y, 3=−y, 4=+z, 5=−z (world axes after transform).
util::Point d_lo
Outer AABB low corner.
double d_t
Wall thickness.
util::Point d_hi
Outer AABB high corner.
void validateParams(double x0, double y0, double z0, double x1, double y1, double z1, double t, int open_face)

References validateAndRefreshCenter().

Here is the call graph for this function:

◆ OpenCuboidChannel3D() [3/3]

geom::OpenCuboidChannel3D::OpenCuboidChannel3D ( const OpenCuboidChannel3D other)

Definition at line 76 of file openCuboidChannel3D.cpp.

77 : GeomObject(other.d_name, other.d_description),
78 d_lo(other.d_lo),
79 d_hi(other.d_hi),
80 d_t(other.d_t),
81 d_openFace(other.d_openFace),
82 d_x(other.d_x) {
83 d_tags = other.d_tags;
84}
std::vector< std::string > d_tags
Tags/attributes about the object.
util::Point d_x
Centroid of the open shell (cached).

References geom::GeomObject::d_tags.

Member Function Documentation

◆ boundingRadius()

double geom::OpenCuboidChannel3D::boundingRadius ( ) const
overridevirtual

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

Returns
Radius Radius of bounding circle/sphere

Reimplemented from geom::GeomObject.

Definition at line 265 of file openCuboidChannel3D.cpp.

265 {
266 const util::Point &c = d_x;
267 util::Point c8[8];
269 double r = 0.;
270 for (int i = 0; i < 8; ++i)
271 r = std::max(r, (c8[i] - c).length());
272 return r;
273}
void cornersFromAabb(const util::Point &lo, const util::Point &hi, util::Point *out8)
A structure to represent 3d vectors.
Definition point.h:30

References d_hi, d_lo, and d_x.

◆ box() [1/2]

std::pair< util::Point, util::Point > geom::OpenCuboidChannel3D::box ( ) const
overridevirtual

Computes the bounding box of object.

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

Reimplemented from geom::GeomObject.

Definition at line 257 of file openCuboidChannel3D.cpp.

257{ return box(0.); }
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.

References box().

Referenced by box(), isNear(), and isNear().

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

◆ box() [2/2]

std::pair< util::Point, util::Point > geom::OpenCuboidChannel3D::box ( const double &  tol) const
overridevirtual

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 from geom::GeomObject.

Definition at line 259 of file openCuboidChannel3D.cpp.

259 {
260 return {d_lo - tol, d_hi + tol};
261}

References d_hi, and d_lo.

◆ center()

util::Point geom::OpenCuboidChannel3D::center ( ) const
overridevirtual

Computes the center of object.

Returns
Point Coordinates of center

Reimplemented from geom::GeomObject.

Definition at line 255 of file openCuboidChannel3D.cpp.

255{ return d_x; }

References d_x.

◆ computeCenter()

util::Point geom::OpenCuboidChannel3D::computeCenter ( ) const
private

Definition at line 179 of file openCuboidChannel3D.cpp.

179 {
180 const double Lx = d_hi.d_x - d_lo.d_x;
181 const double Ly = d_hi.d_y - d_lo.d_y;
182 const double Lz = d_hi.d_z - d_lo.d_z;
183 const double t = d_t;
184 const double Vout = Lx * Ly * Lz;
185 const double Vin = std::max(0., (Lx - 2. * t) * (Ly - 2. * t) * (Lz - 2. * t));
186 const double Vclosed = Vout - Vin;
187 const double cx = 0.5 * (d_lo.d_x + d_hi.d_x);
188 const double cy = 0.5 * (d_lo.d_y + d_hi.d_y);
189 const double cz = 0.5 * (d_lo.d_z + d_hi.d_z);
190 util::Point c_closed(cx, cy, cz);
191 if (Vclosed <= 1.0e-30)
192 return c_closed;
193
194 if (d_openFace < 0 || d_openFace > 5)
195 return c_closed;
196
197 double Aface = 0.;
198 util::Point c_roof(cx, cy, cz);
199 if (d_openFace == 0 || d_openFace == 1) {
200 Aface = Ly * Lz - std::max(0., (Ly - 2. * t) * (Lz - 2. * t));
201 c_roof.d_x = (d_openFace == 0) ? d_hi.d_x - 0.5 * t : d_lo.d_x + 0.5 * t;
202 c_roof.d_y = cy;
203 c_roof.d_z = cz;
204 } else if (d_openFace == 2 || d_openFace == 3) {
205 Aface = Lx * Lz - std::max(0., (Lx - 2. * t) * (Lz - 2. * t));
206 c_roof.d_y = (d_openFace == 2) ? d_hi.d_y - 0.5 * t : d_lo.d_y + 0.5 * t;
207 c_roof.d_x = cx;
208 c_roof.d_z = cz;
209 } else {
210 Aface = Lx * Ly - std::max(0., (Lx - 2. * t) * (Ly - 2. * t));
211 c_roof.d_z = (d_openFace == 4) ? d_hi.d_z - 0.5 * t : d_lo.d_z + 0.5 * t;
212 c_roof.d_x = cx;
213 c_roof.d_y = cy;
214 }
215 const double Vroof = Aface * t;
216 const double Vopen = Vclosed - Vroof;
217 if (Vopen <= 1.0e-30)
218 return c_closed;
219 return (1. / Vopen) * (Vclosed * c_closed - Vroof * c_roof);
220}
double d_y
the y coordinate
Definition point.h:36
double d_z
the z coordinate
Definition point.h:39
double d_x
the x coordinate
Definition point.h:33

References d_hi, d_lo, d_openFace, d_t, util::Point::d_x, util::Point::d_y, and util::Point::d_z.

Referenced by transform(), and validateAndRefreshCenter().

Here is the caller graph for this function:

◆ doesIntersect() [1/2]

bool geom::OpenCuboidChannel3D::doesIntersect ( const std::pair< util::Point, util::Point > &  box) const
overridevirtual

Checks if box intersects this object.

Parameters
boxBox
Returns
True True if intersects

Reimplemented from geom::GeomObject.

Definition at line 321 of file openCuboidChannel3D.cpp.

321 {
322 for (auto p : geom::getCornerPoints(3, bx))
323 if (this->isInside(p))
324 return true;
325 return false;
326}
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
std::vector< util::Point > getCornerPoints(size_t dim, const std::pair< util::Point, util::Point > &box)
Returns all corner points in the box.

References geom::getCornerPoints(), and isInside().

Here is the call graph for this function:

◆ doesIntersect() [2/2]

bool geom::OpenCuboidChannel3D::doesIntersect ( const util::Point x) const
overridevirtual

Checks if point lies exactly on the boundary.

Parameters
xPoint
Returns
True True if it lies on the boundary

Reimplemented from geom::GeomObject.

Definition at line 297 of file openCuboidChannel3D.cpp.

297 {
298 return isNearBoundary(x, 1.0e-8, false);
299}
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
Checks if point is within given distance of this object.

References isNearBoundary().

Here is the call graph for this function:

◆ inClosedShell()

bool geom::OpenCuboidChannel3D::inClosedShell ( const util::Point p) const
private

Definition at line 100 of file openCuboidChannel3D.cpp.

100 {
101 const auto &L = d_lo;
102 const auto &H = d_hi;
103 const double t = d_t;
104 const bool in_outer =
105 p.d_x >= L.d_x && p.d_x <= H.d_x && p.d_y >= L.d_y && p.d_y <= H.d_y && p.d_z >= L.d_z &&
106 p.d_z <= H.d_z;
107 const double xi0 = L.d_x + t, xi1 = H.d_x - t;
108 const double yi0 = L.d_y + t, yi1 = H.d_y - t;
109 const double zi0 = L.d_z + t, zi1 = H.d_z - t;
110 const bool in_inner =
111 p.d_x >= xi0 && p.d_x <= xi1 && p.d_y >= yi0 && p.d_y <= yi1 && p.d_z >= zi0 && p.d_z <= zi1;
112 return in_outer && !in_inner;
113}

References d_hi, d_lo, d_t, util::Point::d_x, util::Point::d_y, and util::Point::d_z.

Referenced by inRemovedFaceSlab(), and isInside().

Here is the caller graph for this function:

◆ inRemovedFaceSlab()

bool geom::OpenCuboidChannel3D::inRemovedFaceSlab ( const util::Point p) const
private

Definition at line 115 of file openCuboidChannel3D.cpp.

115 {
116 if (!inClosedShell(p))
117 return false;
118 const auto &L = d_lo;
119 const auto &H = d_hi;
120 const double t = d_t;
121 constexpr double eps = 1.0e-12;
122 const double x0 = L.d_x, y0 = L.d_y, z0 = L.d_z;
123 const double x1 = H.d_x, y1 = H.d_y, z1 = H.d_z;
124
125 switch (d_openFace) {
126 case 0: { // +x: slab x in [x1-t, x1], (y,z) annulus on +x face
127 if (p.d_x < x1 - t - eps || p.d_x > x1 + eps)
128 return false;
129 const bool oyz = p.d_y >= y0 && p.d_y <= y1 && p.d_z >= z0 && p.d_z <= z1;
130 const bool iyz =
131 p.d_y >= y0 + t && p.d_y <= y1 - t && p.d_z >= z0 + t && p.d_z <= z1 - t;
132 return oyz && !iyz;
133 }
134 case 1: { // -x
135 if (p.d_x < x0 - eps || p.d_x > x0 + t + eps)
136 return false;
137 const bool oyz = p.d_y >= y0 && p.d_y <= y1 && p.d_z >= z0 && p.d_z <= z1;
138 const bool iyz =
139 p.d_y >= y0 + t && p.d_y <= y1 - t && p.d_z >= z0 + t && p.d_z <= z1 - t;
140 return oyz && !iyz;
141 }
142 case 2: { // +y
143 if (p.d_y < y1 - t - eps || p.d_y > y1 + eps)
144 return false;
145 const bool oxz = p.d_x >= x0 && p.d_x <= x1 && p.d_z >= z0 && p.d_z <= z1;
146 const bool ixz =
147 p.d_x >= x0 + t && p.d_x <= x1 - t && p.d_z >= z0 + t && p.d_z <= z1 - t;
148 return oxz && !ixz;
149 }
150 case 3: { // -y
151 if (p.d_y < y0 - eps || p.d_y > y0 + t + eps)
152 return false;
153 const bool oxz = p.d_x >= x0 && p.d_x <= x1 && p.d_z >= z0 && p.d_z <= z1;
154 const bool ixz =
155 p.d_x >= x0 + t && p.d_x <= x1 - t && p.d_z >= z0 + t && p.d_z <= z1 - t;
156 return oxz && !ixz;
157 }
158 case 4: { // +z: roof slab
159 if (p.d_z < z1 - t - eps || p.d_z > z1 + eps)
160 return false;
161 const bool oxy = p.d_x >= x0 && p.d_x <= x1 && p.d_y >= y0 && p.d_y <= y1;
162 const bool ixy =
163 p.d_x >= x0 + t && p.d_x <= x1 - t && p.d_y >= y0 + t && p.d_y <= y1 - t;
164 return oxy && !ixy;
165 }
166 case 5: { // -z
167 if (p.d_z < z0 - eps || p.d_z > z0 + t + eps)
168 return false;
169 const bool oxy = p.d_x >= x0 && p.d_x <= x1 && p.d_y >= y0 && p.d_y <= y1;
170 const bool ixy =
171 p.d_x >= x0 + t && p.d_x <= x1 - t && p.d_y >= y0 + t && p.d_y <= y1 - t;
172 return oxy && !ixy;
173 }
174 default:
175 return false;
176 }
177}
bool inClosedShell(const util::Point &p) const

References d_hi, d_lo, d_openFace, d_t, util::Point::d_x, util::Point::d_y, util::Point::d_z, and inClosedShell().

Referenced by isInside().

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

◆ inscribedRadius()

double geom::OpenCuboidChannel3D::inscribedRadius ( ) const
overridevirtual

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

Returns
Radius Radius of inscribed circle/sphere

Reimplemented from geom::GeomObject.

Definition at line 263 of file openCuboidChannel3D.cpp.

263{ return 0.5 * d_t; }

References d_t.

◆ isInside() [1/2]

bool geom::OpenCuboidChannel3D::isInside ( const std::pair< util::Point, util::Point > &  box) const
overridevirtual

Checks if box is completely inside.

Parameters
boxBox
Returns
True True if box lies inside

Reimplemented from geom::GeomObject.

Definition at line 301 of file openCuboidChannel3D.cpp.

301 {
302 for (auto p : geom::getCornerPoints(3, bx))
303 if (!this->isInside(p))
304 return false;
305 return true;
306}

References geom::getCornerPoints(), and isInside().

Here is the call graph for this function:

◆ isInside() [2/2]

bool geom::OpenCuboidChannel3D::isInside ( const util::Point x) const
overridevirtual

Checks if point is inside this object.

Parameters
xPoint
Returns
True If point lies inside

Reimplemented from geom::GeomObject.

Definition at line 275 of file openCuboidChannel3D.cpp.

275 {
276 return inClosedShell(x) && !inRemovedFaceSlab(x);
277}
bool inRemovedFaceSlab(const util::Point &p) const

References inClosedShell(), and inRemovedFaceSlab().

Referenced by doesIntersect(), isInside(), isNearBoundary(), isOutside(), and isOutside().

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

◆ isNear() [1/2]

bool geom::OpenCuboidChannel3D::isNear ( const std::pair< util::Point, util::Point > &  box,
const double &  tol 
) const
overridevirtual

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 from geom::GeomObject.

Definition at line 316 of file openCuboidChannel3D.cpp.

317 {
318 return geom::areBoxesNear(this->box(), bx, tol, 3);
319}
bool areBoxesNear(const std::pair< util::Point, util::Point > &b1, const std::pair< util::Point, util::Point > &b2, const double &tol, size_t dim)
Checks if given two boxes are within given distance from each other.

References geom::areBoxesNear(), and box().

Here is the call graph for this function:

◆ isNear() [2/2]

bool geom::OpenCuboidChannel3D::isNear ( const util::Point x,
const double &  tol 
) const
overridevirtual

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 from geom::GeomObject.

Definition at line 281 of file openCuboidChannel3D.cpp.

281 {
282 return geom::isPointInsideBox(x, 3, box(tol));
283}
bool isPointInsideBox(util::Point x, size_t dim, const std::pair< util::Point, util::Point > &box)
Returns true if point is inside box.

References box(), and geom::isPointInsideBox().

Referenced by isNearBoundary().

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

◆ isNearBoundary()

bool geom::OpenCuboidChannel3D::isNearBoundary ( const util::Point x,
const double &  tol,
const bool &  within 
) const
overridevirtual

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 from geom::GeomObject.

Definition at line 285 of file openCuboidChannel3D.cpp.

286 {
287 if (!isNear(x, within ? 0. : tol))
288 return false;
289 return isInside(x) && (isOutside(x + util::Point(tol, 0., 0.)) ||
290 isOutside(x - util::Point(tol, 0., 0.)) ||
291 isOutside(x + util::Point(0., tol, 0.)) ||
292 isOutside(x - util::Point(0., tol, 0.)) ||
293 isOutside(x + util::Point(0., 0., tol)) ||
294 isOutside(x - util::Point(0., 0., tol)));
295}
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.

References isInside(), isNear(), and isOutside().

Referenced by doesIntersect().

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

◆ isOutside() [1/2]

bool geom::OpenCuboidChannel3D::isOutside ( const std::pair< util::Point, util::Point > &  box) const
overridevirtual

Checks if box is outside of the object.

Parameters
boxBox
Returns
True True if box lies outside

Reimplemented from geom::GeomObject.

Definition at line 308 of file openCuboidChannel3D.cpp.

308 {
309 bool intersect = false;
310 for (auto p : geom::getCornerPoints(3, bx))
311 if (!intersect)
312 intersect = this->isInside(p);
313 return !intersect;
314}

References geom::getCornerPoints(), and isInside().

Here is the call graph for this function:

◆ isOutside() [2/2]

bool geom::OpenCuboidChannel3D::isOutside ( const util::Point x) const
overridevirtual

Checks if point is outside of this object.

Parameters
xPoint
Returns
True If point lies outside

Reimplemented from geom::GeomObject.

Definition at line 279 of file openCuboidChannel3D.cpp.

279{ return !isInside(x); }

References isInside().

Referenced by isNearBoundary().

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

◆ operator=()

OpenCuboidChannel3D & geom::OpenCuboidChannel3D::operator= ( const OpenCuboidChannel3D other)

Definition at line 86 of file openCuboidChannel3D.cpp.

86 {
87 if (this != &other) {
88 d_tags = other.d_tags;
89 d_lo = other.d_lo;
90 d_hi = other.d_hi;
91 d_t = other.d_t;
92 d_openFace = other.d_openFace;
93 d_x = other.d_x;
94 }
95 return *this;
96}

References d_hi, d_lo, d_openFace, d_t, geom::GeomObject::d_tags, and d_x.

◆ print() [1/2]

void geom::OpenCuboidChannel3D::print ( ) const
inlineoverridevirtual

Prints the information about the object.

Reimplemented from geom::GeomObject.

Definition at line 82 of file openCuboidChannel3D.h.

82{ print(0, 0); };
void print() const override
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]

void geom::OpenCuboidChannel3D::print ( int  nt = 0,
int  lvl = 0 
) const
inlineoverridevirtual

Prints the information about the object.

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

Reimplemented from geom::GeomObject.

Definition at line 81 of file openCuboidChannel3D.h.

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

References printStr().

Here is the call graph for this function:

◆ printStr()

std::string geom::OpenCuboidChannel3D::printStr ( int  nt = 0,
int  lvl = 0 
) const
overridevirtual

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 from geom::GeomObject.

Definition at line 328 of file openCuboidChannel3D.cpp.

328 {
329 auto tabS = util::io::getTabS(nt);
330 std::ostringstream oss;
331 oss << tabS << "------- OpenCuboidChannel3D (open shell) --------" << std::endl;
332 oss << tabS << "Outer AABB: [" << d_lo.d_x << "," << d_lo.d_y << "," << d_lo.d_z << "] — ["
333 << d_hi.d_x << "," << d_hi.d_y << "," << d_hi.d_z << "], t=" << d_t
334 << ", open_face=" << d_openFace << std::endl;
335 oss << tabS << "Center (d_x) = " << d_x.printStr() << std::endl;
336 if (lvl > 0)
337 oss << tabS << "volume = " << volume() << std::endl;
338 return oss.str();
339}
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
std::string getTabS(int nt)
Returns tab spaces of a given size.
Definition io.h:39
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
Definition point.h:94

References d_hi, d_lo, d_openFace, d_t, d_x, util::Point::d_x, util::Point::d_y, util::Point::d_z, util::io::getTabS(), util::Point::printStr(), and volume().

Referenced by print().

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

◆ transform()

void geom::OpenCuboidChannel3D::transform ( const util::Point translation,
const double &  scale,
const double &  angle,
const util::Point axis,
const util::Point rotationPoint 
)
overridevirtual

Similarity about pivot \(\mathbf p\) (default: old center d_x), then rigid displacement \(\mathbf t\) = translation: \(\mathbf y = \mathbf p + s\,\mathbf R(\mathbf x-\mathbf p) + \mathbf t\). When \(\theta=0\) and \(s=1\), \(\mathbf y = \mathbf x + \mathbf t\) for every point and the center.

Parameters
translationRigid translation vector \(\mathbf t\) (added after rotate+scale about \(\mathbf p\))
scaleUniform scale factor
angleRotation angle (radians)
axisAxis of rotation
rotationPointIf non-null, use as \(\mathbf p\); if null, use old d_x as pivot.

Reimplemented from geom::GeomObject.

Definition at line 222 of file openCuboidChannel3D.cpp.

224 {
225 const util::Point c0 = d_x;
226 d_t *= scale;
227 util::Point c[8];
229 for (int i = 0; i < 8; ++i)
230 c[i] = mapSimilarity(c[i], c0, translation, scale, angle, axis, rotationPoint);
233 d_x = computeCenter();
234}
void aabbFromCorners(const util::Point *c, util::Point &lo, util::Point &hi)
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)
Definition geomObjects.h:55

References computeCenter(), d_hi, d_lo, d_openFace, d_t, d_x, util::Point::d_x, util::Point::d_y, util::Point::d_z, and geom::mapSimilarity().

Here is the call graph for this function:

◆ validateAndRefreshCenter()

void geom::OpenCuboidChannel3D::validateAndRefreshCenter ( )
private

Definition at line 98 of file openCuboidChannel3D.cpp.

98{ d_x = computeCenter(); }

References computeCenter(), and d_x.

Referenced by OpenCuboidChannel3D().

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

◆ volume()

double geom::OpenCuboidChannel3D::volume ( ) const
overridevirtual

Computes the volume (area in 2d, length in 1d) of object.

Returns
Volume Volume of object

Reimplemented from geom::GeomObject.

Definition at line 236 of file openCuboidChannel3D.cpp.

236 {
237 const double Lx = d_hi.d_x - d_lo.d_x;
238 const double Ly = d_hi.d_y - d_lo.d_y;
239 const double Lz = d_hi.d_z - d_lo.d_z;
240 const double t = d_t;
241 const double Vout = Lx * Ly * Lz;
242 const double Vin = std::max(0., (Lx - 2. * t) * (Ly - 2. * t) * (Lz - 2. * t));
243 const double Vclosed = Vout - Vin;
244 double Aface = 0.;
245 if (d_openFace == 0 || d_openFace == 1)
246 Aface = Ly * Lz - std::max(0., (Ly - 2. * t) * (Lz - 2. * t));
247 else if (d_openFace == 2 || d_openFace == 3)
248 Aface = Lx * Lz - std::max(0., (Lx - 2. * t) * (Lz - 2. * t));
249 else
250 Aface = Lx * Ly - std::max(0., (Lx - 2. * t) * (Ly - 2. * t));
251 const double Vroof = Aface * t;
252 return std::max(0., Vclosed - Vroof);
253}

References d_hi, d_lo, d_openFace, d_t, util::Point::d_x, util::Point::d_y, and util::Point::d_z.

Referenced by printStr().

Here is the caller graph for this function:

Field Documentation

◆ d_hi

◆ d_lo

◆ d_openFace

int geom::OpenCuboidChannel3D::d_openFace = 0

◆ d_t

◆ d_x

util::Point geom::OpenCuboidChannel3D::d_x

Centroid of the open shell (cached).

Definition at line 48 of file openCuboidChannel3D.h.

Referenced by boundingRadius(), center(), operator=(), printStr(), transform(), and validateAndRefreshCenter().


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