Tangent Line?
-
I don't know. The problem I'm thinking of is this.
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. -
...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.
-
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.
-
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.
-
@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...
-
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! -
TIG, it's just amazing. You've just given me an even easier method which doesn't require a plugin. Thank you.
-
@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?
-
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
... -
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:
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.
A quick little run through Pythagoras' therom and we have b. Draw b perpendicular to a.
Rotate b about the midpoint of the diagonal until its upper end coincides with the guidepoint.
Then it is a simple matter of completing the brace.
-
Thanks Bruce. Now we need someone to figure out how to do that automatically with a plugin.
Advertisement