/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2016-2018 Danny Robson */ #include "tri.hpp" /////////////////////////////////////////////////////////////////////////////// template bool cruft::geom::inclusive (tri2 const &obj, point2 const &p) { // Assumes ccw winding CHECK (cross (obj.b - obj.a, obj.c - obj.a) > 0); auto const sign = [] ( cruft::point2f const p_, cruft::point2f const a_, cruft::point2f const b_) { return cross (p_ - a_, b_ - a_); }; return sign (p, obj.a, obj.b) <= 0 and sign (p, obj.b, obj.c) <= 0 and sign (p, obj.c, obj.a) <= 0; } //----------------------------------------------------------------------------- template bool cruft::geom::inclusive (tri2 const&, point2 const&);