TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: LSElite on November 20, 2015, 07:29:02 PM
-
Hey All
I am trying to find the intersection point between to lines.
The lines are represented by 2 points
line1 = (x1, y1, z1) (x2, y2, z2)
line2 = (x3, y3, z3) (x4, y4, z4)
I am aware I can achieve the desired outcome through the Intersect method.
However I wanted to avoid the unnecessary adding and removing from the database.
I have tried hashing this out through raw math but I keep running into the problem.
Vertical lines do not work for the intersection equation due to the lack of Y intercept.
http://www.mathopenref.com/coordequation.html
Is it possible to inverse the intersection equation to work with x intercepts instead of y?
then I could set up 3 intercept types: x, y and vertical perpendicular.
Any math guru's out there able to shed some light?
To recap, what I am looking for is a function using 2 lines, (p1 p2) (p3 p4), that returns the coordinates of the intersection.
-
The pure Math solutions I've seen are very complicated.
Did you know that the lisp function inters<> does not require objects ?
(inters pt1 pt2 pt3 pt4
[onseg
])
added:
http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-A181D474-F817-4550-86E9-87649262FA8A
-
Kerry, you sir are a life saver.
That is heaps easier.
I think I figured out the math solution anyway.
Instead of making the Ys equal to find X, you can use the X value of the vertical line since X doesn't change.
It actually makes it significantly easier, haha. :lol:
Felt like a clown when I realized.
-
Felt like a clown when I realized.
You'll fit in really well here then ;-D
but seriously,
Sometimes the process of fully writing out the problem ( tell it to the duck ) makes a resolution visible.
... verbalising puts the issues in focus.