|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 o" g/ @- k7 r1 Z$ zNX二次开发源码分享: 在绝对坐标系和视图上点映射0 r# _3 X& G3 j$ V! u
: E# l8 F3 S# c8 C5 U. T- o
5 n! D9 @) R2 y- j: g
[mw_shl_code=c,true]
9 }5 n4 j# x. D# I& B" I2 S [$ ? Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d)8 Y/ O! s+ f1 i: \" x0 e* I: W
Dim vmx As Matrix3x3 = aView.Matrix0 x6 L+ q( {; K# a( \
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}; T& z3 N+ `" H' J, f" t
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
+ X( S% D0 {7 }; s% y9 f Dim mx(11) As Double
3 u# `% U" n) U7 x3 P5 Y; G Dim irc As Integer
' V5 ~4 j, X) s2 l Dim c() As Double = {coords.X, coords.Y, coords.Z}0 l2 g9 I: _7 }2 m
/ Q& S3 j) ~: e! m) t2 h ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)
x2 a* I8 K+ f! r4 s ufs.Trns.MapPosition(c, mx): D, ~2 d1 N" b# N: g9 ?: Q
) I. v9 g5 v8 e+ z0 a
MapView2Abs = New Point3d(c(0), c(1), c(2))# I3 Z" k; B' A
End Function( t- h% T4 G# U0 W' P, N
: X' d$ d. n( D& h4 w/ D
Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)% K+ i! z+ O G6 h2 z
Dim vmx As Matrix3x3 = aView.Matrix+ w9 w( Q A# A
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
6 V! K. H- V' h8 i' w, y! O Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
3 m' @) M, X, e# U* o$ n( ?% r Dim mx(11) As Double
% j! d0 @+ `. Y Dim irc As Integer
. w- |* C6 l1 a% O4 P( J: K8 E& F Dim c() As Double = {coords.X, coords.Y, coords.Z}0 b6 ^% w7 v( m( n5 N' w
1 ^, P9 N9 `' r8 u# C ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
3 i- k: U, i/ Q' S ufs.Trns.MapPosition(c, mx)
; D5 M6 w$ w/ w% Q5 l( l
4 V3 ~- `+ |/ y; h* j# O' c1 E MapAbs2View = New Point3d(c(0), c(1), c(2))
( W( A9 C. P( `3 e- ?" J' Y S+ l% X% e End Function* W8 ^0 R! r; Q7 d" M8 Q4 V
[/mw_shl_code]2 K# A# h3 O) u0 w4 E
|
|