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

    Calculate a curve that fits between two edge?

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 5 Posters 467 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

      I need some math help;
      I want to take two edges which forms a corner and make a curve that tangent the two edges given a specific radius. How do you calculate that?

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

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        It all depends whether the 2 edges are coplanar or not.

        If they are coplanar, then you can use a simple Bezier curve with the 2 close extremities of the edges and their intersection. This respect the edge ends.

        For a circle arc, there is no solution in the general case, but you can deform it to make it an ellipse arc.

        Fredo

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

          Coplanar, yes.

          What I had in mind was something like this:
          arc-tangent.png
          You have two edges that meet in one point, forming a corner. I want to round if that corner with a given radius. I need to work out the position of the centre point and and start and end angle of the arc so the two end points tangent the edges.

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

          1 Reply Last reply Reply Quote 0
          • fredo6F Offline
            fredo6
            last edited by

            You can have a look at BZ_Arc (part of BezierSpline), which is more or less doing this calculation.
            See http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=18070&hilit=plugin#p145567

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

              hmm... here the radius is the variable, and the offset from the corner is fixed. But I have a fixed radius with variable offset from the corner.

              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

                hmm.... wait... if I get the Line for both edges, offset them by the radius, their intersection should be the centre point, right?

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

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  A linear combination of the vectors of each line will return the vector on which your centerpoint will exist. Then you just have to figure out how far down that vector it will sit.....ok, that's all got I got. I'm useless.

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

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

                    Thom, your last statement is correct. Lines parallel to the edges and offset by the radius of the curve will intersect at the arc center. What you do with that in a Ruby is way over my head, though.

                    Etaoin Shrdlu

                    %

                    (THERE'S NO PLACE LIKE)

                    G28 X0.0 Y0.0 Z0.0

                    M30

                    %

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

                      @dave r said:

                      What you do with that in a Ruby is way over my head, though.

                      It'll soon be revealed... 😉

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

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        BTW, if you should start a thread about it, I have some organization and expansion ideas...

                        Chris

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

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

                          Yea, I'll make a thread later this week when I've added a couple of more things to the concept script and make some illustrations. Just make a note of your ideas etc and do a follow-up post when I post it.

                          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

                            "this week", as in the next week... 😳 still a couple of hours until monday...

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

                            1 Reply Last reply Reply Quote 0
                            • TIGT Offline
                              TIG Moderator
                              last edited by

                              Sorry to disappoint... but K_Tools.rb has long had an L function to joint two selected edges and add a specified radius (like 'fillet')... Isn't that exactly what you are trying to do ?

                              Just look at the code for clues...
                              .

                              TIG

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

                                Giving a radius to two edges is only one minor function. I ended up getting the linear_combination of the two edge's vectors, then use trigonometry to calculate the centre point on that vector.

                                It'd be interesting to have a look at K_Tools.rb to see how it's done there. My trigonometry is very rusty so I'm not sure if I'm doing it the best way.

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

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

                                Advertisement