Matt J

3D polyshapes

Matt J on 10 Jan 2024 (Edited on 10 Jan 2024)
Latest activity Reply by John D'Errico on 29 Jan 2024

Is there a reason for TMW not to invest in 3D polyshapes? Is the mathematical complexity of having all the same operations in 3D (union, intersection, subtract,...) prohibitive?
John D'Errico
John D'Errico on 29 Jan 2024
Complexity of all these operations grows at least exponentially with dimension, and it gets nasty fast. Actually, the growth is probably factorial, not just simply exponential.
But 3-d operations would seem seriously valuable, and worth the time. We see frequent questions that would be resolved with a 3-d polyshape suite. I'd stop at 3-d though, as the cost versus gain beyond that point is too large.
Mike Croucher
Mike Croucher on 19 Jan 2024
Imagine you did have them? What would you use them for? Has any other programming language got them?
John D'Errico
John D'Errico on 29 Jan 2024
MIke - What language has them? MATLAB. I've written tools like them. In fact, the suite of tools I built anout 25-30 years ago was tremendously useful. Old now though.
We used them for color characterization problem mainly. A lot of gamut mapping and modeling.
I wrote a 2-d/3-d alpha shape tool. A slicing tool, that could make a planar slice through any tessellation, in any number of dimensions. (Practical limit was about 4-d though, since the complexity grows at least exponentially.) The result is a tessellation that lives in a lower dimenionsla manifold, embedded in the original space. That was often useful. You coulrd them slice that again if you want.
A planar truncation tool, that could take only the set of simplexes that live on one side of a plane. So any simplex that crosses the plane would get dissected.
Next, I had tools for the union and intersection of two simplicial complexes. I may even have had a setdiff. Since all of these tools were initially targeted at working with color device gamuts, you could see the set of colors which were producible by one device, but not another with a smaller gamut, or the set of colors which were in common to both color gamuts, etc.
I wrrote tools to find the projection of an exterior point onto the surface of a non-convex tessellation, moving along some path. I also wrote a tool to find the closest point on the surface of a complex from an exterior point, but this often led to poor gamut maps.
All of the above are purely geometrical in nature though. Perhaps more important was the use of these tools as mappings themselves. That is, if you associate a set of coordinates form some other coordinate system with every nodes in a complex, then you can do a simple linear interpolation from one domain to a range domain. Linear interpolation was important of course, since cmooth interpolants can introduce artifacts.
This concept of a mapping between different spaces was hugely valuable, gain because we were using these tools for device color modeling. I also developed a code to fit a surface, using ideas much like those in gridfit, but on a tessellated domain that need not even be convex. A nice trick then was to write an adaptive fitting tool, that would refine a complex in only parts of the domain where it found high curvature. I only ever wrote the adaptive tool for 2-d mappings though, as I had retired around then.
Finally, I tried my hand at a 2-d numerical adaptive integration tool using these methods. It would adaptively place new nodes, then refining the corresponding simplexes in regions where large errors were found in the integral. A neat idea, but it had some problems with convergence on some problems. Oh well. Since I had retired around then, I stopped working on that idea too.
Matt J
Matt J on 24 Jan 2024 (Edited on 24 Jan 2024)
It would be very useful for composing plots of 3D solids. For example, in this thread, the poster wanted to plot a cuboid with a cylindrical hole.
It can be done using patch(), but with quite a bit of code. It would be much easier if 3D polyshape arithmetic were avaialble.
For comparison, generating the 2D analogue of this can be done in just a few lines with currently enabled 2D polyshape operations,
p=subtract(nsidedpoly(4,'Side',200), nsidedpoly(1000,'Radius',50));
plot(p); axis equal
Mike Croucher
Mike Croucher on 25 Jan 2024
I brought this up with development and they pointed out that you could create the example you showed using the PDE Toolbox extrude method
p=subtract(nsidedpoly(4,'Side',200), nsidedpoly(1000,'Radius',50));
gm = fegeometry(triangulation(p));
gm2 = extrude(gm,150);
Of course extrusion is not a general solution and we’ve added this request to our internal feature request database. Thanks for the suggestion

See Also


No tags entered yet.