Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I seem to have forgotten my basic geometry

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
Gary_J_Orr
982 Views, 16 Replies

I seem to have forgotten my basic geometry

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):

 

Dist_Ang_Calc.JPG

 

 

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

 

 

 

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
16 REPLIES 16
Message 2 of 17
Kent1Cooper
in reply to: Gary_J_Orr

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

)

Kent Cooper, AIA
Message 3 of 17
Gary_J_Orr
in reply to: Kent1Cooper

Thanks Kent,
I had not thought about the inters function and Something along these lines may serve as a workaround, but my example is based upon an inside angle and the realities may be an outside angle and would require a few additional hoops creating additional "extension points" and working from them for the Inters function...
But I believe more reliability would be assured if someone can actually help me in remembering the formula for determining the distance and angle...

But I do thank you for the suggestion, and will work it into the solution if all else fails.

-G
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 4 of 17
Gary_J_Orr
in reply to: Gary_J_Orr

Kent,
I stand corrected on my concerns of the inside/outside concerns... missed the passing of the "nil" to create the "infinite length" segments for finding the intersection...

Thanks again
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 5 of 17
WolframKuss12
in reply to: Gary_J_Orr

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:ForAutoDeskForum.png

L = Dist / cos (0.5*(ANG2-ANG1))

Message 6 of 17
Gary_J_Orr
in reply to: WolframKuss12

Thank you WolframKuss12...
You reminded me of the basics... sin, cos, etc... now to try to see if such can be worked into my code, without getting me distracted by playing with the math again *ReallyBigGrin*...

I used to love math... solving problems has always been "my thing" and in school math gave you the best problems to solve... now my problems have gotten bigger and I have forgotten the math (who can blame me after all these years, right? 😉

otherwise I'll end up taking Kent's "easy way out" and let ACAD take care of it for me...
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 7 of 17
smaher12
in reply to: Kent1Cooper

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)
)

 

Message 8 of 17
Kent1Cooper
in reply to: smaher12


@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....

Kent Cooper, AIA
Message 9 of 17
Gary_J_Orr
in reply to: Kent1Cooper

Kent,
Given Smaher12's simplified example all one has to do is enter a negative value for the offset to indicate such a relationship 😉
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 10 of 17
Gary_J_Orr
in reply to: Gary_J_Orr

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

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 11 of 17
Kent1Cooper
in reply to: Gary_J_Orr


@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]: "))

Kent Cooper, AIA
Message 12 of 17
Gary_J_Orr
in reply to: Kent1Cooper

All kinds of ways to handle it Kent... adding the +/- still assumes that the user would inherently relate the pos/neg to the order of the pick points, etc... an additional prompt to ask for which side, etc...

all assuming that the poster actually intended to use that as a "fully formed function"...

But I think that the intent of the posted example was simply to say: "cool, I understand that and can use it, it might come in handy somewhere... thanks..."

-G
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 13 of 17
btlsp2014
in reply to: Gary_J_Orr

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

Message 14 of 17
btlsp2014
in reply to: btlsp2014

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

Message 15 of 17
btlsp2014
in reply to: btlsp2014

The sketch is inverted   🙂  due to the Kinkos clerk..........................

Message 16 of 17
Gary_J_Orr
in reply to: btlsp2014


@btlsp2014 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

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 17 of 17
btlsp2014
in reply to: Gary_J_Orr

Thanks for writing Gary. I love doing this stuff since my high school
Algebra
teacher turned me on to Algebra. In 12 days I will be 63. I'm glad the
intersection
method works for you, I haven't really been doing Autolisp or Autocad in a
long
time. When I was working in the Civil Engineering office in Mammoth CA I
was
able to see all my Cad and programming learning at work real-to-life.
Unfortunately the job only lasted 6 months, but later employment in steel
detailing
and drawing 3d exhibit stages in aluminum lighted everything up anew. Just
before
converting to Cad I drew assessor maps in ink, then just after I left San
Diego
they sent the office staff to computer school, ****.

One steel detailing gig, I was there 2 years and became the top detailler,
Supervisor

and the Boss wanted to know how I was able to efficiently do a
project in record time. I told them to stop dragging their feet using my
lisp.
They were just too stuck with the same old methods which worked but didn't
save time.

Here are 4 vector functions to handle the lisp for the solution I came up
with.
Also I did something better actually. Today I rewrote the something so I
could follow it
through better and proof it thoroughly. There are several sketches I could
pdf but I'm going to draw them in html canvas which I am just learning.
The method is
the best way to get at v10, it uses only the cos and sin functions of half
the
included angle of the angle formed by points 1, 2 and 3 and vectors. The
solution uses
the dot-product(see below). It would pay you to become familiar with
vectors and vector functions I think, to give you a better handle on
Geometry.
Not that you don't already. Mr Johnson to go back to high school, my 2
brothers
and I all had his Geometry class, taught us well and developing proofs was
most satisfying.


Bill



------------------------------------------------------------------------------------------------------------------
//Vector Functions in Lisp

//by Bill Tonnesen

//01.july.2014

//btlsp2013@gmail.com

//////////////////////////////////////////////////////////////////

//vector addition

(defun vadd

(setq

vx (getreal “v x component”)

vy (getreal “v y component”)

ux (getreal “u x component”)

uy (getreal “u y component”)

v (list

( + vx ux )

( + vy uy ) )

)





//vector multiplication

(defun vmultiply

(setq

vx (getreal “v x component”)

vy (getreal “v y component”)

m (getreal coefficient)

v (list

( * m vx ) ( * m vy ) )

)





//dot product

(defun dpt

(setq

vx (getreal “v x component”)

vy (getreal “v y component”)

ux (getreal “u x component”)

uy (getreal “u y component”)

dpt (list

( + ( * vx ux ) ( * vy uy ) )

)





//cross product

(defun cpt

(setq

vx (getreal “v x component”)

vy (getreal “v y component”)

ux (getreal “v z component”)

uy (getreal “u x component”)

ux (getreal “u y component”)

uy (getreal “u z component”)



cpt (list

( + ( * vy uz ) ( * uy vx ) )

( - ( * ux vz ) ( * vx uz ) )

( + ( * vx uy ) ( * uy vx ) )

)


------------------------------------------------------------------------------------------------------------------








________________________
Click to read the Lonely Road
updated on Sundays
*LONELY ROAD *



Bill Tonnesen


*503-935-2391*

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost