50 votes

Can Mathematica solve Plateau's problem (finding a minimal surface with specified boundary)?

Edit: added Gradient -> grad[vars] option. Without this small option the code was several orders of magnitude slower. Yes, it can! Unfortunately, not ...
user avatar
  • 42.8k
43 votes
Accepted

How to perform Loop subdivision on a triangle mesh with Mathematica?

We need quite a bit of preparation. In the first place we need methods to compute cell adjacency matrices from here. I copied the code for completeness. ...
user avatar
42 votes

Can I get the curvature at any point of a random curve?

I guess the first step would always be to find an ordered list of points along the middle of the curve. That I can help with: First binarize and thin the image of the curve, so you get a 1-pixel wide ...
user avatar
  • 35.4k
41 votes
Accepted

Numerically solving Helmholtz equation in 3D for arbitrary shapes

Version 11 has both symbolic and numeric eigensolvers, see here for an overview Here is a slightly different way to do it. We write a function that converts any PDE (1D/2D/3D) into discretized system ...
user avatar
  • 35.6k
38 votes
Accepted

Can Mathematica solve Plateau's problem (finding a minimal surface with specified boundary)?

Here is a method that utilizes $H^1$-gradient flows. This is far quicker than the $L^2$-gradient flow (a.k.a. mean curvature flow) or using FindMinimum and friends, ...
user avatar
34 votes

How to create word clouds?

There is now a built-in version of an algorithm in v10.1: WordCloud. I wonder whether any of your nice algorithms introduced here had any influence on the built-in ...
user avatar
34 votes

How to estimate geodesics on discrete surfaces?

Geodesics in Heat Algorithm At the suggestion of @user21 I am splitting up my answers to help make the code(s) for calculating geodesics distances easier to find for other people interested in these ...
user avatar
  • 3,524
32 votes
Accepted

Faster way to compute the distance from a point to a surface in 3D

Well, you can use the undocumented RegionDistance which does exactly this as follows: (This answer, as written, only works for V9 as noted by Oska, for V10 see ...
user avatar
  • 32.5k
32 votes
Accepted

How to speed up estimation of Mean and Gaussian curvatures on triangular meshes?

Note added 1/29/2020: the routines here have a bug where the mean curvature is sometimes computed with the opposite sign. I still need to work on how to fix this. I guess I should not have been ...
user avatar
29 votes
Accepted

Finding length of intersection of two surfaces

Fixed (see below) Here's an approach: r1 = Exp[-x^3 - y] - 1 == z; r2 = y == z; We create ImplicitRegions: ...
user avatar
  • 32.5k
25 votes
Accepted

Catmull-Clark and Doo-Sabin Subdivision Implementations

Catmull-Clark Subdivision Indeed, I have some code for Catmull-Clark subdivision and I planned to post it here for quite some time. This seems to be a good opportunity. The code is optimized for ...
user avatar
24 votes
Accepted

Better way to calculate angle between lines?

This passed all test cases, I think: anglecalc[vec1_, vec2_] := Mod[(ArcTan @@ vec2) - (ArcTan @@ vec1), 2 π]
user avatar
  • 11.3k
23 votes
Accepted

How to extract parts from atomic expressions like DelaunayMesh and Graph?

I'm going to take this as a general question, referring to all atomic objects, not just DelaunayMesh. By design, atomic objects like ...
user avatar
  • 224k
22 votes
Accepted

GeoGraphics : path within a country

Here is a solution I can think of. Idea is to take the FullPolygon of a given country and then triangulate the region. Once that is done take the underlying ...
user avatar
  • 14.2k
22 votes
Accepted

How to estimate geodesics on discrete surfaces?

Nothing really new from my side. But since I really like the heat method and because the authors of the Geodesics-in-Heat paper are good friends of mine (Max Wardetzky is even my doctor father), here ...
user avatar
22 votes
Accepted

Making a graph or network interactively over an image

There are many ways to do this, modifying, improving my method or doing a completely different thing. My goal here is to show a very basic idea that should give you a start. ...
user avatar
21 votes

Site - Cell Correspondence in Voronoi Diagram obtained via VoronoiMesh

Of course it's not good that Mathematica forget initial points for Voronoi mesh. May be it is a bug. However one can easily recover all generating points directly from the mesh. It's interesting from ...
user avatar
  • 42.8k
21 votes

Find duplicates in list of InfiniteLine

DeleteDuplicates[lines, RegionWithin] {InfiniteLine[{{0, 0}, {1, 0}}], InfiniteLine[{{0, 1}, {1, 0}}]} Also ...
user avatar
  • 349k
21 votes

How to speed up estimation of Mean and Gaussian curvatures on triangular meshes?

It took me a while, but the suggestion of @Michael E2 was quite helpful, and especially the post (Optimize inner loops). For those of you (like me) who are new to this style of programming in ...
user avatar
  • 3,524
21 votes

How to generate approximately equally spaced points efficiently

Many solutions similar to how to get $n$ equidistributed points on the unit sphere are possible, especially if one can accept that points are not on the edges of a region. For instance, one can use ...
user avatar
  • 14.6k
20 votes

Site - Cell Correspondence in Voronoi Diagram obtained via VoronoiMesh

There is also a currently undocumented internal function that may be useful. Region`Mesh`MeshMemberCellIndex[mr] generates a function which can be applied to list ...
user avatar
  • 25.1k
20 votes
Accepted

How to get a specified number of points that are nearly equally spaced in a closed rectangle

There is a neat (and widely known) trick to produce n approximately evenly distributed points in a disk, or on any surface of revolution. Points are placed on a ...
user avatar
  • 224k
20 votes
Accepted

How to generate approximately equally spaced points efficiently

Annealing Found this to be an interesting question and immediately I thought it to be a good application for simulated annealing. Here's a little unoptimized annealing function I wrote. The idea is ...
user avatar
19 votes

Numerically solving Helmholtz equation in 3D for arbitrary shapes

This slightly modified function ...
user avatar
  • 21.7k
19 votes

Determine whether points lie within a cow

One way is to compute the solid angle subtended by the cow viewed at the point by summing signed solid angles corresponding to the cow's polygonal faces. If the total is 4 pi, the point is inside the ...
user avatar
19 votes

Converting a Sierpinski tetrahedron to a Graph

A natural and simple way to approach this problem, assuming that your SiPyramid function has been defined, is as follows: ...
user avatar
  • 31.8k
19 votes
Accepted

How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face?

Edit - forgot to add a necessary link Coincidentally I had a little personal project trying to make a good dice roller in Mathematica a while back. Here's some of my code (note: this was before I ...
user avatar
  • 2,392
19 votes
Accepted

GeometricTest doesn't work in ellipse

Yep, it's a simple mistake by WRI, that is, a bug. ...
user avatar
  • 213k

Only top scored, non community-wiki answers of a minimum length are eligible