5555#include < geogram/mesh/mesh_decimate.h>
5656#include < geogram/mesh/mesh_tetrahedralize.h>
5757#include < geogram/mesh/mesh_topology.h>
58+ #include < geogram/mesh/mesh_AABB.h>
5859
5960#include < geogram/delaunay/LFS.h>
6061
@@ -101,7 +102,7 @@ namespace {
101102 );
102103 ImGui::Image (
103104 convert_to_ImTextureID (geogram_logo_texture_),
104- ImVec2 (256 , 256 )
105+ ImVec2 (256 . 0f * scaling () , 256 . 0f * scaling () )
105106 );
106107 ImGui::Text (
107108 " \n "
@@ -128,6 +129,15 @@ namespace {
128129 " (C)opyright 2006-2016\n "
129130 " The ALICE project, Inria\n "
130131 );
132+ ImGui::Text (" \n " );
133+ ImGui::Separator ();
134+ ImGui::Text (
135+ " %s" ,
136+ (
137+ " GEOGRAM version:" +
138+ Environment::instance ()->get_value (" version" )
139+ ).c_str ()
140+ );
131141 ImGui::EndMenu ();
132142 }
133143 }
@@ -340,6 +350,12 @@ namespace {
340350 this , &GeoBoxApplication::compute_local_feature_size
341351 );
342352 }
353+ if (ImGui::MenuItem (" compute distance to border" )) {
354+ Command::set_current (
355+ " compute_distance_to_border(std::string attribute_name=\" distance\" )" ,
356+ this , &GeoBoxApplication::compute_distance_to_border
357+ );
358+ }
343359 ImGui::EndMenu ();
344360 }
345361 }
@@ -842,6 +858,27 @@ namespace {
842858 set_attribute (" vertices." + attribute_name);
843859 show_attributes ();
844860 }
861+
862+ void compute_distance_to_border (std::string attribute_name) {
863+ if (mesh ()->cells .nb () == 0 ) {
864+ Logger::err (" Distance" ) << " Mesh has no cell"
865+ << std::endl;
866+ return ;
867+ }
868+ begin ();
869+ Attribute<double > distance (
870+ mesh ()->vertices .attributes (), attribute_name
871+ );
872+ MeshFacetsAABB AABB (*mesh ());
873+ for (index_t v=0 ; v<mesh ()->vertices .nb (); ++v) {
874+ distance[v] = ::sqrt (
875+ AABB.squared_distance (vec3 (mesh ()->vertices .point_ptr (v)))
876+ );
877+ }
878+ end ();
879+ set_attribute (" vertices." + attribute_name);
880+ show_attributes ();
881+ }
845882
846883 protected:
847884
0 commit comments