明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1779|回复: 1

关于曲线法线的问题

[复制链接]
发表于 2007-7-26 15:12:00 | 显示全部楼层 |阅读模式

请问如何能获取曲线上任意点处的法线方向,请哪位高手指点一下!

发表于 2007-8-2 11:52:00 | 显示全部楼层

Download VLAX.cls and Curve.cls... Then the following codes can find out the tangent direction of a point on curve.

Sub TEST()
Dim C As Curve
Dim objCur As AcadEntity
Dim pickPnt As Variant
Dim closePnt As Variant
Dim paramatclosePnt As Double
Dim tangentatclosePnt As Variant
Set C = New Curve
ThisDrawing.Utility.GetEntity objCur, pickPnt, "SELECT A CURVE:"
Set C.Entity = objCur
closePnt = C.GetClosestPointTo(pickPnt)
paramatclosePnt = C.GetParameterAtPoint(closePnt)
tangentatclosePnt = C.GetFirstDerivative(paramatclosePnt)

Dim objRay As AcadRay
Dim origin(2) As Double
Dim pt2(2) As Double
origin(0) = 0#: origin(1) = 0#: origin(2) = 0#
pt2(0) = tangentatclosePnt(0): pt2(1) = tangentatclosePnt(1): pt2(2) = tangentatclosePnt(2)
Set objRay = ThisDrawing.ModelSpace.AddRay(origin, pt2)
objRay.Move origin, closePnt
End Sub

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 13:32 , Processed in 0.154742 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表