------------------------------------------------------------------------------
| 607 | |
| 608 | //------------------------------------------------------------------------------ |
| 609 | bool vtkHyperTreeGridGeometry3DImpl::ComputeEdgeInterface(const HTG3DPoint& firstPoint, |
| 610 | const HTG3DPoint& secondPoint, std::vector<std::pair<HTG3DPoint, HTG3DPoint>>& edgePoints, |
| 611 | unsigned int edgeAxis, unsigned int edgeId, |
| 612 | std::map<unsigned int, std::pair<HTG3DPoint*, unsigned int>>& internalFace, |
| 613 | HTG3DPoint& pointInter, unsigned int& edgePointId, bool isInterfaceA) |
| 614 | { |
| 615 | if (!firstPoint.IsValid) |
| 616 | { |
| 617 | vtkWarningWithObjectMacro(nullptr, "First edge point is invalid."); |
| 618 | } |
| 619 | if (!secondPoint.IsValid) |
| 620 | { |
| 621 | vtkWarningWithObjectMacro(nullptr, "Second edge point is invalid."); |
| 622 | } |
| 623 | |
| 624 | auto firstPointDist = |
| 625 | (isInterfaceA ? firstPoint.DistanceToInterfaceA : firstPoint.DistanceToInterfaceB); |
| 626 | auto secondPointDist = |
| 627 | (isInterfaceA ? secondPoint.DistanceToInterfaceA : secondPoint.DistanceToInterfaceB); |
| 628 | |
| 629 | if (firstPointDist == 0.) |
| 630 | { |
| 631 | if (secondPointDist == 0.) |
| 632 | { |
| 633 | // Edge case : the interface corresponds to the edge |
| 634 | // XXX: need to clarify naming for iEdgePoint1 and iEdgePoint2 |
| 635 | unsigned int iEdgePoint1 = ::EDGE_PTS_IDS[edgeId].first + NUMBER_OF_EDGES; |
| 636 | edgePoints[iEdgePoint1].first = firstPoint; |
| 637 | edgePoints[iEdgePoint1].second.IsValid = false; |
| 638 | this->SetInterfaceFace(iEdgePoint1, internalFace, &edgePoints[iEdgePoint1].first); |
| 639 | |
| 640 | unsigned int iEdgePoint2 = ::EDGE_PTS_IDS[edgeId].second + NUMBER_OF_EDGES; |
| 641 | edgePoints[iEdgePoint2].first = secondPoint; |
| 642 | edgePoints[iEdgePoint2].second.IsValid = false; |
| 643 | this->SetInterfaceFace(iEdgePoint2, internalFace, &edgePoints[iEdgePoint2].first); |
| 644 | this->CompleteLinkage(internalFace, iEdgePoint1, iEdgePoint2); |
| 645 | |
| 646 | return true; |
| 647 | } |
| 648 | |
| 649 | // The interface point is a the first point of the cell |
| 650 | pointInter = firstPoint; |
| 651 | edgePointId = ::EDGE_PTS_IDS[edgeId].first + NUMBER_OF_EDGES; |
| 652 | } |
| 653 | else if (secondPointDist == 0.) |
| 654 | { |
| 655 | // The interface point is a the second point of the cell |
| 656 | pointInter = secondPoint; |
| 657 | edgePointId = ::EDGE_PTS_IDS[edgeId].second + NUMBER_OF_EDGES; |
| 658 | } |
| 659 | else if (firstPointDist * secondPointDist < 0.) |
| 660 | { |
| 661 | // Compute the position of the interface point on the edge, |
| 662 | // between the first and the second point |
| 663 | double xyz[3] = { 0., 0., 0. }; |
| 664 | memcpy(xyz, firstPoint.Coords, 3 * sizeof(double)); |
| 665 | xyz[edgeAxis] = (secondPointDist * firstPoint.Coords[edgeAxis] - |
| 666 | firstPointDist * secondPoint.Coords[edgeAxis]) / |
no test coverage detected