Revision b3324a3d59c75129437b5e2ab80655887d882124 authored by Christoph Lehmann on 02 November 2023, 10:23:56 UTC, committed by Christoph Lehmann on 02 November 2023, 10:23:56 UTC
Draft: Remove coupled solutions

Closes #3432

See merge request ogs/ogs!4784
2 parent s 29e4abf + 0a9611d
Raw File
Triangle.cpp
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 */

#include "Triangle.h"

#include <Eigen/Core>

#include "AnalyticalGeometry.h"
#include "MathLib/GeometricBasics.h"
#include "Point.h"

namespace GeoLib
{
Triangle::Triangle(std::vector<Point*> const& pnt_vec, std::size_t pnt_a,
                   std::size_t pnt_b, std::size_t pnt_c)
    : _pnts(pnt_vec), _pnt_ids({{pnt_a, pnt_b, pnt_c}})
{
    assert(!_pnts.empty());
    assert(pnt_a < _pnts.size() && pnt_b < _pnts.size() &&
           pnt_c < _pnts.size());
}

bool Triangle::containsPoint(MathLib::Point3d const& q, double eps) const
{
    GeoLib::Point const& a(*(_pnts[_pnt_ids[0]]));
    GeoLib::Point const& b(*(_pnts[_pnt_ids[1]]));
    GeoLib::Point const& c(*(_pnts[_pnt_ids[2]]));
    return MathLib::isPointInTriangle(q, a, b, c, eps);
}
}  // namespace GeoLib
back to top