Title: Suggested package/function to compute the vertices of a 3-simplex (tetrahedron)
Tags: r
Question: I'd like to draw the 3-simplex which encloses some random points in 3D.  So for example:
pts <- rnorm(30)
pts <- matrix(pts, ncol = 3)
With these points, I'd like to compute the vertices of the 3-simplex (irregular tetrahedron) that just encloses these points.  Can someone suggest a package/function that will do this?  All manner of searching for simplex-related material is dominated by answers that relate to using simplices for other purposes, of which there are many.  I just want to compute one and draw it.  Seems simple, but I don't seem to know the relevant keywords for what I need.


Here is another answer: If nobody can find a suitable package for this, you'll have to settle for doing it yourself, which isn't so difficult if you don't require it to be the absolute tightest fit. See this question dana95@example.net.
The simplest approach presented in this question seems to me to be translating the origin so that all points lie in the positive orthant (i.e, all point dimensions are positive) and then projecting the points to lie within the simplex denoted by each unit vector. To get this simplex in your original coordinate system you can take the inverse projection and inverse translation of the points in this simplex.
Another approach suggested there is to find the enveloping sphere (which you can for instance use Ritter's algorithm for), and then find an enveloping simplex of the sphere, which might be an easier task depending what you are most comfortable with.
Comment for this answer: Thanks for the link.  I had dana95@example.net but not the math site. I was only needing a demo so I did it manually.  But it's quite interesting to me that this task does not seem to be implemented in R.  Lots and lots of convex hull functions, but none to find the 'bounding simplex' (a great search term I had not considered).

Here is another answer: I think you're looking for convhulln in the geometry package, but I'm no expert, so maybe that isn't quite what you are looking for.
Comment for this answer: Thanks.  I have explored that package - it's a bit atypical. I don't see a function `convexhulln` but it's really hard to find the docs for the R interface.  Can you give me a bit more detail, esp. a link to R docs?
Comment for this answer: This has a brief mention of `convhulln`: http://geometry.r-forge.r-project.org/ (didn't have the right name) which does have a proper R help page.
Comment for this answer: I don't seem to understand the documentation very well, but I can only get `simp3 <- convhulln(pts, "FA")` to return the convex hull, not the 3-simplex.  There might be an option to do that, but I can't figure it out.
Comment for this answer: I'll do that search, thanks.  As I mentioned, finding the right search terms has been a challenge.
Comment for this answer: Indeed, you are correct, I incorrectly believed that the convex hull was the same as the 3-simplex. The search term `minimum volume enclosing simplex` returns a lot of papers describing algorithms. I haven't found one implemented in R though.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:09/26/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<r>', 'Title': 'Suggested package/function to compute the vertices of a 3-simplex (tetrahedron)', 'ViewCount': 164, 'id': 19040390, 'user_AboutMe': '<p>After 32 years of teaching, I am now Professor Emeritus of  Chemistry &amp; Biochemistry at DePauw University.  You can learn more about me at my <a href="https://ChemoSpec.org" rel="nofollow noreferrer">website</a>.</p>\n', 'user_AccountId': 316869.0, 'user_DisplayName': 'Bryan Hanson', 'user_Reputation': 5983.0, 'user_Views': 831.0, 'user_id': 633251.0}}