I don't ask for help often but...
I guess I've gotten a bit too dependent on programs performing calculations for me and seem to have forgotten my basic geometry (it's been 32 years since high school and over 15 since I had to calculate points in the field without my trusty computer and/or high powered calculator) and I'm wondering if some of you Civil/Survey/Mechanical types can refresh my memory on the formula that I need to find a distance and angle to develop a point.
Given this scenario (as an example):
I have three points (1, 2, and 3)
I have the angle from point 1 to point 2 (ang1)
I have the angle from point 2 to point 3 (ang2)
I have a defined constant distance (DIST)
Developing point 4 from point 1 is easy: ANG1 + 90 degrees at DIST
Developing point 6 from point 3 is easy: ANG2 + 90 degrees at DIST
What is the formula for developing Point 5 from point 2?
Distance will need to be calculated due to the diaganal involved and the angle will need to be something along the lines of an average of ANG1 and ANG2 + 90 degrees (I think)...
And yes, I need the formula, not "tricks" such as creating a pline and offsetting it and then aquiring the point from the resulting entity... this is part of a looping function and needs to be calculated, not to mention that there may be considerably more than a single point that I need to find.
There was a day, back when I was laying out for construction with manual instruments (yes, there was a day before the "Total Station"), that I had to do all this stuff on my little "surveyor's log book", but that was a looooong time ago...
Any help is greatly appreciated.
-Gary
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
You don't really need to have a formula for that, if you don't need the formula itself for other purposes. You can do it using the (inters) and (polar) functions:
(inters
pt4
(polar pt4 ang1 1)
pt6
(polar pt6 ang2 1)
nil
)
Sorry for the bad drawing (placement), but I hope you understand me anyway:
Lets call the angles of the x-axis to line 1-4 "Beta1" and to line 3-6 "Beta2" then as you have correctly said,
Beta1 = ANG1 + 90 degrees
Beta2 = ANG2 + 90 degrees
Now draw perpendiculars from point 5 to lines 1-2 (See picture) and to 2-3 (not pictured)
These two new lines will be parallel to lines 1-4 and 3-6 respectively and therefore their angles to the x-axis is again Beta1 and Beta2.
So the angle between them is (the absolute value of) beta2-beta1. The angle between one of them and the line 2-5 is 0.5 * (beta2-beta1) as line 2-5 for symmetry reasons divides the angle beta2-beta1 into two equal parts. This is the angle betwen the two yellow lines. Note that you now have a triangle with the length "L" you are searching being the hypotenuse. The other yellow line has length Dist. So the formual for cosine is:
cos (0.5*(beta2-beta1)) = Dist / L.
Noting that beta2-Beta1 = ANG2-ANG1 and solving for L yields:
L = Dist / cos (0.5*(ANG2-ANG1))
Thanks Kent I learned something new today (inters). I had no idea...
(defun C:test (/ p1 p2 p3 od a1 a2 p4 p6 p5) (setq p1 (getpoint "\nSpecify point one: ")) (setq p2 (getpoint p1 "\nSpecify point two: ")) (setq p3 (getpoint p2 "\nSpecify point three: ")) (setq od (getdist "\nSpecify offset distance: ")) (setq a1 (angle p1 p2) a2 (angle p2 p3) p4 (polar p1 (+ a1 (/ pi 2)) od) p6 (polar p3 (+ a2 (/ pi 2)) od) p5 (inters p4 (polar p4 a1 1) p6 (polar p6 a2 1) nil) ) (command "_.pline" "_none" p1 "_none" p2 "_none" p3 "" "_.pline" "_none" p4 "_none" p5 "_none" p6 "" ) (princ) )
@smaher12 wrote:
Thanks Kent I learned something new today (inters). I had no idea...
....
You're welcome -- it's a very useful function. The next step is to account for the possibility that the User might not always want p4-p5-p6 to be to the left in relation to the p1-p2-p3 direction....
well, I've had a lot of fun playing with the math...
Thanks again to WolframKuss12 for the distance formula.
Unfortunately, I ended up half way through the process of trying to define a transformation matrix to overcome ACAD's coordinate system when applying the derived angle to use the distance with (much fun and merriment ensued by trying the simple method of averaging/bisecting the angles to derive the desired angle then watching what happened as I sent the info to acad, should have been simple enough but, in the end it has to pass through ACAD's coordinate system and their methods of determining points and angles when being passed through the "polar" and other available functions to actually derive/create the point in Acad's terms)...
So, in the end, I've abandonded the math and will use the functions provided in lisp that already does all of that for me (thanks Kent Cooper for reminding me that "inters" existed and getting me to look into it)...
I could eventually have worked the transformations out but there is really no need to do so other than for the pure mental exercise.
Thanks for the help,
-Gary
@Anonymous wrote:
Kent,
Given Smaher12's simplified example all one has to do is enter a negative value for the offset to indicate such a relationship 😉
True, but it means that either the User needs to know which sign puts them on which side, or they need to do it and see whether they got what they wanted [assuming the result is actually used to draw something so they can see], and possibly undo and redo with the opposite sign. It would be simple enough to indicate in the prompt, something like:
(setq od (getdist "\nSpecify offset distance [+ left / - right]: "))
Hello my name is Bill
I learned from calculus classes a great way to deal with
points and more is to use vectors, so many of my routines
are vector based.
To the problem:
Solution:
v10 = v8 + v2 + (|v1| / sin B)
v2...the first vector
v8...the position vector for v10 which is point 1
v1...the perpendicular vector from point 1 to the strart point
on the parrallel vector to vector 2, the first vector
B...half of the included angle between the distance lines between points 1, 2 and 3
I will provide a sketch Monday.
Bill
Hello again here is the sketch. Since, I have come up with something better, solving for the
point with the vector dot product. 2 methods, one using the magnitude of the subject vector
and it's normal. Subject vector being the bisector of the lines formed by points 1, 2 and 3,
the included angle. Sketch, proof, mathematical solutions and examples to follow.
Bill
@Anonymous wrote:Hello again here is the sketch. Since, I have come up with something better, solving for the
point with the vector dot product. 2 methods, one using the magnitude of the subject vector
and it's normal. Subject vector being the bisector of the lines formed by points 1, 2 and 3,
the included angle. Sketch, proof, mathematical solutions and examples to follow.
Bill
Thanks for the "study" on developing the point using vectors... It's something to look at and play with but, unfortunately, I will not be able to apply the results using lisp...
If I were producing a C++ app and working with the native ARX I would possibly be able to apply it, but, again, my current project is in VLisp and that limits my ability somewhat... fortunately, they have provided methods of finding what I need with the Inters function and I have long since moved on to other issues.
But, again, I thank you for the work and the "study".
-Gary
Can't find what you're looking for? Ask the community or share your knowledge.