最初由 ppp1ppp2 发布
[B]各位仁兄:
请问如何用ads_vector_image画一条弧线?
不会是一度一度地画直线吧!? [/B]
DCL画向量没有提供画弧,因此你需要先用算法用满足精度的折线模你ARC,然后画直线。
精度当然不要求一度一度的,看你的需要了,5度,10度都可以,或者你给”弦高差“做控制也可以。
ARX几何库有很多方法可以替你做
你先实例一个AcGeCircArc2d几何实体,然后设置好你的弧线参数。
然后使用:AcGeCurve2d::getSamplePoints 求样本点函数,有两个重载的方法,一个是给点数目,一个是给”弦高差“,直接就能得到样本点。
剩下就把这些点两两用向量画到DCL IMAGE里面就可以了。

- [FONT=courier new]
- AcGeCurve2d::getSamplePoints Function void
- getSamplePoints(
- double fromParam,
- double toParam,
- double approxEps,
- AcGePoint2dArray& pointArray,
- AcGeDoubleArray& paramArray) const;
- fromParam Input starting parameter
- toParam Input ending parameter
- approxEps Input chord-height tolerance
- pointArray Output array of points on curve between fromParam and toParam
- paramArray Output array of parameters corresponding to points in pointArray
- Returns a list of points on the curve between fromParam and toParam. The line segment between any two consecutive points returned in pointArray does not deviate by more than approxEps from the curve.
- --------------------------------------------------------------------------------
- void
- getSamplePoints(
- int numSample,
- AcGePoint2dArray& unnamed) const;
- numSample Input number of points that are to be returned
- unnamed Output array of sampled points
- Returns the specified number of points on the curve. The points are equally spaced by parameter value. So if the interval of the curve [0,1] and numSample is 5, the parameter values of the returned points will be 0, 0.25, 0.5, 0.75, and 1.
- [/FONT]
|