Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Math, circles, interior points and densities [modified]

Math, circles, interior points and densities [modified]

Scheduled Pinned Locked Moved The Lounge
htmlcomalgorithmsquestion
20 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H hairy_hats

    What about using rand() for radius and angle and not discarding any? :)

    I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

    J Offline
    J Offline
    Johann Gerell
    wrote on last edited by
    #10

    But that would just give a uniform distribution along a specific line through the center, which would give a higher density closer to the center. Right?

    -- Time you enjoy wasting is not wasted time - Bertrand Russel

    1 Reply Last reply
    0
    • H hairy_hats

      How about using a Sobol sequence[^] to generate the points?

      I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

      J Offline
      J Offline
      Johann Gerell
      wrote on last edited by
      #11

      Thanks - I'll read up a bit on that!

      -- Time you enjoy wasting is not wasted time - Bertrand Russel

      1 Reply Last reply
      0
      • H hairy_hats

        What about using rand() for radius and angle and not discarding any? :)

        I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

        J Offline
        J Offline
        Johann Gerell
        wrote on last edited by
        #12

        That'd cause a skewed density with bias to the center. Found a link: http://mathworld.wolfram.com/DiskPointPicking.html[^]

        -- Time you enjoy wasting is not wasted time - Bertrand Russel

        1 Reply Last reply
        0
        • H hairy_hats

          What about using rand() for radius and angle and not discarding any? :)

          I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #13

          that results in an entirely different distribution, as now the cartesian density is higher near the center. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Happy New Year to all.
          We hope 2010 soon brings us automatic PRE tags!
          Until then, please insert them manually.


          J 1 Reply Last reply
          0
          • L Luc Pattyn

            that results in an entirely different distribution, as now the cartesian density is higher near the center. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            Happy New Year to all.
            We hope 2010 soon brings us automatic PRE tags!
            Until then, please insert them manually.


            J Offline
            J Offline
            Johann Gerell
            wrote on last edited by
            #14

            Yep. http://mathworld.wolfram.com/DiskPointPicking.html[^]

            -- Time you enjoy wasting is not wasted time - Bertrand Russel

            L 1 Reply Last reply
            0
            • J Johann Gerell

              Yep. http://mathworld.wolfram.com/DiskPointPicking.html[^]

              -- Time you enjoy wasting is not wasted time - Bertrand Russel

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #15

              darts players would like it though, they'd hit bull's eye much oftener[*]. :laugh: [*] trying to keep it a loungy thread.

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


              Happy New Year to all.
              We hope 2010 soon brings us automatic PRE tags!
              Until then, please insert them manually.


              1 Reply Last reply
              0
              • H hairy_hats

                What about using rand() for radius and angle and not discarding any? :)

                I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

                CPalliniC Offline
                CPalliniC Offline
                CPallini
                wrote on last edited by
                #16

                Because it is plainly wrong. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                In testa che avete, signor di Ceprano?

                1 Reply Last reply
                0
                • J Johann Gerell

                  Yes, I thought about that a bit, but it felt as it would skew the density and give a wrong bias to the points with x/y values inside the circle. I cannot put words on that feeling, so it's probably plain wrong.

                  -- Time you enjoy wasting is not wasted time - Bertrand Russel

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #17

                  I don't see the problem, namely: Assumed that

                  • X and Y are independent coordinates.
                  • rand() gives (pseudo)random numbers with uniform distribution.

                  extracting N numbers (with N big enough) will fill uniformly a square area. Finally cutting a circle from this area, gives you the requested uniformly populated circular area. Of course this is going on my arrogant assumptions... :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  In testa che avete, signor di Ceprano?

                  J 1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    I don't see the problem, namely: Assumed that

                    • X and Y are independent coordinates.
                    • rand() gives (pseudo)random numbers with uniform distribution.

                    extracting N numbers (with N big enough) will fill uniformly a square area. Finally cutting a circle from this area, gives you the requested uniformly populated circular area. Of course this is going on my arrogant assumptions... :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    J Offline
                    J Offline
                    Johann Gerell
                    wrote on last edited by
                    #18

                    Maybe you're right - who am I to say? After all, I only have this "feeling" which makes me feel like my wife; she's full of them. Anyway, I'm following http://mathworld.wolfram.com/DiskPointPicking.html[^] now.

                    -- Time you enjoy wasting is not wasted time - Bertrand Russel

                    CPalliniC 1 Reply Last reply
                    0
                    • E Electron Shepherd

                      Well, it is winter - it makes sense to use polar coordinates :-D

                      Server and Network Monitoring

                      CPalliniC Offline
                      CPalliniC Offline
                      CPallini
                      wrote on last edited by
                      #19

                      Well, you need to see the question from the right angle... :-D

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      In testa che avete, signor di Ceprano?

                      1 Reply Last reply
                      0
                      • J Johann Gerell

                        Maybe you're right - who am I to say? After all, I only have this "feeling" which makes me feel like my wife; she's full of them. Anyway, I'm following http://mathworld.wolfram.com/DiskPointPicking.html[^] now.

                        -- Time you enjoy wasting is not wasted time - Bertrand Russel

                        CPalliniC Offline
                        CPalliniC Offline
                        CPallini
                        wrote on last edited by
                        #20

                        That way you haven't to discard anything (that would make me feel like my wife... :rolleyes: ). I'm curious about performance, though: you may try both methods, compare them (for correctness and performance) and eventually write an article... :laugh:

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        In testa che avete, signor di Ceprano?

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups