Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Choosing a random point on a sphere surface Date: Tue, 11 Jun 2019 18:33:45 -0700 Organization: None to speak of Lines: 41 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="94f8535fa0edb95ec4b940ba1f48184e"; logging-data="7384"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ppuI7pIPK3wWcVJvrjo2B" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:P78eZWcebOKUlMVgTByv6ZKONFg= sha1:HrjC3bzRpB4lfgmJ2wkSSe1Mnww= Xref: csiph.com comp.lang.c:144758 Clifford Heath writes: > On 11/6/19 1:54 am, Stefan Ram wrote: >> The following picture shows a unit ball (sphere) with a width >> and a height of «1». > > I just came up with a very nice alternate way to uniformly choose a > point on a unit sphere, with arbitrary granularity. Use a hierarchical > triangular mesh with a random binary bit-string of 3+2n bits. Convert > the HTM value into your chosen coordinate system, job done. > > HTM is a generalised coordinate system for points on the globe, based on > an iterated triangular subdivision of the sides of an octahedron. > > > I don't believe the selection is uniform. Quoting from your second link (emphasis added): We describe a method to subdivide the surface of a sphere into spherical triangles of similar, *but not identical*, shapes and sizes. We start with the surface of the sphere partitioned into 8 identical spherical triangles, with 90-degree vertices. Considering one of the 8 triangles, we draw great circle segments connecting the midpoints of the edges, partitioning it into 4 smaller triangles. I believe the outer 3 triangles are congruent to each other, but the central one is not. It looks like a useful way to define a coordinate system on the surface of a sphere, but it doesn't produce equal-area triangles (and it's not intended to). I don't quite have the math to confirm or refute this. Anyone else? -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */