HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Detect if Inside Ellipse?

    Scheduled Pinned Locked Moved Scripting
    23 Posts 5 Posters 1.5k Views
    Loading More Posts
    • 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.
    • E
      ericchesek @ustk
      last edited by

      @ustk Yeah this isn't too bad! Nice solution and thanks for the help. :)

      1 Reply Last reply Reply Quote 0
      • E
        ericchesek @ulrik
        last edited by

        @ulrik This is really helpful too! Thanks!

        1 Reply Last reply Reply Quote 0
        • ulrikU
          ulrik @ulrik
          last edited by ulrik

          @ulrik I couldn't help my self to explore this area a bit more so, in this snippet I have a function to find which area/areas is hovered (they can be on top of each other as well), so I have the rectangle and the ellipse but I couldn't find a way to get the precise area of the triangle ๐Ÿ˜”
          So if anybody with a magical knowledge of trigonometry (ustk?) could point me in the right direction I would be grateful!

          The difficulties with the triangles (for me at least), how to find out if hovered inside or outside the triangle because of the radian.

          whicharea.gif

          HiseSnippet 1683.3ocwXstaaaCEVJIZaxqEaEXO.D9GcxsoN1NosCIsq49VvZRMZxJFPQPKiDsEWnIMjnhsQQdb1O2Swdg1av14PIYI63Dj51gYfbgmKjeeGdHO731QJeVbrJxx18jQ8YV12w43QRc3NgTtz5fcsrq3rOWFrUDiZs8n9z3XVfks8h+Dp21cIKym+9EaSEToOqPjk0aTbe1K4835Bos27W3Bw9z.1I7dkrdsMOvWI2QITI.VVzogUep+4ztrinnYK3XY+E6Ev0pni0TMK1xdosUAiNNTMPlZ+a3w7yDLbPSqigIJU79JQ.hXTp0NgbQP6bNGaAyR6hHvhoQfuy4Pd.er7hHw2ZTPJ7nb7vdgIg2hS.ulkgWiRvaFPxtDjVJER2y4X+HdecgFDOesyARMKpCEB6kgRpsVK7m2wYGEXgTWuG8b19Qvfwd38jFMVl.+p1FUfHerlbAMhzVJHOmj6UWldGUu9JILvqJnqJXbE3u0iY51PXQ+ZUhlKYdcRj9Z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2HGPhCUIh.RH8BFr8a.JlgT9N0yRzfg9ncxuWS5v6l.tBOMMelTCHZEIPQ3Zx50xjdLLDd2KiF.OFjQxmuXx.3tRRWTKI6xNyxtL42SfmIK3myPGxlkwwrXTPl8+eG9tDONBarQLcRjb74Z311JiOWpjGozrWI8LGEqbYExzp5zYl5vtChTBAKZlpw95htIG8jI8NiEsLzvA7dqwFBM6LYGTNWeGTkavyOsYkRFpjGH45W0mIut19rx5vA9ue8fcgq2v1txjA1AUCzbDB16xt.5gMsILWmcYwmqU8M1l0Vjk8WpMZuadKZTISXwgFwbbfBCVCK5w8nMGUdv.dfNbrf2GuYHi2MrnW42ObSJVrOujBfmuwA57gTHv5psJBMopBRDT8jcthsqmo.1LlncQrkPYLWOpb67e1Zm81Bw64zFuDe1XbgYfQXK6+BLl8k.bWm85zANZW.vkb1+29uoieqztn6B2qGwg7EmiR5cL7nGeFr5RHcBOLXu.l1lNtANFi.GyjAlA+C7ISYSbrclxl4Js5Q8iTuyO8HH90L7UFI.ljlugEWmCwwjlVlikX5ai5Mr5wC3uy2Go+ifSRy1mVygOqNG9r1b3yimCedxb3ySmCe9gazG7KaZqDspW5wAPP68L2UYaumjBYVlrPq+EqprKZ
          

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          ustkU 2 Replies Last reply Reply Quote 4
          • ustkU
            ustk @ulrik
            last edited by ustk

            @ulrik Well, getting the area of a triangle is possible with trigo but not an easy thing (I don't know how from the top of my head though I tested a while ago two mathematics way of doing it)
            From here, seeing the particular shape you're using and that you are going further than simple ellipse or rectangle, the solution would be the implementation of a Juce function to detect if inside the path. (a different one than getIntersection). Then it'll be very easy and less mind torturing (even if I like that ๐Ÿ™ƒ )

            Can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @ulrik
              last edited by ustk

              @ulrik Stupid me... I already added it along with getIntersection ๐Ÿ™„
              It's Path.contains(point)

              HiseSnippet 931.3ocsV8uaaaCDlxIbsV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NHImknUeJot0y8.jaW4A4jr5Ymcom5rCFPpZGcx19Q8I43yx9TRh63+qXGz1y496PNOXGx4g6PNOZGx4w6PNOYGx429p4392HNpzpxqaGPGwiplQ44MRxPkUkJj7u.xPkoEC
              

              pathContains.gif

              Can't help pressing F5 in the forum...

              ulrikU Dan KorneffD E 4 Replies Last reply Reply Quote 5
              • ulrikU
                ulrik @ustk
                last edited by

                @ustk Nice one ๐Ÿ‘

                Hise Develop branch
                MacOs 15.3.1, Xcode 16.2
                http://musikboden.se

                1 Reply Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff @ustk
                  last edited by

                  @ustk nice job!

                  Dan Korneff - Producer / Mixer / Audio Nerd

                  1 Reply Last reply Reply Quote 0
                  • ulrikU
                    ulrik @ustk
                    last edited by

                    @ustk Would it also be possible to add text to follow a path you think?

                    Hise Develop branch
                    MacOs 15.3.1, Xcode 16.2
                    http://musikboden.se

                    ustkU 1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @ulrik
                      last edited by

                      @ulrik Alright... It's official... I'm drinking to much...

                      writeOnPath.gif

                      HiseSnippet 1266.3ocsV8uSaaDG+Lf2VxV0FR6A3HRSxoDL1.kUozpADfonU.qFV6lPnpC6K12v4NqyWJMah+YuE6sYOR6MX66c1l3.oUSQsVJN999i66m66Ou.oHjlmKjHqFmOIihr9J6AS3pjdIDFG0+Pj0p1Gy3QGklxxxo6KoDzASxH44zHjk0x+nVLqFqfLO+yOb.IkvCoSIgPuRvBoufMholRMXuehkldLIhdNaTMo2Yu9gBdOQpXL.oks8PYjvqIwzSIZwVxFY8YGEwTB4.EQQyQVqbfHZxfDwM7B4eEKmcUJUuvGM.1nBxGKRizHVSE0KgkFETczyQvtDL0Qrbgi3asOgEwti9TGx2XXfmpQc+g0RyBukmAd90gmWM3MGHYUCRqT.oUsGDJYYpobz34Ks6yUT4PB31qCkBYQK8W118DfDbk6Hx0zikvh6zvYWOuNX3U6tMAoxEoT2vTJQ5.DZBwhbE9sDINfmhe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RnT7lvhRP8Up9BCE.SbysIaXehdM1GYJK0oudtdnQvs6dSXn93uATIMec1ZAzY6EPmcV.cdxBnytKfNe+BnyS+f5nuX89iUhQEkC.gfiL8prrNhSfLKSVH5+.KzJo4
                      

                      Can't help pressing F5 in the forum...

                      ulrikU Dan KorneffD 2 Replies Last reply Reply Quote 7
                      • ulrikU
                        ulrik @ustk
                        last edited by

                        @ustk Hahaha....beautiful!!! ๐Ÿบ cheers

                        Hise Develop branch
                        MacOs 15.3.1, Xcode 16.2
                        http://musikboden.se

                        1 Reply Last reply Reply Quote 0
                        • E
                          ericchesek
                          last edited by

                          Hahaha this is incredible. Excellent work!

                          1 Reply Last reply Reply Quote 0
                          • E
                            ericchesek @ustk
                            last edited by

                            @ustk Just to be clear, this only works with paths and not fillEllipse or drawEllipse, for example? If so, is there an API reference for what shapes can be made with paths? Similar to what you did with

                            const var p = Content.createPath();
                            p.addStar([300,300], 5, 50, 200, 0); 
                            
                            ulrikU 1 Reply Last reply Reply Quote 0
                            • ulrikU
                              ulrik @ericchesek
                              last edited by

                              @ericchesek in the API you'll find this

                              Skรคrmavbild 2023-08-08 kl. 21.39.04.png

                              Hise Develop branch
                              MacOs 15.3.1, Xcode 16.2
                              http://musikboden.se

                              E 1 Reply Last reply Reply Quote 0
                              • E
                                ericchesek @ulrik
                                last edited by

                                @ulrik Hmm, maybe I'm on an older build. 3.0.0, build 650, 2023 April 3.
                                I only have a fraction of these options in the "Path" API list. I'll look into it. Thanks!

                                ustkU 1 Reply Last reply Reply Quote 0
                                • Dan KorneffD
                                  Dan Korneff @ustk
                                  last edited by

                                  @ustk said in How to Detect if Inside Ellipse?:

                                  Alright... It's official... I'm drinking to much...

                                  Maybe I'm not drinking enough

                                  Dan Korneff - Producer / Mixer / Audio Nerd

                                  ustkU 1 Reply Last reply Reply Quote 0
                                  • ustkU
                                    ustk @Dan Korneff
                                    last edited by

                                    @Dan-Korneff said in How to Detect if Inside Ellipse?:

                                    @ustk said in How to Detect if Inside Ellipse?:

                                    Alright... It's official... I'm drinking to much...

                                    Maybe I'm not drinking enough

                                    ๐Ÿคฃ :clinking_beer_mugs:

                                    Can't help pressing F5 in the forum...

                                    1 Reply Last reply Reply Quote 0
                                    • ustkU
                                      ustk @ericchesek
                                      last edited by ustk

                                      @ericchesek April 3 is the date you built, not the branch date. I've implemented the new methods before that so you probably have to build the develop branch again

                                      Can't help pressing F5 in the forum...

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post

                                      17

                                      Online

                                      1.7k

                                      Users

                                      11.8k

                                      Topics

                                      102.7k

                                      Posts