PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
GeometryUtilities.hpp
Go to the documentation of this file.
1// _LICENSE_HEADER_
2//
3// Copyright (C) 2019 - 2025.
4// Terms register on the GPL-3.0 license.
5//
6// This file can be redistributed and/or modified under the license terms.
7//
8// See top level LICENSE file for more details.
9//
10// This file can be used citing references in CITATION.cff file.
11
12#ifndef __GEOMETRYUTILITIES_H
13#define __GEOMETRYUTILITIES_H
14
15#include "Eigen/Eigen"
16#include "IOUtilities.hpp"
17#include <iostream>
18#include <numbers>
19
20namespace Gedim
21{
34
37{
38 private:
39 const GeometryUtilitiesConfig &_configuration;
40
41 public:
42 enum struct CompareTypes
43 {
44 Unknown = 0,
46 Coincident = 2,
48 };
49
50 enum struct PolygonTypes
51 {
52 Unknown = 0,
53 Triangle = 1,
58 };
59
61 {
62 Unknown = 0,
63 Clockwise = 1,
65 };
66
78
80 {
81 Unknown = 0,
82 Negative = 1,
83 OnPlane = 2,
84 Positive = 3
85 };
86
100
132
134 {
135 enum struct Types
136 {
137 Unknown = 0,
138 ExternalOrigin = 1,
139 Internal = 2,
140 ExternalEnd = 3
141 };
142
143 Eigen::MatrixXd Points;
144 std::vector<std::vector<unsigned int>> SubPolygons;
145 std::vector<Gedim::GeometryUtilities::PolygonDivisionByAngleQuadrantResult::Types> SubPolygonTypes;
147 };
148
150 {
151 Eigen::MatrixXd Points;
152 std::vector<std::vector<unsigned int>> SubTriangles;
153 std::vector<std::vector<unsigned int>> InternalTriangles;
154 std::vector<std::vector<unsigned int>> SubPolygons;
155 };
156
158 {
159 Eigen::MatrixXd Points;
160 std::vector<std::vector<unsigned int>> SubTriangles;
161 std::vector<std::vector<unsigned int>> InternalTriangles;
162 std::vector<std::vector<unsigned int>> SubPolygons;
163 };
164
196
198 {
199 enum struct Types
200 {
201 Unknown = 0,
202 NoAction = 1,
203 PolygonUpdate = 2,
205 };
206
219
221 {
222 enum struct Types
223 {
224 Unknown = 0,
225 EdgeNew = 1,
226 EdgeUpdate = 2
227 };
228
231 unsigned int OldEdgeId = 0;
232 unsigned int OriginId = 0;
233 unsigned int EndId = 0;
234 std::vector<unsigned int> Cell2DNeighbours = {};
235 };
236
238 {
239 std::list<unsigned int> Vertices = {};
240 std::list<unsigned int> Edges = {};
241 };
242
245 std::list<Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewVertex> NewVertices = {};
246 std::list<Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewEdge> NewEdges = {};
247 std::vector<Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewPolygon> NewPolygons = {};
248 };
249
251 {
252 enum struct Types
253 {
254 Unknown = 0,
255 NoAction = 1,
256 PolygonUpdate = 2,
258 };
259
275
300
316
319 std::vector<unsigned int> PolygonVerticesNewVerticesPosition = {};
320 std::vector<unsigned int> CircleIntersectionsNewVerticesPosition = {};
321 std::vector<Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewVertex> NewVertices = {};
322 std::vector<Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewEdge> NewEdges = {};
323 std::vector<Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewPolygon> NewPolygons = {};
324 };
325
367
389
414
416 {
417 enum struct Types
418 {
419 Unknown = 0,
420 None = 1,
421 OneIntersection = 2,
422 TwoIntersections = 3,
424 };
425
439
453
467
487
490 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::LineIntersection> LineIntersections;
491 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronVertexIntersection> PolyhedronVertexIntersections = {};
494 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronEdgeIntersection> PolyhedronEdgeIntersections = {};
496 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronFaceIntersection> PolyhedronFaceIntersections = {};
498 };
499
501 {
503 {
504 std::vector<unsigned int> Cell3DIndices = {};
505 };
506
508 {
509 std::vector<double> Points = {};
510 std::vector<unsigned int> Cell3DIndices = {};
511 };
512
513 std::map<double, Gedim::GeometryUtilities::IntersectionPolyhedronsSegmentResult::IntersectionPoint> Points;
514 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronsSegmentResult::IntersectionSegment> Segments;
515 };
516
518 {
519 enum struct Types
520 {
521 Unknown = 0,
522 None = 1,
523 OnVertex = 2,
524 OnEdge = 3,
525 OnFace = 4,
526 NewPolygon = 5
527 };
528
541
547
560
575
578 unsigned int IntersectionId = 0;
580 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::VertexIntersection> VertexIntersections = {};
581 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::EdgeIntersection> EdgeIntersections = {};
582 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::FaceIntersection> FaceIntersections = {};
583 std::vector<Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::Intersection> Intersections = {};
584 Eigen::MatrixXd IntersectionCoordinates;
585 };
586
588 {
589 Unknown = 0,
590 Outside = 1,
591 OnBorder = 2,
592 Inside = 3
593 };
594
610
641
659
675
677 {
678 Eigen::MatrixXd Vertices;
679 Eigen::MatrixXi Edges;
680 std::vector<Eigen::MatrixXi> Faces;
681 };
682
684 {
685 enum struct Types
686 {
687 Unknown = 0,
688 Split = 1,
689 Positive = 2,
690 Negative = 3,
691 OnPlane = 4
692 };
693
694 std::vector<unsigned int> PositiveVertices;
695 std::vector<unsigned int> NegativeVertices;
696 std::vector<unsigned int> PointsOnPlane;
697 std::vector<Eigen::Vector3d> NewVertices;
698 std::vector<unsigned int> NewVerticesEdgeIndex;
701 };
702
752
754 {
755 std::vector<std::vector<unsigned int>> AlignedEdgesVertices;
756 std::vector<std::vector<unsigned int>> AlignedEdgesEdges;
757 };
758
760 {
761 enum struct MergeTypes
762 {
763 None = 0,
764 Common = 1,
765 Remove = 2
766 };
767
768 constexpr static unsigned int none = UINT_MAX;
769
770 using MergeTypesList = std::vector<std::pair<Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypes, unsigned int>>;
771
772 std::array<Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypesList, 2> Vertices_Type;
773 std::array<Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypesList, 2> Edges_Type;
774 std::array<Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypesList, 2> Faces_Type;
775 std::vector<std::array<unsigned int, 2>> Common_vertices;
776 std::vector<std::array<unsigned int, 2>> Common_edges;
777 std::vector<std::array<unsigned int, 2>> Common_faces;
778 };
779
781 {
782 constexpr static unsigned int none = UINT_MAX;
783 std::array<std::vector<unsigned int>, 2> OriginalToMergedVertices;
784 std::array<std::vector<unsigned int>, 2> OriginalToMergedEdges;
785 std::array<std::vector<unsigned int>, 2> OriginalToMergedFaces;
786 std::vector<std::array<unsigned int, 2>> MergedToOriginalVertices;
787 std::vector<std::array<unsigned int, 2>> MergedToOriginalEdges;
788 std::vector<std::array<unsigned int, 2>> MergedToOriginalFaces;
790 };
791
792 public:
793 GeometryUtilities(const GeometryUtilitiesConfig &configuration);
795
797 inline double Tolerance1D() const
798 {
799 return std::max(_configuration.MinTolerance, _configuration.Tolerance1D);
800 }
802 inline double Tolerance1DSquared() const
803 {
804 return std::max(_configuration.MinTolerance * _configuration.MinTolerance,
805 _configuration.Tolerance1D * _configuration.Tolerance1D);
806 }
808 inline double Tolerance2D() const
809 {
810 return std::max(_configuration.MinTolerance,
811 std::max(_configuration.Tolerance2D, 0.25 * std::sqrt(3.0) * Tolerance1D() * Tolerance1D()));
812 }
814 inline double Tolerance3D() const
815 {
816 return std::max(_configuration.MinTolerance,
817 std::max(_configuration.Tolerance3D,
818 std::max(std::sqrt(2.0) / 12.0 * Tolerance1D() * Tolerance1D() * Tolerance1D(),
819 std::sqrt(6.0) / 9.0 * Tolerance2D() * Tolerance1D())));
820 }
821
825 inline double RelativeDifference(const double &first, const double &second, const double &tolerance) const
826 {
827 const double max_tolerance = std::max(std::abs(tolerance), _configuration.MinTolerance);
828 return std::abs(second - first) / ((std::abs(first) <= max_tolerance) ? 1.0 : std::abs(first));
829 }
830
836 CompareTypes CompareValues(const double &first, const double &second, const double &tolerance) const;
837
842 inline bool AreValuesEqual(const double &first, const double &second, const double &tolerance) const
843 {
845 }
846
850 inline bool IsValueGreater(const double &first, const double &second, const double &tolerance) const
851 {
853 }
854
858 inline bool IsValueGreaterOrEqual(const double &first, const double &second, const double &tolerance) const
859 {
861
862 return result == CompareTypes::SecondBeforeFirst || result == CompareTypes::Coincident;
863 }
864
865 inline bool IsValueLower(const double &first, const double &second, const double &tolerance) const
866 {
868 }
869
870 inline bool IsValueLowerOrEqual(const double &first, const double &second, const double &tolerance) const
871 {
873 }
874
877 inline bool IsValuePositive(const double &value, const double &tolerance) const
878 {
880 }
881
884 inline bool IsValueNegative(const double &value, const double &tolerance) const
885 {
887 }
888
891 inline bool IsValueZero(const double &value, const double &tolerance) const
892 {
893 return CompareValues(0.0, value, tolerance) == CompareTypes::Coincident;
894 }
895
896 Eigen::MatrixXd fibonacci_sphere(const unsigned int num_points) const;
897 Eigen::MatrixXd generate_uniform_random_points_in_sphere(const unsigned int num_points, const double radius = 1.0) const;
898
902 std::vector<double> EquispaceCoordinates(const double &step, const bool &insertExtremes) const;
903
910 std::vector<double> EquispaceCoordinates(const unsigned int &size, const double &origin, const double &end, const bool &insertExtremes) const;
917 std::vector<double> RandomCoordinates(const unsigned int size,
918 const bool insertExtremes,
919 const double &minDistance,
920 const unsigned int seed = time(nullptr)) const;
921
927 inline double PolarAngle(const Eigen::Vector3d &v_prev,
928 const Eigen::Vector3d &v,
929 const Eigen::Vector3d &v_next,
930 const double &norm_v_prev_v,
931 const double &norm_v_next_v) const
932 {
934 ? 0.0
935 : (v.x() - v_prev.x()) * (v_next.y() - v_prev.y()) / (norm_v_prev_v * norm_v_next_v) -
936 (v_next.x() - v_prev.x()) * (v.y() - v_prev.y()) / (norm_v_prev_v * norm_v_next_v);
937 }
938
944 inline double Angle(const Eigen::Vector3d &v_prev,
945 const Eigen::Vector3d &v,
946 const Eigen::Vector3d &v_next,
947 const double &norm_v_prev_v,
948 const double &norm_v_next_v) const
949 {
951 ? 0.0
952 : std::atan2(((v_next.x() - v.x()) * (v_prev.y() - v.y()) - (v_next.y() - v.y()) * (v_prev.x() - v.x())),
953 (v_prev.x() - v.x()) * (v_next.x() - v.x()) + (v_prev.y() - v.y()) * (v_next.y() - v.y()));
954 }
955
956 inline double AngleRadiansToDegree(const double &rad_angle) const
957 {
958 return std::atan2(std::sin(rad_angle), std::cos(rad_angle)) * 180.0 / std::numbers::pi;
959 }
960
961 inline double AngleDegreeToRadians(const double &deg_angle) const
962 {
963 return IsValueZero(deg_angle, Tolerance1D()) ? 0.0
964 : IsValueZero(std::fmod(deg_angle, 180.0), Tolerance1D())
965 ? IsValuePositive(deg_angle, Tolerance1D()) ? std::numbers::pi : -std::numbers::pi
966 : std::atan2(std::sin(deg_angle * std::numbers::pi / 180.0), std::cos(deg_angle * std::numbers::pi / 180.0));
967 }
968
973 inline double PointDistance(const Eigen::Vector3d &firstPoint, const Eigen::Vector3d &secondPoint) const
974 {
975 return (secondPoint - firstPoint).norm();
976 }
977
982 Eigen::VectorXd PointDistances(const Eigen::MatrixXd &points, const Eigen::Vector3d &point) const;
983
986 Eigen::MatrixXd PointsDistance(const Eigen::MatrixXd &points) const;
987
990 Eigen::MatrixXd PointsBoundingBox(const Eigen::MatrixXd &points) const;
991
995 inline bool IsPointInBoundingBox(const Eigen::Vector3d &point, const Eigen::MatrixXd &boudingBox) const
996 {
997 return (IsValueGreaterOrEqual(point.x(), boudingBox(0, 0), Tolerance1D()) &&
1003 }
1004
1005 inline bool BoundingBoxesIntersects(const Eigen::MatrixXd &boudingBox_1, const Eigen::MatrixXd &boudingBox_2) const
1006 {
1007 return IsValueLowerOrEqual(boudingBox_1(0, 0), boudingBox_2(0, 1), Tolerance1D()) &&
1013 }
1014
1017 double PointsMaxDistance(const Eigen::MatrixXd &points) const;
1018
1019 inline bool IsPointZero(const Eigen::Vector3d &point) const
1020 {
1021 return IsValueZero(PointDistance(Eigen::Vector3d::Zero(), point), Tolerance1D());
1022 }
1023
1027 inline bool PointsAreCoincident(const Eigen::Vector3d &firstPoint, const Eigen::Vector3d &secondPoint) const
1028 {
1030 }
1031
1036 std::vector<unsigned int> FindPointInPoints(const Eigen::MatrixXd &points, const Eigen::Vector3d &point) const;
1037
1044 inline double PointLineDistance(const Eigen::Vector3d &point, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &normalToLine) const
1045 {
1046 return std::abs(normalToLine.dot(point - lineOrigin)) / normalToLine.norm();
1047 }
1048
1051 inline bool PointIs2D(const Eigen::Vector3d &point) const
1052 {
1053 return PointsAre2D(point);
1054 }
1055
1058 inline bool PointsAre2D(const Eigen::MatrixXd &points) const
1059 {
1060 Gedim::Output::Assert(points.rows() == 3 && points.cols() > 0);
1061 return points.row(2).isZero(_configuration.Tolerance1D);
1062 }
1063
1069 inline double PointCurvilinearCoordinate(const Eigen::Vector3d &point,
1070 const Eigen::Vector3d &segmentOrigin,
1071 const Eigen::Vector3d &segmentEnd) const
1072 {
1073 const Eigen::Vector3d segmentTangent = (segmentEnd - segmentOrigin);
1075 }
1076
1083 inline double PointLineCurvilinearCoordinate(const Eigen::Vector3d &point,
1084 const Eigen::Vector3d &lineOrigin,
1085 const Eigen::Vector3d &lineTangent,
1086 const double &lineTangentSquaredLength) const
1087 {
1089 }
1090
1096 bool IsPointOnLine(const Eigen::Vector3d &point,
1097 const Eigen::Vector3d &lineOrigin,
1098 const Eigen::Vector3d &lineTangent,
1099 const double &lineTangentSquaredLength) const;
1100
1108 const Eigen::Vector3d &segmentOrigin,
1109 const Eigen::Vector3d &segmentEnd) const;
1110
1115
1121 inline double PointSegmentProjection(const Eigen::Vector3d &point,
1122 const Eigen::Vector3d &segmentOrigin,
1123 const Eigen::Vector3d &segmentEnd) const
1124 {
1126 }
1127
1132 double PointPlaneDistance(const Eigen::Vector3d &point, const std::array<Eigen::Vector3d, 3> &planePoints) const;
1138 double PointPlaneDistance(const Eigen::Vector3d &point, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin) const;
1139
1144
1147 inline bool IsPointOnPlane(const double &pointPlaneDistance) const
1148 {
1150 }
1151
1156 inline bool IsPointOnPlane(const Eigen::Vector3d &point, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin) const
1157 {
1159 }
1160
1164 inline double SegmentLength(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
1165 {
1166 return (segmentEnd - segmentOrigin).norm();
1167 }
1168
1172 inline Eigen::Vector3d SegmentTangent(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
1173 {
1174 return segmentEnd - segmentOrigin;
1175 }
1176
1181 inline Eigen::Vector3d SegmentNormal(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
1182 {
1184 Eigen::Vector3d tangent = SegmentTangent(segmentOrigin, segmentEnd).normalized();
1185 return Eigen::Vector3d(tangent.y(), -tangent.x(), 0.0);
1186 }
1187
1193 inline double SegmentSlope(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
1194 {
1196 return (segmentEnd.y() - segmentOrigin.y()) / (segmentEnd.x() - segmentOrigin.x());
1197 }
1198
1204 inline double SegmentIntercept(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
1205 {
1207 return segmentOrigin.y() -
1208 segmentOrigin.x() * (segmentEnd.y() - segmentOrigin.y()) / (segmentEnd.x() - segmentOrigin.x());
1209 }
1210
1211 Eigen::MatrixXi MakeConcatenation(const Eigen::MatrixXi &segments, const unsigned int starting_vertex) const;
1212
1220 inline bool CheckNoSpheresIntersection(const Eigen::Vector3d &firstSphereCenter,
1221 const Eigen::Vector3d &secondSphereCenter,
1222 const double &firstSphereDiameter,
1223 const double &secondSphereDiameter) const
1224 {
1227 Tolerance1D());
1228 }
1229
1232 bool CheckTrianglesIntersection(const Eigen::MatrixX3d &triangle_one,
1233 const Eigen::MatrixX3d &triangle_two,
1234 const bool admit_boundary = true) const;
1235
1241 bool AreLineCoplanar(const Eigen::Vector3d &firstLineOrigin,
1242 const Eigen::Vector3d &firstLineTangent,
1243 const Eigen::Vector3d &secondLineOrigin,
1244 const Eigen::Vector3d &secondLineTangent) const;
1245
1247 bool IsPolygonCoplanar(const Eigen::Vector3d &planeNormal,
1248 const Eigen::Vector3d &planeOrigin,
1249 const Eigen::MatrixXd &polygonVertices,
1250 const std::vector<unsigned int> &polygonUnalignedVertices) const;
1251
1259 IntersectionSegmentSegmentResult IntersectionSegmentSegment(const Eigen::Vector3d &firstSegmentOrigin,
1260 const Eigen::Vector3d &firstSegmentEnd,
1261 const Eigen::Vector3d &secondSegmentOrigin,
1262 const Eigen::Vector3d &secondSegmentEnd) const;
1263
1270 std::vector<std::list<double>> IntersectionsBetweenSegments(const std::vector<Eigen::MatrixXd> &segmentsVertices,
1271 const std::vector<Eigen::Vector3d> &segmentsTangent,
1272 const std::vector<Eigen::Vector3d> &segmentsBarycenter,
1273 const std::vector<double> &segmentsLength) const;
1274
1283 const Eigen::Vector3d &segmentEnd,
1284 const Eigen::Vector3d &circleCenter,
1285 const double &circleRadius) const;
1286
1295 const Eigen::Vector3d &segmentEnd,
1296 const Eigen::Vector3d &planeNormal,
1297 const Eigen::Vector3d &planeOrigin) const;
1298
1310 const Eigen::MatrixXd &polyhedronVertices,
1311 const Eigen::MatrixXi &polyhedronEdges,
1312 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
1313 const Eigen::Vector3d &planeNormal,
1314 const Eigen::Vector3d &planeOrigin,
1315 const Eigen::Matrix3d &planeRotationMatrix,
1316 const Eigen::Vector3d &planeTranslation) const;
1317
1319 const Eigen::MatrixXd &polyhedronVertices,
1320 const Eigen::MatrixXi &polyhedronEdges,
1321 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
1322 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
1323 const std::vector<Eigen::MatrixXd> &polyhedronFaceEdgeTangents,
1324 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations,
1325 const std::vector<Eigen::Matrix3d> &polyhedronFaceRotationMatrices,
1326 const Eigen::Vector3d &planeNormal,
1327 const Eigen::Vector3d &planeOrigin,
1328 const Eigen::Matrix3d &planeRotationMatrix,
1329 const Eigen::Vector3d &planeTranslation) const;
1330
1331 std::vector<GeometryUtilities::Polyhedron> SplitPolyhedronWithPlaneResultToPolyhedra(const SplitPolyhedronWithPlaneResult &result) const;
1332
1341 IntersectionPolyhedronLineResult IntersectionPolyhedronLine(const Eigen::MatrixXd &polyhedronVertices,
1342 const Eigen::MatrixXi &polyhedronEdges,
1343 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
1344 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
1345 const std::vector<bool> &polyhedronFaceNormalDirections,
1346 const Eigen::Vector3d &lineTangent,
1347 const Eigen::Vector3d &lineOrigin) const;
1348
1360 const Eigen::MatrixXd &polyhedronVertices,
1361 const Eigen::MatrixXi &polyhedronEdges,
1362 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
1363 const Eigen::Vector3d &segmentOrigin,
1364 const Eigen::Vector3d &segmentEnd,
1365 const Eigen::Vector3d &segmentTangent,
1366 const IntersectionPolyhedronLineResult &polyhedronLineIntersections) const;
1367
1377 const std::vector<Polyhedron> &polyhedrons,
1378 const std::vector<std::vector<Eigen::Vector3d>> &polyhedronFaceNormals,
1379 const std::vector<std::vector<bool>> &polyhedronFaceNormalDirections,
1380 const Eigen::Vector3d &segmentOrigin,
1381 const Eigen::Vector3d &segmentEnd,
1382 const Eigen::Vector3d &segmentTangent) const;
1383
1390 const Eigen::MatrixXd &polygonVertices) const;
1391
1393 const Eigen::MatrixXd &polygonVertices) const;
1394
1399 inline bool IsPointInsidePolygon(const Eigen::Vector3d &point, const Eigen::MatrixXd &polygonVertices) const
1400 {
1403 }
1404
1415
1416 LinePolygonPositionResult LinePolygonPosition(const Eigen::Vector3d &lineTangent,
1417 const Eigen::Vector3d &lineOrigin,
1418 const Eigen::MatrixXd &polygonVertices) const;
1419
1424
1437 const Eigen::Vector3d &point,
1438 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
1439 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
1440 const std::vector<Eigen::MatrixXd> &polyhedronFaceRotatedVertices,
1441 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
1442 const std::vector<bool> &polyhedronFaceNormalDirections,
1443 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations,
1444 const std::vector<Eigen::Matrix3d> &polyhedronFaceRotationMatrices) const;
1457 const Eigen::Vector3d &point,
1458 const std::vector<Eigen::MatrixXi> &polyhedron_faces,
1459 const std::vector<Eigen::MatrixXd> &polyhedron_faces_3D_vertices,
1460 const std::vector<Eigen::MatrixXd> &polyhedron_faces_2D_vertices,
1461 const std::vector<Eigen::Vector3d> &polyhedron_faces_normals,
1462 const std::vector<bool> &polyhedron_faces_normal_direction,
1463 const std::vector<Eigen::Vector3d> &polyhedron_faces_translation,
1464 const std::vector<Eigen::Matrix3d> &polyhedron_faces_rotation_matrix,
1465 const std::vector<Eigen::MatrixXd> &polyhedron_tetrahedrons) const;
1466
1467 bool IsPointInsideTetrahedron(const Eigen::MatrixXd &tetrahedron, const Eigen::Vector3d &point) const;
1468
1476 const Eigen::Vector3d &circleCenter,
1477 const double &circleRadius) const;
1478
1485 std::vector<PointCirclePositionResult> PointCirclePositions(const Eigen::MatrixXd &points,
1486 const Eigen::Vector3d &circleCenter,
1487 const double &circleRadius) const;
1488
1497 const Eigen::MatrixXd &polygonVertices,
1498 const Eigen::Vector3d &circleCenter,
1499 const double &circleRadius,
1500 const std::vector<PointCirclePositionResult> &vertexPositions,
1502
1509 const Eigen::Vector3d &circleCenter,
1510 const double &circleRadius) const;
1511
1516 std::vector<unsigned int> PolygonTriangulationByFirstVertex(const Eigen::MatrixXd &polygonVertices) const;
1517
1521 std::vector<unsigned int> PolygonTriangulationByEarClipping(const Eigen::MatrixXd &polygonVertices) const;
1522
1528 std::vector<unsigned int> PolygonTriangulationByInternalPoint(const Eigen::MatrixXd &polygonVertices,
1529 const Eigen::Vector3d &internalPoint) const;
1530
1538 const Eigen::MatrixXd &polygonEdgeTangents,
1539 const Eigen::Vector3d &circleCenter,
1540 const double &circleRadius,
1541 const unsigned int &curvedEdgeIndex) const;
1542
1550 const Eigen::MatrixXd &polygonEdgeTangents,
1551 const Eigen::Vector3d &circleCenter,
1552 const double &circleRadius,
1553 const unsigned int &curvedEdgeIndex) const;
1554
1564 const Eigen::MatrixXd &polygonEdgeTangents,
1565 const Eigen::Vector3d &circleCenter,
1566 const double &circleRadius,
1567 const unsigned int &curvedEdgeIndex) const;
1568
1577 const Eigen::MatrixXd &polygonEdgeTangents,
1578 const Eigen::Vector3d &circleCenter,
1579 const double &circleRadius,
1580 const unsigned int &curvedEdgeIndex) const;
1581
1585 double PolygonArea(const Eigen::MatrixXd &polygonVertices) const;
1586
1589 double PolygonArea3D(const Eigen::MatrixXd &polygonVertices) const;
1590
1594 Eigen::Matrix2d PolygonMass(const Eigen::Vector3d &polygonCentroid,
1595 const std::vector<Eigen::Matrix3d> &polygonTriangulationPoints) const;
1596
1600 Eigen::Matrix3d PolygonInertia(const Eigen::Vector3d &polygonCentroid,
1601 const std::vector<Eigen::Matrix3d> &polygonTriangulationPoints) const;
1602
1608
1620 const Eigen::MatrixXd &polygonVertices,
1621 const Eigen::Vector3d &circleCenter,
1622 const double &circleRadius,
1623 const std::vector<PointCirclePositionResult> &vertexPositions,
1626
1634 const unsigned int &subPolygonIndex,
1635 const Eigen::MatrixXd &polygonVertices,
1637
1647 const Eigen::MatrixXd &polygonEdgeTangents,
1648 const Eigen::Vector3d &planeNormal,
1649 const Eigen::Vector3d &planeOrigin,
1650 const Eigen::Vector3d &polygonTranslation,
1651 const Eigen::Matrix3d &polygonRotationMatrix) const;
1652
1656 Eigen::Vector3d PolygonNormal(const Eigen::MatrixXd &polygonVertices) const;
1657
1658 std::array<Eigen::Vector3d, 2> PolygonTangents(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &polygonNormal) const;
1659
1663 Eigen::MatrixXd PolygonEdgesCentroid(const Eigen::MatrixXd &polygonVertices) const;
1664
1668 Eigen::VectorXd PolygonEdgeLengths(const Eigen::MatrixXd &polygonVertices) const;
1669
1673 Eigen::MatrixXd PolygonEdgeTangents(const Eigen::MatrixXd &polygonVertices) const;
1674
1678 Eigen::MatrixXd PolygonEdgeNormals(const Eigen::MatrixXd &polygonVertices) const;
1679
1682 inline Eigen::Vector3d SimplexBarycenter(const Eigen::MatrixXd &vertices) const
1683 {
1684 Gedim::Output::Assert(vertices.rows() == 3);
1685 return vertices.rowwise().mean();
1686 }
1687
1688 inline double SimplexMeasure(const Eigen::MatrixXd &vertices) const
1689 {
1690 Gedim::Output::Assert(vertices.rows() == 3 && vertices.cols() < 5);
1691
1692 Eigen::MatrixXd measure_matrix(vertices.cols(), 4);
1693 measure_matrix.block(0, 0, vertices.cols(), 3) = vertices.transpose();
1694 measure_matrix.col(3).setOnes();
1695 const double div_dim = vertices.cols() == 3 ? 0.5 : 1.0 / 6.0;
1696
1697 return div_dim * std::abs(measure_matrix.determinant());
1698 }
1699
1703 inline Eigen::Vector3d SegmentBarycenter(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
1704 {
1705 return SimplexBarycenter((Eigen::MatrixXd(3, 2) << segmentOrigin, segmentEnd).finished());
1706 }
1707
1710 inline Eigen::Vector3d PolygonBarycenter(const Eigen::MatrixXd &polygonVertices) const
1711 {
1712 Gedim::Output::Assert(polygonVertices.rows() == 3 && polygonVertices.cols() > 2);
1714 }
1715
1718 inline Eigen::Vector3d PolyhedronBarycenter(const Eigen::MatrixXd &polyhedronVertices) const
1719 {
1722 }
1723
1728 Eigen::Vector3d PolygonCentroid(const Eigen::MatrixXd &polygonVertices, const double &polygonArea) const;
1729
1734 inline Eigen::Vector3d PolygonCentroid(const Eigen::MatrixXd &subPolygonCentroids,
1735 const Eigen::VectorXd &subPolygonAreas,
1736 const double &polygonArea) const
1737 {
1739 subPolygonCentroids.cols() == subPolygonAreas.size());
1740
1742 }
1743
1754 const Eigen::MatrixXd &polygonVertices,
1755 const Eigen::VectorXd &edgeLengths,
1756 const Eigen::MatrixXd &edgeTangents,
1757 const Eigen::MatrixXd &edgeNormals,
1758 const Eigen::MatrixXd &referenceQuadraturePoints = (Eigen::MatrixXd(3, 1) << 0.5, 0.0, 0.0).finished(),
1759 const Eigen::VectorXd &referenceQuadratureWeights = Eigen::VectorXd::Ones(1)) const;
1760
1765 double PolygonAreaByInternalIntegral(const std::vector<Eigen::Matrix3d> &polygonTriangulationPoints,
1766 const Eigen::VectorXd &referenceQuadratureWeights = Eigen::VectorXd::Constant(1, 0.5)) const;
1767
1776 Eigen::Vector3d PolygonCentroidByIntegral(const Eigen::MatrixXd &polygonVertices,
1777 const Eigen::VectorXd &edgeLengths,
1778 const Eigen::MatrixXd &edgeTangents,
1779 const Eigen::MatrixXd &edgeNormals,
1780 const double &polygonArea) const;
1781
1786 Eigen::VectorXd PolygonCentroidEdgesDistance(const Eigen::MatrixXd &polygonVertices,
1787 const Eigen::Vector3d &polygonCentroid,
1788 const Eigen::MatrixXd &polygonEdgeNormals) const;
1789
1793 Eigen::VectorXd PolygonCentroidVerticesDistance(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &polygonCentroid) const;
1794
1797 inline double PolygonInRadius(const Eigen::VectorXd &polygonCentroidEdgesDistance) const
1798 {
1799 return polygonCentroidEdgesDistance.minCoeff();
1800 }
1801
1805 inline double PolygonAspectRatio(const double &polygonDiameter, const double &polygonInRadius) const
1806 {
1807 return polygonDiameter / (2.0 * polygonInRadius);
1808 };
1809
1812 inline double PolygonDiameter(const Eigen::MatrixXd &polygonVertices) const
1813 {
1815 }
1816
1822 inline Eigen::Vector3d PolygonTranslation(const Eigen::MatrixXd &polygonVertices) const
1823 {
1824 return polygonVertices.col(0);
1825 }
1826
1834 Eigen::Matrix3d PolygonRotationMatrix(const Eigen::MatrixXd &polygonVertices,
1835 const Eigen::Vector3d &polygonNormal,
1836 const Eigen::Vector3d &polygonTranslation) const;
1837
1843 bool PolygonIsConvex(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &convexHull) const;
1844
1848 PolygonTypes PolygonType(const unsigned int &numPolygonVertices, const bool &isPolygonConvex) const;
1849
1853 PolygonOrientations PolygonOrientation(const std::vector<unsigned int> &convexHull) const;
1854
1857 inline std::vector<unsigned int> ChangePolygonOrientation(const unsigned int numPolygonVertices) const
1858 {
1859 std::vector<unsigned int> newVertices(numPolygonVertices);
1860 newVertices[0] = 0;
1861 for (unsigned int i = 1; i < numPolygonVertices; i++)
1863 return newVertices;
1864 }
1865
1871 Eigen::Matrix3d PlaneRotationMatrix(const Eigen::Vector3d &planeNormal) const;
1872
1879 inline Eigen::Vector3d PlaneTranslation(const Eigen::Vector3d &planeOrigin) const
1880 {
1881 return planeOrigin;
1882 }
1883
1884 Eigen::Matrix3d PlaneReflectionMatrix(const Eigen::Vector3d &plane_normal) const;
1885 Eigen::Vector3d PlaneReflectionTranslation(const Eigen::Vector3d &plane_normal, const Eigen::Vector3d &planeOrigin) const;
1886
1887 Eigen::MatrixXd PlaneToPolygon(const Eigen::Vector3d &plane_normal, const Eigen::Vector3d &plane_origin) const;
1888
1894 inline Eigen::MatrixXd RotatePoints(const Eigen::MatrixXd &points,
1895 const Eigen::Matrix3d &rotationMatrix,
1896 const Eigen::Vector3d &translation = Eigen::Vector3d::Zero()) const
1897 {
1898 Gedim::Output::Assert(points.rows() == 3 && points.cols() > 0);
1899 return (rotationMatrix * points).colwise() + translation;
1900 }
1901
1907 inline Eigen::MatrixXd RotatePointsFrom2DTo3D(const Eigen::MatrixXd &points,
1908 const Eigen::Matrix3d &rotationMatrix,
1909 const Eigen::Vector3d &translation = Eigen::Vector3d::Zero()) const
1910 {
1911 Gedim::Output::Assert(points.rows() == 3 && points.cols() > 0 && PointsAre2D(points));
1912 return (rotationMatrix * points).colwise() + translation;
1913 }
1919 inline Eigen::MatrixXd RotatePointsFrom3DTo2D(const Eigen::MatrixXd &points,
1920 const Eigen::Matrix3d &rotationMatrix,
1921 const Eigen::Vector3d &translation = Eigen::Vector3d::Zero()) const
1922 {
1923 Gedim::Output::Assert(points.rows() == 3 && points.cols() > 0);
1924 Eigen::MatrixXd rotatedPoints = rotationMatrix * (points.colwise() - translation);
1925 rotatedPoints.row(2).setZero();
1926 return rotatedPoints;
1927 }
1928
1934 std::vector<unsigned int> ConvexHull(const Eigen::MatrixXd &points, const bool &includeCollinear = true) const;
1935
1941 inline std::vector<bool> PointsAreAligned(const Eigen::Vector3d &segmentOrigin,
1942 const Eigen::Vector3d &segmentEnd,
1943 const Eigen::MatrixXd &points) const
1944 {
1946 }
1947
1953 std::vector<bool> PointsAreOnLine(const Eigen::MatrixXd &points,
1954 const Eigen::Vector3d &lineOrigin,
1955 const Eigen::Vector3d &lineTangent) const;
1956
1962 inline bool PointIsAligned(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::Vector3d &point) const
1963 {
1965 }
1966
1972 inline bool PointIsOnLine(const Eigen::Vector3d &point, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &lineTangent) const
1973 {
1975 }
1976
1977 std::array<double, 3> PointToBarycentricCoordinates2D(const Eigen::Matrix3d &triangle, const Eigen::Vector3d &point) const;
1978 Eigen::Vector3d BarycentricCoordinatesToPoint2D(const Eigen::Matrix3d &triangle,
1979 const std::array<double, 3> &barycentric_coordinates) const;
1980
1986 std::vector<unsigned int> UnalignedPoints(const Eigen::MatrixXd &points, const unsigned int numDesiredUnalignedPoints = 0) const;
1987
1991 std::vector<unsigned int> UnalignedPolyhedronPoints(const Eigen::MatrixXd &polyhedronVertices,
1992 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
1993 const std::vector<Eigen::Vector3d> &polyhedronFacesTranslation,
1994 const std::vector<Eigen::Matrix3d> &polyhedronFacesRotationMatrix,
1995 const std::vector<std::vector<unsigned int>> &polyhedronUnaligedFaces,
1996 const std::vector<std::vector<unsigned int>> &polyhedronFacesUnalignedVertices) const;
1997
1998 AlignedPolyhedronEdgesResult AlignedPolyhedronEdges(const Eigen::MatrixXd &polyhedronVertices,
1999 const std::vector<std::vector<unsigned int>> &verticesAdjacency,
2000 const std::vector<std::vector<unsigned int>> &edgesAdjacency,
2001 const std::vector<std::unordered_map<unsigned int, unsigned int>> &adjacencyVerticesMap,
2002 const Eigen::MatrixXd &polyhedronEdgeTangents,
2003 const Eigen::VectorXd &polyhedronEdgeSquaredLenghts) const;
2004
2008 Eigen::MatrixXd ExtractPoints(const Eigen::MatrixXd &points, const std::vector<unsigned int> &filter) const;
2009
2013 std::vector<Eigen::Matrix3d> ExtractTriangulationPoints(const Eigen::MatrixXd &points,
2014 const std::vector<unsigned int> &pointsTriangulation) const;
2015
2020 std::vector<Eigen::Matrix3d> ExtractTriangulationPointsByInternalPoint(const Eigen::MatrixXd &points,
2021 const Eigen::Vector3d &internalPoint,
2022 const std::vector<unsigned int> &pointsTriangulation) const;
2023
2030 Eigen::MatrixXd CreateEllipse(const double &axisMajorLength, const double &axisMinorLength, const unsigned int &resolution) const;
2031
2033 Eigen::MatrixXd CreateTriangle(const Eigen::Vector3d &p1, const Eigen::Vector3d &p2, const Eigen::Vector3d &p3) const;
2038 Eigen::MatrixXd CreateParallelogram(const Eigen::Vector3d &origin,
2039 const Eigen::Vector3d &lengthVector,
2040 const Eigen::Vector3d &widthVector) const;
2045 inline Eigen::MatrixXd CreateRectangle(const Eigen::Vector3d &origin, const double &base, const double &height) const
2046 {
2047 return CreateParallelogram(origin, Eigen::Vector3d(base, 0.0, 0.0), Eigen::Vector3d(0.0, height, 0.0));
2048 }
2049
2053 inline Eigen::MatrixXd CreateSquare(const Eigen::Vector3d &origin, const double &edgeLength) const
2054 {
2055 return CreateRectangle(origin, edgeLength, edgeLength);
2056 }
2057
2064 Polyhedron CreateTetrahedronWithOrigin(const Eigen::Vector3d &origin,
2065 const Eigen::Vector3d &lengthVector,
2066 const Eigen::Vector3d &heightVector,
2067 const Eigen::Vector3d &widthVector) const;
2068
2075 Polyhedron CreateTetrahedronWithVertices(const Eigen::Vector3d &v1,
2076 const Eigen::Vector3d &v2,
2077 const Eigen::Vector3d &v3,
2078 const Eigen::Vector3d &v4) const;
2079
2086 Polyhedron CreateParallelepipedWithOrigin(const Eigen::Vector3d &origin,
2087 const Eigen::Vector3d &lengthVector,
2088 const Eigen::Vector3d &heightVector,
2089 const Eigen::Vector3d &widthVector) const;
2090
2095 inline Polyhedron CreatePolyhedronWithExtrusion(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &heightVector) const
2096 {
2097 return CreatePolyhedronWithExtrusion(polygonVertices, std::vector<Eigen::Vector3d>(polygonVertices.cols(), heightVector));
2098 }
2099
2104 Polyhedron CreatePolyhedronWithExtrusion(const Eigen::MatrixXd &polygonVertices,
2105 const std::vector<Eigen::Vector3d> &heightVectors) const;
2106
2111 inline Polyhedron CreateCubeWithOrigin(const Eigen::Vector3d &origin, const double &edgeLength) const
2112 {
2113 return CreateParallelepipedWithOrigin(origin,
2114 Eigen::Vector3d(edgeLength, 0.0, 0.0),
2115 Eigen::Vector3d(0.0, 0.0, edgeLength),
2116 Eigen::Vector3d(0.0, edgeLength, 0.0));
2117 }
2118
2129 const std::vector<std::vector<Eigen::Matrix3d>> &polyhedronFaceRotatedTriangulationPoints,
2130 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
2131 const std::vector<bool> &polyhedronFaceNormalDirections,
2132 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations,
2133 const std::vector<Eigen::Matrix3d> &polyhedronFaceRotationMatrices,
2134 const Eigen::MatrixXd &referenceQuadraturePoints = (Eigen::MatrixXd(3, 1) << 1.0 / 3.0, 1.0 / 3.0, 0.0).finished(),
2135 const Eigen::VectorXd &referenceQuadratureWeights = Eigen::VectorXd::Constant(1, 0.5)) const;
2136
2141 double PolyhedronVolumeByInternalIntegral(const std::vector<Eigen::MatrixXd> &polyhedronTetrahedronVertices,
2142 const Eigen::VectorXd &referenceQuadratureWeights = Eigen::VectorXd::Constant(1, 1.0 / 6.0)) const;
2143
2152 Eigen::Vector3d PolyhedronCentroid(const std::vector<std::vector<Eigen::Matrix3d>> &polyhedronFaceRotatedTriangulationPoints,
2153 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
2154 const std::vector<bool> &polyhedronFaceNormalDirections,
2155 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations,
2156 const std::vector<Eigen::Matrix3d> &polyhedronFaceRotationMatrices,
2157 const double &polyhedronVolume) const;
2158
2161 inline double PolyhedronDiameter(const Eigen::MatrixXd &polyhedronVertices) const
2162 {
2164 }
2165
2170 Eigen::MatrixXd PolyhedronEdgesCentroid(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges) const;
2171
2176 Eigen::VectorXd PolyhedronEdgesLength(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges) const;
2177
2182 Eigen::MatrixXd PolyhedronEdgeTangents(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges) const;
2183
2189 std::vector<Eigen::MatrixXd> PolyhedronFaceVertices(const Eigen::MatrixXd &polyhedronVertices,
2190 const std::vector<Eigen::MatrixXi> &polyhedronFaces) const;
2191
2197 std::vector<std::vector<bool>> PolyhedronFaceEdgeDirections(const Eigen::MatrixXd &polyhedronVertices,
2198 const Eigen::MatrixXi &polyhedronEdges,
2199 const std::vector<Eigen::MatrixXi> &polyhedronFaces) const;
2200
2207 std::vector<Eigen::MatrixXd> PolyhedronFaceEdgeTangents(const Eigen::MatrixXd &polyhedronVertices,
2208 const Eigen::MatrixXi &polyhedronEdges,
2209 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2210 const std::vector<std::vector<bool>> &polyhedronFaceEdgeDirections,
2211 const Eigen::MatrixXd &polyhedronEdgeTangents) const;
2212
2216 std::vector<Eigen::Matrix3d> PolyhedronFaceRotationMatrices(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2217 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
2218 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations) const;
2219
2223 std::vector<Eigen::Vector3d> PolyhedronFaceTranslations(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices) const;
2224
2230 std::vector<Eigen::MatrixXd> PolyhedronFaceRotatedVertices(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2231 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations,
2232 const std::vector<Eigen::Matrix3d> &polyhedronFaceRotationMatrices) const;
2233
2237 std::vector<std::vector<unsigned int>> PolyhedronFacesUnalignedVertices(const std::vector<Eigen::MatrixXd> &polyhedronFacesRotatedVertices) const;
2238
2242 std::vector<Eigen::Vector3d> PolyhedronFaceNormals(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices) const;
2243
2244 std::vector<std::array<Eigen::Vector3d, 2>> PolyhedronFaceTangents(const std::vector<Eigen::MatrixXd> &polyhedronFacesVertices,
2245 const std::vector<Eigen::Vector3d> &polyhedronFacesNormal,
2246 const std::vector<bool> &polyhedronFacesNormalDirection) const;
2247
2251 std::vector<Eigen::Vector3d> PolyhedronFaceBarycenter(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices) const;
2252
2253 Eigen::Matrix3d PolyhedronMass(const Eigen::Vector3d &polyhedronCentroid,
2254 const std::vector<Eigen::MatrixXd> &polyhedronTetrahedronPoints) const;
2255
2256 Eigen::Matrix3d PolyhedronInertia(const Eigen::Vector3d &polyhedronCentroid,
2257 const std::vector<Eigen::MatrixXd> &polyhedronTetrahedraPoints) const;
2258
2259 Eigen::VectorXd PolyhedronCentroidFacesDistance(const Eigen::Vector3d &polyhedronCentroid,
2260 const std::vector<Eigen::Vector3d> &polyhedronFacesNormal,
2261 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices) const;
2262
2263 inline double PolyhedronInRadius(const Eigen::VectorXd &polyhedronCentroidFacesDistance) const
2264 {
2265 return polyhedronCentroidFacesDistance.minCoeff();
2266 }
2267
2276 bool PolyhedronIsConvex(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2277 const std::vector<Eigen::MatrixXd> &polyhedronFaceRotatedVertices,
2278 const std::vector<Eigen::Vector3d> &polyhedronFaceInternalPoints,
2279 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
2280 const std::vector<bool> &polyhedronFaceNormalDirections,
2281 const Eigen::Vector3d &polyhedronInternalPoint) const;
2282
2289 std::vector<bool> PolyhedronFaceNormalDirections(const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2290 const Eigen::Vector3d &pointInsidePolyhedron,
2291 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals) const;
2298 std::vector<bool> PolyhedronFaceNormalDirections(const Eigen::MatrixXd &polyhedronVertices,
2299 const Eigen::MatrixXi &polyhedronEdges,
2300 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2301 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2302 const std::vector<Eigen::Vector3d> &polyhedronFaceInternalPoints,
2303 const std::vector<Eigen::MatrixXd> &polyhedronFaceRotatedVertices,
2304 const std::vector<Eigen::Vector3d> &polyhedronFaceNormals,
2305 const std::vector<Eigen::Vector3d> &polyhedronFaceTranslations,
2306 const std::vector<Eigen::Matrix3d> &polyhedronFaceRotationMatrices) const;
2307
2312 std::vector<std::vector<unsigned int>> PolyhedronFaceTriangulations(const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2313 const std::vector<std::vector<unsigned int>> &localFaceTriangulations) const;
2318 std::vector<std::vector<unsigned int>> PolyhedronFaceTriangulationsByFirstVertex(const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2319 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices) const;
2320
2325 std::vector<std::vector<unsigned int>> PolyhedronFaceTriangulationsByEarClipping(const unsigned int numPolyhedronFaces,
2326 const std::vector<Eigen::MatrixXd> &polyhedronFaces2DVertices) const;
2327
2328 std::vector<std::vector<Eigen::Matrix3d>> PolyhedronFaceExtractTriangulationPoints(
2329 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2330 const std::vector<std::vector<unsigned int>> &polyhedronFaceTriangulations) const;
2331
2332 std::vector<std::vector<Eigen::Matrix3d>> PolyhedronFaceTriangulationPointsByInternalPoint(
2333 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2334 const std::vector<Eigen::Vector3d> &polyhedronFaceInternalPoints,
2335 const std::vector<std::vector<unsigned int>> &polyhedronFaceTriangulations) const;
2336
2344 std::vector<std::vector<unsigned int>> PolyhedronFaceTriangulationsByInternalPoint(
2345 const Eigen::MatrixXd &polyhedronVertices,
2346 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2347 const std::vector<Eigen::MatrixXd> &polyhedronFaceVertices,
2348 const std::vector<Eigen::Vector3d> &polyhedronFaceInternalPoints) const;
2349
2357 std::vector<unsigned int> PolyhedronTetrahedronsByFaceTriangulations(const Eigen::MatrixXd &polyhedronVertices,
2358 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2359 const std::vector<std::vector<unsigned int>> &polyhedronFaceTriangulations,
2360 const Eigen::Vector3d &polyhedronInternalPoint) const;
2361
2371 std::vector<unsigned int> PolyhedronTetrahedronsByFaceTriangulations(const Eigen::MatrixXd &polyhedronVertices,
2372 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2373 const std::vector<std::vector<unsigned int>> &polyhedronFaceTriangulations,
2374 const std::vector<Eigen::Vector3d> &polyhedronFaceInternalPoints,
2375 const Eigen::Vector3d &polyhedronInternalPoint) const;
2376
2381 std::vector<Eigen::MatrixXd> ExtractTetrahedronPoints(const Eigen::MatrixXd &polyhedronVertices,
2382 const Eigen::Vector3d &polyhedronInternalPoint,
2383 const std::vector<unsigned int> &pointTetrahedrons) const;
2389 std::vector<Eigen::MatrixXd> ExtractTetrahedronPoints(const Eigen::MatrixXd &polyhedronVertices,
2390 const Eigen::Vector3d &polyhedronInternalPoint,
2391 const std::vector<Eigen::Vector3d> &polyhedronFaceInternalPoints,
2392 const std::vector<unsigned int> &pointTetrahedrons) const;
2393
2398 std::vector<unsigned int> PolyhedronCoordinateSystem(const Eigen::MatrixXd &polyhedronVertices,
2399 const Eigen::MatrixXi &polyhedronEdges);
2400
2406 void ExportPolyhedronToVTU(const Eigen::MatrixXd &polyhedronVertices,
2407 const Eigen::MatrixXi &polyhedronEdges,
2408 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2409 const std::string &exportFolder) const;
2410
2411 inline void ExportPolyhedronToVTU(const Polyhedron &polyhedron, const std::string &exportFolder) const
2412 {
2414 }
2415
2421 void ExportPolyhedronToVTU(const unsigned int &index,
2422 const Eigen::MatrixXd &polyhedronVertices,
2423 const Eigen::MatrixXi &polyhedronEdges,
2424 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
2425 const std::vector<Eigen::MatrixXd> &polyhedronTetra,
2426 const double &polyhedronVolume,
2427 const Eigen::Vector3d &polyhedronCentroid,
2428 const std::vector<Eigen::MatrixXd> &polyhedronFaces3DVertices,
2429 const std::vector<double> &polyhedronFacesArea,
2430 const std::vector<Eigen::Vector3d> &polyhedronFaces2DCentroid,
2431 const std::vector<Eigen::Vector3d> &polyhedronFacesTranslation,
2432 const std::vector<Eigen::Matrix3d> &polyhedronFacesRotationMatrix,
2433 const std::vector<std::vector<Eigen::Matrix3d>> &polyhedronFaces3DTriangles,
2434 const std::vector<Eigen::Vector3d> &polyhedronFaces3DInternalPoint,
2435 const std::vector<Eigen::Vector3d> &polyhedronFaces3DNormal,
2436 const std::vector<bool> &polyhedronFaces3DNormalDirection,
2437 const std::string &exportFolder) const;
2438
2439 void ExportPolygonToVTU(const unsigned int &index,
2440 const Eigen::MatrixXd &polygon,
2441 const std::vector<Eigen::Matrix3d> &polygon_triangles,
2442 const double &polygon_volume,
2443 const Eigen::Vector3d &polygon_centroid,
2444 const Eigen::MatrixXd &polygon_edges_centroid,
2445 const Eigen::MatrixXd &polygon_edges_normal,
2446 const std::vector<bool> &polygon_edges_normal_direction,
2447 const std::string &exportFolder) const;
2448
2449 void ExportPlanteToVTU(const Eigen::Vector3d &plane_origin,
2450 const Eigen::Vector3d &plane_normal,
2451 const Eigen::Vector3d &plane_translation,
2452 const Eigen::Matrix3d &plane_rotation_matrix,
2453 const std::string &exportFolder) const;
2454
2455 MergePolyhedronsInput MergePolyhedronByFace(const std::array<Polyhedron, 2> &polyhedrons,
2456 const std::array<unsigned int, 2> polyhedrons_common_face_index,
2457 const bool remove_common_face) const;
2458
2462 MergePolyhedronsResult MergePolyhedrons(const std::array<Polyhedron, 2> &polyhedrons,
2463 const MergePolyhedronsInput &merge_information = {}) const;
2464
2465 std::map<unsigned int, unsigned int> FacetsToVertices(const std::vector<std::vector<unsigned int>> &facets) const;
2466 std::map<std::pair<unsigned int, unsigned int>, unsigned int> FacetsToEdges(const std::vector<std::vector<unsigned int>> &facets) const;
2467
2468 Polyhedron FacetsToPolyhedron(const Eigen::MatrixXd &points, const std::vector<std::vector<unsigned int>> &facets) const;
2469 std::vector<std::vector<unsigned int>> PolyhedronToFacets(const Polyhedron &polyhedron) const;
2470
2473 void PolygonChebyshevCenter(const Eigen::MatrixXd &polygonVertices,
2474 const Eigen::MatrixXd &edgeNormals,
2475 Eigen::Vector3d &in_center,
2476 double &in_radius,
2477 const double r0,
2478 const bool use_r0) const;
2479
2481 const unsigned int face_index) const;
2483 std::vector<Eigen::MatrixXi> ChangePolyhedronFacesOrientation(const Gedim::GeometryUtilities::Polyhedron &polyhedron,
2484 const std::vector<bool> &faces_normal_direction) const;
2485};
2486
2487} // namespace Gedim
2488
2489#endif // __GEOMETRYUTILITIES_H
Eigen column vector.
Definition Eigen_Array.hpp:23
The GeometryUtilities class intersects 3D segments.
Definition GeometryUtilities.hpp:37
std::vector< unsigned int > PolygonTriangulationByInternalPoint(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &internalPoint) const
Convex Polygon simple Triangulation from an internal point.
Definition GeometryUtilities_Polygon.cpp:569
Eigen::Matrix3d PlaneRotationMatrix(const Eigen::Vector3d &planeNormal) const
Compute the rotation matrix of a plane from 2D to 3D.
Definition GeometryUtilities.cpp:175
PolygonCirclePositionTypes
Definition GeometryUtilities.hpp:88
void ExportPlanteToVTU(const Eigen::Vector3d &plane_origin, const Eigen::Vector3d &plane_normal, const Eigen::Vector3d &plane_translation, const Eigen::Matrix3d &plane_rotation_matrix, const std::string &exportFolder) const
Definition GeometryUtilities_Polygon.cpp:1767
std::vector< Eigen::MatrixXd > ExtractTetrahedronPoints(const Eigen::MatrixXd &polyhedronVertices, const Eigen::Vector3d &polyhedronInternalPoint, const std::vector< Eigen::Vector3d > &polyhedronFaceInternalPoints, const std::vector< unsigned int > &pointTetrahedrons) const
std::vector< std::vector< unsigned int > > PolyhedronFaceTriangulationsByFirstVertex(const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices) const
Polyhedron Face Triangulations by first vertex of each face.
Definition GeometryUtilities_Polyhedron.cpp:920
Eigen::MatrixXd CreateTriangle(const Eigen::Vector3d &p1, const Eigen::Vector3d &p2, const Eigen::Vector3d &p3) const
Create a triangle with points.
Definition GeometryUtilities.cpp:402
bool BoundingBoxesIntersects(const Eigen::MatrixXd &boudingBox_1, const Eigen::MatrixXd &boudingBox_2) const
Definition GeometryUtilities.hpp:1005
CircleDivisionByPolygonResult CircleDivisionByPolygon(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &polygonEdgeTangents, const Eigen::Vector3d &circleCenter, const double &circleRadius, const unsigned int &curvedEdgeIndex) const
Circle division from Convex Polygon sub division which intersects a polygon in a curved edge.
Definition GeometryUtilities_Polygon.cpp:1205
Gedim::GeometryUtilities::PolygonCirclePositionTypes PolygonCirclePosition(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &circleCenter, const double &circleRadius, const std::vector< PointCirclePositionResult > &vertexPositions, const IntersectionPolygonCircleResult &polygonCircleIntersections) const
Definition GeometryUtilities_Polygon.cpp:1495
Eigen::Matrix3d PolyhedronMass(const Eigen::Vector3d &polyhedronCentroid, const std::vector< Eigen::MatrixXd > &polyhedronTetrahedronPoints) const
Definition GeometryUtilities_Polyhedron.cpp:523
Eigen::MatrixXd CreateParallelogram(const Eigen::Vector3d &origin, const Eigen::Vector3d &lengthVector, const Eigen::Vector3d &widthVector) const
Create a parallelogram with origin and dimension.
Definition GeometryUtilities.cpp:412
std::vector< unsigned int > PolyhedronCoordinateSystem(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges)
Get Polyhedron Coordinate System.
Definition GeometryUtilities_Polyhedron.cpp:1079
Eigen::MatrixXi MakeConcatenation(const Eigen::MatrixXi &segments, const unsigned int starting_vertex) const
Definition GeometryUtilities_Point.cpp:191
std::vector< unsigned int > ChangePolygonOrientation(const unsigned int numPolygonVertices) const
Definition GeometryUtilities.hpp:1857
std::vector< Eigen::Matrix3d > ExtractTriangulationPoints(const Eigen::MatrixXd &points, const std::vector< unsigned int > &pointsTriangulation) const
Definition GeometryUtilities.cpp:331
bool IsValueGreater(const double &first, const double &second, const double &tolerance) const
Definition GeometryUtilities.hpp:850
std::vector< unsigned int > PolyhedronTetrahedronsByFaceTriangulations(const Eigen::MatrixXd &polyhedronVertices, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< std::vector< unsigned int > > &polyhedronFaceTriangulations, const Eigen::Vector3d &polyhedronInternalPoint) const
Polyhedron Tetrahedrons By Face Triangulations.
bool PointIsOnLine(const Eigen::Vector3d &point, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &lineTangent) const
Check if a point is on a line.
Definition GeometryUtilities.hpp:1972
Gedim::GeometryUtilities::IntersectionPolygonCircleResult IntersectionPolygonCircle(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &circleCenter, const double &circleRadius) const
Definition GeometryUtilities_Intersection.cpp:1071
std::vector< PointCirclePositionResult > PointCirclePositions(const Eigen::MatrixXd &points, const Eigen::Vector3d &circleCenter, const double &circleRadius) const
Check if points are inside a circle.
Definition GeometryUtilities_Point.cpp:640
double Tolerance2D() const
Definition GeometryUtilities.hpp:808
double Angle(const Eigen::Vector3d &v_prev, const Eigen::Vector3d &v, const Eigen::Vector3d &v_next, const double &norm_v_prev_v, const double &norm_v_next_v) const
Definition GeometryUtilities.hpp:944
Eigen::VectorXd PolyhedronEdgesLength(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges) const
Compute Polyhedron Edges Lenght.
Definition GeometryUtilities_Polyhedron.cpp:349
void ExportPolyhedronToVTU(const Polyhedron &polyhedron, const std::string &exportFolder) const
Definition GeometryUtilities.hpp:2411
double PointPlaneDistance(const Eigen::Vector3d &point, const std::array< Eigen::Vector3d, 3 > &planePoints) const
Compute point position respect to a plane formed by 3 points.
Definition GeometryUtilities_Point.cpp:161
std::vector< unsigned int > ConvexHull(const Eigen::MatrixXd &points, const bool &includeCollinear=true) const
Compute the Convex Hull of 2D points.
Definition GeometryUtilities.cpp:229
std::vector< std::vector< Eigen::Matrix3d > > PolyhedronFaceTriangulationPointsByInternalPoint(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::Vector3d > &polyhedronFaceInternalPoints, const std::vector< std::vector< unsigned int > > &polyhedronFaceTriangulations) const
Definition GeometryUtilities_Polyhedron.cpp:954
Eigen::Vector3d SegmentNormal(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Definition GeometryUtilities.hpp:1181
double Tolerance3D() const
Definition GeometryUtilities.hpp:814
AlignedPolyhedronEdgesResult AlignedPolyhedronEdges(const Eigen::MatrixXd &polyhedronVertices, const std::vector< std::vector< unsigned int > > &verticesAdjacency, const std::vector< std::vector< unsigned int > > &edgesAdjacency, const std::vector< std::unordered_map< unsigned int, unsigned int > > &adjacencyVerticesMap, const Eigen::MatrixXd &polyhedronEdgeTangents, const Eigen::VectorXd &polyhedronEdgeSquaredLenghts) const
Definition GeometryUtilities_Polyhedron.cpp:1388
bool IsPointInsideTetrahedron(const Eigen::MatrixXd &tetrahedron, const Eigen::Vector3d &point) const
Definition GeometryUtilities_Point.cpp:603
Eigen::MatrixXd CreateRectangle(const Eigen::Vector3d &origin, const double &base, const double &height) const
Create a rectangle with origin and dimensions parallel to axis.
Definition GeometryUtilities.hpp:2045
std::vector< Eigen::Matrix3d > PolyhedronFaceRotationMatrices(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals, const std::vector< Eigen::Vector3d > &polyhedronFaceTranslations) const
Compute Polyhedron Faces Rotation matrix.
Definition GeometryUtilities_Polyhedron.cpp:430
std::vector< std::vector< unsigned int > > PolyhedronFaceTriangulationsByEarClipping(const unsigned int numPolyhedronFaces, const std::vector< Eigen::MatrixXd > &polyhedronFaces2DVertices) const
Polyhedron Face Triangulations by ear clipping of each face.
Definition GeometryUtilities_Polyhedron.cpp:930
double SegmentLength(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Definition GeometryUtilities.hpp:1164
bool IsPolygonCoplanar(const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin, const Eigen::MatrixXd &polygonVertices, const std::vector< unsigned int > &polygonUnalignedVertices) const
verify if the polygon is in the coplana to a plane
Definition GeometryUtilities_Polygon.cpp:1674
double AngleDegreeToRadians(const double &deg_angle) const
Definition GeometryUtilities.hpp:961
Eigen::Vector3d PolygonNormal(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon tridimensional normalized Normal.
Definition GeometryUtilities_Polygon.cpp:62
Eigen::MatrixXd PolygonEdgeNormals(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon edge normals outgoing the polygon.
Definition GeometryUtilities_Polygon.cpp:137
Eigen::Vector3d PolygonBarycenter(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon barycenter as a mean of all vertices.
Definition GeometryUtilities.hpp:1710
Eigen::Vector3d PolygonCentroid(const Eigen::MatrixXd &subPolygonCentroids, const Eigen::VectorXd &subPolygonAreas, const double &polygonArea) const
Compute the Polygon centroid using polygon sub-division.
Definition GeometryUtilities.hpp:1734
std::array< Eigen::Vector3d, 2 > PolygonTangents(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &polygonNormal) const
Definition GeometryUtilities_Polygon.cpp:81
Eigen::Vector3d SimplexBarycenter(const Eigen::MatrixXd &vertices) const
Compute the simplex barycenter as a mean of all vertices.
Definition GeometryUtilities.hpp:1682
~GeometryUtilities()
Definition GeometryUtilities.cpp:26
Gedim::GeometryUtilities::SplitPolygonWithSegmentResult SplitPolygonWithSegment(const SplitPolygonInput &input) const
Split a polygon with n vertices numbered from 0 to n counterclockwise given a segment contained insid...
Definition GeometryUtilities_Split.cpp:21
bool PolygonIsConvex(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &convexHull) const
Check if Polygon is Convex.
Definition GeometryUtilities_Polygon.cpp:400
double AngleRadiansToDegree(const double &rad_angle) const
Definition GeometryUtilities.hpp:956
double PolygonArea(const Eigen::MatrixXd &polygonVertices) const
Definition GeometryUtilities_Polygon.cpp:1354
Eigen::MatrixXd ExtractPoints(const Eigen::MatrixXd &points, const std::vector< unsigned int > &filter) const
Definition GeometryUtilities.cpp:322
bool IsPointInBoundingBox(const Eigen::Vector3d &point, const Eigen::MatrixXd &boudingBox) const
Definition GeometryUtilities.hpp:995
std::vector< Eigen::MatrixXd > ExtractTetrahedronPoints(const Eigen::MatrixXd &polyhedronVertices, const Eigen::Vector3d &polyhedronInternalPoint, const std::vector< unsigned int > &pointTetrahedrons) const
Eigen::Matrix3d PolygonInertia(const Eigen::Vector3d &polygonCentroid, const std::vector< Eigen::Matrix3d > &polygonTriangulationPoints) const
Definition GeometryUtilities_Polygon.cpp:1439
Eigen::Matrix3d PolygonRotationMatrix(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &polygonNormal, const Eigen::Vector3d &polygonTranslation) const
Compute the rotation matrix and translation vector of a tridimensional Polygon.
Definition GeometryUtilities_Polygon.cpp:360
double PolarAngle(const Eigen::Vector3d &v_prev, const Eigen::Vector3d &v, const Eigen::Vector3d &v_next, const double &norm_v_prev_v, const double &norm_v_next_v) const
Definition GeometryUtilities.hpp:927
Eigen::Vector3d PolygonCentroidByIntegral(const Eigen::MatrixXd &polygonVertices, const Eigen::VectorXd &edgeLengths, const Eigen::MatrixXd &edgeTangents, const Eigen::MatrixXd &edgeNormals, const double &polygonArea) const
Polygon Area By Integral on edges.
Definition GeometryUtilities_Polygon.cpp:280
Eigen::MatrixXd PolyhedronEdgeTangents(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges) const
Compute Polyhedron Edges Tangent.
Definition GeometryUtilities_Polyhedron.cpp:362
PointCirclePositionResult PointCirclePosition(const Eigen::Vector3d &point, const Eigen::Vector3d &circleCenter, const double &circleRadius) const
Check if point is inside a circle.
Definition GeometryUtilities_Point.cpp:627
Gedim::GeometryUtilities::IntersectionSegmentCircleResult IntersectionSegmentCircle(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::Vector3d &circleCenter, const double &circleRadius) const
Compute the intersection between the a segment and a circle.
Definition GeometryUtilities_Intersection.cpp:1018
std::vector< std::vector< unsigned int > > PolyhedronFacesUnalignedVertices(const std::vector< Eigen::MatrixXd > &polyhedronFacesRotatedVertices) const
Compute Polyhedron Faces Unaligned Vertices Indices.
Definition GeometryUtilities_Polyhedron.cpp:473
Gedim::GeometryUtilities::IntersectionSegmentPlaneResult IntersectionSegmentPlane(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin) const
Intersection between a Segment, represented by origin and end and a plane represented by the normal a...
Definition GeometryUtilities_Intersection.cpp:291
std::vector< unsigned int > UnalignedPolyhedronPoints(const Eigen::MatrixXd &polyhedronVertices, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< Eigen::Vector3d > &polyhedronFacesTranslation, const std::vector< Eigen::Matrix3d > &polyhedronFacesRotationMatrix, const std::vector< std::vector< unsigned int > > &polyhedronUnaligedFaces, const std::vector< std::vector< unsigned int > > &polyhedronFacesUnalignedVertices) const
Extract the circumscribed unaligned points (minimum 4) in a polyhedron.
Definition GeometryUtilities_Polyhedron.cpp:1314
std::vector< Eigen::MatrixXd > PolyhedronFaceVertices(const Eigen::MatrixXd &polyhedronVertices, const std::vector< Eigen::MatrixXi > &polyhedronFaces) const
Compute Polyhedron Faces Vertices.
Definition GeometryUtilities_Polyhedron.cpp:375
Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult IntersectionPolyhedronPlane(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin, const Eigen::Matrix3d &planeRotationMatrix, const Eigen::Vector3d &planeTranslation) const
Intersection between a Polyhedron and a Plane.
Definition GeometryUtilities_Intersection.cpp:335
PointSegmentPositionTypes
Definition GeometryUtilities.hpp:68
PolygonDivisionByAngleQuadrantResult PolygonOutsideCircleDivisionByAngleQuadrant(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &polygonEdgeTangents, const Eigen::Vector3d &circleCenter, const double &circleRadius, const unsigned int &curvedEdgeIndex) const
Convex Polygon sub division by angle quadrant which intersects a polygon in a curved edge.
Definition GeometryUtilities_Polygon.cpp:589
CompareTypes
Definition GeometryUtilities.hpp:43
Polyhedron CreateTetrahedronWithOrigin(const Eigen::Vector3d &origin, const Eigen::Vector3d &lengthVector, const Eigen::Vector3d &heightVector, const Eigen::Vector3d &widthVector) const
Create a Tetrahedron with origin and dimension.
Definition GeometryUtilities_Polyhedron.cpp:26
std::vector< double > RandomCoordinates(const unsigned int size, const bool insertExtremes, const double &minDistance, const unsigned int seed=time(nullptr)) const
Definition GeometryUtilities.cpp:108
Gedim::GeometryUtilities::IntersectionPolyhedronsSegmentResult IntersectionPolyhedronsSegment(const std::vector< Polyhedron > &polyhedrons, const std::vector< std::vector< Eigen::Vector3d > > &polyhedronFaceNormals, const std::vector< std::vector< bool > > &polyhedronFaceNormalDirections, const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::Vector3d &segmentTangent) const
Intersection between a collectio of Polyhedrons and a segment.
Definition GeometryUtilities_Intersection.cpp:905
PolygonOrientations
Definition GeometryUtilities.hpp:61
Eigen::MatrixXd PolygonEdgesCentroid(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon edges centroid.
Definition GeometryUtilities_Polygon.cpp:92
std::vector< unsigned int > PolygonTriangulationByEarClipping(const Eigen::MatrixXd &polygonVertices) const
Concave Polygon Triangulation with ear clipping algorithm.
Definition GeometryUtilities_Polygon.cpp:475
bool PointIs2D(const Eigen::Vector3d &point) const
Definition GeometryUtilities.hpp:1051
double PolyhedronDiameter(const Eigen::MatrixXd &polyhedronVertices) const
Compute the Polyhedron diameter defined as the maximum distance between the vertices.
Definition GeometryUtilities.hpp:2161
Eigen::Matrix3d PlaneReflectionMatrix(const Eigen::Vector3d &plane_normal) const
Definition GeometryUtilities.cpp:194
double PolyhedronVolumeByBoundaryIntegral(const std::vector< std::vector< Eigen::Matrix3d > > &polyhedronFaceRotatedTriangulationPoints, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals, const std::vector< bool > &polyhedronFaceNormalDirections, const std::vector< Eigen::Vector3d > &polyhedronFaceTranslations, const std::vector< Eigen::Matrix3d > &polyhedronFaceRotationMatrices, const Eigen::MatrixXd &referenceQuadraturePoints=(Eigen::MatrixXd(3, 1)<< 1.0/3.0, 1.0/3.0, 0.0).finished(), const Eigen::VectorXd &referenceQuadratureWeights=Eigen::VectorXd::Constant(1, 0.5)) const
Compute the Polyhedron Volume.
Definition GeometryUtilities_Polyhedron.cpp:210
Polyhedron CreateParallelepipedWithOrigin(const Eigen::Vector3d &origin, const Eigen::Vector3d &lengthVector, const Eigen::Vector3d &heightVector, const Eigen::Vector3d &widthVector) const
Create a Parallelepiped with origin and dimension.
Definition GeometryUtilities_Polyhedron.cpp:102
std::vector< GeometryUtilities::Polyhedron > SplitPolyhedronWithPlaneResultToPolyhedra(const SplitPolyhedronWithPlaneResult &result) const
Definition GeometryUtilities_SplitPolyhedron.cpp:611
Eigen::MatrixXd CreateSquare(const Eigen::Vector3d &origin, const double &edgeLength) const
Create a square with origin and dimensions parallel to axis.
Definition GeometryUtilities.hpp:2053
double PolygonAreaByInternalIntegral(const std::vector< Eigen::Matrix3d > &polygonTriangulationPoints, const Eigen::VectorXd &referenceQuadratureWeights=Eigen::VectorXd::Constant(1, 0.5)) const
Polygon Area By Internal Integral.
Definition GeometryUtilities_Polygon.cpp:214
std::vector< std::list< double > > IntersectionsBetweenSegments(const std::vector< Eigen::MatrixXd > &segmentsVertices, const std::vector< Eigen::Vector3d > &segmentsTangent, const std::vector< Eigen::Vector3d > &segmentsBarycenter, const std::vector< double > &segmentsLength) const
Compute the intersection between a collection of segments.
Definition GeometryUtilities_Intersection.cpp:251
bool IsValueGreaterOrEqual(const double &first, const double &second, const double &tolerance) const
Definition GeometryUtilities.hpp:858
Gedim::GeometryUtilities::SplitPolygonWithCircleResult SplitPolygonWithCircle(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &circleCenter, const double &circleRadius, const std::vector< PointCirclePositionResult > &vertexPositions, const IntersectionPolygonCircleResult &polygonCircleIntersections, const PolygonCirclePositionTypes &polygonCirclePosition) const
Split a polygon with n vertices numbered from 0 to n counterclockwise given a cirle.
Definition GeometryUtilities_Split.cpp:839
PointSegmentPositionTypes PointSegmentPosition(const Eigen::Vector3d &point, const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Compute point position respect to a segment.
std::vector< std::array< Eigen::Vector3d, 2 > > PolyhedronFaceTangents(const std::vector< Eigen::MatrixXd > &polyhedronFacesVertices, const std::vector< Eigen::Vector3d > &polyhedronFacesNormal, const std::vector< bool > &polyhedronFacesNormalDirection) const
Definition GeometryUtilities_Polyhedron.cpp:495
Eigen::VectorXd PolyhedronCentroidFacesDistance(const Eigen::Vector3d &polyhedronCentroid, const std::vector< Eigen::Vector3d > &polyhedronFacesNormal, const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices) const
Definition GeometryUtilities_Polyhedron.cpp:680
Eigen::MatrixXd RotatePoints(const Eigen::MatrixXd &points, const Eigen::Matrix3d &rotationMatrix, const Eigen::Vector3d &translation=Eigen::Vector3d::Zero()) const
Rotate Points P using rotation matrix Q and translation t: Q * P + t.
Definition GeometryUtilities.hpp:1894
bool IsValueZero(const double &value, const double &tolerance) const
Definition GeometryUtilities.hpp:891
bool IsValuePositive(const double &value, const double &tolerance) const
Definition GeometryUtilities.hpp:877
std::vector< std::vector< bool > > PolyhedronFaceEdgeDirections(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces) const
Compute Polyhedron Faces Edge Direction.
Definition GeometryUtilities_Polyhedron.cpp:392
Polyhedron FacetsToPolyhedron(const Eigen::MatrixXd &points, const std::vector< std::vector< unsigned int > > &facets) const
Definition GeometryUtilities_Polyhedron.cpp:1566
Eigen::Vector3d PolygonTranslation(const Eigen::MatrixXd &polygonVertices) const
Compute the translation vector of a tridimensional Polygon.
Definition GeometryUtilities.hpp:1822
bool CheckTrianglesIntersection(const Eigen::MatrixX3d &triangle_one, const Eigen::MatrixX3d &triangle_two, const bool admit_boundary=true) const
Definition GeometryUtilities_Polygon.cpp:26
double RelativeDifference(const double &first, const double &second, const double &tolerance) const
Definition GeometryUtilities.hpp:825
PointPlanePositionTypes PointPlanePosition(const double &pointPlaneDistance) const
Compute point position respect to a plane.
Definition GeometryUtilities_Point.cpp:181
double SegmentIntercept(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Compute the segment intercept q of line y = m * x + q.
Definition GeometryUtilities.hpp:1204
std::vector< Eigen::MatrixXi > ChangePolyhedronFacesOrientation(const Gedim::GeometryUtilities::Polyhedron &polyhedron, const std::vector< bool > &faces_normal_direction) const
Change Polyhedron Face Orientation if face_normal_direction is false.
Definition GeometryUtilities_Polyhedron.cpp:1648
PolygonOrientations PolygonOrientation(const std::vector< unsigned int > &convexHull) const
Definition GeometryUtilities_Polygon.cpp:428
double PolygonArea3D(const Eigen::MatrixXd &polygonVertices) const
Definition GeometryUtilities_Polygon.cpp:1369
std::vector< Eigen::Matrix3d > ExtractTriangulationPointsByInternalPoint(const Eigen::MatrixXd &points, const Eigen::Vector3d &internalPoint, const std::vector< unsigned int > &pointsTriangulation) const
Definition GeometryUtilities.cpp:348
std::vector< bool > PolyhedronFaceNormalDirections(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const Eigen::Vector3d &pointInsidePolyhedron, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals) const
Compute Polyhedron Face Normal Directions.
CompareTypes CompareValues(const double &first, const double &second, const double &tolerance) const
Compare two values according to tolerance.
Definition GeometryUtilities.cpp:161
Eigen::MatrixXd SplitPolygonWithCircleBuildSubPolygon(const SplitPolygonWithCircleResult &splitResult, const unsigned int &subPolygonIndex, const Eigen::MatrixXd &polygonVertices, const Gedim::GeometryUtilities::IntersectionPolygonCircleResult &polygonCircleIntersections) const
Build the subpolygon coordinates from split result.
Definition GeometryUtilities_Split.cpp:1241
bool CheckNoSpheresIntersection(const Eigen::Vector3d &firstSphereCenter, const Eigen::Vector3d &secondSphereCenter, const double &firstSphereDiameter, const double &secondSphereDiameter) const
Check if two spheres do not intersect.
Definition GeometryUtilities.hpp:1220
Gedim::GeometryUtilities::PointPolyhedronPositionResult PointPolyhedronPosition(const Eigen::Vector3d &point, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::MatrixXd > &polyhedronFaceRotatedVertices, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals, const std::vector< bool > &polyhedronFaceNormalDirections, const std::vector< Eigen::Vector3d > &polyhedronFaceTranslations, const std::vector< Eigen::Matrix3d > &polyhedronFaceRotationMatrices) const
Check if point is inside a polygon.
Eigen::MatrixXd PointsBoundingBox(const Eigen::MatrixXd &points) const
Definition GeometryUtilities_Point.cpp:49
std::vector< std::vector< unsigned int > > PolyhedronToFacets(const Polyhedron &polyhedron) const
Definition GeometryUtilities_Polyhedron.cpp:1612
bool IsPointOnPlane(const double &pointPlaneDistance) const
Definition GeometryUtilities.hpp:1147
Eigen::Matrix3d PolyhedronInertia(const Eigen::Vector3d &polyhedronCentroid, const std::vector< Eigen::MatrixXd > &polyhedronTetrahedraPoints) const
Definition GeometryUtilities_Polyhedron.cpp:601
Eigen::MatrixXd PolygonEdgeTangents(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon edge tangents.
Definition GeometryUtilities_Polygon.cpp:122
std::vector< bool > PointsAreOnLine(const Eigen::MatrixXd &points, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &lineTangent) const
Check if a set of points are on a line.
Definition GeometryUtilities_Point.cpp:655
double PolyhedronInRadius(const Eigen::VectorXd &polyhedronCentroidFacesDistance) const
Definition GeometryUtilities.hpp:2263
Eigen::VectorXd PolygonCentroidVerticesDistance(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &polygonCentroid) const
Definition GeometryUtilities_Polygon.cpp:343
Eigen::Vector3d BarycentricCoordinatesToPoint2D(const Eigen::Matrix3d &triangle, const std::array< double, 3 > &barycentric_coordinates) const
Definition GeometryUtilities_Point.cpp:696
bool IsPointOnLine(const Eigen::Vector3d &point, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &lineTangent, const double &lineTangentSquaredLength) const
Definition GeometryUtilities_Point.cpp:99
bool PointsAre2D(const Eigen::MatrixXd &points) const
Definition GeometryUtilities.hpp:1058
std::map< unsigned int, unsigned int > FacetsToVertices(const std::vector< std::vector< unsigned int > > &facets) const
Definition GeometryUtilities_Polyhedron.cpp:1525
bool IsValueNegative(const double &value, const double &tolerance) const
Definition GeometryUtilities.hpp:884
Eigen::VectorXd PolygonCentroidEdgesDistance(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &polygonCentroid, const Eigen::MatrixXd &polygonEdgeNormals) const
Definition GeometryUtilities_Polygon.cpp:325
PolygonDivisionByCircleResult PolygonDivisionByCircle(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &polygonEdgeTangents, const Eigen::Vector3d &circleCenter, const double &circleRadius, const unsigned int &curvedEdgeIndex) const
Convex Polygon sub division from a circle which intersects a polygon in a curved edge.
Definition GeometryUtilities_Polygon.cpp:971
PolygonTypes PolygonType(const unsigned int &numPolygonVertices, const bool &isPolygonConvex) const
Definition GeometryUtilities_Polygon.cpp:416
Eigen::Vector3d PlaneReflectionTranslation(const Eigen::Vector3d &plane_normal, const Eigen::Vector3d &planeOrigin) const
Definition GeometryUtilities.cpp:206
bool IsPointOnPlane(const Eigen::Vector3d &point, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin) const
Definition GeometryUtilities.hpp:1156
void PolygonChebyshevCenter(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &edgeNormals, Eigen::Vector3d &in_center, double &in_radius, const double r0, const bool use_r0) const
Definition GeometryUtilities_Polygon.cpp:238
bool IsPointZero(const Eigen::Vector3d &point) const
Definition GeometryUtilities.hpp:1019
IntersectionPolyhedronLineResult IntersectionPolyhedronLine(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals, const std::vector< bool > &polyhedronFaceNormalDirections, const Eigen::Vector3d &lineTangent, const Eigen::Vector3d &lineOrigin) const
Intersection between a Polyhedron and a line.
Definition GeometryUtilities_Intersection.cpp:590
IntersectionSegmentSegmentResult IntersectionSegmentSegment(const Eigen::Vector3d &firstSegmentOrigin, const Eigen::Vector3d &firstSegmentEnd, const Eigen::Vector3d &secondSegmentOrigin, const Eigen::Vector3d &secondSegmentEnd) const
Compute the intersection between the two segments.
Definition GeometryUtilities_Intersection.cpp:50
Eigen::MatrixXd PointsDistance(const Eigen::MatrixXd &points) const
Definition GeometryUtilities_Point.cpp:28
Eigen::VectorXd PointDistances(const Eigen::MatrixXd &points, const Eigen::Vector3d &point) const
compute the distance between a point and a list of points
Definition GeometryUtilities_Point.cpp:23
double PointLineDistance(const Eigen::Vector3d &point, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &normalToLine) const
Compute the distance between a point and a line.
Definition GeometryUtilities.hpp:1044
double Tolerance1DSquared() const
Definition GeometryUtilities.hpp:802
bool AreLineCoplanar(const Eigen::Vector3d &firstLineOrigin, const Eigen::Vector3d &firstLineTangent, const Eigen::Vector3d &secondLineOrigin, const Eigen::Vector3d &secondLineTangent) const
Definition GeometryUtilities_Intersection.cpp:23
std::vector< Eigen::MatrixXd > PolyhedronFaceRotatedVertices(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::Vector3d > &polyhedronFaceTranslations, const std::vector< Eigen::Matrix3d > &polyhedronFaceRotationMatrices) const
Compute Polyhedron Faces Rotated Vertices 2D.
Definition GeometryUtilities_Polyhedron.cpp:456
Eigen::Matrix2d PolygonMass(const Eigen::Vector3d &polygonCentroid, const std::vector< Eigen::Matrix3d > &polygonTriangulationPoints) const
Definition GeometryUtilities_Polygon.cpp:1384
std::vector< Eigen::Vector3d > PolyhedronFaceBarycenter(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices) const
Compute Polyhedron Faces barycenters.
Definition GeometryUtilities_Polyhedron.cpp:512
bool PolyhedronIsConvex(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::MatrixXd > &polyhedronFaceRotatedVertices, const std::vector< Eigen::Vector3d > &polyhedronFaceInternalPoints, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals, const std::vector< bool > &polyhedronFaceNormalDirections, const Eigen::Vector3d &polyhedronInternalPoint) const
Check if Polyhedron is Convex.
Definition GeometryUtilities_Polyhedron.cpp:697
PolygonTypes
Definition GeometryUtilities.hpp:51
bool PointsAreCoincident(const Eigen::Vector3d &firstPoint, const Eigen::Vector3d &secondPoint) const
Definition GeometryUtilities.hpp:1027
LinePolygonPositionResult LinePolygonPosition(const Eigen::Vector3d &lineTangent, const Eigen::Vector3d &lineOrigin, const Eigen::MatrixXd &polygonVertices) const
Definition GeometryUtilities_Polygon.cpp:1587
Polyhedron CreatePolyhedronWithExtrusion(const Eigen::MatrixXd &polygonVertices, const Eigen::Vector3d &heightVector) const
Create Polyhedron With Extrusion.
Definition GeometryUtilities.hpp:2095
std::vector< unsigned int > FindPointInPoints(const Eigen::MatrixXd &points, const Eigen::Vector3d &point) const
Find a point in point list.
Definition GeometryUtilities_Point.cpp:86
bool IsValueLower(const double &first, const double &second, const double &tolerance) const
Definition GeometryUtilities.hpp:865
Eigen::Vector3d PlaneTranslation(const Eigen::Vector3d &planeOrigin) const
Compute the translation vector of a plane from 2D to 3D.
Definition GeometryUtilities.hpp:1879
double PolyhedronVolumeByInternalIntegral(const std::vector< Eigen::MatrixXd > &polyhedronTetrahedronVertices, const Eigen::VectorXd &referenceQuadratureWeights=Eigen::VectorXd::Constant(1, 1.0/6.0)) const
Polyhedron Volume By Internal Integral.
Definition GeometryUtilities_Polyhedron.cpp:255
double PolygonDiameter(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon diameter defined as the maximum distance between the vertices.
Definition GeometryUtilities.hpp:1812
std::vector< unsigned int > PolygonTriangulationByFirstVertex(const Eigen::MatrixXd &polygonVertices) const
Convex Polygon simple Triangulation from the first vertex.
Definition GeometryUtilities_Polygon.cpp:445
Eigen::MatrixXd fibonacci_sphere(const unsigned int num_points) const
Definition GeometryUtilities.cpp:49
Gedim::GeometryUtilities::IntersectionPolyhedronLineResult IntersectionPolyhedronSegment(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::Vector3d &segmentTangent, const IntersectionPolyhedronLineResult &polyhedronLineIntersections) const
Intersection between a Polyhedron and a segment.
Definition GeometryUtilities_Intersection.cpp:798
Polyhedron CreateTetrahedronWithVertices(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2, const Eigen::Vector3d &v3, const Eigen::Vector3d &v4) const
Create a Tetrahedron with the four vertices.
Definition GeometryUtilities_Polyhedron.cpp:64
double PointDistance(const Eigen::Vector3d &firstPoint, const Eigen::Vector3d &secondPoint) const
compute the Point distance
Definition GeometryUtilities.hpp:973
std::vector< Eigen::Vector3d > PolyhedronFaceTranslations(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices) const
Compute Polyhedron Faces translation vectors.
Definition GeometryUtilities_Polyhedron.cpp:446
Eigen::MatrixXd RotatePointsFrom3DTo2D(const Eigen::MatrixXd &points, const Eigen::Matrix3d &rotationMatrix, const Eigen::Vector3d &translation=Eigen::Vector3d::Zero()) const
Rotate Points P From 3D To 2D using rotation matrix Q and translation t: Q * (P - t)
Definition GeometryUtilities.hpp:1919
double PolygonAspectRatio(const double &polygonDiameter, const double &polygonInRadius) const
Definition GeometryUtilities.hpp:1805
std::map< std::pair< unsigned int, unsigned int >, unsigned int > FacetsToEdges(const std::vector< std::vector< unsigned int > > &facets) const
Definition GeometryUtilities_Polyhedron.cpp:1540
bool IsValueLowerOrEqual(const double &first, const double &second, const double &tolerance) const
Definition GeometryUtilities.hpp:870
std::vector< Eigen::Vector3d > PolyhedronFaceNormals(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices) const
Compute Polyhedron Faces Normals.
Definition GeometryUtilities_Polyhedron.cpp:484
Eigen::Vector3d SegmentBarycenter(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Compute the segment barycenter as a mean of all vertices.
Definition GeometryUtilities.hpp:1703
double SegmentSlope(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Compute the segment slope m of line y = m * x + q.
Definition GeometryUtilities.hpp:1193
Eigen::MatrixXd RotatePointsFrom2DTo3D(const Eigen::MatrixXd &points, const Eigen::Matrix3d &rotationMatrix, const Eigen::Vector3d &translation=Eigen::Vector3d::Zero()) const
Rotate Points P From 2D To 3D using rotation matrix Q and translation t: Q * P + t.
Definition GeometryUtilities.hpp:1907
bool PointIsAligned(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::Vector3d &point) const
Check if a point is aligned to a line identified by a segment.
Definition GeometryUtilities.hpp:1962
Eigen::MatrixXd generate_uniform_random_points_in_sphere(const unsigned int num_points, const double radius=1.0) const
Definition GeometryUtilities.cpp:30
Eigen::MatrixXd PolyhedronEdgesCentroid(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges) const
Compute Polyhedron Edges Centroid.
Definition GeometryUtilities_Polyhedron.cpp:336
std::vector< std::vector< unsigned int > > PolyhedronFaceTriangulations(const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< std::vector< unsigned int > > &localFaceTriangulations) const
Polyhedron Face Triangulations of each face.
Definition GeometryUtilities_Polyhedron.cpp:901
PointCirclePositionResult
Definition GeometryUtilities.hpp:588
Eigen::MatrixXi ChangePolyhedronFaceOrientation(const Gedim::GeometryUtilities::Polyhedron &polyhedron, const unsigned int face_index) const
Definition GeometryUtilities_Polyhedron.cpp:1628
Eigen::Vector3d PolyhedronCentroid(const std::vector< std::vector< Eigen::Matrix3d > > &polyhedronFaceRotatedTriangulationPoints, const std::vector< Eigen::Vector3d > &polyhedronFaceNormals, const std::vector< bool > &polyhedronFaceNormalDirections, const std::vector< Eigen::Vector3d > &polyhedronFaceTranslations, const std::vector< Eigen::Matrix3d > &polyhedronFaceRotationMatrices, const double &polyhedronVolume) const
Compute the Polyhedron centroid.
Definition GeometryUtilities_Polyhedron.cpp:279
MergePolyhedronsInput MergePolyhedronByFace(const std::array< Polyhedron, 2 > &polyhedrons, const std::array< unsigned int, 2 > polyhedrons_common_face_index, const bool remove_common_face) const
Definition GeometryUtilities_merged_polyhedrons.cpp:17
void ExportPolyhedronToVTU(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::string &exportFolder) const
Export Polyhedron To VTU.
Definition GeometryUtilities_Polyhedron.cpp:1104
Eigen::MatrixXd CreateEllipse(const double &axisMajorLength, const double &axisMinorLength, const unsigned int &resolution) const
Create 2D Ellipse approximation with 2D polygon.
Definition GeometryUtilities.cpp:366
PointPlanePositionTypes
Definition GeometryUtilities.hpp:80
void ExportPolygonToVTU(const unsigned int &index, const Eigen::MatrixXd &polygon, const std::vector< Eigen::Matrix3d > &polygon_triangles, const double &polygon_volume, const Eigen::Vector3d &polygon_centroid, const Eigen::MatrixXd &polygon_edges_centroid, const Eigen::MatrixXd &polygon_edges_normal, const std::vector< bool > &polygon_edges_normal_direction, const std::string &exportFolder) const
Definition GeometryUtilities_Polygon.cpp:1691
PolygonDivisionByAngleQuadrantResult PolygonInsideCircleDivisionByAngleQuadrant(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &polygonEdgeTangents, const Eigen::Vector3d &circleCenter, const double &circleRadius, const unsigned int &curvedEdgeIndex) const
Convex Polygon sub division by angle quadrant which intersects a polygon in a curved edge.
Definition GeometryUtilities_Polygon.cpp:784
double PolygonInRadius(const Eigen::VectorXd &polygonCentroidEdgesDistance) const
Definition GeometryUtilities.hpp:1797
Eigen::Vector3d PolygonCentroid(const Eigen::MatrixXd &polygonVertices, const double &polygonArea) const
Compute the Polygon centroid as described in https://en.wikipedia.org/wiki/Centroid.
Definition GeometryUtilities_Polygon.cpp:152
double PointSegmentProjection(const Eigen::Vector3d &point, const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Project point on a segment line.
Definition GeometryUtilities.hpp:1121
bool IsPointInsidePolygon_RayCasting(const Eigen::Vector3d &point, const Eigen::MatrixXd &polygonVertices) const
IsPointInsidePolygon using RayCasting algorithm (see https://en.wikipedia.org/wiki/Point_in_polygon)
Definition GeometryUtilities.hpp:1410
Polyhedron CreateCubeWithOrigin(const Eigen::Vector3d &origin, const double &edgeLength) const
Create a Cube with origin aligned to axis.
Definition GeometryUtilities.hpp:2111
bool IsPointInsidePolygon(const Eigen::Vector3d &point, const Eigen::MatrixXd &polygonVertices) const
Definition GeometryUtilities.hpp:1399
Eigen::Vector3d SegmentTangent(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
Definition GeometryUtilities.hpp:1172
bool AreValuesEqual(const double &first, const double &second, const double &tolerance) const
Check if two values are equal according to tolerance.
Definition GeometryUtilities.hpp:842
Eigen::MatrixXd PlaneToPolygon(const Eigen::Vector3d &plane_normal, const Eigen::Vector3d &plane_origin) const
Definition GeometryUtilities.cpp:213
std::vector< std::vector< unsigned int > > PolyhedronFaceTriangulationsByInternalPoint(const Eigen::MatrixXd &polyhedronVertices, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::Vector3d > &polyhedronFaceInternalPoints) const
Polyhedron Face Triangulations by internal point of each face.
Definition GeometryUtilities_Polyhedron.cpp:970
double PointsMaxDistance(const Eigen::MatrixXd &points) const
Definition GeometryUtilities_Point.cpp:63
MergePolyhedronsResult MergePolyhedrons(const std::array< Polyhedron, 2 > &polyhedrons, const MergePolyhedronsInput &merge_information={}) const
Merge two Polyhedrons not intersecting.
Definition GeometryUtilities_merged_polyhedrons.cpp:85
std::vector< bool > PointsAreAligned(const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd, const Eigen::MatrixXd &points) const
Check if a set of points are aligned to a line identified by a segment.
Definition GeometryUtilities.hpp:1941
std::vector< unsigned int > PolyhedronTetrahedronsByFaceTriangulations(const Eigen::MatrixXd &polyhedronVertices, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< std::vector< unsigned int > > &polyhedronFaceTriangulations, const std::vector< Eigen::Vector3d > &polyhedronFaceInternalPoints, const Eigen::Vector3d &polyhedronInternalPoint) const
Polyhedron Tetrahedrons By Face Triangulations with face internal points.
std::vector< unsigned int > UnalignedPoints(const Eigen::MatrixXd &points, const unsigned int numDesiredUnalignedPoints=0) const
Extract the circumscribed unaligned points (minimum 2) in a set of points.
Definition GeometryUtilities_Point.cpp:708
double PointCurvilinearCoordinate(const Eigen::Vector3d &point, const Eigen::Vector3d &segmentOrigin, const Eigen::Vector3d &segmentEnd) const
compute the Point Curvilinear Coordinate of segment
Definition GeometryUtilities.hpp:1069
double Tolerance1D() const
Definition GeometryUtilities.hpp:797
Gedim::GeometryUtilities::SplitPolygonWithPlaneResult SplitPolygonWithPlane(const Eigen::MatrixXd &polygonVertices, const Eigen::MatrixXd &polygonEdgeTangents, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin, const Eigen::Vector3d &polygonTranslation, const Eigen::Matrix3d &polygonRotationMatrix) const
Split 3d Polygon With Plane.
Definition GeometryUtilities_SplitPolyhedron.cpp:21
Eigen::Vector3d PolyhedronBarycenter(const Eigen::MatrixXd &polyhedronVertices) const
Compute the polyhedron barycenter as a mean of all vertices.
Definition GeometryUtilities.hpp:1718
Gedim::GeometryUtilities::PointPolygonPositionResult PointPolygonPosition_RayCasting(const Eigen::Vector3d &point, const Eigen::MatrixXd &polygonVertices) const
Definition GeometryUtilities_Point.cpp:302
std::vector< double > EquispaceCoordinates(const double &step, const bool &insertExtremes) const
Definition GeometryUtilities.cpp:75
std::vector< std::vector< Eigen::Matrix3d > > PolyhedronFaceExtractTriangulationPoints(const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< std::vector< unsigned int > > &polyhedronFaceTriangulations) const
Definition GeometryUtilities_Polyhedron.cpp:941
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult SplitPolyhedronWithPlane(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< Eigen::MatrixXd > &polyhedronFaceVertices, const std::vector< Eigen::MatrixXd > &polyhedronFaceEdgeTangents, const std::vector< Eigen::Vector3d > &polyhedronFaceTranslations, const std::vector< Eigen::Matrix3d > &polyhedronFaceRotationMatrices, const Eigen::Vector3d &planeNormal, const Eigen::Vector3d &planeOrigin, const Eigen::Matrix3d &planeRotationMatrix, const Eigen::Vector3d &planeTranslation) const
Definition GeometryUtilities_SplitPolyhedron.cpp:141
std::array< double, 3 > PointToBarycentricCoordinates2D(const Eigen::Matrix3d &triangle, const Eigen::Vector3d &point) const
Definition GeometryUtilities_Point.cpp:673
Eigen::VectorXd PolygonEdgeLengths(const Eigen::MatrixXd &polygonVertices) const
Compute the Polygon edge lengths.
Definition GeometryUtilities_Polygon.cpp:107
double PolygonAreaByBoundaryIntegral(const Eigen::MatrixXd &polygonVertices, const Eigen::VectorXd &edgeLengths, const Eigen::MatrixXd &edgeTangents, const Eigen::MatrixXd &edgeNormals, const Eigen::MatrixXd &referenceQuadraturePoints=(Eigen::MatrixXd(3, 1)<< 0.5, 0.0, 0.0).finished(), const Eigen::VectorXd &referenceQuadratureWeights=Eigen::VectorXd::Ones(1)) const
Polygon Area By Integral on edges.
Definition GeometryUtilities_Polygon.cpp:175
Gedim::GeometryUtilities::PointPolygonPositionResult PointPolygonPosition(const Eigen::Vector3d &point, const Eigen::MatrixXd &polygonVertices) const
Check if point is inside a polygon.
Definition GeometryUtilities_Point.cpp:253
double PointLineCurvilinearCoordinate(const Eigen::Vector3d &point, const Eigen::Vector3d &lineOrigin, const Eigen::Vector3d &lineTangent, const double &lineTangentSquaredLength) const
compute the Point Curvilinear Coordinate of line
Definition GeometryUtilities.hpp:1083
double SimplexMeasure(const Eigen::MatrixXd &vertices) const
Definition GeometryUtilities.hpp:1688
std::vector< Eigen::MatrixXd > PolyhedronFaceEdgeTangents(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const std::vector< std::vector< bool > > &polyhedronFaceEdgeDirections, const Eigen::MatrixXd &polyhedronEdgeTangents) const
Compute Polyhedron Faces Edge Tangents.
Definition GeometryUtilities_Polyhedron.cpp:409
static void Assert(const bool &logicResult)
Assert for all code, generate exception if something goes wrong.
Definition IOUtilities.hpp:126
Definition Eigen_Array.cpp:22
Definition GeometryUtilities.hpp:754
std::vector< std::vector< unsigned int > > AlignedEdgesEdges
Definition GeometryUtilities.hpp:756
std::vector< std::vector< unsigned int > > AlignedEdgesVertices
Definition GeometryUtilities.hpp:755
std::vector< std::vector< unsigned int > > InternalTriangles
Triangle formed with circle Center and new points.
Definition GeometryUtilities.hpp:161
Eigen::MatrixXd Points
Coordinates of generated points.
Definition GeometryUtilities.hpp:159
std::vector< std::vector< unsigned int > > SubTriangles
Triangle formed with sub-polygons and circle Center.
Definition GeometryUtilities.hpp:160
std::vector< std::vector< unsigned int > > SubPolygons
Subpolygon formed.
Definition GeometryUtilities.hpp:162
double CurvilinearCoordinate
Valid only in IndexType Edge.
Definition GeometryUtilities.hpp:124
Gedim::GeometryUtilities::IntersectionPolygonCircleResult::Intersection::IndexTypes IndexType
Definition GeometryUtilities.hpp:121
Gedim::GeometryUtilities::IntersectionPolygonCircleResult::Intersection::Types Type
Definition GeometryUtilities.hpp:119
unsigned int Index
Definition GeometryUtilities.hpp:123
std::vector< Gedim::GeometryUtilities::IntersectionPolygonCircleResult::Intersection > Intersections
Definition GeometryUtilities.hpp:127
Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::LineIntersection::Types PolyhedronType
Definition GeometryUtilities.hpp:479
unsigned int PolyhedronIndex
vertex index)
Definition GeometryUtilities.hpp:483
double CurvilinearCoordinate
Curvilinear coordinate in the line.
Definition GeometryUtilities.hpp:485
Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronEdgeIntersection::Types Type
Definition GeometryUtilities.hpp:449
unsigned int LineIntersectionIndex
Index of line intersection collection.
Definition GeometryUtilities.hpp:451
unsigned int LineIntersectionIndex
Index of line intersection collection.
Definition GeometryUtilities.hpp:437
Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronFaceIntersection::Types Type
Definition GeometryUtilities.hpp:435
Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronVertexIntersection::Types Type
Definition GeometryUtilities.hpp:463
unsigned int LineIntersectionIndex
Index of line intersection collection.
Definition GeometryUtilities.hpp:465
Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::Types Type
Definition GeometryUtilities.hpp:488
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronEdgeIntersection > PolyhedronEdgeIntersections
size polyhedron num edges
Definition GeometryUtilities.hpp:494
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronFaceIntersection > PolyhedronFaceIntersections
size polyhedron num faces
Definition GeometryUtilities.hpp:496
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::LineIntersection > LineIntersections
The line intersections.
Definition GeometryUtilities.hpp:490
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronLineResult::PolyhedronVertexIntersection > PolyhedronVertexIntersections
Definition GeometryUtilities.hpp:491
Gedim::GeometryUtilities::IntersectionSegmentPlaneResult Intersection
plane
Definition GeometryUtilities.hpp:544
Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::FaceIntersection::Types Type
Definition GeometryUtilities.hpp:538
Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::Intersection::Types Type
Definition GeometryUtilities.hpp:570
unsigned int EdgeId
Edge index of the Polyhedron.
Definition GeometryUtilities.hpp:572
unsigned int VertexId
Vertex index of the Polyhedron, available only if Type is Types::Vertex.
Definition GeometryUtilities.hpp:573
Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::VertexIntersection::Types Type
Definition GeometryUtilities.hpp:557
unsigned int IntersectionId
Types::OnEdge and Types::OnFace.
Definition GeometryUtilities.hpp:578
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::EdgeIntersection > EdgeIntersections
Edge intersections.
Definition GeometryUtilities.hpp:581
Eigen::MatrixXd IntersectionCoordinates
The resulting intersection coordinates.
Definition GeometryUtilities.hpp:584
Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::Types Type
The intersection type.
Definition GeometryUtilities.hpp:576
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::VertexIntersection > VertexIntersections
Vertex intersections.
Definition GeometryUtilities.hpp:580
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::Intersection > Intersections
The resulting intersections.
Definition GeometryUtilities.hpp:583
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronPlaneResult::FaceIntersection > FaceIntersections
Face intersections.
Definition GeometryUtilities.hpp:582
std::vector< unsigned int > Cell3DIndices
Definition GeometryUtilities.hpp:504
std::vector< unsigned int > Cell3DIndices
Definition GeometryUtilities.hpp:510
std::vector< double > Points
Definition GeometryUtilities.hpp:509
std::map< double, Gedim::GeometryUtilities::IntersectionPolyhedronsSegmentResult::IntersectionPoint > Points
Definition GeometryUtilities.hpp:513
std::vector< Gedim::GeometryUtilities::IntersectionPolyhedronsSegmentResult::IntersectionSegment > Segments
Definition GeometryUtilities.hpp:514
Gedim::GeometryUtilities::PointSegmentPositionTypes Type
Definition GeometryUtilities.hpp:380
Gedim::GeometryUtilities::IntersectionSegmentCircleResult::Types Type
Definition GeometryUtilities.hpp:384
std::vector< Gedim::GeometryUtilities::IntersectionSegmentCircleResult::IntersectionPosition > SegmentIntersections
intersections of the segment,
Definition GeometryUtilities.hpp:387
Gedim::GeometryUtilities::PointSegmentPositionTypes Type
Definition GeometryUtilities.hpp:402
double CurvilinearCoordinate
Definition GeometryUtilities.hpp:403
Gedim::GeometryUtilities::IntersectionSegmentPlaneResult::Intersection SingleIntersection
Definition GeometryUtilities.hpp:408
Gedim::GeometryUtilities::IntersectionSegmentPlaneResult::Types Type
The intersection type.
Definition GeometryUtilities.hpp:406
Gedim::GeometryUtilities::PointSegmentPositionTypes Type
Definition GeometryUtilities.hpp:346
IntersectionLineTypes
Definition GeometryUtilities.hpp:329
Gedim::GeometryUtilities::IntersectionSegmentSegmentResult::IntersectionSegmentTypes IntersectionSegmentsType
Definition GeometryUtilities.hpp:352
std::vector< Gedim::GeometryUtilities::IntersectionSegmentSegmentResult::IntersectionPosition > FirstSegmentIntersections
intersections of the first segment,
Definition GeometryUtilities.hpp:362
std::vector< unsigned int > SecondIntersectionRelation
Definition GeometryUtilities.hpp:359
IntersectionSegmentTypes
Definition GeometryUtilities.hpp:337
std::vector< Gedim::GeometryUtilities::IntersectionSegmentSegmentResult::IntersectionPosition > SecondSegmentIntersections
intersections of the second segment,
Definition GeometryUtilities.hpp:365
Gedim::GeometryUtilities::IntersectionSegmentSegmentResult::IntersectionLineTypes IntersectionLinesType
Definition GeometryUtilities.hpp:350
double CurvilinearCoordinate
Definition GeometryUtilities.hpp:634
Gedim::GeometryUtilities::LinePolygonPositionResult::EdgeIntersection::Types Type
Definition GeometryUtilities.hpp:631
unsigned int Index
Definition GeometryUtilities.hpp:633
Definition GeometryUtilities.hpp:612
Gedim::GeometryUtilities::LinePolygonPositionResult::Types Type
Definition GeometryUtilities.hpp:638
std::vector< Gedim::GeometryUtilities::LinePolygonPositionResult::EdgeIntersection > EdgeIntersections
Definition GeometryUtilities.hpp:637
Types
Definition GeometryUtilities.hpp:614
Definition GeometryUtilities.hpp:760
std::vector< std::pair< Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypes, unsigned int > > MergeTypesList
Definition GeometryUtilities.hpp:770
std::vector< std::array< unsigned int, 2 > > Common_vertices
Definition GeometryUtilities.hpp:775
static constexpr unsigned int none
Definition GeometryUtilities.hpp:768
std::array< Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypesList, 2 > Vertices_Type
Definition GeometryUtilities.hpp:772
MergeTypes
Definition GeometryUtilities.hpp:762
std::array< Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypesList, 2 > Faces_Type
Definition GeometryUtilities.hpp:774
std::array< Gedim::GeometryUtilities::MergePolyhedronsInput::MergeTypesList, 2 > Edges_Type
Definition GeometryUtilities.hpp:773
std::vector< std::array< unsigned int, 2 > > Common_faces
Definition GeometryUtilities.hpp:777
std::vector< std::array< unsigned int, 2 > > Common_edges
Definition GeometryUtilities.hpp:776
Definition GeometryUtilities.hpp:781
std::array< std::vector< unsigned int >, 2 > OriginalToMergedEdges
Definition GeometryUtilities.hpp:784
Gedim::GeometryUtilities::Polyhedron MergedPolyhedron
Definition GeometryUtilities.hpp:789
static constexpr unsigned int none
Definition GeometryUtilities.hpp:782
std::array< std::vector< unsigned int >, 2 > OriginalToMergedFaces
Definition GeometryUtilities.hpp:785
std::vector< std::array< unsigned int, 2 > > MergedToOriginalVertices
Definition GeometryUtilities.hpp:786
std::array< std::vector< unsigned int >, 2 > OriginalToMergedVertices
Definition GeometryUtilities.hpp:783
std::vector< std::array< unsigned int, 2 > > MergedToOriginalEdges
Definition GeometryUtilities.hpp:787
std::vector< std::array< unsigned int, 2 > > MergedToOriginalFaces
Definition GeometryUtilities.hpp:788
Definition GeometryUtilities.hpp:596
Gedim::GeometryUtilities::PointPolygonPositionResult::Types Type
Definition GeometryUtilities.hpp:607
Types
Definition GeometryUtilities.hpp:598
unsigned int BorderIndex
index of vertex/edge of border
Definition GeometryUtilities.hpp:606
Gedim::GeometryUtilities::PointPolyhedronPositionResult::Types Type
Definition GeometryUtilities.hpp:656
unsigned int BorderIndex
index of vertex/edge/face of border
Definition GeometryUtilities.hpp:654
std::vector< unsigned int > Internal_indices
list of index of internal cell (usually tetrahedrons)
Definition GeometryUtilities.hpp:655
Eigen::MatrixXd Points
Coordinates of generated points.
Definition GeometryUtilities.hpp:143
std::vector< std::vector< unsigned int > > SubPolygons
Subpolygon formed.
Definition GeometryUtilities.hpp:144
std::vector< Gedim::GeometryUtilities::PolygonDivisionByAngleQuadrantResult::Types > SubPolygonTypes
types
Definition GeometryUtilities.hpp:145
std::vector< std::vector< unsigned int > > InternalTriangles
Triangle formed with circle Center and new points.
Definition GeometryUtilities.hpp:153
std::vector< std::vector< unsigned int > > SubPolygons
Subpolygon formed.
Definition GeometryUtilities.hpp:154
std::vector< std::vector< unsigned int > > SubTriangles
Triangle formed with sub-polygons and circle Center.
Definition GeometryUtilities.hpp:152
Eigen::MatrixXd Points
Coordinates of generated points.
Definition GeometryUtilities.hpp:151
Definition GeometryUtilities.hpp:677
Eigen::MatrixXd Vertices
vertices, size 3 x numVertices
Definition GeometryUtilities.hpp:678
Eigen::MatrixXi Edges
edges, size 2 x numEdges
Definition GeometryUtilities.hpp:679
std::vector< Eigen::MatrixXi > Faces
faces vertices and edges˝, size numFaces x 2 x numFaceVertices
Definition GeometryUtilities.hpp:680
unsigned int BorderIndex
index of edge/face of border
Definition GeometryUtilities.hpp:671
Gedim::GeometryUtilities::SegmentPolyhedronPositionResult::Types Type
Definition GeometryUtilities.hpp:672
unsigned int OriginVertexIndex
Definition GeometryUtilities.hpp:169
unsigned int EndVertexIndex
Definition GeometryUtilities.hpp:170
Gedim::GeometryUtilities::SplitPolygonInput::SplitSegment::Vertex::Types Type
Definition GeometryUtilities.hpp:184
unsigned int Index
Definition GeometryUtilities.hpp:185
Gedim::GeometryUtilities::SplitPolygonInput::SplitSegment::Vertex End
Definition GeometryUtilities.hpp:189
Gedim::GeometryUtilities::SplitPolygonInput::SplitSegment::Vertex Origin
Definition GeometryUtilities.hpp:188
Definition GeometryUtilities.hpp:166
unsigned int NumberPolygonVertices
Definition GeometryUtilities.hpp:192
std::vector< Gedim::GeometryUtilities::SplitPolygonInput::AlignedEdge > AlignedEdges
Definition GeometryUtilities.hpp:193
Gedim::GeometryUtilities::SplitPolygonInput::SplitSegment Segment
Definition GeometryUtilities.hpp:194
Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewEdge::Types Type
Definition GeometryUtilities.hpp:292
unsigned int PolygonIndex
Index of Edge in polygon intersections.
Definition GeometryUtilities.hpp:298
std::vector< unsigned int > VertexIndices
Index of vertices in NewVertices.
Definition GeometryUtilities.hpp:297
Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewEdge::ArcTypes ArcType
Type is Arc.
Definition GeometryUtilities.hpp:294
std::vector< unsigned int > Vertices
Definition GeometryUtilities.hpp:313
Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewPolygon::Types Type
Definition GeometryUtilities.hpp:311
std::vector< unsigned int > Edges
Definition GeometryUtilities.hpp:314
Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewVertex::Types Type
Definition GeometryUtilities.hpp:270
unsigned int IntersectionIndex
Index in circle intersections.
Definition GeometryUtilities.hpp:273
unsigned int PolygonIndex
Index in polygon vertices.
Definition GeometryUtilities.hpp:272
Definition GeometryUtilities.hpp:251
std::vector< unsigned int > CircleIntersectionsNewVerticesPosition
Definition GeometryUtilities.hpp:320
std::vector< Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewEdge > NewEdges
Definition GeometryUtilities.hpp:322
std::vector< Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewPolygon > NewPolygons
Definition GeometryUtilities.hpp:323
std::vector< Gedim::GeometryUtilities::SplitPolygonWithCircleResult::NewVertex > NewVertices
Definition GeometryUtilities.hpp:321
Types
Definition GeometryUtilities.hpp:253
std::vector< unsigned int > PolygonVerticesNewVerticesPosition
Definition GeometryUtilities.hpp:319
Gedim::GeometryUtilities::SplitPolygonWithCircleResult::Types Type
Definition GeometryUtilities.hpp:317
Definition GeometryUtilities.hpp:684
std::vector< unsigned int > PositiveVertices
Definition GeometryUtilities.hpp:694
std::vector< unsigned int > NegativeVertices
vertices indices of the positive sub-polygon
Definition GeometryUtilities.hpp:695
std::vector< Eigen::Vector3d > NewVertices
vertices indices of the points on plane
Definition GeometryUtilities.hpp:697
Gedim::GeometryUtilities::SplitPolygonWithPlaneResult::Types Type
new vertices edge indices
Definition GeometryUtilities.hpp:699
std::vector< unsigned int > PointsOnPlane
vertices indices of the negative sub-polygon
Definition GeometryUtilities.hpp:696
std::vector< unsigned int > NewVerticesEdgeIndex
new vertices coordinates
Definition GeometryUtilities.hpp:698
Types
Definition GeometryUtilities.hpp:686
unsigned int OriginId
Definition GeometryUtilities.hpp:232
Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewEdge::Types Type
Definition GeometryUtilities.hpp:229
unsigned int EndId
Definition GeometryUtilities.hpp:233
std::vector< unsigned int > Cell2DNeighbours
Definition GeometryUtilities.hpp:234
unsigned int OldEdgeId
Definition GeometryUtilities.hpp:231
std::list< unsigned int > Edges
Definition GeometryUtilities.hpp:240
std::list< unsigned int > Vertices
Definition GeometryUtilities.hpp:239
Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewVertex::Types Type
Definition GeometryUtilities.hpp:216
std::list< Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewVertex > NewVertices
Definition GeometryUtilities.hpp:245
Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::Types Type
Definition GeometryUtilities.hpp:243
std::vector< Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewPolygon > NewPolygons
Definition GeometryUtilities.hpp:247
std::list< Gedim::GeometryUtilities::SplitPolygonWithSegmentResult::NewEdge > NewEdges
Definition GeometryUtilities.hpp:246
Eigen::MatrixXi Edges
all edges contained in the new polyhedra
Definition GeometryUtilities.hpp:721
std::vector< int > NewEdgesOriginalEdges
edge
Definition GeometryUtilities.hpp:722
std::vector< int > NewEdgesOriginalFace
located
Definition GeometryUtilities.hpp:724
std::vector< int > NewFacesOriginalFaces
face
Definition GeometryUtilities.hpp:731
std::vector< Eigen::MatrixXi > Faces
Definition GeometryUtilities.hpp:730
std::vector< unsigned int > Faces
Definition GeometryUtilities.hpp:739
std::vector< unsigned int > Vertices
Definition GeometryUtilities.hpp:737
std::vector< unsigned int > Edges
Definition GeometryUtilities.hpp:738
std::vector< unsigned int > NewVerticesOriginalEdge
to which is located
Definition GeometryUtilities.hpp:715
Eigen::MatrixXd Vertices
all vertices contained in the new polyhedra
Definition GeometryUtilities.hpp:714
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult::NewFaces Faces
Definition GeometryUtilities.hpp:746
std::vector< std::vector< unsigned int > > OriginalFacesNewFaces
Definition GeometryUtilities.hpp:743
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult::NewPolyhedron PositivePolyhedron
Definition GeometryUtilities.hpp:747
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult::Types Type
Definition GeometryUtilities.hpp:749
std::vector< std::vector< unsigned int > > OriginalEdgesNewEdges
Definition GeometryUtilities.hpp:742
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult::NewEdges Edges
Definition GeometryUtilities.hpp:745
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult::NewPolyhedron NegativePolyhedron
Definition GeometryUtilities.hpp:748
Gedim::GeometryUtilities::SplitPolyhedronWithPlaneResult::NewVertices Vertices
Definition GeometryUtilities.hpp:744
Definition GeometryUtilities.hpp:23
static constexpr double DefaultMinTolerance()
Definition GeometryUtilities.hpp:24
double Tolerance3D
Definition GeometryUtilities.hpp:32
double MinTolerance
Definition GeometryUtilities.hpp:29
double Tolerance2D
Definition GeometryUtilities.hpp:31
double Tolerance1D
Definition GeometryUtilities.hpp:30