如何作直线的垂线、直线与圆的交点、圆的切线
本帖最后由 bobeeeeee 于 2010-12-25 20:11 编辑目前正在做一个避雷针保护范围校验的小程序,遇到以下几个问题:
(1)如何过直线上给定点作该直线的垂线;
(2)如何求直线与圆的交点;
(3)如何作过给定点并与圆相切的直线。
请高手赐教,非常感谢。
Curve.GetClosestPointTo Method (Point3d, 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.
谢谢lzh741206,能给出详细一点的示例代码吗? 1、var pt2 = line.GetClosestPointTo(pt1, true);
pt2就是垂足了
2、求直线与圆的交点
Entity.IntersectWith Method (Entity, Autodesk.AutoCAD.DatabaseServices.Intersect, Point3dCollection, int, int)
Entity entityPointerInput entity with which "this" entity is to intersect
Autodesk.AutoCAD.DatabaseServices.Intersect intersectTypeInput type of intersection requested
Point3dCollection pointsOutput with the points of intersection appended
int thisGraphicSystemMarkerInput GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable.
int otherGraphicSystemMarkerInput 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、这个可能要自己计算了 本帖最后由 bobeeeeee 于 2010-12-25 20:23 编辑
感谢lzh741206
“1、var pt2 = line.GetClosestPointTo(pt1, true);
pt2就是垂足了”
如果pt1在line上,可以这样求吗? 如果pt1在line上,获取直线的向量,然后把这个向量旋转90度 可以通过下面这个函数得到切点再画切线吗?
void GetObjectSnapPoints ( ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds ) 可以试下,不过这个函数有时会崩溃 回复 lzh741206 的帖子
谢谢。我试试 下面两个链接或许有用……
页:
[1]
2