关于polarpoint的用法 - 精华帖集合
www.dimcax.com
关于polarpoint的用法
已知一点,求该点旋转一定角度和移动一定距离的点,怎么求? vlisp中很方便的,这里面这个函数怎么用?
自己用程序算一下坐标不就行了。vlist中也应该是用算的。
解决办法:
newpoint=oldpoint+new vector3d(m_dist,0,0)//先x向移动
newpoint=newpoint.rotateby(angle,new vect3d(0,0,1),m_oldpoint)//再旋转
[ ]
...............
用矩整算这个最方便
vlisp代码
(polar '(2 2 0) 0.174444 5)
c#代码
double[] baspt=new double[]{2,2,0};
double angle=0.174444;
double dist=5;
object polarpt=polarpoint(baspt,angle,dist);
vba代码
dim polarpnt as variant
dim basepnt(0 to 2) as double
dim angle as double
dim distance as double
basepnt(0) = 2#: basepnt(1) = 2#: basepnt(2) = 0#
angle = 0.1744444 ' 45 degrees
distance = 5
polarpnt = thisdrawing.utility.polarpoint(basepnt, angle, distance)
原帖由 caiqs 于 2007-11-29 07:34 am 发表 vlisp代码 (polar '(2 2 0) 0.174444 5) c#代码 double[] baspt=new double[]{2,2,0}; double angle=0.174444; double dist=5; object polarpt=polarpoint(baspt,angle,dist);
你这个是com方式的写法,不提倡,建议使用上面那位网友提到的矩阵的方法实现。当然如果嫌麻烦的话,你也可以用dotnetarx中的tools.polarpoint函数。
c#最适合开发autocad,因为它拥有vb容易的特点,却具有vc++的强大功能。
通过三角函数也很简单
public function getnewpoint(byval pt1 as point3d, byval l as double, byval rangle as double) as point3d
return new point3d(pt1.x + math.cos(rangle) * l, pt1.y + math.sin(rangle) * l, pt1.z)
end function
复制代码
模具相关绿色软件
皆唯网