pauldk Posted March 21, 2012 (edited) Hi fellow brickers. Is there a math genius who can solve my problem? I'm trying to figure out what the exact angles of the hinges are, on a model I'm making. https://skydrive.live.com/redir.aspx?cid=fa1897de68ef1702&resid=FA1897DE68EF1702!301&parid=FA1897DE68EF1702!300&authkey=!AIkFOmEefzZn29w On the link above, you can see what I'm talking about. It's the hinges 1-7 I'm trying to figure out. The arch I'm making has to fit so I can put a two-dot brick in between (8) the orange end of the arch and the green brick at the end, if you know what I mean. So anyone, please help me out. Kind regards Paul in Denmark. Edited March 21, 2012 by pauldk Share this post Link to post Share on other sites
Bojan Pavsic Posted March 21, 2012 Image is not visible. Share this post Link to post Share on other sites
pauldk Posted March 21, 2012 Image is not visible. I had to make a link instead. - Paul Share this post Link to post Share on other sites
Bojan Pavsic Posted March 21, 2012 What curve would you like the "line" to follow? Should the goal be that angles 2-7 would be as close to eachother as possible? Because this doesn't have a unique result... Share this post Link to post Share on other sites
pauldk Posted March 21, 2012 What curve would you like the "line" to follow? Should the goal be that angles 2-7 would be as close to eachother as possible? Because this doesn't have a unique result... Well the curve has to be on the left side of the red line. Well it doesn't matter if angle 2-7 is as close to each other numerically , it just have to form a be a proper "round" curve, without too much of a gab where the hinges is. - Paul Share this post Link to post Share on other sites
Bojan Pavsic Posted March 21, 2012 (edited) a = 9,00 / 10,00 / 10,80 / 10,10 / 9,70 / 10,60 / 60,20 / x = 48,0001 / y = 32,0003 / diff = 0,00000011 / 0,00040506 a = 9,00 / 10,00 / 10,90 / 9,60 / 10,90 / 9,30 / 59,70 / x = 48,0002 / y = 32,0002 / diff = 0,00000010 / 0,00044028 a = 9,00 / 10,00 / 10,90 / 9,70 / 10,40 / 10,00 / 60,00 / x = 48,0001 / y = 31,9998 / diff = 0,00000003 / 0,00022862 a = 9,00 / 10,00 / 10,90 / 9,80 / 10,00 / 10,50 / 60,20 / x = 48,0004 / y = 31,9999 / diff = 0,00000019 / 0,00048942 a = 9,00 / 10,10 / 10,40 / 10,60 / 9,70 / 10,20 / 60,00 / x = 47,9997 / y = 32,0002 / diff = 0,00000011 / 0,00046409 a = 9,00 / 10,10 / 10,40 / 10,70 / 9,30 / 10,70 / 60,20 / x = 47,9999 / y = 32,0001 / diff = 0,00000002 / 0,00020103 a = 9,00 / 10,10 / 10,50 / 10,30 / 10,00 / 10,10 / 60,00 / x = 48,0002 / y = 31,9999 / diff = 0,00000006 / 0,00032837 a = 9,00 / 10,20 / 10,10 / 10,90 / 9,60 / 10,20 / 60,00 / x = 47,9999 / y = 31,9996 / diff = 0,00000015 / 0,00047076 a = 9,10 / 9,80 / 10,70 / 10,40 / 10,20 / 9,50 / 59,70 / x = 48,0002 / y = 32,0003 / diff = 0,00000012 / 0,00046690 a = 9,20 / 9,50 / 10,90 / 10,60 / 9,90 / 9,60 / 59,70 / x = 47,9995 / y = 32,0000 / diff = 0,00000021 / 0,00047361 a = 9,20 / 9,50 / 10,90 / 10,70 / 9,50 / 10,10 / 59,90 / x = 47,9999 / y = 32,0002 / diff = 0,00000005 / 0,00028831 a = 9,20 / 9,50 / 10,90 / 10,80 / 9,10 / 10,60 / 60,10 / x = 48,0001 / y = 32,0001 / diff = 0,00000001 / 0,00015129 a = 9,50 / 10,00 / 9,10 / 10,70 / 10,60 / 10,90 / 60,80 / x = 48,0003 / y = 31,9998 / diff = 0,00000009 / 0,00041066 a = 9,60 / 9,70 / 9,30 / 10,80 / 10,70 / 10,50 / 60,60 / x = 47,9999 / y = 31,9999 / diff = 0,00000002 / 0,00017598 a = 9,70 / 9,10 / 10,60 / 9,60 / 10,90 / 10,90 / 60,80 / x = 47,9999 / y = 32,0004 / diff = 0,00000015 / 0,00048733 a = 9,70 / 9,20 / 10,30 / 9,90 / 10,80 / 10,90 / 60,80 / x = 48,0003 / y = 32,0000 / diff = 0,00000011 / 0,00033032 a = 9,70 / 9,30 / 9,90 / 10,40 / 10,80 / 10,50 / 60,60 / x = 48,0000 / y = 32,0001 / diff = 0,00000001 / 0,00010925 a = 9,80 / 9,00 / 10,10 / 10,60 / 10,50 / 10,60 / 60,60 / x = 47,9996 / y = 32,0000 / diff = 0,00000017 / 0,00044663 a = 9,80 / 9,10 / 9,80 / 10,80 / 10,90 / 9,90 / 60,30 / x = 48,0001 / y = 32,0003 / diff = 0,00000009 / 0,00037339 A couple of angles that work, choose the ones that you like :) The angles are from 7 to 1. Format of a single line is: a7 / a6 / a5 / a4 / a3 / a2 / a1 / x size of the construction / y size of the construction / eps^2 / eps where x is the length of your red line from corner to hinge 7, y is the length of the yellow line from corner to hinge 1 (minus one), eps^2 is the sum of squares of differences (calculated x - target x)^2 + (calculated y - target y)^2, eps is the sum of absolute values of differences... I'd recommend taking a line with minimal eps (in the attached file, i used the numbers from the 3rd line from bottom). The difference between max an min angle is about 1 degree (hope that's not too much). The resolution in searching the numbers is 1/10 of degree. I can increase that, but then i'd need to optimize the program as it's already slow. edit: attachment didn't work, i'm including a link: http://www.pavsic.com/ldd/wall_seg.lxf I tried with same angles a2-a7, but couldn't get even close to this results.. Edited March 21, 2012 by Bojan Pavsic Share this post Link to post Share on other sites
Alasdair Ryan Posted March 21, 2012 I am no maths genius but what about doing something like this: Share this post Link to post Share on other sites
Rook Posted March 21, 2012 (edited) On angle 1 your brick is not laid the same as others thus it might be throughing off your calculations. Bojan has an answer that I'm sure is completely correct but I don't remember enough about math to even explain it. If you break it down to simpler math, you basically have 7 slight angles that (if you change your hinge brick at angle 1) would equal 90 degrees (triangle equals 180 degrees minus the right angle in the corner). So you've got 90 divided by 7 equals 12.857142. So about 12.9 degrees angle at each hinge. Note that is only true if you change the hinge at angle 1, as it is turned in where the other are turned out. Edited March 21, 2012 by Rook Share this post Link to post Share on other sites
Bojan Pavsic Posted March 21, 2012 Explanation: Each segment is the hypothenuse of a right triangle (imagine the other two cathets on the lego grid below). From that, you can calculate them: x_part = l * cos(angle) y_part = l * sin(angle) The whole bounding box of the curve is just a sum of all the X parts and Y parts of all the segments... and angles sum up: angle_7 = angle_guess angle_6 = angle_7 + angle_guess angle_5 = angle_7 + angle_6 + angle_guess... First i tried with all angles the same and the best match was around 9,85 (=angle_guess). Then i changed the program to "try" values from 9 to 11 for each angle with the resolution of 0.1 degree... The results are up there. There's only 1 catch. The first segment has pivoting points on different sides of the 1x10 brick... Which means you need to compensate that in the calculations (length is not 10 but square root of 101). There's a slight angle change because of that too, but that's just in the calculation part. The output already has that calculated in. Share this post Link to post Share on other sites
pauldk Posted March 21, 2012 a = 9,00 / 10,00 / 10,80 / 10,10 / 9,70 / 10,60 / 60,20 / x = 48,0001 / y = 32,0003 / diff = 0,00000011 / 0,00040506 a = 9,00 / 10,00 / 10,90 / 9,60 / 10,90 / 9,30 / 59,70 / x = 48,0002 / y = 32,0002 / diff = 0,00000010 / 0,00044028 a = 9,00 / 10,00 / 10,90 / 9,70 / 10,40 / 10,00 / 60,00 / x = 48,0001 / y = 31,9998 / diff = 0,00000003 / 0,00022862 a = 9,00 / 10,00 / 10,90 / 9,80 / 10,00 / 10,50 / 60,20 / x = 48,0004 / y = 31,9999 / diff = 0,00000019 / 0,00048942 a = 9,00 / 10,10 / 10,40 / 10,60 / 9,70 / 10,20 / 60,00 / x = 47,9997 / y = 32,0002 / diff = 0,00000011 / 0,00046409 a = 9,00 / 10,10 / 10,40 / 10,70 / 9,30 / 10,70 / 60,20 / x = 47,9999 / y = 32,0001 / diff = 0,00000002 / 0,00020103 a = 9,00 / 10,10 / 10,50 / 10,30 / 10,00 / 10,10 / 60,00 / x = 48,0002 / y = 31,9999 / diff = 0,00000006 / 0,00032837 a = 9,00 / 10,20 / 10,10 / 10,90 / 9,60 / 10,20 / 60,00 / x = 47,9999 / y = 31,9996 / diff = 0,00000015 / 0,00047076 a = 9,10 / 9,80 / 10,70 / 10,40 / 10,20 / 9,50 / 59,70 / x = 48,0002 / y = 32,0003 / diff = 0,00000012 / 0,00046690 a = 9,20 / 9,50 / 10,90 / 10,60 / 9,90 / 9,60 / 59,70 / x = 47,9995 / y = 32,0000 / diff = 0,00000021 / 0,00047361 a = 9,20 / 9,50 / 10,90 / 10,70 / 9,50 / 10,10 / 59,90 / x = 47,9999 / y = 32,0002 / diff = 0,00000005 / 0,00028831 a = 9,20 / 9,50 / 10,90 / 10,80 / 9,10 / 10,60 / 60,10 / x = 48,0001 / y = 32,0001 / diff = 0,00000001 / 0,00015129 a = 9,50 / 10,00 / 9,10 / 10,70 / 10,60 / 10,90 / 60,80 / x = 48,0003 / y = 31,9998 / diff = 0,00000009 / 0,00041066 a = 9,60 / 9,70 / 9,30 / 10,80 / 10,70 / 10,50 / 60,60 / x = 47,9999 / y = 31,9999 / diff = 0,00000002 / 0,00017598 a = 9,70 / 9,10 / 10,60 / 9,60 / 10,90 / 10,90 / 60,80 / x = 47,9999 / y = 32,0004 / diff = 0,00000015 / 0,00048733 a = 9,70 / 9,20 / 10,30 / 9,90 / 10,80 / 10,90 / 60,80 / x = 48,0003 / y = 32,0000 / diff = 0,00000011 / 0,00033032 a = 9,70 / 9,30 / 9,90 / 10,40 / 10,80 / 10,50 / 60,60 / x = 48,0000 / y = 32,0001 / diff = 0,00000001 / 0,00010925 a = 9,80 / 9,00 / 10,10 / 10,60 / 10,50 / 10,60 / 60,60 / x = 47,9996 / y = 32,0000 / diff = 0,00000017 / 0,00044663 a = 9,80 / 9,10 / 9,80 / 10,80 / 10,90 / 9,90 / 60,30 / x = 48,0001 / y = 32,0003 / diff = 0,00000009 / 0,00037339 A couple of angles that work, choose the ones that you like :) The angles are from 7 to 1. Format of a single line is: a7 / a6 / a5 / a4 / a3 / a2 / a1 / x size of the construction / y size of the construction / eps^2 / eps where x is the length of your red line from corner to hinge 7, y is the length of the yellow line from corner to hinge 1 (minus one), eps^2 is the sum of squares of differences (calculated x - target x)^2 + (calculated y - target y)^2, eps is the sum of absolute values of differences... I'd recommend taking a line with minimal eps (in the attached file, i used the numbers from the 3rd line from bottom). The difference between max an min angle is about 1 degree (hope that's not too much). The resolution in searching the numbers is 1/10 of degree. I can increase that, but then i'd need to optimize the program as it's already slow. edit: attachment didn't work, i'm including a link: http://www.pavsic.com/ldd/wall_seg.lxf I tried with same angles a2-a7, but couldn't get even close to this results.. Simply brilliant Bojan. I'm no math genius so you just saved my day. I just imported the model you attached and it fits perfectly. THANKS ...and everyone else, thank you very much for your replay...I appreciate your help. Have a good one. - Paul. Share this post Link to post Share on other sites
Nachapon Lego Posted March 21, 2012 (edited) Maybe there is only one angles set that the arch most tan to the bottom line. (This one just close to that, for the ideal one: angle# 2,3,4,5,6 should be all the same and close to #7.) angle by Nachapon S., on Flickr Edited March 21, 2012 by bbqqq Share this post Link to post Share on other sites
Superkalle Posted March 21, 2012 This is intriguing Paul. You have to let us know what it became in the end Share this post Link to post Share on other sites
Bojan Pavsic Posted March 22, 2012 @bbqqq Yea, i thought so at first too. I even wanted to solve it analiticaly. Well, couldn't get an exact result, so i tried numericaly. Still couldn't get an "exact" (exact in quotes as it's still an aproximation because of the trigonometrical functions) result. Then i changed from a2 = a3 =... = a7 to all different, but close enough which yielded nice angles (1 decimal only as i used 0.1 degree resolution) with a mismatch at the 4th/5th decimal (which in lego AND LDD is basicly exact). Share this post Link to post Share on other sites
DLuders Posted March 22, 2012 (edited) @ Bovan Pavsic and bbqqq: I think I'll stick with solving easier Lego math problems, like these: Edited March 22, 2012 by DLuders Share this post Link to post Share on other sites
Nachapon Lego Posted March 23, 2012 (edited) This is intriguing Paul. You have to let us know what it became in the end This topic become a mathematic class. We know that trial and error method is quick and good enough way to solve this problem. We try to find ideal angle just for fun. I agree with Rook that if all hinges are at the same side then it will be easier to solve. It will become as sketch below. Use red and blue triangle can find the ideal angles set. 5 / sin A = R = 28.42973795 / sin 6A , then find angle A angle2 by Nachapon S., on Flickr Excel: 5/(SIN(B4*PI()/180)) - 28.4297379516589/(SIN((B4*PI()/180)*6)) Then trail and error cell B4 to make the result closer and closer to zero.(R-R=0, then same R) A = 5.469182598479° R = 52.4601998774508 Angle #2-6 = 169.061634803042° I test this result by draw a sketch with above data and it seems correct. @bbqqq Yea, i thought so at first too. I even wanted to solve it analiticaly. Well, couldn't get an exact result, so i tried numericaly. Still couldn't get an "exact" (exact in quotes as it's still an aproximation because of the trigonometrical functions) result. Then i changed from a2 = a3 =... = a7 to all different, but close enough which yielded nice angles (1 decimal only as i used 0.1 degree resolution) with a mismatch at the 4th/5th decimal (which in lego AND LDD is basicly exact). It is difficult to keep angle #2-6 equal and keep all six segment (10x5 + 10.04987562112089027021926491276x1 (paste from calculator):Because the first hinge is different) keep connect at the same. Your calculation is great. I will try to study them. @ Bovan Pavsic and bbqqq: I think I'll stick with solving easier Lego math problems, like these: That is a good idea, DLuders. Just build it with real brick then measure the angles in real world. Edited March 23, 2012 by bbqqq Share this post Link to post Share on other sites
Bojan Pavsic Posted March 23, 2012 (edited) I agree with simplifying the problem (changing the pivot point), but it's no good as it'll yield results, that you can't really use in LDD, because they'll be too much off. let's say L is the segment length. X = 48, Y = 32, L = 10, that's established from the first picture of the problem. We need to calculate Ld (which is the diagonal of the 1 x L plate) = sqrt(L * L + 1 * 1) = sqrt (101). a = angle between the segment (plate) and a virtual horizontal line ad = angle of the diagonal = arctan(1 / L) = arctan (0.1) so the rightmost segment is: x6 = L * cos (a7) y6 = L * sin (a7) then following to the left 1 by 1: x5 = L * cos (a6 + a7) y5 = L * sin (a6 + a7) x4 = L * cos (a5 + a6 + a7) y4 = L * sin (a5 + a6 + a7) x3 = L * cos (a4 + a5 + a6 + a7) y3 = L * sin (a4 + a5 + a6 + a7) x2 = L * cos (a3 + a4 + a5 + a6 + a7) y2 = L * sin (a3 + a4 + a5 + a6 + a7) x1 = Ld * cos (a2 + a3 + a4 + a5 + a6 + a7) y1 = Ld * sin (a2 + a3 + a4 + a5 + a6 + a7) The first angle a1 = 90 - a2 - a3 - a4 - a5 - a6 - a7, but it doesn't really matter for the calculations, just as the final hinge angle value. if we say that the angles are the same, then we get: X = L * cos (a) + L * cos (2a) + L * cos (3a) + L * cos (4a) + L * cos (5a) + Ld * cos (6a - ad) Y = L * sin (a) + L * sin (2a) + L * sin (3a) + L * sin (4a) + L * sin (5a) + Ld * sin (6a - ad) while L = 10, Ld = sqrt (L*L + 1) = sqrt(101), X = 48, Y = 32 If you want to solve this analiticaly, then you need to use the formulas for sin (a + b) = sin(a) cos (b) + sin (b) cos (a) sin (a - b) = sin(a) cos (b) - sin (b) cos (a) cos (a + b) = cos(a) cos (b) - sin (a) sin (b) cos (a - b) = cos(a) cos (b) + sin (a) sin (b) sin^2 (a) + cos^2 (a) = 1 http://mathworld.wol...onFormulas.html and get all the sin / cos (n * a) into sin (a) and cos (a). This is the exact solution for the problem, no hinge side changings etc... Maybe if matlab or mathematica or any other sw would be used, but i'm definitely not going to do that by hand :) (And it's easy expandable to different segment count. Btw, i didn't "trial and error" it :) I did all the formulas and then just used a program to calculate the values (i didn't use any real numerical methods for solving thou, but just brute force, would take way more time and wouldn't get much better results). Edited March 23, 2012 by Bojan Pavsic Share this post Link to post Share on other sites
Nachapon Lego Posted March 23, 2012 (edited) I found that Excel can solve the fomular very quick. My link Edited March 23, 2012 by bbqqq Share this post Link to post Share on other sites
pauldk Posted March 28, 2012 (edited) So fellas. Once again thanks for your kind help, I really appreciate that. Some of you is probably wondering what I'm building. I'm building a church in Denmark, but I'm on a small break from the project because there's a bit to do. I will continue the project in a couple of days. Until then, here's an image of what I have made so far. http://dl.dropbox.com/u/15855227/Lego/lddc.jpg Again, thanks. Edited March 28, 2012 by Calabar Oversized image converted in text link (maximum size allowed is 800x600). Share this post Link to post Share on other sites