sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Code to calculate Catenary curves?

    Scheduled Pinned Locked Moved Developers' Forum
    21 Posts 5 Posters 5.6k Views 5 Watching
    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.
    • thomthomT Offline
      thomthom
      last edited by

      Thanks remus. I've found myself on deep water with this problem. Been a while since I've done any math beyond simple + - * /, but I've never done this kind of math.

      (I can hear all my former math teachers laughing, quoting me "I'll never have any use of that in real life!" sigh )

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Looking at: http://mathworld.wolfram.com/Catenary.html

        @unknownuser said:

        The arc length, curvature, and tangential angle for t>0 are given by

        http://mathworld.wolfram.com/images/equations/Catenary/Inline16.gif

        http://mathworld.wolfram.com/images/equations/Catenary/Inline19.gif

        http://mathworld.wolfram.com/images/equations/Catenary/Inline22.gif

        Is the first one the arch length?

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • R Offline
          remus
          last edited by

          Indeed i think the first one is arc length.

          i've found another form that might be a bit more useful:

          arc length = (2H/w)* sinh (wl/2H)

          where H=horizontal tension on the cord, w=weight of the cord and and l=distance between the 2 points.

          thinks a bit more
          

          http://remusrendering.wordpress.com/

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            I've been searching some more on Catenary and it appears that the formulas assume the two points to be at equal height.

            The example at wolfram site has code which generates a curve from points at different heights. http://demonstrations.wolfram.com/CatenaryTheHangingChain/
            But I can't interpret the code. And it also appears to not be a variable width arc.

            The thing is, it's not required that I use the Catenary equation. It's just what seemed to be to be related to what I wanted to do. If anyone got other suggestions, I'm all ears.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • R Offline
              remus
              last edited by

              Ok, i think i've sort of got it.

              Essentially the problem boils down to finding the correct value of a for your length of rope and the distance between the 2 fixing points.

              This is given by a=w/H where w=weight of the rope and H=horizontal force tensioning the rope. If you have got some accurate values for w and H you should be able to work out a and then substitute it back in to the original catenary equation ( y=a*cosh(x/a))

              Thats the easy version, if you cant make that work i think it gets yet more complicated, as i dont think you can get a value for a easily only knowing L.

              It should also be possible to make it work with points at unequal heights, although again it would add an extra level of complication.

              p.s. the parabola is a reasonable approximation to a catenary curve, and could simplify the maths quite a bit. Probably worth having a look in to it if you dont need to be entirely accurate.

              http://remusrendering.wordpress.com/

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                @remus said:

                p.s. the parabola is a reasonable approximation to a catenary curve, and could simplify the maths quite a bit. Probably worth having a look in to it if you dont need to be entirely accurate.

                Good point. I think that's worth investigating. I don't want to do a true physic simulation. Just something that closely looks like ropes.

                The whole idea comes from last week when I modelled an old boat crane located on the site for a project at work. It has lots of wires hanging about. I had it rigged, but at some point I wanted to adjust it's arm positions, which resulted in me having to re-rig all the wires. So I thought I'd try to make a plugin which allowed you to pick to vertices in the model, specify a length and it'd make the rope. As you move/rotate the objects the rope/cable/wire is attached to they'll deform accordingly. That an making a plugin to allow me to set up pivot points which I can control from a webdialog so I get a control panel for the crane, or whatever you set up.)

                Ok, parabola...

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • R Offline
                  remus
                  last edited by

                  Having heard a bit more about your idea, are you absolutely sure you want to do it by specifying the length? i'm fairly sure you could do it by specifying the value of a.

                  http://remusrendering.wordpress.com/

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    How would that work? I'd still like it to hang more when the points are closer together. Would it do that?

                    Came across this: http://mathforum.org/library/drmath/view/53706.html looks interesting. Though, it's getting late now. Need to get some sleep. This stuff bends my brain.

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      Found two more resources about and unequal heights.
                      http://home.earthlink.net/~w6rmk/math/catenary.htm <- got an approximation, might be useful
                      http://members.chello.nl/j.beentjes3/Ruud/catfiles/catenary.pdf <- got some sample C code, but it seem to solve it by doing trial and error...

                      now, seriously, sleep.

                      Again, thank you very much Remus for your input.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        remus
                        last edited by

                        You would have to set a value of a for each curve, but then youd also have to set a length for each curve as well, so id imagine it'd work out pretty similar in terms of the amount of effort on the part of the user. I suppose you could also set the value for a relative to the distance between the 2 points, which should give you quite a similar effect to setting a length but without all the hard work.

                        As for the problem of unequal heights, from the links you provided it would seem an iterative method is necessary, although i'll look in to it a bit more.

                        If i remember i'll ask my maths tutor at college about it. Might know a good way of doing it.

                        http://remusrendering.wordpress.com/

                        1 Reply Last reply Reply Quote 0
                        • V Offline
                          vitaleMarco
                          last edited by

                          Check out this port, this might help you.

                          http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=64842

                          All the best Marco

                          1 Reply Last reply Reply Quote 0
                          • Didier BurD Offline
                            Didier Bur
                            last edited by

                            Hi,

                            Check this one by Aerilius: http://rhin.crai.archi.fr/rld/plugin_details.php?id=990

                            DB

                            1 Reply Last reply Reply Quote 0
                            • 1
                            • 2
                            • 1 / 2
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement