Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling from a triangulation #3

Open
sauln opened this issue Oct 30, 2018 · 3 comments
Open

Sampling from a triangulation #3

sauln opened this issue Oct 30, 2018 · 3 comments

Comments

@sauln
Copy link
Member

sauln commented Oct 30, 2018

Many people have triangulations of their favorite objects. It could be nice to have a method of taking a triangulation and sampling points on the surface with various levels of noise and density.

@ctralie
Copy link
Member

ctralie commented Oct 31, 2018

I've actually written some pure numpy and for-loop free code to evenly sample points on a triangle mesh by area:

https://github.com/ctralie/pyhks/blob/a66c317866d984a7a1f37f5c8ab839dec7210739/HKS.py#L249

It's designed for 3D but I'm sure it could be extended to higher dimensions without too much trouble

@sauln
Copy link
Member Author

sauln commented Oct 31, 2018

That's awesome. I'll try to add this now.

@sauln
Copy link
Member Author

sauln commented Oct 31, 2018

Began a port here:

def from_mesh(vertices, triangles, n=1000):
"""
Randomly sample points by area on a triangle mesh. This function is
extremely fast by using broadcasting/numpy operations in lieu of loops

sauln pushed a commit that referenced this issue Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants