月海临风 发表于 2004-9-6 12:10:00

高手请看:用相对坐标还是坐标平移旋转?

小弟是一名业余的vba爱好者,在学习过程中遇到点问题,自己想了好久也没有解决


只好向各位高手请教


小弟要绘制回旋曲线,由曲线公式可以绘制出起始位置切线方向为水平时的曲线图(曲线上各点的坐标均为相对与曲线起点的坐标),但当曲线起点切线方向不水平时(即起点切线方向平移旋转之后),不知道如何解决,


思路一:


利用CAD里的新建ucs,利用3点建立,可以指定新的坐标系,但由vba里边给定坐标绘制均为世界坐标系,是否有办法给出相对于曲线起点的相对坐标进行绘图?


思路二:


将曲线上各点的相对坐标由经坐标平移旋转后得到世界UCS,由此可以绘制出曲线,但小弟查了好久也没有查找到坐标平移旋转公式,只好向各位大侠求助,还请各位高手给个公式:)


以上思路是否可行,请不吝赐教!还有更好的解决办法没有?

雪山飞狐_lzh 发表于 2004-9-6 13:37:00

<P class=syntax>RetVal = object.TranslateCoordinates(OriginalPoint, From, To, Disp[, OCSNormal])
<P class=element>Object


<P class=element-desc><A href="http://www.vba.cn/object/acad2004/idh_utility_object.htm" target="_blank" >Utility</A><BR>使用该方法的对象。
<P class=element>OriginalPoint


<P class=element-desc>Variant[变体] (三元素双精度数组); 仅用于输入<BR>The 3D WCS coordinates specifying the original coordinates to be translated. This parameter can be treated as a point or a displacement vector depending on the value of Disp.
<P class=element>From


<P class=element-desc>AcCoordinateSystem 常数; 仅用于输入<BR>The coordinate system from which the point originates.
<P class=Constant>acWorld
<P class=Constant>acUCS
<P class=Constant>acOCS
<P class=Constant>acDisplayDCS
<P class=Constant-Last>acPaperSpaceDCS
<P class=element>To


<P class=element-desc>AcCoordinateSystem 常数; 仅用于输入<BR>The coordinate system to which the point will be converted.
<P class=Constant>acWorld
<P class=Constant>acUCS
<P class=Constant>acOCS
<P class=Constant>acDisplayDCS
<P class=Constant-Last>acPaperSpaceDCS
<P class=element>Disp


<P class=element-desc>Integer[整数]; 仅用于输入<BR>A displacement vector flag.
<P class=Constant>TRUE: OriginalPoint is treated as a displacement vector.
<P class=Constant>FALSE: OriginalPoint is treated as a point.
<P class=element>OCSNormal


<P class=element-desc>Variant[变体] (三元素双精度数组); 仅用于输入;可选项<BR>The normal for the OCS.
<P class=element>RetVal


<P class=element-desc>Variant[变体] (三元素双精度数组)<BR>The translated 3D coordinate.
<P class=Heading-2>说明
<P class=body>You cannot directly translate a coordinate from one OCS to another OCS. To do this, first translate the coordinate from one OCS to an intermediary coordinate system such as the WCS. Then translate that coordinate into the second OCS.
<P class=body>To translate a point on a <A href="http://www.vba.cn/object/acad2004/idh_polyline_object.htm" target="_blank" >Polyline</A> or <A href="http://www.vba.cn/object/acad2004/idh_lightweightpolyline_object.htm" target="_blank" >LightWeightPolyline</A> object from OCS to WCS:
<P class=body>1. Get the X and Y coordinates of the OCS point from the <A href="http://www.vba.cn/object/acad2004/idh_coordinate.htm" target="_blank" >Coordinate</A> or <A href="http://www.vba.cn/object/acad2004/idh_coordinates.htm" target="_blank" >Coordinates</A> property.
<P class=body>2. Get the Z coordinate of the OCS point from the <A href="http://www.vba.cn/object/acad2004/idh_elevation.htm" target="_blank" >Elevation</A> property.
<P class=body>3. Get the Normal for the polyline from the <A href="http://www.vba.cn/object/acad2004/idh_normal.htm" target="_blank" >Normal</A> property.
<P class=body>4. Call TranslateCoordinates using the X, Y, Z coordinates and the Normal.

月海临风 发表于 2004-9-7 09:09:00

<A name=48497><FONT color=#990000><B>lzh741206</B></FONT></A>斑竹:


OSC坐标,必须知道法线,在帮助上的


                       Dim plineNormal(0 To 2) As Double<BR>                       plineNormal(0) = 1#<BR>                       plineNormal(1) = 1#<BR>                       plineNormal(2) = 0#<BR>                       plineObj.Normal = plineNormal


1。似乎这个法线只有一个点,是否默认是(1,1,0)于(0,0,0)的连线?


2。其余的Pline上各点的坐标均相对于(0,0,0),plineNormal垂直整个Z平面,Pline的方向如何确定?听说是什么右手定则,不知确切?


3。当我只知道曲线起点的切线方向以及切点坐标时,我如何得到法线方程或法线上任意2各点的坐标(因为需要指定法线)?


4。而法线若如上述1条所述总是有一点为(0,0,0)时,这样在计算法线时不是很麻烦,因为法线可能离我的曲线非常远,如何解决?

雪山飞狐_lzh 发表于 2004-9-7 10:38:00

法线只是一个向量,实际上你可以不考虑UCS,直接给定起始点和终点的向量为0,即自由向量

月海临风 发表于 2004-9-7 13:01:00

斑竹能够说得清楚些吗?小弟还是不明就里


请指教!
页: [1]
查看完整版本: 高手请看:用相对坐标还是坐标平移旋转?