Notifications
Clear all
[Closed] Scripting/Modelling: Intersection of 2 edges
Jun 29, 2005 11:49 pm
Howdy
Im trying in Max6 to find the intersection point of two converging edges (on the same plane) , so i can then move the verts to this common point.
Anyone got any ideas???
A script that placed a helper point at the intersection would be just dandy. Me no script
cheers
2 Replies
Jun 29, 2005 11:49 pm
You could try using a formula from mathworld.wolfram.com (genius site btw)
use this link
http://mathworld.wolfram.com/Line-LineIntersection.html
since your lines are on the same surface you could do it in a local space (eg. the polygon’s surface)
it takes a little brain juice but makes you all the more satisfied when done.
Jun 29, 2005 11:49 pm
Maybe this is what you need maybe not…
-- E D G E I N T E R S E C T O R
-- Tim Waijers 2005
--
-- finds the intersection for two edges in an editable poly
-- and makes a point helper on the intersection
-- the intersection can lay outside of the edges
--
-- instruction:
-- select the two edges in the editable poly and run the script
--
Edges = $.getselection #edge as array
Master = $
if Edges.count != 2 then
(
format "you have to select two edges, no more no less"
) else (
p1Num = master.getEdgeVertex edges[1] 1
p2Num = master.getEdgeVertex edges[1] 2
p3Num = master.getEdgeVertex edges[2] 1
p4Num = master.getEdgeVertex edges[2] 2
p1 = master.getvertex p1Num
p2 = master.getvertex p2Num
p3 = master.getvertex p3Num
p4 = master.getvertex p4Num
x1 = p1[1]
y1 = p1[2]
x2 = p2[1]
y2 = p2[2]
x3 = p3[1]
y3 = p3[2]
x4 = p4[1]
y4 = p4[2]
ux = (y4-y3)*(x2-x1)-(x4-x3)*(y2-y1)
ua1 = (x4-x3)*(y1-y3)-(y4-y3)*(x1-x3)
ua = ua1/ux
x = (x1 + ua*(x2-x1))
y = (y1 + ua*(y2-y1))
point1 = point()
in coordsys master point1.pos = [x,y,0]
)
let me know if you think it's handy
i’m terribly new at this scripting thing so go easy on me