69 const std::pair<double, double> &p0,
70 const std::pair<double, double> &p1,
72 std::vector<SimplexId> &cellList)
const {
75 std::pair<double, double> q0, q1;
78 q0.first =
nodeList_[nodeId].rangeBox_.first.first;
79 q0.second =
nodeList_[nodeId].rangeBox_.second.first;
81 q1.first =
nodeList_[nodeId].rangeBox_.first.second;
82 q1.second = q0.second;
86 for(
size_t i = 0; i <
nodeList_[nodeId].childList_.size(); i++) {
94 this->
printMsg(
"Node #" + std::to_string(nodeId) +
" returns its "
100 cellList.insert(cellList.end(),
nodeList_[nodeId].cellList_.begin(),
108 q0.first =
nodeList_[nodeId].rangeBox_.first.second;
109 q0.second =
nodeList_[nodeId].rangeBox_.second.first;
111 q1.first =
nodeList_[nodeId].rangeBox_.first.second;
112 q1.second =
nodeList_[nodeId].rangeBox_.second.second;
115 if(
nodeList_[nodeId].childList_.size()) {
116 for(
size_t i = 0; i <
nodeList_[nodeId].childList_.size(); i++) {
124 this->
printMsg(
"Node #" + std::to_string(nodeId) +
" returns its "
130 cellList.insert(cellList.end(),
nodeList_[nodeId].cellList_.begin(),
138 q0.first =
nodeList_[nodeId].rangeBox_.first.first;
139 q0.second =
nodeList_[nodeId].rangeBox_.second.second;
141 q1.first =
nodeList_[nodeId].rangeBox_.first.second;
142 q1.second =
nodeList_[nodeId].rangeBox_.second.second;
145 if(
nodeList_[nodeId].childList_.size()) {
146 for(
size_t i = 0; i <
nodeList_[nodeId].childList_.size(); i++) {
154 this->
printMsg(
"Node #" + std::to_string(nodeId) +
" returns its "
160 cellList.insert(cellList.end(),
nodeList_[nodeId].cellList_.begin(),
168 q0.first =
nodeList_[nodeId].rangeBox_.first.first;
169 q0.second =
nodeList_[nodeId].rangeBox_.second.first;
171 q1.first =
nodeList_[nodeId].rangeBox_.first.first;
172 q1.second =
nodeList_[nodeId].rangeBox_.second.second;
175 if(
nodeList_[nodeId].childList_.size()) {
176 for(
size_t i = 0; i <
nodeList_[nodeId].childList_.size(); i++) {
184 this->
printMsg(
"Node #" + std::to_string(nodeId) +
" returns its "
190 cellList.insert(cellList.end(),
nodeList_[nodeId].cellList_.begin(),
198 if((p0.first >=
nodeList_[nodeId].rangeBox_.first.first)
199 && (p0.first <
nodeList_[nodeId].rangeBox_.first.second)
200 && (p0.second >=
nodeList_[nodeId].rangeBox_.second.first)
201 && (p0.second <
nodeList_[nodeId].rangeBox_.second.second)) {
204 if(
nodeList_[nodeId].childList_.size()) {
205 for(
size_t i = 0; i <
nodeList_[nodeId].childList_.size(); i++) {
213 this->
printMsg(
"Node #" + std::to_string(nodeId) +
" returns its "
219 cellList.insert(cellList.end(),
nodeList_[nodeId].cellList_.begin(),
225 if((p1.first >=
nodeList_[nodeId].rangeBox_.first.first)
226 && (p1.first <
nodeList_[nodeId].rangeBox_.first.second)
227 && (p1.second >=
nodeList_[nodeId].rangeBox_.second.first)
228 && (p1.second <
nodeList_[nodeId].rangeBox_.second.second)) {
231 if(
nodeList_[nodeId].childList_.size()) {
232 for(
size_t i = 0; i <
nodeList_[nodeId].childList_.size(); i++) {
240 this->
printMsg(
"Node #" + std::to_string(nodeId) +
" returns its "
246 cellList.insert(cellList.end(),
nodeList_[nodeId].cellList_.begin(),
258 stream <<
"[RangeDrivenOctree]" << std::endl;
259 stream <<
"[RangeDrivenOctree] Node #" << nodeId << std::endl;
260 stream <<
"[RangeDrivenOctree] Domain box: ["
261 <<
nodeList_[nodeId].domainBox_[0].first <<
" "
262 <<
nodeList_[nodeId].domainBox_[0].second <<
"] ["
263 <<
nodeList_[nodeId].domainBox_[1].first <<
" "
264 <<
nodeList_[nodeId].domainBox_[1].second <<
"] ["
265 <<
nodeList_[nodeId].domainBox_[2].first <<
" "
266 <<
nodeList_[nodeId].domainBox_[2].second <<
"] "
268 << (
nodeList_[nodeId].domainBox_[0].second
270 * (
nodeList_[nodeId].domainBox_[1].second
272 * (
nodeList_[nodeId].domainBox_[2].second
276 stream <<
"[RangeDrivenOctree] Range box: ["
277 <<
nodeList_[nodeId].rangeBox_.first.first <<
" "
278 <<
nodeList_[nodeId].rangeBox_.first.second <<
"] ["
279 <<
nodeList_[nodeId].rangeBox_.second.first <<
" "
280 <<
nodeList_[nodeId].rangeBox_.second.second <<
"] "
282 << (
nodeList_[nodeId].rangeBox_.first.second
283 -
nodeList_[nodeId].rangeBox_.first.first)
284 * (
nodeList_[nodeId].rangeBox_.second.second
285 -
nodeList_[nodeId].rangeBox_.second.first)
288 stream <<
"[RangeDrivenOctree] Number of cells: "
289 <<
nodeList_[nodeId].cellList_.size() << std::endl;
352 const std::pair<double, double> &p0,
353 const std::pair<double, double> &p1,
354 const std::pair<double, double> &q0,
355 const std::pair<double, double> &q1)
const {
358 bool horizontal =
true;
361 if(q0.first == q1.first)
364 double denP = p1.first - p0.first;
368 double P = (p1.second - p0.second) / denP;
371 double const bP = p1.second - P * p1.first;
383 if((x < fmin(q0.first, q1.first)) || (x > fmax(q0.first, q1.first))) {
387 if((y < fmin(q0.second, q1.second)) || (y > fmax(q0.second, q1.second))) {
393 if((x < fmin(p0.first, p1.first) || (x > fmax(p0.first, p1.first)))
394 && ((y < fmin(p0.second, p1.second)
395 || (y > fmax(p0.second, p1.second))))) {