geogram icon indicating copy to clipboard operation
geogram copied to clipboard

How to compute the power Diagram ? I got the error when follow the tutorial in the repos

Open liu411417492 opened this issue 2 years ago • 5 comments

I want to compute Power Diagram in my project, and I follow the tutorial in your repos,but when i run this code "delaunay_->copy_Laguerre_cell_from_Delaunay(i, C, W_);" i got the Error: “Abnormal program termination: received signal 11 (SIGSEGV)”

And i notice that when i comment out the code : "delaunay_->set_weights(weights_vec.data());" then everything is ok .So i want to know is there anything to pay attention to when set the weight vector?

——————————————————————————————————————————————————————————

Here is the code

function(){

using namespace GEO;

GEO::initialize();

Stopwatch Wtot("Total time");

if (InitPara) { CmdLine::import_arg_group("standard"); CmdLine::import_arg_group("algo"); GEO::CmdLine::import_arg_group("co3ne"); GEO::CmdLine::import_arg_group("pre"); GEO::CmdLine::import_arg_group("post"); GEO::CmdLine::import_arg_group("remesh"); GEO::CmdLine::import_arg_group("opt"); GEO::CmdLine::import_arg_group("tet"); }

GEO::Mesh gm_pts; mesh_load("sample-10000.xyz", gm_pts); // read 1w points gm_pts.facets.clear();

PeriodicDelaunay3d::IncidentTetrahedra W_; SmartPointer<PeriodicDelaunay3d> delaunay_ = new PeriodicDelaunay3d(false, 1.0);

delaunay_->set_vertices(gm_pts.vertices.nb(), gm_pts.vertices.point_ptr(0)); delaunay_->set_keeps_infinite(true);

GEO::vector weights_vec; for (auto i = 0; i < gm_pts.vertices.nb(); i++) {

double* p = gm_pts.vertices.point_ptr(i);

weights_vec.push_back(std::abs(p[2]));

}

delaunay_->set_weights(weights_vec.data());

delaunay_->compute();

ConvexCell C; //delaunay_->copy_Laguerre_cell_from_Delaunay(0, C);

delaunay_->copy_Laguerre_cell_from_Delaunay(0, C, W_);

return; }

liu411417492 avatar Nov 05 '23 15:11 liu411417492

and i found in function copy_Laguerre_cell_from_Delaunay line 3667 called funtion get_incident_tets(i,W); in this function and in line 3568 code : t = index_t(v_to_cell_[v]); running assert geo_debug_assert(i < size()); and then report error

liu411417492 avatar Nov 05 '23 16:11 liu411417492

Hello, I'll try to help you, To start, a little question: as far as I understand, you are using the z coordinate of the points as the weights ? why ?

BrunoLevy avatar Nov 06 '23 07:11 BrunoLevy

Hello, I'll try to help you, To start, a little question: as far as I understand, you are using the z coordinate of the points as the weights ? why ?

oh i have a algorithm to compute the weights and it is too long so i didn't copy the code

the weights i used in the project is vary from [0,C] and C is the constant value; so i use the z coordinate of the points as the weight for example

liu411417492 avatar Nov 06 '23 08:11 liu411417492

by the way ,my partner found that v_to_cell_ in delaunay_->compute() didn't update for the all time ,because the multiple thread0 is always return ,but when i comment out the return ,it didnt report error, but the result is also wrong. TAT Uploading 13b547fa1fe4ede6cb86d7c041f507f.png…

liu411417492 avatar Nov 06 '23 08:11 liu411417492

(I'm sorry I am a bit slow to answer, need to finish a batch of changes / bugfixes then I'll come back to you right after).

BrunoLevy avatar Nov 30 '23 13:11 BrunoLevy