- UID
- 105412
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-12-25
- 最后登录
- 1970-1-1
|
发表于 2007-5-25 08:51:31
|
显示全部楼层
Up a level to AcDbEntity
AcDbEntity::intersectWith Function virtual Acad::ErrorStatus
intersectWith(
const AcDbEntity* pEnt,
AcDb::Intersect intType,
AcGePoint3dArray& points,
int thisGsMarker = 0,
int otherGsMarker = 0) const;
pEnt Input entity with which "this" entity is to intersect
intType Input type of intersection requested
points Output with the points of intersection appended
thisGsMarker Input GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable.
otherGsMarker Input GS marker of subentity of the entity pointed to by pEnt that's involved in the intersection operation. Use the 0 default if not applicable.
Function usage
It finds the intersections of the entity pointed to by pEnt and all the edges of the bounding box of this entity.
The intType is used to determine how to deal with extending the two entities in order to calculate intersections. The possible AcDb::Intersect values are:
Value Meaning
AcDb::kOnBothOperands Do not extend either entity. This results in only calculating intersections where the two entitys' geometry actually intersect
AcDb::kExtendThis Extend this entity (if necessary) when calculating intersections, but do not extend the pEnt entity.
AcDb::kExtendArg Extend the pEnt entity (if necessary) when calculating intersections, but do not extend this entity.
AcDb::kExtendBoth Extend both the pEnt entity and this entity (if necessary) when calculating intersections
Any intersection points found are appended to the points array. All points are in WCS coordinates.
The thisGsMarker and otherGsMarker arguments are intended to provide this function with information to allow it to localize the search for intersections to be between specific subentities. However, this function is not required to make use of either of these arguments (most, if not all, of the AutoCAD built-in entity classes do not). When calling this function, either or both of these arguments may be 0 in order to indicate that they should be ignored.
If this function is successful it returns Acad::eOk. Return values for error conditions are dependent on the implementation of this function in the classes involved.
Function implementation in derived classes
This function should do all it can to find all intersection points between the entity it's being called on and the entity pointed to by pEnt. All intersection points found should be appended to the points array. All such points must be in WCS coordinates.
When implementing the intersection calculation portion of this function you should take a good look at the AcGe classes to see if they can provide any useful functionality to help in finding intersections with the geometric primitives that make up the entity this function is being called on and the pEnt entity. For example, the AcGeCurve3d class has an isOn() method that will indicate if a supplied point is on the curve and the AcGeArc3d class has several intersectWith() methods to find intersections with other AcGe types.
If the pEnt entity is a type not recognized by this function, it is quite reasonable to call the pEnt entity's intersectWith() method passing in a pointer to this entity as the "pEnt", and all the other arguments passed into this function (remembering to convert the intType argument If necessary) to see if that entity can determine any intersection points. This is what the AutoCAD built-in classes do.
Also, don't forget to take into account the intType value. The intType tells you which, if any, of the two entities should be extended to find "apparent" intersections. It is not required that apparent intersection be supported, but if it is not, then an appropriate ErrorStatus value should be returned to indicate that the call failed.
The thisGsMarker and otherGsMarker arguments are provided to allow this function to determine exactly which subentities are involved in the intersection operation (for example, if this function is being called by AutoCAD as part of an intersection Osnap operation these arguments would indicate which subentities are within the osnap pickbox). For these arguments, a value less than or equal to zero indicates that that argument should not be used.
If this function completes successfully (even if no intersection points are found), it should return Acad::eOk. Determining what is considered an error and what ErrorStatus return code to use for any such errors are up to the implementor -- there are no conventions in this regard.
Default implementation: Immediately returns Acad::eNotImplemented.
--------------------------------------------------------------------------------
virtual Acad::ErrorStatus
intersectWith(
const AcDbEntity* pEnt,
AcDb::Intersect intType,
const AcGePlane& projPlane,
AcGePoint3dArray& points,
int thisGsMarker = 0,
int otherGsMarker = 0) const;
pEnt Input entity with which "this" entity is to intersect
intType Input type of intersection requested. The possible AcDb::Intersect values are:
Value Meaning
AcDb::kOnBothOperands Do not extend either entity. This results in only calculating intersections where the two entitys' geometry actually intersect
AcDb::kExtendThis Extend this entity (if necessary) when calculating intersections, but do not extend the pEnt entity.
AcDb::kExtendArg Extend the pEnt entity (if necessary) when calculating intersections, but do not extend this entity.
AcDb::kExtendBoth Extend both the pEnt entity and this entity (if necessary) when calculating intersections
projPlane Input a projection plane for the apparent intersection of the two entities
points Output with the points of intersection appended
thisGsMarker Input GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable.
otherGsMarker Input GS marker of subentity of the entity pointed to by pEnt that's involved in the intersection operation. Use the 0 default if not applicable.
Same as the other version of this function except that it projects this entity and the pEnt entity onto the projPlane, finds the intersection points, and then projects the intersection points back onto this entity. So, all points appended to the points array will be on this entity. The projections are done parallel to the projPlane's normal vector.
When implementing the intersection calculation portion of this function, in addition to the intersection functionality mentioned in the documentation on the other version of this function, the AcGe classes have functionality available to aid in the projection onto a plane and the projection of points onto AcGe objects. |
|