Comments (4)
Triangle itself can accept a "seed point" for each hole, and it will cull them out from the inside - but otherwise get the centroids of the resulting triangles and classify them by in-polygon test with your inputs and cull from that.
The interface accepts these seed points, search for "hole" here: http://dzhelil.info/triangle/
from triangle.
Thanks for looking- I am passing holes
(an (n,2) array of seed points) in the example above. I think the data isn't making it where it needs to go in this wrapper, as the same logic works properly in the meshpy.triangle
wrapper.
from triangle.
Ah, sorry about that - reacted too fast! It's great to have an example to follow - I'm keen to learn Python.
from triangle.
Actually, this was the result of my segments not being closed, when that was fixed it worked fine:
import triangle
import triangle.plot
import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
### generate a circle with a hole in it
theta = np.linspace(0.0, np.pi * 2, 25)
circle = np.column_stack((np.cos(theta),
np.sin(theta)))
# exterior plus interior
vertices = np.vstack((circle, circle * .5))
segments = np.column_stack((np.arange(0, len(circle) - 1),
np.arange(1, len(circle))))
# make sure segments are closed
segments %= len(circle) - 1
# add the interior
segments = np.vstack((segments,
segments + len(circle) + 1))
# the hole is in the middle. like a doughnut
holes = np.array([[0,0]], dtype=np.float64)
# args to pass to triangulate
args = {'segments': segments,
'vertices': vertices,
'holes': holes}
t = triangle.triangulate(args, 'pq0D')
triangle.plot.plot(plt.axes(), **t)
plt.show()
In testing, triangle.triangulate
was pretty much exactly twice as fast as meshpy.triangle
and has a nicer API. After testing, I changed the default in trimesh
to use triangle.triangulate
- thanks for the great package!
from triangle.
Related Issues (20)
- Add edges output HOT 2
- I can not for the life of me install triangle HOT 7
- Can't get edge list from triangulation HOT 1
- Project as a whole doesn't appear to be able to be licensed as LGPL-3 HOT 2
- Max triangles index exceeds number of vertices HOT 3
- Issue with License / conda forge submission HOT 1
- Wheels for Python 3.9 / 3.10 on PyPI HOT 7
- triangle/core.c:19390:5: error: lvalue required as increment operand HOT 1
- i cannot establish a restrictive triangulation network HOT 2
- "a" option for maximum area ignored if smaller than 0.00001 HOT 1
- i can't install triangle in mac M1 HOT 2
- pip install fails with python 3.10 HOT 1
- Build wheel for Python 3.10 and Apple M1 HOT 5
- Pip install of latest version fails for intel mac with python 3.9 HOT 2
- 0xC0000005 error HOT 4
- [Feature Request] Make a new release HOT 5
- Segmentation fault while doing multiple loop in ubuntu. HOT 2
- access segments including attribute HOT 1
- Could not build wheels for triangle HOT 1
- Broken intall for python 3.11 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from triangle.