bool SphereOCTVolume::isInside(Point& p) const { if (!isInsideBB(p)) return false; if ( (center-p).norm() <= radius ) return true; else return false; }
bool CurveNode::isInsideBB(const glm::vec2& pos, unsigned level, unsigned i) { if ((*m_AABBs[level])[i].contains(pos)) { if (level == 0) { // Check individual points const CurveAABB& aabb = (*m_AABBs[level])[i]; for (int i=aabb.m_StartIdx; i<=aabb.m_EndIdx; ++i) { if (glm::distance(m_CenterCurve[i], pos) < getStrokeWidth()/2) { return true; } } return false; } else { // Recurse to smaller bounding boxes. if (i*2+1 < m_AABBs[level-1]->size()) { return isInsideBB(pos, level-1, i*2) || isInsideBB(pos, level-1, i*2+1); } else { return isInsideBB(pos, level-1, i*2); } } } else { return false; } }
bool CurveNode::isInside(const glm::vec2& pos) { glm::vec2 globalPos = toGlobal(pos); return isInsideBB(globalPos, m_AABBs.size()-1, 0); }