已知一段弧的起点和终点以及其凸度,求其圆心
便于一些初学者学习,整理了网上的一些基础函数, 现在这里贴出来已知一段弧的起点和终点以及其凸度,求其圆心
**** Hidden Message ***** 支持LZ的学习专贴 向您学习,回复看贴 不学习了!!!! 路过,看看是什么东东
回复一下要几分钟,真是无语! 本帖最后由 zjsmlzp 于 2013-9-15 06:44 编辑
怎么试用呢?学习学习:) 已知一段弧的起点和终点以及其凸度,求其圆心 {:soso_e100:}{:soso_e101:}{:soso_e102:}{:soso_e102:} ;P向您学习,回复看;P 已知一段弧的起点和终点以及其凸度,求其圆心 谢谢。学习了。 啥也不说了,感谢楼主分享哇! 这个问题求出弧线中点,然后用几何库的AcGeCircArc3d 通过三点构造函数,得到几何实体,然后直接用center()方法求得。
AcGeCircArc3d(
const AcGePoint3d& startPoint,
const AcGePoint3d& pnt,
const AcGePoint3d& endPoint);
startPoint Input start point of arc
pnt Input point on arc
endPoint Input endpoint of arc
Constructs an arc through three points. None of the three points may be coincindent and they may not be colinear. This constructor always constructs a bounded arc and cannot be used to construct a full circle.
114b864e-5e83-4733-9a4d-2f7f784da71b
下面是用LISP实现的这个过程
(defun c:tt ()
(if (and
(setq p1 (getpoint "\nfirst point:"))
(setq p2 (getpoint p1 "\nsecond point:"))
(setq bulge (getreal "\n输入bulge:"))
)
(progn
(setq dis (distance p1 p2)
v (mapcar
'-
p2
p1
)
vx (xdrx_vector_normalize v)
pmid (mapcar
'+
p1
(xdrx_vector_product vx (/ dis 2.0))
)
vy (xdrx_vector_perpvector vx)
h (* dis (/ (abs bulge) 2))
)
(if (> bulge 0.0)
(setq vy (xdrx_vector_negate vy))
)
(setq pmid (mapcar
'+
pmid
(xdrx_vector_product vy h)
)
)
(setq garc (xdge::constructor "kCircArc3d" p1 pmid p2)
cen (xdge::getpropertyvalue garc "center")
line1 (xdge::constructor "kLineSeg3d" cen p1)
line2 (xdge::constructor "kLineSeg3d" p2 cen)
poly (xdge::constructor "kCompositeCrv3d" (list line2 line1 garc))
)
(xdge::entity:make poly)
(xdrx_setpropertyvalue (entlast) "color" (xdrx_math_rand 255))
(xdge::free)
)
)
(princ)
)
谢谢楼主分享