Calculate Angles (in LDCad)  Printable Version + LDraw.org Discussion Forums (https://forums.ldraw.org) + Forum: LDraw Programs (https://forums.ldraw.org/forum7.html) + Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum11.html) + Thread: Calculate Angles (in LDCad) (/thread22169.html) Pages:
1
2

Calculate Angles (in LDCad)  Jaco van der Molen  20170512 Hi all, Is there a way to exactly calculate the angles the 1x5 beam and 1x10 brick make? I kind of know how to do this in LDCad, but with these I don't know how. I have done this by hand and eye, but I'd like it to be exact. [attachment=2771] Thanks! RE: Calculate Angles (in LDCad)  Jaco van der Molen  20170512 Never mind, I got it. Suddenly remembered how to show info and work from 90 degree angles with a "helper" pin. [attachment=2772] The only thing that I do not fully understand is the sequence to select the pins. Selecting like I did I found the angles of the red triangle to be the ones I needed :) RE: Calculate Angles (in LDCad)  Philippe Hurbain  20170512 Method to close a triangle in LDCad:
RE: Calculate Angles (in LDCad)  Jaco van der Molen  20170512 (20170512, 15:17)Philippe Hurbain Wrote: Method to close a triangle in LDCad: Thanks Philo for those steps. My problem was only step one. I just go by much trial and error to find the right pins and select sequence. The way you put it I understand! Thanks. The rest I knew, but just forgot. RE: Calculate Angles (in LDCad)  N. W. Perry  20191030 There's another way to do this, by finding the intersection of two circles. This might be handy if you need to do it in a program that doesn't have LDCad's triangle calculation feature (or if, as I did, you forgot that feature exists and spent an hour figuring it out for yourself and are feeling all clever about it). To illustrate this, I whipped up the same model in LDCad. I've added some circular paths to show the circles, but you actually don't need them. All you have to do now is calculate the intersection of the two circles (highlighted in yellow). [attachment=4144] It turns out that's pretty simple math (for a computer) if you know the X,Y position of the center of each circle (we do: the selected pins) and its radius (we can find out: by using LDCad's selection info, or in this case just counting studs). You can look up the mathematical formula if you want, but it's much quicker to use an online calculator—I found this one, which works perfectly. So let's enter the values we know: we need the X and Y coordinates of the selected pins (we can ignore the Z), and the radii (distance to the end pins: 140 and 80) [attachment=4145] And the result, complete with a little graph of the two circles: [attachment=4146] (Note that the graph is a mirror image of the circles in our project, because of the opposite orientation of LDraw's Y axis. But the numbers themselves are correct.) Of the two intersections found, choose the one that you want to use—in this case it's the second one. Create a new helper part and place it at those X,Y coordinates, then use Selection Info (okay, I guess you still need LDCad for this…) to find the rotation angle you need: [attachment=4148] Repeat for the other beam, apply the rotations to both parts, and you're done! [attachment=4149] RE: Calculate Angles (in LDCad)  Jaco van der Molen  20191030 (20191030, 2:48)N. W. Perry Wrote: There's another way to do this, by finding the intersection of two circles. This might be handy if you need to do it in a program that doesn't have LDCad's triangle calculation feature (or if, as I did, you forgot that feature exists and spent an hour figuring it out for yourself and are feeling all clever about it). Nice! RE: Calculate Angles (in LDCad)  Orion Pobursky  20191030 I have a raft of helper spreadsheets for exactly this (circlecircle, circleline, etc...): https://docs.google.com/spreadsheets/d/1UKP13fEiShvChxOy1pCrlV4W_47rUEnwV7xOgUQWBc/edit?usp=sharing RE: Calculate Angles (in LDCad)  Roland Melkert  20191030 (20191030, 2:48)N. W. Perry Wrote: There's another way to do this, by finding the intersection of two circles. This might be handy if you need to do it in a program that doesn't have LDCad's triangle calculation feature (or if, as I did, you forgot that feature exists and spent an hour figuring it out for yourself and are feeling all clever about it). I setup the selection info stuff before the scripting existed and didn't want to force a certain way to apply the angles etc. But you could script your method, and apply the angles in one go if wanted. FYI: This is what the selection info does internally: Code: RE: Calculate Angles (in LDCad)  N. W. Perry  20191030 (20191030, 19:18)Roland Melkert Wrote: I setup the selection info stuff before the scripting existed and didn't want to force a certain way to apply the angles etc. Yes, it was pretty easy to find the formula for circle intersections as a code snippet, too. I bet it would be pretty easy to incorporate into an editor, for those with a little more experience in that than I have. :) This also makes me wonder, could the circles method be used for any situation that the triangle method can't? Or is it really just a different way of doing the same exact thing? RE: Calculate Angles (in LDCad)  Philippe Hurbain  20191031 (20191030, 2:48)N. W. Perry Wrote: There's another way to do this, by finding the intersection of two circles. This might be handy if you need to do it in a program that doesn't have LDCad's triangle calculation featureThough it also needs to have the possibility to set precise coordinates or turn by a precise angle, two possibilities that AFAIK are not available eg. in LDD or Studio... 