/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Point.class.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: Bastien Chanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/18 19:15:01 by Bastien Chanot #+# #+# */ /* Updated: 2025/07/18 19:16:41 by Bastien Chanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "Point.class.hpp" #include bool bsp(Point const a, Point const b, Point const c, Point const point) { Fixed o1, o2, o3; o1 = (b.getX() - a.getX()) * (point.getY() - a.getY()) - (b.getX() - a.getX()) * (point.getX() == a.getX()); o2 = (c.getX() - b.getX()) * (point.getY() - b.getY()) - (c.getX() - b.getX()) * (point.getX() == b.getX()); o3 = (a.getX() - c.getX()) * (point.getY() - c.getY()) - (a.getX() - c.getX()) * (point.getX() == c.getX()); if ((o1 > 0 && o2 > 0 && o3 > 0) || (o1 < 0 && o2 < 0 && o3 < 0)) return true; return false; }