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. I need to exorcise my computer from voodoo

I need to exorcise my computer from voodoo

Scheduled Pinned Locked Moved The Lounge
csharpcomalgorithmsquestion
39 Posts 11 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 honey the codewitch

    Frankly, I solved that by not coding in python =P It's a magical language in some ways, but the grammar was designed at gunpoint. Who uses tabs to dictate program flow? I protest the language out of my distaste for poor grammars /grammar nazi

    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #17

    Quote:

    Who uses tabs to dictate program flow?

    A thing I'm asking me all the time.

    It does not solve my Problem, but it answers my question

    H 1 Reply Last reply
    0
    • H honey the codewitch

      Frankly, I solved that by not coding in python =P It's a magical language in some ways, but the grammar was designed at gunpoint. Who uses tabs to dictate program flow? I protest the language out of my distaste for poor grammars /grammar nazi

      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #18

      Once you get used to it, the spacing makes a lot of sense. I find it easier to follow programme flow with the indentation.

      “That which can be asserted without evidence, can be dismissed without evidence.”

      ― Christopher Hitchens

      H 1 Reply Last reply
      0
      • G GuyThiebaut

        Once you get used to it, the spacing makes a lot of sense. I find it easier to follow programme flow with the indentation.

        “That which can be asserted without evidence, can be dismissed without evidence.”

        ― Christopher Hitchens

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #19

        most people indent. write a python parser, then we'll talk about "getting used to it" when you have to make the grammar (including the tokenizer) context sensitive in order to handle significant vs insignificant whitespace.

        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

        L 1 Reply Last reply
        0
        • L Lost User

          Quote:

          Who uses tabs to dictate program flow?

          A thing I'm asking me all the time.

          It does not solve my Problem, but it answers my question

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #20

          i mean, it's one thing to use tabs to show program flow, but they should be descriptive, not prescriptive.

          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

          L 1 Reply Last reply
          0
          • H honey the codewitch

            i mean, it's one thing to use tabs to show program flow, but they should be descriptive, not prescriptive.

            When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #21

            Yes yes, I'm with you on this, and I think all who ever wrote a parser/compiler will agree. WhiteChars _are not_ an instrument to be a part of the gramatics.

            It does not solve my Problem, but it answers my question

            1 Reply Last reply
            0
            • H honey the codewitch

              most people indent. write a python parser, then we'll talk about "getting used to it" when you have to make the grammar (including the tokenizer) context sensitive in order to handle significant vs insignificant whitespace.

              When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #22

              :thumbsup:

              It does not solve my Problem, but it answers my question

              H 1 Reply Last reply
              0
              • L Lost User

                :thumbsup:

                It does not solve my Problem, but it answers my question

                H Offline
                H Offline
                honey the codewitch
                wrote on last edited by
                #23

                i love your signature by the way. it's too real.

                When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                L 1 Reply Last reply
                0
                • H honey the codewitch

                  i love your signature by the way. it's too real.

                  When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #24

                  Thank you :)

                  It does not solve my Problem, but it answers my question

                  1 Reply Last reply
                  0
                  • S Super Lloyd

                    Use the debugger! What a novel idea! :laugh: The problem with stepping through the whole algorithm manually is that there is too much data and raw numerical values don't make much sense to human eyes... it describe 2 potatoes intersection.. but when I look at the bezier's handle point values, it means little to me (except visually..) FYI, trying to debug this vector graphic eraser [issue](https://ibb.co/Ydf8yqg) :(( Anyway, just made a tiny bit more progress... In my structure I got, for some reason, an odd number of intersection (between 2 shapes)... :wtf: :confused: 333!

                    A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                    M Offline
                    M Offline
                    Mark_Wallace
                    wrote on last edited by
                    #25

                    Super Lloyd wrote:

                    it describe 2 potatoes intersection

                    That explains it. Your computer's got the wrong chips.

                    I wanna be a eunuchs developer! Pass me a bread knife!

                    S 1 Reply Last reply
                    0
                    • H honey the codewitch

                      I'm building a parser generator right now, so if you know what that entails, you know I mean it when I say I feel your pain, neighbor.

                      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                      S Offline
                      S Offline
                      Super Lloyd
                      wrote on last edited by
                      #26

                      I have used a few of them, they are good! :) They are also tricky beast! :~ Good luck with that! :) And thanks for the support! ;P

                      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                      1 Reply Last reply
                      0
                      • M Mark_Wallace

                        Super Lloyd wrote:

                        it describe 2 potatoes intersection

                        That explains it. Your computer's got the wrong chips.

                        I wanna be a eunuchs developer! Pass me a bread knife!

                        S Offline
                        S Offline
                        Super Lloyd
                        wrote on last edited by
                        #27

                        :laugh: Ha! Forget 586! Sour cream and chilly is the way of the future! ;P

                        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                        1 Reply Last reply
                        0
                        • S Super Lloyd

                          I have been working on and off (at home) on that single algorithm for almost 2 and half years, I think. I am now very close to completion with an elegantly simple algorithm :) Except.. it doesn't work... After days of staring at my screen I came up with a test that shows an internal data inconsistency that will predict failure. But... basically the validation is a loop doing some calculation at each step.. . It came literally right after the same loop applying the calculation result.. yet it has different value than expected?! Why, ho why? And how? :(( :(( I think the forces that be are preventing me from finding the truth! :o That's the only logical explanation I can come up with! Need exorcism ASAP! :mad: :rolleyes: :wtf: :~

                          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                          M Offline
                          M Offline
                          migelle
                          wrote on last edited by
                          #28

                          Seems to me you have an ID problem here. I will try to explain. When your eraser tool, which is nothing but a circle object intersects with the existing object it creates new vertices. Those new vertices need to be connected to existing ones. During this process an AREA needs to be defined within the connections will happen. Since you have no area defined, newly formed vertices connect to the existing ones. Since no more than 2 vertices can be connected on a 2 dimensional object, an existing connection is broken splitting the object in 2. Here's how this happens: there's a vertex at the top left of your image where the breaking happens, and let's label it V1, and it's connected to a vertex below it, so let's label that one V2, and there's a Bezier curve that connects them. When you introduce the eraser tool (which is a new circle object that also consists of vertices) and intersect it with the object, you are creating new vertices, so for easier understanding let's say 2 new ones, V3 and V4. As a result, instead of new vertices V3 and V4 being connected and creating a Bezier curve between them, connection at V1 breaks, a new connection is created between V1 and V4, also between V2 and V3 thus splitting the object in two, and also creating a Bezier curve as it was their last state. The best way to approach this problem is to create 2 new states for each vertex: - is a vertex being deleted cause intersection happens where the vertex is, and 2 new vertices are created and connected thus eliminating the first one, - if the intersection doesn't happen where the new vertex is, newly created vertices should be connected to the nearest left, between themselves, and nearest right, following the edge of the object. Proposed solution This is just a rough idea on what's going on and what the solution may be. I hope I helped.

                          S 1 Reply Last reply
                          0
                          • M migelle

                            Seems to me you have an ID problem here. I will try to explain. When your eraser tool, which is nothing but a circle object intersects with the existing object it creates new vertices. Those new vertices need to be connected to existing ones. During this process an AREA needs to be defined within the connections will happen. Since you have no area defined, newly formed vertices connect to the existing ones. Since no more than 2 vertices can be connected on a 2 dimensional object, an existing connection is broken splitting the object in 2. Here's how this happens: there's a vertex at the top left of your image where the breaking happens, and let's label it V1, and it's connected to a vertex below it, so let's label that one V2, and there's a Bezier curve that connects them. When you introduce the eraser tool (which is a new circle object that also consists of vertices) and intersect it with the object, you are creating new vertices, so for easier understanding let's say 2 new ones, V3 and V4. As a result, instead of new vertices V3 and V4 being connected and creating a Bezier curve between them, connection at V1 breaks, a new connection is created between V1 and V4, also between V2 and V3 thus splitting the object in two, and also creating a Bezier curve as it was their last state. The best way to approach this problem is to create 2 new states for each vertex: - is a vertex being deleted cause intersection happens where the vertex is, and 2 new vertices are created and connected thus eliminating the first one, - if the intersection doesn't happen where the new vertex is, newly created vertices should be connected to the nearest left, between themselves, and nearest right, following the edge of the object. Proposed solution This is just a rough idea on what's going on and what the solution may be. I hope I helped.

                            S Offline
                            S Offline
                            Super Lloyd
                            wrote on last edited by
                            #29

                            Actually, you know what? I think I found it! When I got this

                               |  |
                             ==+==+==
                                \\\\\_/
                            

                            Sometimes I have to merge vertex when they are separated by very small interval, otherwise I got algorithmic issue... (like never ending loop calculating approximate intersection) But when I merge the intersection above, they become a touch.. i.e. the merge point is NOT an intersection anymore.. but I dunno it, all I know (at the moment) is a point with 4 line convergent on it, must be an intersection, right? I have to take that into consideration! Woa,.. good find.. will implement that later! :D (got othe rthings to do! :D )

                            A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                            M 1 Reply Last reply
                            0
                            • S Super Lloyd

                              Actually, you know what? I think I found it! When I got this

                                 |  |
                               ==+==+==
                                  \\\\\_/
                              

                              Sometimes I have to merge vertex when they are separated by very small interval, otherwise I got algorithmic issue... (like never ending loop calculating approximate intersection) But when I merge the intersection above, they become a touch.. i.e. the merge point is NOT an intersection anymore.. but I dunno it, all I know (at the moment) is a point with 4 line convergent on it, must be an intersection, right? I have to take that into consideration! Woa,.. good find.. will implement that later! :D (got othe rthings to do! :D )

                              A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                              M Offline
                              M Offline
                              migelle
                              wrote on last edited by
                              #30

                              I deal with this a lot in 3ds Max. Perhaps you could take a look how editable splines work, and that may be of help.

                              S 1 Reply Last reply
                              0
                              • S Super Lloyd

                                I have been working on and off (at home) on that single algorithm for almost 2 and half years, I think. I am now very close to completion with an elegantly simple algorithm :) Except.. it doesn't work... After days of staring at my screen I came up with a test that shows an internal data inconsistency that will predict failure. But... basically the validation is a loop doing some calculation at each step.. . It came literally right after the same loop applying the calculation result.. yet it has different value than expected?! Why, ho why? And how? :(( :(( I think the forces that be are preventing me from finding the truth! :o That's the only logical explanation I can come up with! Need exorcism ASAP! :mad: :rolleyes: :wtf: :~

                                A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                R Offline
                                R Offline
                                Reader Man San
                                wrote on last edited by
                                #31

                                It happened to me once and i had a too long time to discover the problem. i was using ADO.Net, and connecting a textbox.text to a field in the table, and that field is int16, and i was trying to save into it an int64, and while the number value is small, but still, the textbox did not have its text changed, it always stayed a null. after the yoricka came :-D , i changed/or casted the int64 to int16, and it worked. so, check if there is a conversion happening here or there. Regards.

                                ___________________________________________ May god give u good health and knowledge.

                                S 1 Reply Last reply
                                0
                                • R Reader Man San

                                  It happened to me once and i had a too long time to discover the problem. i was using ADO.Net, and connecting a textbox.text to a field in the table, and that field is int16, and i was trying to save into it an int64, and while the number value is small, but still, the textbox did not have its text changed, it always stayed a null. after the yoricka came :-D , i changed/or casted the int64 to int16, and it worked. so, check if there is a conversion happening here or there. Regards.

                                  ___________________________________________ May god give u good health and knowledge.

                                  S Offline
                                  S Offline
                                  Super Lloyd
                                  wrote on last edited by
                                  #32

                                  Haha this is not it! ;) I think I get it ... (since it's gonna be hard to fix I left the fix (test) to later) When I merge 2 intersection close to each other (for numerical reason), sometimes the resulting point is not an intersection (despite having for segment attached to it) but just a touch... Will have to put that in... :o

                                  A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                  1 Reply Last reply
                                  0
                                  • M migelle

                                    I deal with this a lot in 3ds Max. Perhaps you could take a look how editable splines work, and that may be of help.

                                    S Offline
                                    S Offline
                                    Super Lloyd
                                    wrote on last edited by
                                    #33

                                    At this stage I am not interested in reading other people's code! ^_^ And I need the (working) algorithm in my .NET app.. I would be interested in a .NET C# library manipulating geometry.. But I can't find any.. (the only one I know is some GIS I forgot the name, and they only deal in polygon, not shape and their API is convoluted...)

                                    A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                    M 1 Reply Last reply
                                    0
                                    • S Super Lloyd

                                      At this stage I am not interested in reading other people's code! ^_^ And I need the (working) algorithm in my .NET app.. I would be interested in a .NET C# library manipulating geometry.. But I can't find any.. (the only one I know is some GIS I forgot the name, and they only deal in polygon, not shape and their API is convoluted...)

                                      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                      M Offline
                                      M Offline
                                      migelle
                                      wrote on last edited by
                                      #34

                                      A slight misunderstanding.I wasn't talking about the code but the understanding of behavior of editable spline objects and their properties, i/e axis orientation of vertices within the spline (where during intersection X and Y axis can be swapped), managing direction of IDs (i/e clockwise vs counterclockwise on a circle), and welding function (which, as the name says) welds two vertices into one using the area concept (maximum allowed distance between two vertices so no unwanted vertices get welded), for the purpose of avoiding problems like the one you encountered, which are quite common in the world of 3D graphic. For the past 23 years of my experience with CAD and 3D software I have seen my share of weird things, and I have an understanding that I thought might be useful. Basically, I am trying to point you think in the right direction, nothing more. Have fun.

                                      S 1 Reply Last reply
                                      0
                                      • S Super Lloyd

                                        I have been working on and off (at home) on that single algorithm for almost 2 and half years, I think. I am now very close to completion with an elegantly simple algorithm :) Except.. it doesn't work... After days of staring at my screen I came up with a test that shows an internal data inconsistency that will predict failure. But... basically the validation is a loop doing some calculation at each step.. . It came literally right after the same loop applying the calculation result.. yet it has different value than expected?! Why, ho why? And how? :(( :(( I think the forces that be are preventing me from finding the truth! :o That's the only logical explanation I can come up with! Need exorcism ASAP! :mad: :rolleyes: :wtf: :~

                                        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                        J Offline
                                        J Offline
                                        jeb1217
                                        wrote on last edited by
                                        #35

                                        9 times out of 10 this type of issue is related to only a few of things. 1) Something isn't being properly initialized (especially common in loops; where do you initialize/reset conditions) 2) you are calling routines and not careful about parameter passing (value vs reference) 3) You've an error that for some reason is "swallowed". My first week on my current job I added an Unhandled Exception Handler to a troublesome Windows Service. It was very enlightening. 4) the Context has changed between your calculation loop and the validation (have seen issues with the same name used in different namespaces and the code was actually executing 2 different code sets) This are a bear to track down. Often the best way to find the bug is swallow your pride and get a junior person to sit with you and explain your code to him. The 2nd set of eyes, rethinking the code as you explain it and sometimes "dumb" questions will highlight your problem. I ate crow recently after swearing my code was solid and it "had" to be a data issue, a code review with a person my junior caused me to spot the bad code I had passed over 100 times while trying to fix the bug.

                                        1 Reply Last reply
                                        0
                                        • M migelle

                                          A slight misunderstanding.I wasn't talking about the code but the understanding of behavior of editable spline objects and their properties, i/e axis orientation of vertices within the spline (where during intersection X and Y axis can be swapped), managing direction of IDs (i/e clockwise vs counterclockwise on a circle), and welding function (which, as the name says) welds two vertices into one using the area concept (maximum allowed distance between two vertices so no unwanted vertices get welded), for the purpose of avoiding problems like the one you encountered, which are quite common in the world of 3D graphic. For the past 23 years of my experience with CAD and 3D software I have seen my share of weird things, and I have an understanding that I thought might be useful. Basically, I am trying to point you think in the right direction, nothing more. Have fun.

                                          S Offline
                                          S Offline
                                          Super Lloyd
                                          wrote on last edited by
                                          #36

                                          To be fair I had trouble understanding your explanation... I think I found the fix (while day dreaming during latest work meeting just now)(this is for a pet home project). Each intersection vertex need a bool Crossing flag. When I merge 2 vertices (because of close proximity), crossing should be updated with an Xor of both values.

                                          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                          M 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