bool plane::isInPlane(const line& l)const { auto dot = norm_.dotProduct(l.dir()); if (!floatEqual(dot, 0.0f)) return false; return isInPlane(l.start()); }
std::pair<bool, vector3> plane::intersection(const line& l)const { auto ret = std::make_pair<bool, vector3>(false, vector3()); if (isInPlane(l)) return ret; ret.first = true; auto t = (norm_.dotProduct(point_) - norm_.dotProduct(l.start())) / (norm_.dotProduct(l.dir())); ret.second = l.start() + t * l.dir(); return ret; }