Bot releases are hidden (Show)
This release brings some new functions for conveniently creating meshes of various common forms without having to use the general TriangularMesh.indexed
constructor. The simplest function is grid
:
TriangularMesh.grid : Int -> Int -> (Float -> Float -> vertex) -> TriangularMesh vertex
This lets you easily create meshes in the form of rectangular grids, by passing the number of steps to take in the U (horizontal) and V (vertical) directions, and a function that will get called to create vertices at different U and V values (which each range from 0 to 1). For example, TriangularMesh.grid 3 2 f
will produce a mesh like
There are also tube
, ring
and ball
functions (with the same function signature as grid
) for creating meshes that are topologically equivalent to a cylinder, torus and sphere respectively (where the mesh 'wraps around' in certain directions).
In addition, each of the above functions comes in an indexed
version, for example:
TriangularMesh.indexedGrid : Int -> Int -> (Int -> Int -> vertex) -> TriangularMesh vertex
The indexed
versions behave exactly the same, but instead of passing floating-point U/V values to the callback function, they pass integer U/V indices:
Finally, a TriangularMesh.radial
function has been added that behaves just like TriangularMesh.fan
, but joins the last vertex back to the first to form a closed shape (useful for creating cone-like shapes):
TriangularMesh.radial : vertex -> List vertex -> TriangularMesh vertex
Published by ianmackenzie almost 5 years ago
Update README and add simple usage example
Published by ianmackenzie almost 5 years ago
Add title to README to match style used by other packages
Published by ianmackenzie over 6 years ago
Update image link in documentation.
Published by ianmackenzie over 6 years ago
This is largely a direct transfer from opensolid/mesh
, but involves a few breaking changes:
OpenSolid.Mesh
to TriangularMesh
.with
has been replaced by indexed
faces
has been renamed to faceVertices
edges
has been renamed to edgeVertices
In addition, the triangles
, fan
and strip
constructors have been added to aid in generating meshes of different shapes.