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

    Tangent Line?

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 5 Posters 1.2k 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.
    • Dave RD Offline
      Dave R
      last edited by

      I did a search and came up empty handed. Is there a plugin or would it be possible to create one that would generate a line that is tangent to a circle and passes through a selected point?

      Etaoin Shrdlu

      %

      (THERE'S NO PLACE LIKE)

      G28 X0.0 Y0.0 Z0.0

      M30

      %

      1 Reply Last reply Reply Quote 0
      • B Offline
        BTM
        last edited by

        I don't know. The problem I'm thinking of is this.
        tangent issue..png
        Sketchup doesn't work with perfect circles, so It would cut through the circle if the tangent line didn't come in contact with the circle on an endpoint/midpoint. For midpoints, the line they're on is already tangent.

        1 Reply Last reply Reply Quote 0
        • B Offline
          BTM
          last edited by

          ...Then again, Chris F. did make a script that found the center of a curve, and from that I would assume a plugin would be possible. Not saying it would be simple, but possible.

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

            I was thinking about that problem, BTM. I don't know what calculations would be required but I wondered if it would be possible to pick up the radius of the circle and essentially calculate how much the circle would need to be rotated so that a vertex would be placed at the tangent point. That would prevent the problem that you illustrate.

            Etaoin Shrdlu

            %

            (THERE'S NO PLACE LIKE)

            G28 X0.0 Y0.0 Z0.0

            M30

            %

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

              TIG, that's a good idea. I don't know what it was exactly but reading what you wrote gave me the idea of how to solve my specific problem. Thank you good sir.

              Etaoin Shrdlu

              %

              (THERE'S NO PLACE LIKE)

              G28 X0.0 Y0.0 Z0.0

              M30

              %

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

                @dave r said:

                I was thinking about that problem, BTM. I don't know what calculations would be required but I wondered if it would be possible to pick up the radius of the circle and essentially calculate how much the circle would need to be rotated so that a vertex would be placed at the tangent point. That would prevent the problem that you illustrate.

                My increasing segments method effectively rotates a vertex so it's as near to the tangent point as makes no difference...
                Your calculation idea works for a Circle, thus... [outline of script]
                Let's set some variables etc...
                Let 1st point [picked] = pt
                Let circle's center = ct and radius = ra
                Let point where tangent should touch on circumference = tp
                Let distance form pt to ct = di (Methods give us: di=pt.distance(ct))
                Let distance from pt to tp = dt
                From Pythagoras: dt = Math::sqrt(ra2 - d12)
                Let angle between the tangent and the pt to ct line = aa
                From Trig: aa = Math::asin(ra / di)
                Draw a new edge from pt to tp - it should NOT intersect with the arc as it's 'true' tangent, it might touch at a vertex by coincidence...
                We know the tangent point (tp), now we pick any Vertex (its point=vp) of the Circle's Edge-set and find the included angle (ia) between the the Vector from ct to tp and the Vector from ct to vp.
                Now Transform Rotate the circle about ct by angle ia...
                The vertex should now be coincident with tp.

                If the circle is not flat then the Arc's normals etc need to be included in our processing... e.g.
                Transform Rotate tp about ct by angle the arc's normal is off vertical, in the plane tp,ct,ct_z+1 ... needs thinking through a bit more ! The Circle's rotation also needs to use its normal etc...

                For an Arc it's much more complex - you'll have to redraw the arc between the original arc's end points with the same radius, edge-count etc - I suggest you might draw a circle centred on the arc's centre, with its segments = arc's_segments*2PI / arcs_included_angle, and rotate this circle as above, then split it at the arc'c ends (need intersecting vectors for that ?) and erase the rest ? The new curve is the Arc rotated to suit... This is NOT easy...

                Now all someone needs to do is code it up...

                TIG

                1 Reply Last reply Reply Quote 0
                • G Offline
                  Gjenio
                  last edited by

                  Such a script is a long requested one by me!
                  Here
                  http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=3610&hilit=+construction
                  and here
                  http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=17122&hilit=+construction
                  I had suggested some time ago a construction circle tool wich would have worked with circle like the tape measure tool work with lines. But was told me that was not possible to do with ruby scripts. This is a slightly different approach to the problem but with the same aim, drawing with accuracy on curvy shapes. This actualy is the biggest lack in Sketchup! So every step in the direction to fill it is greatly appreciated.
                  Keep working on it, please!

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

                    TIG, it's just amazing. You've just given me an even easier method which doesn't require a plugin. Thank you.

                    Etaoin Shrdlu

                    %

                    (THERE'S NO PLACE LIKE)

                    G28 X0.0 Y0.0 Z0.0

                    M30

                    %

                    1 Reply Last reply Reply Quote 0
                    • G Offline
                      Gjenio
                      last edited by

                      @dave r said:

                      TIG, it's just amazing. You've just given me an even easier method which doesn't require a plugin. Thank you.

                      Can you share it with the community?

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

                        If it's still an arc or a circle then use 'Entity Info' to increase its segments to say 1000 [if it's no longer an arc then use Chris's tool to find where its centre used to be and draw a temporary 1000s circle centred on that, snapping to an outer vertex], then draw from your desired point to the tangent it should be accurate enough for most purposes - change the number of segments back to something less intensive (24/32/64 etc) [or erase the temporary circle]. You can choose say 128s as a pretty good approximation and leave it at that... If you want the thing to 'face' the you might need to zoom in and fiddle around with some lengths to suit IF you've changed the segment count...
                        TangentApproximation.skp
                        ...

                        TIG

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

                          Sure. Here you go. Mind you this is for a specific application. It would probably work for others but this works. It does require a calculator but the math is simple enough.

                          The request I had was to show how to accurately draw in diagonal braces for a gate. Thus:

                          http://img.photobucket.com/albums/v506/weekender410/OllysGate4.jpg

                          The requirement is that the acute angled corners of the brace be located 2" from the ends of the horizontal members. So I started with a couple of guidepoints at the 2" distance and drew a line between. Then I drew line a from the midpoint of the diagonal line. Line b is half the width of the brace. Then I measured from the midpoint of the diagonal to the guidepoint. This is c.

                          http://img.photobucket.com/albums/v506/weekender410/olly1.jpg

                          A quick little run through Pythagoras' therom and we have b. Draw b perpendicular to a.

                          http://img.photobucket.com/albums/v506/weekender410/olly2.jpg

                          Rotate b about the midpoint of the diagonal until its upper end coincides with the guidepoint.

                          http://img.photobucket.com/albums/v506/weekender410/olly3.jpg

                          http://img.photobucket.com/albums/v506/weekender410/olly4.jpg

                          Then it is a simple matter of completing the brace.

                          Etaoin Shrdlu

                          %

                          (THERE'S NO PLACE LIKE)

                          G28 X0.0 Y0.0 Z0.0

                          M30

                          %

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

                            Thanks Bruce. Now we need someone to figure out how to do that automatically with a plugin. 😄

                            Etaoin Shrdlu

                            %

                            (THERE'S NO PLACE LIKE)

                            G28 X0.0 Y0.0 Z0.0

                            M30

                            %

                            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