Skip to content
Snippets Groups Projects
Commit 8e075d61 authored by Tom Fischer's avatar Tom Fischer
Browse files

Changes due to moving AnalyticalGeometry.* from namespace MathLib to namespace GeoLib.

parent 8e8b5116
No related branches found
No related tags found
No related merge requests found
......@@ -141,7 +141,7 @@ bool Polygon::isPartOfPolylineInPolygon(const Polyline& ply) const
const std::size_t n_nodes(getNumberOfPoints() - 1);
for (std::size_t k(0); k < ply_size - 1; k++) {
for (std::size_t j(0); j < n_nodes; j++) {
if (MathLib::lineSegmentIntersect(*(getPoint(j)), *(getPoint(j + 1)),
if (GeoLib::lineSegmentIntersect(*(getPoint(j)), *(getPoint(j + 1)),
*(ply.getPoint(k)), *(ply.getPoint(k + 1)), *s)) {
delete s;
return true;
......@@ -160,7 +160,7 @@ bool Polygon::getNextIntersectionPointPolygonLine (GeoLib::Point const & a,
if (_simple_polygon_list.empty()) {
const std::size_t n_nodes(getNumberOfPoints() - 1);
for (std::size_t k(seg_num); k < n_nodes; k++) {
if (MathLib::lineSegmentIntersect(*(getPoint(k)), *(getPoint(k + 1)), a, b, *intersection_pnt)) {
if (GeoLib::lineSegmentIntersect(*(getPoint(k)), *(getPoint(k + 1)), a, b, *intersection_pnt)) {
seg_num = k;
return true;
}
......@@ -171,7 +171,7 @@ bool Polygon::getNextIntersectionPointPolygonLine (GeoLib::Point const & a,
const Polygon* polygon(*it);
const std::size_t n_nodes_simple_polygon(polygon->getNumberOfPoints() - 1);
for (std::size_t k(0); k < n_nodes_simple_polygon; k++) {
if (MathLib::lineSegmentIntersect(*(polygon->getPoint(k)), *(polygon->getPoint(k + 1)),
if (GeoLib::lineSegmentIntersect(*(polygon->getPoint(k)), *(polygon->getPoint(k + 1)),
a, b, *intersection_pnt)) {
seg_num = k;
return true;
......@@ -246,13 +246,13 @@ void Polygon::ensureCWOrientation ()
// *** calculate supporting plane (plane normal and
MathLib::Vector plane_normal;
double d;
MathLib::getNewellPlane(tmp_polygon_pnts, plane_normal, d);
GeoLib::getNewellPlane(tmp_polygon_pnts, plane_normal, d);
// *** rotate if necessary
double tol (sqrt(std::numeric_limits<double>::min()));
if (fabs(plane_normal[0]) > tol || fabs(plane_normal[1]) > tol)
// rotate copied points into x-y-plane
MathLib::rotatePointsToXY(plane_normal, tmp_polygon_pnts);
GeoLib::rotatePointsToXY(plane_normal, tmp_polygon_pnts);
for (std::size_t k(0); k < tmp_polygon_pnts.size(); k++)
(*(tmp_polygon_pnts[k]))[2] = 0.0; // should be -= d but there are numerical errors
......@@ -270,27 +270,27 @@ void Polygon::ensureCWOrientation ()
}
// *** determine orientation
MathLib::Orientation orient;
GeoLib::Orientation orient;
if (0 < min_x_max_y_idx && min_x_max_y_idx < n_pnts - 2)
orient = MathLib::getOrientation (
orient = GeoLib::getOrientation (
tmp_polygon_pnts[min_x_max_y_idx - 1],
tmp_polygon_pnts[min_x_max_y_idx],
tmp_polygon_pnts[min_x_max_y_idx + 1]);
else
{
if (0 == min_x_max_y_idx)
orient = MathLib::getOrientation (
orient = GeoLib::getOrientation (
tmp_polygon_pnts[n_pnts - 1],
tmp_polygon_pnts[0],
tmp_polygon_pnts[1]);
else
orient = MathLib::getOrientation (
orient = GeoLib::getOrientation (
tmp_polygon_pnts[n_pnts - 2],
tmp_polygon_pnts[n_pnts - 1],
tmp_polygon_pnts[0]);
}
if (orient == MathLib::CCW)
if (orient == GeoLib::CCW)
{
// switch orientation
std::size_t tmp_n_pnts (n_pnts);
......@@ -309,7 +309,7 @@ void Polygon::splitPolygonAtIntersection (std::list<Polygon*>::iterator polygon_
while (polygon_it != _simple_polygon_list.end())
{
GeoLib::Point* intersection_pnt (new GeoLib::Point);
bool is_simple (!MathLib::lineSegmentsIntersect (*polygon_it,
bool is_simple (!GeoLib::lineSegmentsIntersect (*polygon_it,
idx0,
idx1,
*intersection_pnt));
......
......@@ -387,7 +387,7 @@ bool isLineSegmentIntersecting (const Polyline& ply,
bool intersect(false);
GeoLib::Point intersection_pnt;
for (std::size_t k(0); k < n && !intersect; k++)
intersect = MathLib::lineSegmentIntersect (*(ply.getPoint(k)), *(ply.getPoint(
intersect = GeoLib::lineSegmentIntersect (*(ply.getPoint(k)), *(ply.getPoint(
k + 1)),
s0, s1, intersection_pnt);
return intersect;
......
......@@ -39,7 +39,7 @@ EarClippingTriangulation::EarClippingTriangulation(const GeoLib::Polygon* polygo
std::vector<GeoLib::Point*> const& ref_pnts_vec (polygon->getPointsVec());
std::list<GeoLib::Triangle>::const_iterator it (_triangles.begin());
if (_original_orient == MathLib::CW) {
if (_original_orient == GeoLib::CW) {
while (it != _triangles.end()) {
const std::size_t i0 (polygon->getPointID ((*it)[0]));
const std::size_t i1 (polygon->getPointID ((*it)[1]));
......@@ -112,16 +112,16 @@ void EarClippingTriangulation::ensureCWOrientation ()
}
// determine orientation
if (0 < min_x_max_y_idx && min_x_max_y_idx < n_pnts-1) {
_original_orient = MathLib::getOrientation (
_original_orient = GeoLib::getOrientation (
_pnts[min_x_max_y_idx-1], _pnts[min_x_max_y_idx], _pnts[min_x_max_y_idx+1]);
} else {
if (0 == min_x_max_y_idx) {
_original_orient = MathLib::getOrientation (_pnts[n_pnts-1], _pnts[0], _pnts[1]);
_original_orient = GeoLib::getOrientation (_pnts[n_pnts-1], _pnts[0], _pnts[1]);
} else {
_original_orient = MathLib::getOrientation (_pnts[n_pnts-2], _pnts[n_pnts-1], _pnts[0]);
_original_orient = GeoLib::getOrientation (_pnts[n_pnts-2], _pnts[n_pnts-1], _pnts[0]);
}
}
if (_original_orient == MathLib::CCW) {
if (_original_orient == GeoLib::CCW) {
// switch orientation
for (std::size_t k(0); k<n_pnts/2; k++) {
std::swap (_pnts[k], _pnts[n_pnts-1-k]);
......@@ -155,14 +155,14 @@ void EarClippingTriangulation::initLists ()
prev--;
next = it;
next++;
MathLib::Orientation orientation;
GeoLib::Orientation orientation;
while (next != _vertex_list.end()) {
orientation = getOrientation (_pnts[*prev], _pnts[*it], _pnts[*next]);
if (orientation == COLLINEAR) {
if (orientation == GeoLib::COLLINEAR) {
it = _vertex_list.erase (it);
next++;
} else {
if (orientation == CW) {
if (orientation == GeoLib::CW) {
_convex_vertex_list.push_back (*it);
if (isEar (*prev, *it, *next))
_ear_list.push_back (*it);
......@@ -175,10 +175,10 @@ void EarClippingTriangulation::initLists ()
next = _vertex_list.begin();
orientation = getOrientation (_pnts[*prev], _pnts[*it], _pnts[*next]);
if (orientation == COLLINEAR) {
if (orientation == GeoLib::COLLINEAR) {
it = _vertex_list.erase (it);
}
if (orientation == CW) {
if (orientation == GeoLib::CW) {
_convex_vertex_list.push_back (*it);
if (isEar (*prev, *it, *next))
_ear_list.push_back (*it);
......@@ -224,9 +224,9 @@ void EarClippingTriangulation::clipEars()
prevprev--;
// apply changes to _convex_vertex_list and _ear_list looking "backward"
MathLib::Orientation orientation = getOrientation(_pnts[*prevprev], _pnts[*prev],
GeoLib::Orientation orientation = GeoLib::getOrientation(_pnts[*prevprev], _pnts[*prev],
_pnts[*next]);
if (orientation == CW) {
if (orientation == GeoLib::CW) {
BaseLib::uniquePushBack(_convex_vertex_list, *prev);
// prev is convex
if (isEar(*prevprev, *prev, *next)) {
......@@ -240,7 +240,7 @@ void EarClippingTriangulation::clipEars()
// prev is not convex => reflex or collinear
_convex_vertex_list.remove(*prev);
_ear_list.remove(*prev);
if (orientation == COLLINEAR) {
if (orientation == GeoLib::COLLINEAR) {
prev = _vertex_list.erase(prev);
if (prev == _vertex_list.begin()) {
prev = _vertex_list.end();
......@@ -265,7 +265,7 @@ void EarClippingTriangulation::clipEars()
// apply changes to _convex_vertex_list and _ear_list looking "forward"
orientation = getOrientation(_pnts[*prev], _pnts[*next],
_pnts[*nextnext]);
if (orientation == CW) {
if (orientation == GeoLib::CW) {
BaseLib::uniquePushBack(_convex_vertex_list, *next);
// next is convex
if (isEar(*prev, *next, *nextnext)) {
......@@ -279,7 +279,7 @@ void EarClippingTriangulation::clipEars()
// next is not convex => reflex or collinear
_convex_vertex_list.remove(*next);
_ear_list.remove(*next);
if (orientation == COLLINEAR) {
if (orientation == GeoLib::COLLINEAR) {
next = _vertex_list.erase(next);
if (next == _vertex_list.end())
next = _vertex_list.begin();
......@@ -298,7 +298,7 @@ void EarClippingTriangulation::clipEars()
next++;
it = next;
next++;
if (getOrientation(_pnts[*prev], _pnts[*it], _pnts[*next]) == CCW)
if (getOrientation(_pnts[*prev], _pnts[*it], _pnts[*next]) == GeoLib::CCW)
_triangles.push_back(GeoLib::Triangle(_pnts, *prev, *next, *it));
else
_triangles.push_back(GeoLib::Triangle(_pnts, *prev, *it, *next));
......
......@@ -58,7 +58,7 @@ private:
*/
std::list<GeoLib::Triangle> _triangles;
MathLib::Orientation _original_orient;
GeoLib::Orientation _original_orient;
};
} // end namespace MathLib
......
......@@ -77,8 +77,8 @@ bool TemplateQuad<NNODES,CELLQUADTYPE>::isEdge(unsigned idx1, unsigned idx2) con
template <unsigned NNODES, CellType::type CELLQUADTYPE>
bool TemplateQuad<NNODES,CELLQUADTYPE>::isPntInside(GeoLib::Point const& pnt, double eps) const
{
return (MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps) ||
MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[2], *_nodes[3], eps));
return (GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps) ||
GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[2], *_nodes[3], eps));
}
template <unsigned NNODES, CellType::type CELLQUADTYPE>
......
......@@ -64,7 +64,7 @@ bool TemplateTri<NNODES,CELLTRITYPE>::isEdge(unsigned idx1, unsigned idx2) const
template <unsigned NNODES, CellType::type CELLTRITYPE>
bool TemplateTri<NNODES,CELLTRITYPE>::isPntInside(GeoLib::Point const& pnt, double eps) const
{
return MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps);
return GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps);
}
template <unsigned NNODES, CellType::type CELLTRITYPE>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment