OGS
GeoMapper.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "GeoMapper.h"
5
6#include <algorithm>
7#include <iterator>
8#include <numeric>
9#include <sstream>
10
11#include "BaseLib/Algorithm.h"
12#include "BaseLib/Logging.h"
13#include "GeoLib/AABB.h"
15#include "GeoLib/GEOObjects.h"
16#include "GeoLib/Raster.h"
20#include "MeshLib/Mesh.h"
22#include "MeshLib/Node.h"
24
25namespace MeshGeoToolsLib
26{
28 const std::string& geo_name)
29 : _geo_objects(geo_objects),
30 _geo_name(const_cast<std::string&>(geo_name)),
31 _raster(nullptr)
32{
33}
34
39
40void GeoMapper::mapOnDEM(std::unique_ptr<GeoLib::Raster const> raster)
41{
42 std::vector<GeoLib::Point*> const* pnts(
43 _geo_objects.getPointVec(_geo_name));
44 if (!pnts)
45 {
46 ERR("Geometry '{:s}' does not exist.", _geo_name);
47 return;
48 }
49 _raster = std::move(raster);
50
51 if (GeoLib::isStation((*pnts)[0]))
52 {
53 mapStationData(*pnts);
54 }
55 else
56 {
57 mapPointDataToDEM(*pnts);
58 }
59}
60
61void GeoMapper::mapOnMesh(MeshLib::Mesh const* const mesh)
62{
63 std::vector<GeoLib::Point*> const* pnts(
64 _geo_objects.getPointVec(_geo_name));
65 if (!pnts)
66 {
67 ERR("Geometry '{:s}' does not exist.", _geo_name);
68 return;
69 }
70
71 // the variable _surface_mesh is reused below, so first the existing
72 // _surface_mesh has to be cleaned up
73 delete _surface_mesh;
74
75 if (mesh->getDimension() < 3)
76 {
77 _surface_mesh = new MeshLib::Mesh(*mesh);
78 }
79 else
80 {
81 Eigen::Vector3d const dir(0, 0, -1);
84 }
85
86 // init grid
87 MathLib::Point3d origin(std::array<double, 3>{{0, 0, 0}});
88 std::vector<MeshLib::Node> flat_nodes;
89 flat_nodes.reserve(_surface_mesh->getNumberOfNodes());
90 // copy nodes and project the copied nodes to the x-y-plane, i.e. set
91 // z-coordinate to zero
92 for (auto n_ptr : _surface_mesh->getNodes())
93 {
94 flat_nodes.emplace_back(*n_ptr);
95 flat_nodes.back()[2] = 0.0;
96 }
97 _grid =
98 new GeoLib::Grid<MeshLib::Node>(flat_nodes.cbegin(), flat_nodes.cend());
99
100 if (GeoLib::isStation((*pnts)[0]))
101 {
102 mapStationData(*pnts);
103 }
104 else
105 {
107 }
108
109 delete _grid;
110}
111
113{
114 std::vector<GeoLib::Point*> const* points(
115 this->_geo_objects.getPointVec(this->_geo_name));
116 if (points == nullptr)
117 {
118 ERR("Geometry '{:s}' not found.", this->_geo_name);
119 return;
120 }
121 std::for_each(points->begin(), points->end(),
122 [value](GeoLib::Point* pnt) { (*pnt)[2] = value; });
123}
124
125void GeoMapper::mapStationData(std::vector<GeoLib::Point*> const& points)
126{
127 double min_val(0);
128 double max_val(0);
129 if (_surface_mesh)
130 {
131 GeoLib::AABB bounding_box(_surface_mesh->getNodes().begin(),
132 _surface_mesh->getNodes().end());
133 min_val = bounding_box.getMinPoint()[2];
134 max_val = bounding_box.getMaxPoint()[2];
135 }
136
137 for (auto* pnt : points)
138 {
139 double offset =
140 (_grid)
141 ? (getMeshElevation((*pnt)[0], (*pnt)[1], min_val, max_val) -
142 (*pnt)[2])
143 : getDemElevation(*pnt);
144
145 if (!GeoLib::isBorehole(pnt))
146 {
147 (*pnt)[2] = offset;
148 continue;
149 }
150 auto const& layers =
151 static_cast<GeoLib::StationBorehole*>(pnt)->getProfile();
152 for (auto* layer_pnt : layers)
153 {
154 (*layer_pnt)[2] = (*layer_pnt)[2] + offset;
155 }
156 }
157}
158
160 std::vector<GeoLib::Point*> const& points) const
161{
162 for (auto* pnt : points)
163 {
164 GeoLib::Point& p(*pnt);
165 p[2] = getDemElevation(p);
166 }
167}
168
170 std::vector<GeoLib::Point*> const& pnts)
171{
172 GeoLib::AABB const aabb(_surface_mesh->getNodes().cbegin(),
173 _surface_mesh->getNodes().cend());
174 auto const [min, max] = aabb.getMinMaxPoints();
175
176 for (auto* pnt : pnts)
177 {
178 // check if pnt is inside of the bounding box of the _surface_mesh
179 // projected onto the y-x plane
180 GeoLib::Point& p(*pnt);
181 if (p[0] < min[0] || max[0] < p[0])
182 {
183 continue;
184 }
185 if (p[1] < min[1] || max[1] < p[1])
186 {
187 continue;
188 }
189
190 p[2] = getMeshElevation(p[0], p[1], min[2], max[2]);
191 }
192}
193
195{
196 double const elevation(_raster->getValueAtPoint(pnt));
197 if (std::abs(elevation - _raster->getHeader().no_data) <
198 std::numeric_limits<double>::epsilon())
199 {
200 return 0.0;
201 }
202 return static_cast<float>(elevation);
203}
204
205double GeoMapper::getMeshElevation(double x, double y, double min_val,
206 double max_val) const
207{
208 const MeshLib::Node* pnt =
209 _grid->getNearestPoint(MathLib::Point3d{{{x, y, 0}}});
210 auto const elements(
211 _surface_mesh->getElementsConnectedToNode(pnt->getID()));
212 std::unique_ptr<GeoLib::Point> intersection;
213
214 for (auto const& element : elements)
215 {
216 if (intersection == nullptr &&
217 element->getGeomType() != MeshLib::MeshElemType::LINE)
218 {
220 *element->getNode(0), *element->getNode(1),
221 *element->getNode(2), GeoLib::Point(x, y, max_val),
222 GeoLib::Point(x, y, min_val));
223 }
224
225 if (intersection == nullptr &&
226 element->getGeomType() == MeshLib::MeshElemType::QUAD)
227 {
229 *element->getNode(0), *element->getNode(2),
230 *element->getNode(3), GeoLib::Point(x, y, max_val),
231 GeoLib::Point(x, y, min_val));
232 }
233 }
234 if (intersection)
235 {
236 return (*intersection)[2];
237 }
238 // if something goes wrong, simply take the elevation of the nearest mesh
239 // node
240 return (*(_surface_mesh->getNode(pnt->getID())))[2];
241}
242
250 std::vector<MeshLib::Element const*> const& elements,
251 MathLib::Point3d const& p)
252{
253 for (auto const elem : elements)
254 {
255 std::unique_ptr<MeshLib::Element> elem_2d(elem->clone());
256 // reset/copy the nodes
257 for (std::size_t k(0); k < elem_2d->getNumberOfNodes(); ++k)
258 {
259 elem_2d->setNode(k, new MeshLib::Node(*elem_2d->getNode(k)));
260 }
261 // project to xy
262 for (std::size_t k(0); k < elem_2d->getNumberOfNodes(); ++k)
263 {
264 (*const_cast<MeshLib::Node*>(elem_2d->getNode(k)))[2] = 0.0;
265 }
266 if (elem_2d->isPntInElement(MathLib::Point3d{{{p[0], p[1], 0.0}}}))
267 {
268 // clean up the copied nodes
269 for (std::size_t k(0); k < elem_2d->getNumberOfNodes(); ++k)
270 {
271 delete elem_2d->getNode(k);
272 }
273 return elem;
274 }
275 // clean up the copied nodes
276 for (std::size_t k(0); k < elem_2d->getNumberOfNodes(); ++k)
277 {
278 delete elem_2d->getNode(k);
279 }
280 }
281 return nullptr;
282}
283
284static std::vector<MathLib::Point3d> computeElementSegmentIntersections(
285 MeshLib::Element const& elem, GeoLib::LineSegment const& segment)
286{
287 std::vector<MathLib::Point3d> element_intersections;
288 for (std::size_t k(0); k < elem.getNumberOfEdges(); ++k)
289 {
290 auto const edge =
291 std::unique_ptr<MeshLib::Element const>(elem.getEdge(k));
292 GeoLib::LineSegment elem_segment{
293 new GeoLib::Point(*dynamic_cast<MathLib::Point3d*>(
294 const_cast<MeshLib::Node*>(edge->getNode(0))),
295 0),
296 new GeoLib::Point(*dynamic_cast<MathLib::Point3d*>(
297 const_cast<MeshLib::Node*>(edge->getNode(1))),
298 0),
299 true};
300 std::vector<MathLib::Point3d> const intersections(
301 GeoLib::lineSegmentIntersect2d(segment, elem_segment));
302 element_intersections.insert(end(element_intersections),
303 begin(intersections), end(intersections));
304 }
305 return element_intersections;
306}
307
308static std::vector<GeoLib::LineSegment> createSubSegmentsForElement(
309 std::vector<MathLib::Point3d> const& intersections,
310 MeshLib::Element const* const beg_elem,
311 MeshLib::Element const* const end_elem, MathLib::Point3d const& beg_pnt,
312 MathLib::Point3d const& end_pnt, MeshLib::Element const* const elem)
313{
314 std::vector<GeoLib::LineSegment> sub_segments;
315 if (intersections.size() > 2)
316 {
317 std::stringstream out;
318 out << "element with id " << elem->getID() << " and seg "
319 << " intersecting at more than two edges\n";
320 for (std::size_t k(0); k < intersections.size(); ++k)
321 {
322 out << k << " " << intersections[k] << "\n";
323 }
324 out << "Could not map segment on element. Aborting.\n";
325 OGS_FATAL("{:s}", out.str());
326 }
327
328 if (intersections.size() == 1 && elem == beg_elem)
329 {
330 // The line segment intersects the element that contains the begin
331 // point of the line segment. Here the first sub line segment is
332 // added.
333 if (MathLib::sqrDist(beg_pnt, intersections[0]) >
334 std::numeric_limits<double>::epsilon())
335 {
336 sub_segments.emplace_back(new GeoLib::Point{beg_pnt, 0},
337 new GeoLib::Point{intersections[0], 0},
338 true);
339 }
340 }
341
342 if (intersections.size() == 1 && elem == end_elem)
343 {
344 // The line segment intersects the element that contains the end
345 // point of the line segment. Here the last sub line segment is
346 // added.
347 if (MathLib::sqrDist(end_pnt, intersections[0]) >
348 std::numeric_limits<double>::epsilon())
349 {
350 sub_segments.emplace_back(new GeoLib::Point{intersections[0], 0},
351 new GeoLib::Point{end_pnt, 0}, true);
352 }
353 }
354
355 if (intersections.size() == 1 && (elem != beg_elem && elem != end_elem))
356 {
357 // Since the line segment enters and leaves the element in the same
358 // point there isn't any need to insert a new sub line segment.
359 return sub_segments;
360 }
361
362 // create sub segment for the current element
363 if (intersections.size() == 2)
364 {
365 sub_segments.emplace_back(new GeoLib::Point{intersections[0], 0},
366 new GeoLib::Point{intersections[1], 0}, true);
367 }
368 return sub_segments;
369}
370
371static std::vector<GeoLib::LineSegment> mapLineSegment(
372 GeoLib::LineSegment const& segment,
373 std::vector<MeshLib::Element const*> const& surface_elements,
374 MeshLib::Element const* const beg_elem,
375 MeshLib::Element const* const end_elem)
376{
377 std::vector<GeoLib::LineSegment> sub_segments;
378 MathLib::Point3d const& beg_pnt(segment.getBeginPoint());
379 MathLib::Point3d const& end_pnt(segment.getEndPoint());
380
381 for (auto const elem : surface_elements)
382 {
383 // compute element-segment-intersections (2d in x-y-plane)
384 std::vector<MathLib::Point3d> element_intersections(
385 computeElementSegmentIntersections(*elem, segment));
386 if (element_intersections.empty())
387 {
388 continue;
389 }
390
391 BaseLib::makeVectorUnique(element_intersections);
392
393 std::vector<GeoLib::LineSegment> sub_seg_elem(
394 createSubSegmentsForElement(element_intersections, beg_elem,
395 end_elem, beg_pnt, end_pnt, elem));
396 sub_segments.insert(sub_segments.end(), sub_seg_elem.begin(),
397 sub_seg_elem.end());
398 }
399
400 // beg_elem == nullptr means there isn't any element corresponding to the
401 // beg_pnt and as a consequence the above algorithm doesn't insert a sub
402 // segment
403 if (beg_elem == nullptr)
404 {
405 auto min_dist_segment = std::min_element(
406 sub_segments.begin(), sub_segments.end(),
407 [&beg_pnt](GeoLib::LineSegment const& seg0,
408 GeoLib::LineSegment const& seg1)
409 {
410 // min dist for segment 0
411 const double d0(
412 std::min(MathLib::sqrDist(beg_pnt, seg0.getBeginPoint()),
413 MathLib::sqrDist(beg_pnt, seg0.getEndPoint())));
414 // min dist for segment 1
415 const double d1(
416 std::min(MathLib::sqrDist(beg_pnt, seg1.getBeginPoint()),
417 MathLib::sqrDist(beg_pnt, seg1.getEndPoint())));
418 return d0 < d1;
419 });
420 GeoLib::Point* pnt{
421 MathLib::sqrDist(beg_pnt, min_dist_segment->getBeginPoint()) <
422 MathLib::sqrDist(beg_pnt, min_dist_segment->getEndPoint())
423 ? new GeoLib::Point{min_dist_segment->getBeginPoint()}
424 : new GeoLib::Point{min_dist_segment->getEndPoint()}};
425 sub_segments.emplace_back(new GeoLib::Point{beg_pnt, 0}, pnt, true);
426 }
427 // sort all sub segments for the given segment (beg_pnt, end_pnt)
428 GeoLib::sortSegments(beg_pnt, sub_segments);
429
430 sub_segments.erase(std::unique(sub_segments.begin(), sub_segments.end()),
431 sub_segments.end());
432
433 return sub_segments;
434}
435
438{
439 // create plane equation: n*p = d
440 auto const& p = elem.getNode(0)->asEigenVector3d();
441 Eigen::Vector3d const n(MeshLib::FaceRule::getSurfaceNormal(elem));
442 if (n[2] == 0.0)
443 { // vertical plane, z coordinate is arbitrary
444 q[2] = p[2];
445 }
446 else
447 {
448 double const d(n.dot(p));
449 q[2] = (d - n[0] * q[0] - n[1] * q[1]) / n[2];
450 }
451}
452
453static std::vector<MeshLib::Element const*>
455 MeshLib::MeshElementGrid const& mesh_element_grid,
456 GeoLib::LineSegment const& segment)
457{
458 GeoLib::LineSegment seg_deep_copy(
459 new GeoLib::Point(segment.getBeginPoint()),
460 new GeoLib::Point(segment.getEndPoint()), true);
461 // modify z coordinates such that all surface elements around the line
462 // segment are found
463 seg_deep_copy.getBeginPoint()[2] = mesh_element_grid.getMinPoint()[2];
464 seg_deep_copy.getEndPoint()[2] = mesh_element_grid.getMaxPoint()[2];
465 std::array<MathLib::Point3d, 2> const pnts{
466 {seg_deep_copy.getBeginPoint(), seg_deep_copy.getEndPoint()}};
467 GeoLib::AABB aabb(pnts.cbegin(), pnts.cend());
468
469 // TODO TF: remove after getElementsInVolume interface change
470 auto convert_to_Point3d = [](Eigen::Vector3d const& v) {
471 return MathLib::Point3d{std::array{v[0], v[1], v[2]}};
472 };
473
474 auto const min = convert_to_Point3d(aabb.getMinPoint());
475 auto const max = convert_to_Point3d(aabb.getMaxPoint());
476 auto candidate_elements = mesh_element_grid.getElementsInVolume(min, max);
477
478 // make candidate elements unique
479 BaseLib::makeVectorUnique(candidate_elements);
480
481 return candidate_elements;
482}
483
485 MeshLib::Element const& elem, double rel_eps)
486{
487 // values will be initialized within computeSqrNodeDistanceRange
488 auto const [sqr_min, sqr_max] = MeshLib::computeSqrNodeDistanceRange(elem);
489
490 double const sqr_eps(rel_eps * rel_eps * sqr_min);
491 for (std::size_t k(0); k < elem.getNumberOfNodes(); ++k)
492 {
493 auto const& node(*elem.getNode(k));
494 double const sqr_dist_2d(MathLib::sqrDist2d(p, node));
495 if (sqr_dist_2d < sqr_eps)
496 {
497#ifdef DEBUG_GEOMAPPER
498 std::stringstream out;
499 out.precision(std::numeric_limits<double>::max_digits10);
500 out << "Segment point snapped from " << p;
501#endif
502 p = node;
503#ifdef DEBUG_GEOMAPPER
504 out << "to " << p;
505 DBUG("{:s}", out.str());
506#endif
507 return true;
508 }
509 }
510 return false;
511}
512
516 std::vector<GeoLib::LineSegment> const& sub_segments)
517{
518 std::size_t const j(segment_it.getSegmentNumber());
519 std::size_t new_pnts_cnt(0);
520 for (auto const& segment : sub_segments)
521 {
522 auto const begin_id(points.push_back(
523 new GeoLib::Point(segment.getBeginPoint(), points.size())));
524 if (ply.insertPoint(j + new_pnts_cnt + 1, begin_id))
525 {
526 new_pnts_cnt++;
527 }
528 auto const end_id(points.push_back(
529 new GeoLib::Point(segment.getEndPoint(), points.size())));
530 if (ply.insertPoint(j + new_pnts_cnt + 1, end_id))
531 {
532 new_pnts_cnt++;
533 }
534 }
535 std::advance(segment_it, new_pnts_cnt);
536}
537
539 GeoLib::Polyline& ply,
540 GeoLib::PointVec& orig_points,
541 MeshLib::MeshElementGrid const& mesh_element_grid)
542{
543 // for each segment ...
544 for (auto segment_it(ply.begin()); segment_it != ply.end(); ++segment_it)
545 {
547 mesh_element_grid, *segment_it));
548
549 auto mapPoint = [&candidate_elements](MathLib::Point3d& p)
550 {
551 auto const* elem(
552 findElementContainingPointXY(candidate_elements, p));
553 if (elem)
554 {
555 if (!snapPointToElementNode(p, *elem, 1e-3))
556 {
557 mapPointOnSurfaceElement(*elem, p);
558 }
559 }
560 return elem;
561 };
562
563 // map segment begin and end point
564 auto const* beg_elem(mapPoint((*segment_it).getBeginPoint()));
565 auto const* end_elem(mapPoint((*segment_it).getEndPoint()));
566
567 // Since the mapping of the segment begin and end points the coordinates
568 // changed. The internal data structures of PointVec are possibly
569 // invalid and hence it is necessary to re-create them.
570 orig_points.resetInternalDataStructures();
571
572 if (beg_elem == end_elem)
573 {
574 // TODO: handle cases: beg_elem == end_elem == nullptr
575 // There are further checks necessary to determine which case we are
576 // in:
577 // 1. beg_elem == end_elem and the segment intersects elements
578 // 2. beg_elem == end_elem and the segment does not intersect any
579 // element, i.e., the segment is located outside of the mesh area
580 //
581 // Case 1 needs additional work.
582 continue;
583 }
584
585 // map the line segment (and if necessary for the mapping partition it)
586 std::vector<GeoLib::LineSegment> sub_segments(mapLineSegment(
587 *segment_it, candidate_elements, beg_elem, end_elem));
588
589 if (sub_segments.empty())
590 {
591 continue;
592 }
593
594 // The case sub_segment.size() == 1 is already handled above.
595
596 if (sub_segments.size() > 1)
597 {
598 insertSubSegments(ply, orig_points, segment_it, sub_segments);
599 }
600 }
601}
602
604{
605 // 1. extract surface
606 delete _surface_mesh;
607
608 if (mesh.getDimension() < 3)
609 {
610 _surface_mesh = new MeshLib::Mesh(mesh);
611 }
612 else
613 {
614 Eigen::Vector3d const dir({0, 0, -1});
616 mesh, dir, 90 + 1e-6);
617 }
618
619 // 2. compute mesh grid for surface
620 MeshLib::MeshElementGrid const mesh_element_grid(*_surface_mesh);
621
622 // 3. map each polyline
623 auto org_lines(_geo_objects.getPolylineVec(_geo_name));
624 auto org_points(_geo_objects.getPointVecObj(_geo_name));
625 for (auto org_line : *org_lines)
626 {
627 mapPolylineOnSurfaceMesh(*org_line, *org_points, mesh_element_grid);
628 }
629}
630
631} // end namespace MeshGeoToolsLib
#define OGS_FATAL(...)
Definition Error.h:10
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:45
Eigen::Vector3d const & getMaxPoint() const
Definition AABB.h:176
Eigen::Vector3d const & getMinPoint() const
Definition AABB.h:169
MinMaxPoints getMinMaxPoints() const
Definition AABB.h:163
Container class for geometric objects.
Definition GEOObjects.h:46
GeoLib::Point const & getBeginPoint() const
GeoLib::Point const & getEndPoint() const
This class manages pointers to Points in a std::vector along with a name. It also handles the deletio...
Definition PointVec.h:25
std::size_t push_back(Point *pnt)
Definition PointVec.cpp:124
void resetInternalDataStructures()
Definition PointVec.cpp:249
std::size_t getSegmentNumber() const
Definition Polyline.cpp:376
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:29
virtual bool insertPoint(std::size_t pos, std::size_t pnt_id)
Definition Polyline.cpp:44
SegmentIterator begin() const
Definition Polyline.h:165
SegmentIterator end() const
Definition Polyline.h:167
A borehole as a geometric object.
std::size_t size() const
Definition TemplateVec.h:88
std::size_t getID() const
Eigen::Vector3d const & asEigenVector3d() const
Definition Point3d.h:55
GeoMapper(GeoLib::GEOObjects &geo_objects, const std::string &geo_name)
Definition GeoMapper.cpp:27
void mapToConstantValue(double value)
Maps geometry to a constant elevation value.
void mapOnDEM(std::unique_ptr< GeoLib::Raster const > raster)
Maps geometry based on a raster file.
Definition GeoMapper.cpp:40
void mapPointDataToDEM(std::vector< GeoLib::Point * > const &points) const
Mapping points on a raster.
std::string & _geo_name
Definition GeoMapper.h:74
void mapStationData(std::vector< GeoLib::Point * > const &points)
Mapping stations, boreholes on a raster or mesh.
double getMeshElevation(double x, double y, double min_val, double max_val) const
GeoLib::GEOObjects & _geo_objects
Definition GeoMapper.h:73
float getDemElevation(GeoLib::Point const &pnt) const
Returns the elevation at Point (x,y) based on a raster.
std::unique_ptr< GeoLib::Raster const > _raster
only necessary for mapping on DEM
Definition GeoMapper.h:81
MeshLib::Mesh * _surface_mesh
only necessary for mapping on mesh
Definition GeoMapper.h:77
void mapOnMesh(MeshLib::Mesh const *const mesh)
Definition GeoMapper.cpp:61
void advancedMapOnMesh(MeshLib::Mesh const &mesh)
GeoLib::Grid< MeshLib::Node > * _grid
Definition GeoMapper.h:78
void mapPointDataToMeshSurface(std::vector< GeoLib::Point * > const &pnts)
Mapping points on mesh.
virtual const Element * getEdge(unsigned i) const =0
Returns the i-th edge of the element.
virtual unsigned getNumberOfNodes() const =0
virtual const Node * getNode(unsigned idx) const =0
virtual unsigned getNumberOfEdges() const =0
Get the number of edges for this element.
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:80
static Eigen::Vector3d getSurfaceNormal(Element const &e)
Returns the surface normal of a 2D element.
Definition FaceRule.cpp:33
Eigen::Vector3d const & getMinPoint() const
std::vector< MeshLib::Element const * > getElementsInVolume(POINT const &min, POINT const &max) const
Eigen::Vector3d const & getMaxPoint() const
unsigned getDimension() const
Definition Mesh.h:80
static MeshLib::Mesh * getMeshSurface(const MeshLib::Mesh &subsfc_mesh, Eigen::Vector3d const &dir, double angle, std::string_view subsfc_node_id_prop_name="", std::string_view subsfc_element_id_prop_name="", std::string_view face_id_prop_name="")
void makeVectorUnique(std::vector< T > &v)
Definition Algorithm.h:198
bool isStation(GeoLib::Point const *pnt)
Definition Station.cpp:66
void sortSegments(MathLib::Point3d const &seg_beg_pnt, std::vector< GeoLib::LineSegment > &sub_segments)
bool isBorehole(GeoLib::Point const *pnt)
std::vector< MathLib::Point3d > lineSegmentIntersect2d(GeoLib::LineSegment const &ab, GeoLib::LineSegment const &cd)
std::unique_ptr< GeoLib::Point > triangleLineIntersection(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &p, MathLib::Point3d const &q)
double sqrDist2d(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition Point3d.h:114
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition Point3d.cpp:19
static std::vector< GeoLib::LineSegment > createSubSegmentsForElement(std::vector< MathLib::Point3d > const &intersections, MeshLib::Element const *const beg_elem, MeshLib::Element const *const end_elem, MathLib::Point3d const &beg_pnt, MathLib::Point3d const &end_pnt, MeshLib::Element const *const elem)
static bool snapPointToElementNode(MathLib::Point3d &p, MeshLib::Element const &elem, double rel_eps)
static std::vector< MathLib::Point3d > computeElementSegmentIntersections(MeshLib::Element const &elem, GeoLib::LineSegment const &segment)
static void insertSubSegments(GeoLib::Polyline &ply, GeoLib::PointVec &points, GeoLib::Polyline::SegmentIterator &segment_it, std::vector< GeoLib::LineSegment > const &sub_segments)
static void mapPointOnSurfaceElement(MeshLib::Element const &elem, MathLib::Point3d &q)
static std::vector< MeshLib::Element const * > getCandidateElementsForLineSegmentIntersection(MeshLib::MeshElementGrid const &mesh_element_grid, GeoLib::LineSegment const &segment)
static void mapPolylineOnSurfaceMesh(GeoLib::Polyline &ply, GeoLib::PointVec &orig_points, MeshLib::MeshElementGrid const &mesh_element_grid)
static MeshLib::Element const * findElementContainingPointXY(std::vector< MeshLib::Element const * > const &elements, MathLib::Point3d const &p)
static std::vector< GeoLib::LineSegment > mapLineSegment(GeoLib::LineSegment const &segment, std::vector< MeshLib::Element const * > const &surface_elements, MeshLib::Element const *const beg_elem, MeshLib::Element const *const end_elem)
std::pair< double, double > computeSqrNodeDistanceRange(MeshLib::Element const &element, bool const check_allnodes)
Compute the minimum and maximum node distances for this element.
Definition Element.cpp:143