Skip to content

Commit ec294db

Browse files
Alphadiusnicolaslg
authored andcommitted
removed CurvedBlocking::get_cut_info(int) that had a buggy implmenentation in favor of the method taking a point as parameter; got the CurvedBlocking::get_projection_info bugfix that preserves the split orientation
1 parent b00049c commit ec294db

File tree

2 files changed

+15
-38
lines changed

2 files changed

+15
-38
lines changed

blocking/inc/gmds/blocking/CurvedBlocking.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -649,12 +649,6 @@ class LIB_GMDS_BLOCKING_API CurvedBlocking
649649
*/
650650
void capt_element(const int AnIdElement, const int ADim);
651651

652-
/**\brief return the parameters for do the cut_sheet
653-
* @param[in] pointId A point id
654-
* @return return the parameters for the cut, we get the edge (first) and the parameter included in ]0,1[(second)
655-
*/
656-
std::pair<CurvedBlocking::Edge, double> get_cut_info(int pointId);
657-
658652
/**\brief return if a cut is possible
659653
* @param[in] pointId A point id
660654
* @param[in] AllEdges all the edges of the blocking

blocking/src/CurvedBlocking.cpp

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*----------------------------------------------------------------------------*/
22
#include "gmds/blocking/CurvedBlocking.h"
33
/*----------------------------------------------------------------------------*/
4+
#include <limits>
5+
/*----------------------------------------------------------------------------*/
46
using namespace gmds;
57
using namespace gmds::blocking;
68
/*----------------------------------------------------------------------------*/
@@ -1000,7 +1002,7 @@ CurvedBlocking::capt_element(const int AnIdElement, const int ADim) {
10001002

10011003

10021004
if(ADim == 0){
1003-
auto paramCut = get_cut_info(AnIdElement);
1005+
auto paramCut = get_cut_info(m_geom_model->getPoint(AnIdElement)->point());
10041006
cut_sheet(paramCut.first,paramCut.second);
10051007
}
10061008
else{
@@ -1045,31 +1047,6 @@ CurvedBlocking::check_cut_possible(int pointId, std::vector<std::vector<CurvedBl
10451047

10461048
}
10471049
/*----------------------------------------------------------------------------*/
1048-
1049-
std::pair<CurvedBlocking::Edge, double>
1050-
CurvedBlocking::get_cut_info(int pointId)
1051-
{
1052-
std::pair<CurvedBlocking::Edge,double> paramCut;
1053-
1054-
//============================================
1055-
auto noCaptPoint0 = m_geom_model->getPoint(pointId);
1056-
gmds::math::Point p(noCaptPoint0->X(),noCaptPoint0->Y(),noCaptPoint0->Z());
1057-
1058-
auto listEdgesPara = get_all_sheet_edge_sets();
1059-
std::vector<gmds::blocking::CurvedBlocking::Edge > listEdgesSplitable;
1060-
unsigned int distMini = 1000;
1061-
for(auto edges : listEdgesPara){
1062-
auto projInfo = get_projection_info(p,edges);
1063-
for(int i =0; i< projInfo.size();i++){
1064-
if(projInfo[i].second<1 && projInfo[i].second>0 && projInfo[i].first <distMini){
1065-
paramCut.first = edges.at(i);
1066-
paramCut.second = projInfo[i].second;
1067-
}
1068-
}
1069-
}
1070-
return paramCut;
1071-
}
1072-
/*----------------------------------------------------------------------------*/
10731050
std::pair<CurvedBlocking::Edge, double>
10741051
CurvedBlocking::get_cut_info(gmds::math::Point APoint)
10751052
{
@@ -1081,19 +1058,17 @@ CurvedBlocking::get_cut_info(gmds::math::Point APoint)
10811058
//============================================
10821059

10831060
auto listEdgesPara = get_all_sheet_edge_sets();
1084-
std::vector<gmds::blocking::CurvedBlocking::Edge > listEdgesSplitable;
1085-
unsigned int distMini = 1000;
1061+
double distMini = std::numeric_limits<double>::max();
10861062
for(auto edges : listEdgesPara){
10871063
auto projInfo = get_projection_info(APoint,edges);
10881064
for(int i =0; i< projInfo.size();i++){
10891065
if(projInfo[i].second<1 && projInfo[i].second>0 && projInfo[i].first <distMini){
10901066
paramCut.first = edges.at(i);
10911067
paramCut.second = projInfo[i].second;
1068+
distMini = projInfo[i].first;
10921069
}
10931070
}
10941071
}
1095-
1096-
10971072
return paramCut;
10981073
}
10991074

@@ -1231,8 +1206,16 @@ CurvedBlocking::get_projection_info(math::Point &AP, std::vector<CurvedBlocking:
12311206
std::vector<std::pair<double, double> > dist_coord;
12321207
for (auto e: AEdges) {
12331208
std::vector<Node> end_points = get_nodes_of_edge(e);
1234-
math::Point end0 = end_points[0]->info().point;
1235-
math::Point end1 = end_points[1]->info().point;
1209+
math::Point end0;
1210+
math::Point end1;
1211+
if( end_points[0]->info().topo_id < end_points[1]->info().topo_id) {
1212+
end0 = end_points[0]->info().point;
1213+
end1 = end_points[1]->info().point;
1214+
}
1215+
else{
1216+
end0 = end_points[1]->info().point;
1217+
end1 = end_points[0]->info().point;
1218+
}
12361219
math::Vector3d v1 = end1 - end0;
12371220
math::Vector3d v2 = AP - end0;
12381221
double coord = 0.0;

0 commit comments

Comments
 (0)