Calculate a curve that fits between two edge?
-
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? -
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
-
Coplanar, yes.
What I had in mind was something like this:
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. -
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 -
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.
-
hmm.... wait... if I get the Line for both edges, offset them by the radius, their intersection should be the centre point, right?
-
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
-
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.
-
@dave r said:
What you do with that in a Ruby is way over my head, though.
It'll soon be revealed...
-
BTW, if you should start a thread about it, I have some organization and expansion ideas...
Chris
-
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.
-
"this week", as in the next week...
still a couple of hours until monday...
-
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...
. -
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.
Advertisement