找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 576|回复: 5

[求助]:求2条线交点。。。。。。。

[复制链接]
发表于 2005-3-3 09:11:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
求助:
提供2条线,如何判断它们是否有交点,如果有如何求?
谢谢。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2005-3-3 09:29:54 | 显示全部楼层
p->intersectWith(AcDbEntity* pEnt,AcDb::Intersect intType,AcGePoint3dArray& points, 0, 0) ;
其中有个是否延伸的参数AcDb::Intersect intType 取值分别如下:
1、AcDb::kOnBothOperands
Do not extend either entity. This results in only calculating intersections where the two entitys' geometry actually intersect
2、AcDb::kExtendThis
Extend this entity (if necessary) when calculating intersections, but do not extend the pEnt entity.
3、AcDb::kExtendArg
Extend the pEnt entity (if necessary) when calculating intersections, but do not extend this entity.
4、AcDb::kExtendBoth
Extend both the pEnt entity and this entity (if necessary) when calculating intersections

如果取得交点,放入points数组中,points的长度即为交点个数,用points[0],points[1]……得到各交点
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-3 10:14:37 | 显示全部楼层
谢谢,有收获。
不过函数
virtual Acad::ErrorStatus  intersectWith(const AcDbEntity* pEnt, AcDb::Intersect intType, const AcGePlane& projPlane, AcGePoint3dArray& points, int thisGsMarker = 0,int otherGsMarker = 0) const
只是求pEnt与其他的实体的交点,我现在只是想求指定的2条线的焦点而已,不知道如何解决。。。

=====================================================
理解错误,刚才头脑发热,没看清楚。。。
现在理解了。。。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2005-3-3 11:54:31 | 显示全部楼层
线也是实体啊
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2005-3-3 22:03:41 | 显示全部楼层
int

acdbInters(

const ads_point from1,

const ads_point to1,

const ads_point from2,

const ads_point to2,

int teston,

ads_point result);

from1 The beginning point of the first line
to1 The end point of the first line
from2 The beginning point of the second line
to2 The end point of the second line
teston If nonzero, the intersection must lie on both of the specified segments; if zero, the intesection can be off one or both segments
result The point of intersection

Examines two lines and returns the point where they intersect.

All four point arguments are three-dimensional points; acdbInters() checks for intersection in 3D space. All points should be expressed in terms of the same coordinate system. Otherwise, acdbInters() will return garbage (it calculates a result but does not check the input values against the current drawing).

If acdbInters() finds an intersection point, it returns RTNORM; otherwise, it returns an error code.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2005-3-4 20:30:59 | 显示全部楼层
可以调用IntersectWith函数,函数带有一个对象为AcGe3dPointArray的参数,通过判断数组是否为空来判断两条线是否有交点
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-22 10:04 , Processed in 0.327510 second(s), 40 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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