Skip to content

Commit

Permalink
removed CurvedBlocking::get_cut_info(int) that had a buggy implmenent…
Browse files Browse the repository at this point in the history
…ation in favor of the method taking a point as parameter; got the CurvedBlocking::get_projection_info bugfix that preserves the split orientation
  • Loading branch information
Alphadius authored and nicolaslg committed Jul 26, 2024
1 parent 2b18471 commit a0c7b7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 38 deletions.
6 changes: 0 additions & 6 deletions blocking/inc/gmds/blocking/CurvedBlocking.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,6 @@ class LIB_GMDS_BLOCKING_API CurvedBlocking
*/
void capt_element(const int AnIdElement, const int ADim);

/**\brief return the parameters for do the cut_sheet
* @param[in] pointId A point id
* @return return the parameters for the cut, we get the edge (first) and the parameter included in ]0,1[(second)
*/
std::pair<CurvedBlocking::Edge, double> get_cut_info(int pointId);

/**\brief return if a cut is possible
* @param[in] pointId A point id
* @param[in] AllEdges all the edges of the blocking
Expand Down
47 changes: 15 additions & 32 deletions blocking/src/CurvedBlocking.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*----------------------------------------------------------------------------*/
#include "gmds/blocking/CurvedBlocking.h"
/*----------------------------------------------------------------------------*/
#include <limits>
/*----------------------------------------------------------------------------*/
using namespace gmds;
using namespace gmds::blocking;
/*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -1000,7 +1002,7 @@ CurvedBlocking::capt_element(const int AnIdElement, const int ADim) {


if(ADim == 0){
auto paramCut = get_cut_info(AnIdElement);
auto paramCut = get_cut_info(m_geom_model->getPoint(AnIdElement)->point());
cut_sheet(paramCut.first,paramCut.second);
}
else{
Expand Down Expand Up @@ -1045,31 +1047,6 @@ CurvedBlocking::check_cut_possible(int pointId, std::vector<std::vector<CurvedBl

}
/*----------------------------------------------------------------------------*/

std::pair<CurvedBlocking::Edge, double>
CurvedBlocking::get_cut_info(int pointId)
{
std::pair<CurvedBlocking::Edge,double> paramCut;

//============================================
auto noCaptPoint0 = m_geom_model->getPoint(pointId);
gmds::math::Point p(noCaptPoint0->X(),noCaptPoint0->Y(),noCaptPoint0->Z());

auto listEdgesPara = get_all_sheet_edge_sets();
std::vector<gmds::blocking::CurvedBlocking::Edge > listEdgesSplitable;
unsigned int distMini = 1000;
for(auto edges : listEdgesPara){
auto projInfo = get_projection_info(p,edges);
for(int i =0; i< projInfo.size();i++){
if(projInfo[i].second<1 && projInfo[i].second>0 && projInfo[i].first <distMini){
paramCut.first = edges.at(i);
paramCut.second = projInfo[i].second;
}
}
}
return paramCut;
}
/*----------------------------------------------------------------------------*/
std::pair<CurvedBlocking::Edge, double>
CurvedBlocking::get_cut_info(gmds::math::Point APoint)
{
Expand All @@ -1081,19 +1058,17 @@ CurvedBlocking::get_cut_info(gmds::math::Point APoint)
//============================================

auto listEdgesPara = get_all_sheet_edge_sets();
std::vector<gmds::blocking::CurvedBlocking::Edge > listEdgesSplitable;
unsigned int distMini = 1000;
double distMini = std::numeric_limits<double>::max();
for(auto edges : listEdgesPara){
auto projInfo = get_projection_info(APoint,edges);
for(int i =0; i< projInfo.size();i++){
if(projInfo[i].second<1 && projInfo[i].second>0 && projInfo[i].first <distMini){
paramCut.first = edges.at(i);
paramCut.second = projInfo[i].second;
distMini = projInfo[i].first;
}
}
}


return paramCut;
}

Expand Down Expand Up @@ -1231,8 +1206,16 @@ CurvedBlocking::get_projection_info(math::Point &AP, std::vector<CurvedBlocking:
std::vector<std::pair<double, double> > dist_coord;
for (auto e: AEdges) {
std::vector<Node> end_points = get_nodes_of_edge(e);
math::Point end0 = end_points[0]->info().point;
math::Point end1 = end_points[1]->info().point;
math::Point end0;
math::Point end1;
if( end_points[0]->info().topo_id < end_points[1]->info().topo_id) {
end0 = end_points[0]->info().point;
end1 = end_points[1]->info().point;
}
else{
end0 = end_points[1]->info().point;
end1 = end_points[0]->info().point;
}
math::Vector3d v1 = end1 - end0;
math::Vector3d v2 = AP - end0;
double coord = 0.0;
Expand Down

0 comments on commit a0c7b7c

Please sign in to comment.