Timeline for How to add random point size to this distribution of 3d points?
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 30, 2022 at 14:52 | vote | accept | Cham | ||
Jul 29, 2022 at 20:31 | comment | added | Bob Hanlon | I have no idea what code you are using. I recommend that you post a new question showing the full code that you are using and explain what problems you are having and what you expect in the end result. | |
Jul 29, 2022 at 20:27 | comment | added | Cham | @BobHanlon, eeww! The new code now produces cubic distributions when p is low. It destroys the natural looking distribution. There's someting wrong in that code. | |
Jul 29, 2022 at 20:23 | comment | added | Cham | @BobHanlon, WOW! It improves the speed enormously! Thanks!! | |
Jul 29, 2022 at 20:16 | comment | added | Bob Hanlon |
AppendTo is inefficient, use Table and Join , i.e., points3D[p_, q_, r_] := Module[{dat = RandomReal[{-1, 1}, {p, 3}]}, Join[dat, Table[r RandomReal[{-1, 1}, 3] + RandomChoice[dat], {i, q}]]]
|
|
Jul 29, 2022 at 19:24 | comment | added | Cham | @BobHanlon, what about modifying the points3D[p, q, r] function to add a fourth coordinate that would define the size? But then, how to modify Point[points3D[p, q, r]] so only the first three coordinates are used to place the points? | |
Jul 29, 2022 at 19:05 | answer | added | lericr | timeline score: 0 | |
Jul 29, 2022 at 19:00 | comment | added | Cham | @BobHanlon. Hmmm, now the manipulate box works (with the SynchronousUpdating -> False), but it's extremely slow! | |
Jul 29, 2022 at 18:59 | comment | added | Cham | I tried your last suggestion. It works outside the manipulate box. But when I use the function view[p, q, r] in a manipulate box, I still have an $Aborted output. | |
Jul 29, 2022 at 18:46 | comment | added | Bob Hanlon |
{PointSize[RandomReal[{0.004, 0.01}]], Point[#]} & /@ points3D[p, q, r] is the same as Map[{PointSize[RandomReal[{0.004,0.01}]], Point[#]}&, points3D[p,q,r]]
|
|
Jul 29, 2022 at 18:41 | comment | added | Bob Hanlon |
Turn off synchronous updating, i.e., Manipulate[view[p, q, r], {{p, 200}, 100, 300, 5, Appearance -> "Labeled"}, {{q, 5000}, 2000, 8000, 1000, Appearance -> "Labeled"}, {{r, 0.1}, 0.05, 0.2, 0.05, Appearance -> "Labeled"}, TrackedSymbols :> All, SynchronousUpdating -> False]
|
|
Jul 29, 2022 at 18:30 | comment | added | Cham | @BobHanlon, I'm getting a problem with your solution. As is, it's working great. But as soon as I put it in a manipulate box to play with the variables (p, q, r), Mathematica aborts the compilation after some delay. There's something fishy. Is there another way in writing your suggestion, without the &/@ (which appears to give troubles to my old version of Mma) | |
Jul 29, 2022 at 18:23 | answer | added | Daniel Huber | timeline score: 2 | |
Jul 29, 2022 at 18:17 | comment | added | Bob Hanlon |
Each Point must have its own PointSize . Change definition of graph3D to graph3D[p_, q_, r_] := Graphics3D[{RGBColor[{0.5, 0.4, 1.0, 0.4}], {PointSize[RandomReal[{0.004, 0.01}]], Point[#]} & /@ points3D[p, q, r]}]
|
|
Jul 29, 2022 at 17:41 | history | edited | Cham | CC BY-SA 4.0 |
added 121 characters in body
|
Jul 29, 2022 at 17:34 | history | asked | Cham | CC BY-SA 4.0 |