Hi there! Anyone knows how to create a custom shape with regular mesh like a PlaneGeometry with segments? Just look at the picture to see what I mean
Have you already checked out the code in the following example?
Ah, now I see what you mean! Well no, there is no way to achieve this with the built-in geometry generators. Shapes need to be triangulated and you have no influence on how this triangulation happens.
You can create the geometry yourself. Compare e.g. Create a curved plane surface which dynamically changes its size
Then you have to determine the intersection points of the heart curve with the horizontal and vertical lines. Then you can define the cut triangles and remove the ones that are completely outside. Do some work. Perhaps there is a more elegant solution?
Or use CSG somehow
Or put points in formation of a heart and try to use Delaunator.
See this recent post where a THREE.Shape was used in the CSG operations.
Hi, I was considering the same problem recently, and I find an ideal solution for me, hope that could help you. Followings are the points:
- Caculate the extent of your shape coordinate, and create an array of coordinates with a fixed intervals in x and y direction.
- Finds Points that fall within shape(polygon) by using Function pointsWithinPolygon in turf.js. Then push all shape points into the points array.
- Caculate the faces indices array of the points array by using Delaunator.js.
- Delete the unwanted indices. In my case, unwanted triangles out of the shape was created.
- Creat buffergeometry with the points array and indices array.
The following example shows more details.
1.Turf.js | Advanced Geospatial Analysis
3.Three.js + Delaunator