明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: matichen

请问,如何求某一点到一pl线的距离

  [复制链接]
 楼主| 发表于 2002-10-30 18:19:00 | 显示全部楼层

不是这个意思,是点到直线(或直线的虚拟延长线)的垂线的距离。

发表于 2002-10-31 06:37:00 | 显示全部楼层

Trying to snap to a polyine at its bending point ...

Trying to snap to a polyine (or other curve) at its bending point to get the distance is not applicable in this question.

Your routine can surely get the closest point at the curve, no worry about the start point or the end point. Howerver, we have to make sure we are in a WCS, otherwise we will get it wrong. What do you reckon?
发表于 2002-10-31 11:58:00 | 显示全部楼层

here!!!

(defun pttoline_dist (/ WW QQ SS)
  (setq SS (car (entsel "\n选择线: ")))
  (setq WW (getpoint "\n选择点: "))
  (setq        QQ (vlax-curve-getclosestpointto
             (vlax-ename->vla-object SS)
             WW
             t
           )
  )
  (distance WW QQ)
)
发表于 2002-11-1 12:24:00 | 显示全部楼层

看不懂你要甚么?????传张图上来吧!!

发表于 2002-11-1 12:32:00 | 显示全部楼层

我想ALIN是不会中文输入法,他应该是香港人吧!我明天也要回香港老家!!!

发表于 2002-11-1 13:33:00 | 显示全部楼层

sorry

发表于 2002-11-1 13:36:00 | 显示全部楼层

I thought you were from Taiwan. How do you know simplified Chinese? hehe..

发表于 2002-11-1 16:07:00 | 显示全部楼层

简体看多了就会习惯,我那些香港同学E_MAIL都是用英文,他们就不会学学中文输入????

发表于 2004-4-14 09:48:00 | 显示全部楼层
点到直线(无限长)距离: 只用点间的距离,就成了平面问题,然后求夹角,用夹角求点、线距离。 (defun p-line-dis (p ;点
end1 ;线端点1
end2 ;线端点2
/
angcos ;线p end1 和线end2 end1的夹角的cos
disp-1 ;p 和 end1 间距离
disp-2 ;p 和 end2 间距离
dis1-2 ;end1 和 end2 间距离.
tem
)
(setq disp-1 (distance p end1)
disp-2 (distance p end2)
dis1-2 (distance end1 end2))
(setq angcos (/ (+ (expt disp-1 2.0) (expt dis1-2 2.0) (* -1.0 (expt disp-2 2.0))) 2.0 disp-1 dis1-2))
(setq tem (- 1.0 (expt angcos 2.0))
tem (sqrt tem)
tem (* disp-1 tem)
)
tem
)
(p-line-dis (getpoint) (getpoint) (getpoint)) 看到此贴临时写的,没有足够验证。如果求点到线段的距离可以根据angcos求垂直点。
发表于 2004-4-15 00:30:00 | 显示全部楼层
用龙龙仔的就很好了么
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 00:51 , Processed in 0.151884 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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