how do I work out the intersection point of two converging edges


#1

Hi guys,

I have a problem whereby I need to know the intersection point of two converging edges, so I can weld the verticies to that point.

Ideally, I’d like to be able to select the two edges and have a point helper (or something) placed where these two edges would eventually converge.

Basically, I’m cleaning up some verticies after a chamfer, and I want to accurately maintain some of the square corners.

Does anyone know a way of doing this?

Cheers

Alex

PS Let me know if this is not clear and I’ll expand further.


#2

Check this it might help you http://forums.cgsociety.org/showpost.php?p=3398267&postcount=3


#3

Ah thanks for that, that may do the job.

I’ll have a go and get back to you.

So I assume fom this then, that there is no ‘proper’ way to do this, it would have to involve Maxscript?


#4

I’m really having trouble with this, as I have no experiance of Maxscript. I have read up on scriptspot but i’m still none the wiser.

The script seems to be:

fn lineLineIntersect pA pB pC pD = (
local a=pB-pA
local b=pD-pC
local c=pC-pA
local cross1 = cross a b
local cross2 = cross c b
pA + ( a*( (dot cross2 cross1)/((length cross1)^2) ) )
)
But how do I make that into Maxscript?

I’ve added it to a text file and saved as MCR, and dragged it into Max, but can’t see any sign of it in the custom UI.

Is this right or am I missing something?

Do I need to add some extra script in at the begining?

Any help is much apppreciated,

Alex


#5

Hi Alex,

How about converting the edges to splines and then trimming / extending to get the intersection?

Josh.


#6

I wrote something like this based on Seneca’s modo script called “unbevel”

[img]http://bryancavett.com/maxscripts/unbevel_01.gif[/img]

Just select all the edges plus the two outer edges and run the script. It must be an open edge selection though and can not be a loop.

Get it here:
http://bryancavett.com/maxscripts/unbevel.ms

It should show up under the “BCTools” category


#7

--@categorie:Akira Scripts;name:edgeIntersect;description Get Intersection point of two edges
--*** ************************************************************************************************* ***--
-- Created: 		13.04.2010
-- Last Updated:	13.04.2010
-- Version:			0.04
--
-- Author :  Akram Parvez /akram2601@gmail.com / http://akira-techart.blogspot.com
-- Version:  3ds max 2009 (10) (should work in older versions too!)
--
-- Description:  Get Intersection point of two edges
-- Usage: RUN IT
--
-- Wishlist:
--
--*** ************************************************************************************************* ***--
-- MODIFY THIS AT YOUR OWN RISK
macroScript edgeIntersect category:"Akira Scripts"
(
	on isEnabled return ((classof selection[1] == Editable_Poly) and ((getSelectionLevel selection[1])==#edge))
	on execute do
	(
		fn lineLineIntersect pA pB pC pD = (
		local a=pB-pA
		local b=pD-pC
		local c=pC-pA
		local cross1 = cross a b
		local cross2 = cross c b
		pA + ( a*( (dot cross2 cross1)/((length cross1)^2) ) )
		)
		
		_obj = selection[1]
		_edges = polyop.getEdgeSelection _obj
		_verts = for i in _edges collect (polyop.getEdgeVerts _obj i)
		
		try(select $point01) catch(select (point()))

		$.pos = lineLineIntersect (polyop.getVert _obj _verts[1][1]) (polyop.getVert _obj _verts[1][2]) (polyop.getVert _obj _verts[2][1]) (polyop.getVert _obj _verts[2][2])
	)
)

– copy the code, save as edgeIntersect.ms and run it once inside 3ds max.
– Then you can find it under Customize->Customize User Interface->ToolsBar->Catogery->Akira’s Scripts. Drag and drop in to your 3ds max tools bar.
– Select any two edges and press egdeIntersect button just created.
– You get a point placed where the edges could meet.

Akram


#8

Akram,

Thank you so much for taking the time to do that for me, it is very much appreciated.

I thought something was missing with the script but I didn’t have the experience with it to know what it was or how to fix it.

That works a treat now.

Thanks to everyone else for their help too.


#9

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.