Jump to content

find intersection of 3D lines


giskumar

Recommended Posts

Hi all,

 

I would like to find the intersection point between below 3D Lines

Line1: (5.0,5.0,8.0) (10.0,10.0,5.0)

Line2: (5.0,5.0,4.0) (10.0,10.0,6.0)

 

Please any one let me know how can i find the intersection point(3D) between these Lines.

 

Regards,

Kumar.

Link to comment
Share on other sites

(setq l1 (entmakex '((0 . "LINE") (10 5.0 5.0 8.0) (11 10.0 10.0 5.0)))
     l2 (entmakex '((0 . "LINE") (10 5.0 5.0 4.0) (11 10.0 10.0 6.0)))
     )

(vlax-invoke
 (vlax-ename->vla-object l1)
 'IntersectWith
 (vlax-ename->vla-object l2)
 acExtendBoth ;or acExtendNone
 )

Link to comment
Share on other sites

another way:

 

(setq p1 '(5.0 5.0 8.0)
     p2 '(10.0 10.0 5.0)
     p3 '(5.0 5.0 4.0)
     p4 '(10.0 10.0 6.0)
)
(setq intpoint (inters p1 p2 p3 p4 nil))

 

Henrique

Link to comment
Share on other sites

A bit more Inters is the original or plain jane lisp intersection command and intesectwith is the newer Vl version I would go down the VL version, intersectwith has 4 options that can be included as part of the test for an intersection, inters has 1 true or false. Intesectwith can calculate an intersection even if the lines do not cross calculating the new pt.

Link to comment
Share on other sites

This may be a little undocumented but a time saver when typing you can replace intersect mode with 0 1 2 3

 

All enumerations will evaluate to either an integer or some other constant data type - hence the name; the protected symbol is merely used to give some meaning to an otherwise 'magic number' e.g. (eval acbylayer) = 256.

 

I strongly disagree with your suggested 'timesaver' as it will render code unreadable and completely defeats the self-documenting purpose of the enumeration symbol.

  • Dislike 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...