明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4938|回复: 15

[几何] 如何作直线的垂线、直线与圆的交点、圆的切线

  [复制链接]
发表于 2010-12-25 20:01 | 显示全部楼层 |阅读模式
本帖最后由 bobeeeeee 于 2010-12-25 20:11 编辑

目前正在做一个避雷针保护范围校验的小程序,遇到以下几个问题:
(1)如何过直线上给定点作该直线的垂线;
(2)如何求直线与圆的交点;
(3)如何作过给定点并与圆相切的直线。
请高手赐教,非常感谢。
发表于 2010-12-25 20:05 | 显示全部楼层
Curve.GetClosestPointTo Method (Point3d, [MarshalAs(UnmanagedType.U1)] bool)
This function projects the curve onto the plane defined by givenPoint. Returns the point (in WCS coordinates) on the curve that is nearest to givenPoint.

 楼主| 发表于 2010-12-25 20:12 | 显示全部楼层
谢谢lzh741206,能给出详细一点的示例代码吗?
发表于 2010-12-25 20:20 | 显示全部楼层
1、var pt2 = line.GetClosestPointTo(pt1, true);
pt2就是垂足了
2、求直线与圆的交点
Entity.IntersectWith Method (Entity, Autodesk.AutoCAD.DatabaseServices.Intersect, Point3dCollection, int, int)
Entity entityPointer  Input entity with which "this" entity is to intersect  
Autodesk.AutoCAD.DatabaseServices.Intersect intersectType  Input type of intersection requested  
Point3dCollection points  Output with the points of intersection appended  
int thisGraphicSystemMarker  Input GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable.  
int otherGraphicSystemMarker  Input GS marker of subentity of the entity pointed to by entityPointer that's involved in the intersection operation. Use the 0 default if not applicable.  
3、这个可能要自己计算了

评分

参与人数 1金钱 +20 收起 理由
bobeeeeee + 20

查看全部评分

 楼主| 发表于 2010-12-25 20:23 | 显示全部楼层
本帖最后由 bobeeeeee 于 2010-12-25 20:23 编辑

感谢lzh741206
“1、var pt2 = line.GetClosestPointTo(pt1, true);
pt2就是垂足了”
如果pt1在line上,可以这样求吗?
发表于 2010-12-25 20:25 | 显示全部楼层
如果pt1在line上,获取直线的向量,然后把这个向量旋转90度
 楼主| 发表于 2010-12-25 20:26 | 显示全部楼层
可以通过下面这个函数得到切点再画切线吗?
void GetObjectSnapPoints ( ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds )
发表于 2010-12-25 20:31 | 显示全部楼层
可以试下,不过这个函数有时会崩溃
 楼主| 发表于 2010-12-25 20:32 | 显示全部楼层
回复 lzh741206 的帖子

谢谢。我试试
发表于 2010-12-26 10:31 | 显示全部楼层
下面两个链接或许有用……
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-25 23:45 , Processed in 0.297565 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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