明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2470|回复: 2

求教:简单的求两直线交点的代码

[复制链接]
发表于 2004-10-15 10:07:00 | 显示全部楼层 |阅读模式
请大家指教,我想要两条直线的交点,请问有这样的命令吗?或者有简单些的代码吗?

发表于 2004-10-15 10:18:00 | 显示全部楼层

Finds the intersection of two lines

(inters pt1 pt2 pt3 pt4 [onseg])

All points are expressed in terms of the current UCS. If all four point arguments are 3D, inters checks for 3D intersection. If any of the points are 2D, inters projects the lines onto the current construction plane and checks only for 2D intersection.

Arguments

pt1

One endpoint of the first line.

pt2

The other endpoint of the first line.

pt3

One endpoint of the second line.

pt4

The other endpoint of the second line.

onseg

If specified as nil, the lines defined by the four pt arguments are considered infinite in length. If the onseg argument is omitted or is not nil, the intersection point must lie on both lines or inters returns nil.

Return Values

If the onseg argument is present and is nil, inters returns the point where the lines intersect, even if that point is off the end of one or both of the lines. If the onseg argument is omitted or is not nil, the intersection point must lie on both lines or inters returns nil. The inters function returns nil if the two lines do not intersect.

Examples

(setq a '(1.0 1.0) b '(9.0 9.0)) 
(setq c '(4.0 1.0) d '(4.0 2.0))

Command: (inters a b c d)

nil

Command: (inters a b c d T)

nil

Command: (inters a b c d nil)

(4.0 4.0)

 楼主| 发表于 2004-10-15 15:01:00 | 显示全部楼层
好长呀,嘿嘿,谢谢拉
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-18 11:29 , Processed in 0.165655 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表