IObjectPosition_KC Interface
- FindStableTangentialPlane
The interface calculates position and orientation of a 3D plane which is
tangential to the surface of the obejct at least at three isolated points.
From different prospective the method calculates which its side can be used to
put it into a stable position on a flat surface. IObjectPosition_KC can be queried from ISection interface
HRESULT FindStableTangentialPlane(DIPoint* pt0, DIPoint* pt1, DIPoint* pt2, double distMax, int* result )
Parameters
pt0, pt1, pt2 - [in,out] Points in global coordinates close to
the surface which will be modified to identify a stable tangential plane
distMax- [in] maximal distance from the initial point or 0 if no restriction required. See remarks.
result - [out] - The return code: > 0 means success. Any other
return values mean thet there was an error
Return value codes:
2 Solution found, but was restricted by distMax for one or more points
1 Success
0 Unknown internal error
-1 Could not calculate projection to the surface of starting points. Can be
caused by incorrect type of entity or incorrect initial position relative to
surface geometry
-2 The initial points were collinear or have become collinear during the
calcualtion
-3 a point reached edge of the surface
-4 At least two points converged into one
-5 Infinite loop. Solution can not be achieved
- Remarks
Assuming pt0, pt1 and pt2 points are close to the surface of this object (the
object this interface was queried from) and do not lie on the same line the
method modifies position of the points in such way that they define a stable
plane. Stable plane is tangential to the surface of the obejct at least at three
different non-collinear points and the object lies completely on one side of the
plane, namely on the negative side.
ppt0, pt1 and pt2 are also assumed to be arranged in CCW direction looking from
outside of the object or more correctly from end of normal to the surface.
NNotice that not every starting configuration pt0, pt1, pt2 results in a stable
plane. The points have to be relatively close to three isolated locally concave
areas on the surface. The algorithm returns an error (result<=0) if during
execution a point reached edge of the surface or two or more points converged.
If i>distMax>0 modifications of all three points are restricted to
area of the surface not further than distMax from the initial
point. Set distMax to 0 to avoid the restriction, which is
the default recommended behaiviour. If distMax>0 and one or more
points were restricted the returned result value is 2.
Use error codes above or IError_KC to obtain description of
the error if the returned result is less or equal to 0.
Completely convex objects do not have a stable tangential plane. Point set for
such an object will either return an error indicating converged points or will
converge to corners of a single simplex for meshed surfaces./p>
|