Can anyone help me hot to get this given point. Thanks
What are the known start values/points?
What "point" do you want returned?
Dave Elder, Tait Communications
In reply to eDave:
The points with arrows of two segments is the one that I would like to know. The segments where to points are close together... Please see the line and the pointing arrow for the segment length i want to know. Thanks
In reply to eDaJun:
OK, that's not too difficult.
You need to calculate perpendicular lines from the two vertices then calculate the distance between the points where these lines intersect one of the segments. The following code should help you.
defun( DE_linePerpendicular (m1, x, y)
(!m1, list(0, y))
(axlGeoEqual(m1, 0), list(nil, x))
(t, m2 = -1.0 / float(m1), b2 = y - m2 * x, list(m2, b2))
defun( DE_LineLineIntersect (m1, b1, m2, b2)
; Returns x,y intersection of line
; y = m1 x + b1
; with line
; y = m2 x + b2
; Returns nil if no or infinite no of points (i.e. m1 = m2)
; m1x + b1 = m2x + b2
; x = (b2 - b1)/(m1 - m2)
; y = m1 x + b1
(!m1 && !m2, nil)
(!m1, list(b1, m2 * b1 + b2)) ; ie. x = b1 for first line (not both nil!)
(!m2, list(b2, m1 * b2 + b1)) ; ie. x = b2 for 2nd line (not both nil!)
(m1 == m2, nil)
(t, x = (b2 - b1) / (m1 - m2), list(x, m1 * x + b1))
defun( DE_LineEquation (pt1, pt2)
; Returns (m, b) s.t. y = mx + b is the equation for the line joining points (x1,y1) and (x2,y2)
; Returns (nil, x) if vertical
m = axlLineSlope(list(pt1, pt2))
b = if(m then cadr(pt1) - m * car(pt1) else float(car(pt1)))
m1 is the slope of the line (given by the DE_LineEquation function).
x:y is a point on the line segment
See attached. The logic might not be correct but it gives you some pointers.