RE: [Algorithms] vectors randomly distributed in a cone From: Jon Watte - 2001-10-01 00:18 ```> time. The basic idea is this: Imagine positioning the cone so the > apex is at the origin. Now consider the intersection between the > (solid) cone and the surface of the unit sphere. Generating a point > uniformly distributed in this area and using the corresponding place > vector should do the trick. The problem is then how to generate > points uniformly in that area. We ended up with using rejection > sampling and a procedure that generated points uniformly > distributed on the unit sphere. To decrease the rejected-to- There's a much simpler solution, assuming you're OK with a distribution that's even over the sphere surface, not even over a flat circle (important difference!) First, remember that the surface area of a "slice" of a hollow sphere is ONLY proportional to the height of the slice and the radius of the sphere, NOT proportional to where on the sphere the slice is located. This can easily be shown using simple algebraic integration. This means that all you need to do is to pick a linearly distributed random number between (cos angle) and 1, and run arccos on that number to get at the angle of your random vector. Then rotate that vector a random amount between [-pi,pi) and you have a uniformly distributed random vector within some angle of deviation from the top of the sphere. Rotate to align the top with the actual center vector you want, and you're done. Note that it may seem that these random vectors would cluster close to the pole of the sphere. It turns out that, because of the surface area property from the first point, they don't. However, if your random number generator is very coarse, you may get banding closer to the poles. Any random number generator with 15 bits or more of output should hide this just fine. Cheers, / h+ ```

Re: [Algorithms] vectors randomly distributed in a cone <vognsen@po...>
 RE: [Algorithms] vectors randomly distributed in a cone From: Jon Watte - 2001-10-01 00:18 ```> time. The basic idea is this: Imagine positioning the cone so the > apex is at the origin. Now consider the intersection between the > (solid) cone and the surface of the unit sphere. Generating a point > uniformly distributed in this area and using the corresponding place > vector should do the trick. The problem is then how to generate > points uniformly in that area. We ended up with using rejection > sampling and a procedure that generated points uniformly > distributed on the unit sphere. To decrease the rejected-to- There's a much simpler solution, assuming you're OK with a distribution that's even over the sphere surface, not even over a flat circle (important difference!) First, remember that the surface area of a "slice" of a hollow sphere is ONLY proportional to the height of the slice and the radius of the sphere, NOT proportional to where on the sphere the slice is located. This can easily be shown using simple algebraic integration. This means that all you need to do is to pick a linearly distributed random number between (cos angle) and 1, and run arccos on that number to get at the angle of your random vector. Then rotate that vector a random amount between [-pi,pi) and you have a uniformly distributed random vector within some angle of deviation from the top of the sphere. Rotate to align the top with the actual center vector you want, and you're done. Note that it may seem that these random vectors would cluster close to the pole of the sphere. It turns out that, because of the surface area property from the first point, they don't. However, if your random number generator is very coarse, you may get banding closer to the poles. Any random number generator with 15 bits or more of output should hide this just fine. Cheers, / h+ ```

 Re: [Algorithms] vectors randomly distributed in a cone From: Ken M - 2001-10-01 00:18 ```Greetings all. As my first post, but long-time lurker, I'll try to be brief.. I've read the papers describing solutions to the problem of "Determining Penetration Depth of overlapping polygons", but to be perfectly honest the math gets a little out of hand for me when trying to implement it. Does anyone know if there are any examples, in code, that describe how to take 2 complex polygonal shapes and compute the penetration depth? I can read code much better than mathematical equations, unfortunately. (A limitation I'm trying to overcome.) It's too bad that RAPID/OPCODE/SWIFT etc doesn't return the penetration depth. SOLID was reported to, but v2.0 doesn't support it and v3.0 seems to be out of the public domain. Any help would be much appreciated, and thanks to all of you who have helped me in the past but didn't know it! Ken Melms wgold@... ```

 RE: [Algorithms] vectors randomly distributed in a cone From: Idahosa Edokpayi - 2001-10-01 00:38 ```It seems I have asked a foolish question... My apologies. ```

 [Algorithms] Penetration Depth of Overlapping Complex Polyhedra From: Ken M - 2001-10-01 00:38 ```Greetings all. As my first post, but long-time lurker, I'll try to be brief.. I've read the papers describing solutions to the problem of "Determining Penetration Depth of overlapping polygons", but to be perfectly honest the math gets a little out of hand for me when trying to implement it. Does anyone know if there are any examples, in code, that describe how to take 2 complex polygonal shapes and compute the penetration depth? I can read code much better than mathematical equations, unfortunately. (A limitation I'm trying to overcome.) It's too bad that RAPID/OPCODE/SWIFT etc doesn't return the penetration depth. SOLID was reported to, but v2.0 doesn't support it and v3.0 seems to be out of the public domain. Any help would be much appreciated, and thanks to all of you who have helped me in the past but didn't know it! Ken Melms wgold@... p.s. sorry for the double post, I had the wrong title.. sigh.. ```

 Re: [Algorithms] Penetration Depth of Overlapping Complex Polyhedra From: Pierre Terdiman - 2001-10-01 01:04 ```Check the archives. Thread named "Computing the penetration distance", started by myself on October, 11, 2000. Pierre NB: ...there's no really good solution anyway. SOLID 3.0, best so far but not available anymore indeed. ```

 Re: [Algorithms] Penetration Depth of Overlapping Complex Polyhedra From: Pierre Terdiman - 2001-10-01 01:09 ```BTW, did someone try the VPS (*) approach in rigid-body sims using penalty methods ? Their force model drives the haptic feedback, but maybe it could work as well for simple RBS ? In any case, Ken, it seems to give an approximate penetration depth - which might be accurate enough for your goals. Or not. (*) voxmap/point shell, the Boeing stuff for haptic rendering Pierre ```

 RE: [Algorithms] vectors randomly distributed in a cone From: George Warner - 2001-10-01 20:57 ```On Sun, 30 Sep 2001 13:00:12 -0700, "Steve Ranck" wrote: >> I think what he means is, given a 3D vector, what's a good method of >> generating a random vector with the constraint being that the angle between >> the two vectors is no larger than a given angle. > I have trouble reconciling that interpretation with the "aligned with > the surface of the cone" condition. I agree, I believe the correct interpretation might be "the angle between the two vectors is equal to a given angle". If this is the case the solution would be to rotate the original vector by the fixed amount but in a random direction away from the original. -- Enjoy, George Warner Mixed Mode Magic Fragment Scientist Apple Developer Technical Support (DTS) ```