Skip to content

How to extract Poisson Disk Samples? #150

Answered by jmespadero
zoyt asked this question in Q&A
Discussion options

You must be logged in to vote

Here is a demo script for poisson_disk_sampling. Please note that:

  • The filter almost never extract the exact number of samples required, even if the argument exactnumflag is set to True.
  • the points are evenly distributed over the surface, it is not a subsample of the input vertex.
#!/usr/bin/python3
import pymeshlab as ml
import numpy as np
import sys

ms = ml.MeshSet()

#Load an input mesh given as argument, or create a sphere
if len(sys.argv) > 1:
  filename=sys.argv[1]  
  print("Loading mesh:", filename)
  ms.load_new_mesh(filename)
else:
  ms.apply_filter('sphere', subdiv = 4) 
  
m = ms.current_mesh()
print("Input mesh:", m.vertex_number(), 'vertex', m.face_number(), 'faces' )

#A…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zoyt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants