mojocorp / geodesic Goto Github PK
View Code? Open in Web Editor NEWMultiple source/target exact geodesic (shortest path) algorithm for triangular mesh (triangulated 2D surface in 3D)
License: MIT License
Multiple source/target exact geodesic (shortest path) algorithm for triangular mesh (triangulated 2D surface in 3D)
License: MIT License
Hi,
Can I ask you for some support running the code from python 2.7 on Windows 10?
After opening it in cmake and trying to configure it I get following problem:
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Regards,
Dado
can you provide an example of how to use this tool? An example of how to generate the geodesic distance given a source point, a target point, and the reference mesh? Thank you so much for your patience.
import sys
import re
def run (argv):
path = argv[1]
with open(path) as f:
vertices = []
faces = []
for line in f.readlines():
vmatch = re.search("^v\s*(-?\d+.\d+)\s*(-?\d+.\d+)\s*(-?\d+.\d+)\s*", line)
if vmatch != None:
groups = vmatch.groups()
vertices.append(groups)
fmatch = re.search("^f\s+(\d+)/\d*/\d*\s+(\d+)/\d*/\d*\s+(\d+)/\d*/\d*\s*\n", line)
if fmatch != None:
groups = fmatch.groups()
faces.append(groups)
res = str(len(vertices)) + " " + str(len(faces))+ '\n'
for x, y, z in vertices:
res += x + "\t" + y + "\t" + z + "\n"
for v1, v2, v3 in faces:
v1 = int(v1) -1
v2 = int(v2) -1
v3 = int(v3) -1
res += str(v1) + "\t" + str(v2) + "\t" + str(v3) + "\n"
print(res)
if __name__ == "__main__":
run(sys.argv)
I don't think the stopping criteria work for target vertices. The max distance works fine but providing target vertices and a max_dist of 1e100 causes a full search of the mesh.
Maybe this is an indexing/pointer issue?
Hello,
I would like to know if it would be possible to define input target (and source points, for building path), wichi are not vertices of the input mesh (in the middle of a mesh facet for example) ?
I have a code that can project given 'external' points (XYZ) on the input mesh, and I would let like ot reuse them for building shortest path.
Is it possible today ?
Thank you
Yvan
for my requirement,I have to iterative use function propagate&trace_back then I find that memory
increase quickly.
I show part of my code below:
`
void geodesicPathFinder::initMesh(vector points, vector faces, int num){
mesh.initialize_mesh_data(points, faces);
subFinders.resize(num);
boundaries.resize(num);
}
void geodesicPathFinder::testMem(int start_vIdx, int end_vIdx){
geodesic::GeodesicAlgorithmExact algorithm(&mesh);
vectorgeodesic::SurfacePoint path;
geodesic::SurfacePoint source(&mesh.vertices()[start_vIdx]);
vector<geodesic::SurfacePoint> all_source(1, source);
geodesic::SurfacePoint traget(&mesh.vertices()[end_vIdx]);
vector<geodesic::SurfacePoint> stop_points(1, traget);
algorithm.propagate(all_source, geodesic::GEODESIC_INF, &stop_points);
algorithm.trace_back(traget, path);
algorithm.clear();
}
`
and where for those function testing:
` void pathFinderTest(){
const float TEST_TIME = 1000.0f;
float interval = 1.0f / TEST_TIME;
const int DEBUG_CONTOUR = 3;
vector vertexList(mesh.n_vertices() * 3);
for (int i = 0; i < mesh.n_vertices(); i++)
{
OpenMesh::VertexHandle v(i);
OpenMesh::Vec3f pos = mesh.point(v);
vertexList[i * 3 + 0] = pos[0];
vertexList[i * 3 + 1] = pos[1];
vertexList[i * 3 + 2] = pos[2];
}
vector faceList(mesh.n_faces() * 3);
for (int i = 0; i < mesh.n_faces(); i++){
OpenMesh::FaceHandle f(i);
int num = 0;
for (MyMesh::FaceVertexCWIter fv_cwit = mesh.fv_cwbegin(f); fv_cwit != mesh.fv_cwend(f); fv_cwit++)
{
faceList[i * 3 + num++] = (*fv_cwit).idx();
}
}
for (int i = 0; i < TEST_TIME; i++){
geodesicPathFinder *finder = new geodesicPathFinder();
finder->initMesh(vertexList, faceList, pMap->contours->size());
finder->testMem(1147, 1444);
delete finder;
cout << "i=" << i << "完成 ";
}
}`
As you can see I use clear() but it dosent work. the cost of memory keep increase even after I delete geodesicPathFinder object every iteration ,what
s more variable algorithm is a local variable,which should be destroy after the function is over.
it cost too much memory,it cost 1GB after 100 iteration!
I don`t know what wrong in those code,or I just make some mistake in using your codes,
can you give me some help ,thanks!
The code is very helpful to me. I am trying to find some methods for mesh vertexs sampling on geodesic disntace. And I find out your code is very helpful. I have read the papers listed in the reference, as a newer to this area, it take me much more time to figure out the derivations.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.