| 488 | } |
| 489 | |
| 490 | int ParticleGroup::qua_d(const VDouble &p1, const VDouble &p2, const VDouble &p3, |
| 491 | const VDouble &p4, int m, int n, const VDouble &vel0, double p0) { |
| 492 | |
| 493 | if (m <= 0 || n <= 0) |
| 494 | return 0; |
| 495 | if (p1.size() != p2.size()) |
| 496 | return -1; |
| 497 | if (p3.size() != p4.size()) |
| 498 | return -1; |
| 499 | if (p1.size() != p4.size()) |
| 500 | return -1; |
| 501 | |
| 502 | // line 12 |
| 503 | VDouble p1p2 = p2; |
| 504 | p1p2 -= p1; |
| 505 | p1p2 /= m; |
| 506 | |
| 507 | // line 43 |
| 508 | VDouble p4p3 = p3; |
| 509 | p4p3 -= p4; |
| 510 | p4p3 /= m; |
| 511 | |
| 512 | // each line between 12 and 43 |
| 513 | VDouble crds12 = p1p2; |
| 514 | crds12 /= 2.0; |
| 515 | crds12 += p1; |
| 516 | |
| 517 | VDouble crds43 = p4p3; |
| 518 | crds43 /= 2.0; |
| 519 | crds43 += p4; |
| 520 | |
| 521 | for (int i = 1; i <= m; i++) { |
| 522 | |
| 523 | // line 12 to 43 |
| 524 | VDouble p1243 = crds43; |
| 525 | p1243 -= crds12; |
| 526 | p1243 /= 2 * n; |
| 527 | |
| 528 | VDouble plow = crds12; |
| 529 | plow += p1243; |
| 530 | VDouble phigh = crds43; |
| 531 | phigh -= p1243; |
| 532 | if (this->line(plow, phigh, n - 1, vel0, p0) < 0) { |
| 533 | return -1; |
| 534 | } |
| 535 | |
| 536 | // incr |
| 537 | crds12 += p1p2; |
| 538 | crds43 += p4p3; |
| 539 | } |
| 540 | |
| 541 | return 0; |
| 542 | } |
| 543 | |
| 544 | int ParticleGroup::tri(const VDouble &p1, const VDouble &p2, const VDouble &p3, |
| 545 | int m, int n, const VDouble &vel0, double p0) { |
no test coverage detected