The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Everything about GDL - Doors/Windows/Objects/Stairs etc. (Example: I created an object that prints an error message in 3D all the time, please help!)

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy, Gergely Feher

User avatar
By Mark
#81798
Hey all,

I have a fairly complex math question (or at least for me). In a gdl object i want to draw a polygon that has 2 sides made from a curve and 2 sides a straight line. This is easy enough but i also want to fillet where they join, see sketch.

Does anyone know the how to work out the formula for this, i believe the formula lies in analytical geometry but is a bit beyond me.

P.S. I realise 2 lines can be filleted using status codes using poly_b but i need to know the start, end and centre points of the fillet when a straight line and curve intersect to use this.

Thanks for any help
Attachments
Page0001.jpg
Page0001.jpg (13.78 KiB) Viewed 8581 times
User avatar
By F. Beister
#81807
You need one more known distance f. The resulting radius r1 of the fitting circle is unique. The pink right triangle brings the formulas. To calculate the X/Y coordinates is still a lot of work, but this should bring you on the track.
HTH. Frank
Attachments
rounded.jpg
By LiHigh
#81826
I hope this is what you are looking for...

!-----------------------------------------
r2 = r1 + d
u = ATN(f/(r2-f))
w = ATN(f/(r1+f))

x1=r1+f :y1=0
x2=r2-f :y2=0
x3=r2*cos(u) :y3=r2*sin(u)
x4=r2*cos(alpha-u) :y4=r2*sin(alpha-u)
x5=(r2-f)*cos(alpha) :y5=(r2-f)*sin(alpha)
x6=(r1+f)*cos(alpha) :y6=(r1+f)*sin(alpha)
x7=r1*cos(alpha-w) :y7=r1*sin(alpha-w)
x8=r1*cos(w) :y8=r1*sin(w)
!-----------------------------------------

poly2_ 9,7,
x1, y1, 1,
x2, y2, 1,
x3, y3, 1001,
x4, y4, 1001,
x5, y5, 1001,
x6, y6, 1,
x7, y7, 1001,
x8, y8, 1001,
x1, y1, 1001
Attachments
polyShape.jpg
User avatar
By Mark
#81868
Thanks for your help LiHigh and Frank. A very sound explanation, I should be able to implement this easily now.
User avatar
By F. Beister
#81876
@LiHigh
That's a quiet good approximation, but it is not the exact solution. Add this at the end of your script:

!-----------------------------------------
line2 r1,0,r1+d,0
arc2 0,0,r1,0,alpha
arc2 0,0,r1+d,0,alpha
rot2 alpha
line2 r1,0,r1+d,0
del 1
!-----------------------------------------

And you will see intersection of the boundarys, which might not exist. The reason:
X2 is NOT R2-F. If you have a look on it in a larger scale you will see. The dependance of the edge radius and the distance of the tangiantial point is as complex as I wrote in my posting above. So it is for all other points. Maybe it is easier to give the radius known instead of the distance. Does make not much difference as one can see. In every case I am shure that there is a simple solution, because the angle of the rounding arc can be found in any of the known triangles. I don't know the English expressions, but there is a basic trigonometric rule that lets me believe in this.

If I get my work done before I sleep I spent still a thought on it. ;) Interesting problem. :)
User avatar
By F. Beister
#81900
Some work and sleep in between. Here is teh exact calculation part:

!-----------------------------------------
r2 = r1 + d
L1 = sqr(r1) * sqr(2*f+r1) - R1
L2 = r2 - sqr(r2^2-2*f*r2)
u = ATN(f/(r2-L2))
w = ATN(f/(r1+L1))

x1=r1+L1 : y1=0
x2=f/tan(u) : y2=0
x3=r2*cos(u) : y3=f*r2/(r2-f)
x4=r2*cos(alpha-u) : y4=r2*sin(alpha-u)
x5=(r2-L2)*cos(alpha) : y5=(r2-L2)*sin(alpha)
x6=(r1+L1)*cos(alpha) : y6=(r1+L1)*sin(alpha)
x7=r1*cos(alpha-w) :y7=r1*sin(alpha-w)
x8=r1*cos(w) :y8=f*r1/(r1+f)
!-----------------------------------------
By LiHigh
#81912
F. Beister wrote:@LiHigh
May I use your illustration and script for a documentation page on opengdl?
Sure! feel free to do so.
By LiHigh
#81916
F. Beister wrote:@LiHigh
That's a quiet good approximation, but it is not the exact solution.
You are right! :oops:

The Fix:

!-----------------------------------------
r2 = r1 + d
u = ASN(f/(r2-f))
w = ASN(f/(r1+f))

x1=(r1+f)*cos(w) :y1=0
x2=(r2-f)*cos(u) :y2=0
x3=r2*cos(u) :y3=r2*sin(u)
x4=r2*cos(alpha-u) :y4=r2*sin(alpha-u)
x5=(r2-f)*cos(u)*cos(alpha) :y5=(r2-f)*cos(u)*sin(alpha)
x6=(r1+f)*cos(w)*cos(alpha) :y6=(r1+f)*cos(w)*sin(alpha)
x7=r1*cos(alpha-w) :y7=r1*sin(alpha-w)
x8=r1*cos(w) :y8=r1*sin(w)
!-----------------------------------------

poly2_ 9,7,
x1, y1, 1,
x2, y2, 1,
x3, y3, 1001,
x4, y4, 1001,
x5, y5, 1001,
x6, y6, 1,
x7, y7, 1001,
x8, y8, 1001,
x1, y1, 1001