//引用定义 using BIM = Bentley.Interop.MicroStationDGN; //P1 BIM.BsplineCurve bspLineCurve = new BIM.BsplineCurveClass(); BIM.Point3d tangentAtPnt = new BIM.Point3d(); //当前点的切向量 bspLineCurve.EvaluatePointTangent(ref tangentAtPnt, parameter1); //P2 ParametricCellElement pc = ParametricCellElement.Create(pcDef, null, dgnModel); //P3 DMatrix3d rotateMatrix pc.Rotation = rotateMatrix; //
如何在P3的时候把前面的tangentAtPnt方向赋值给rotateMatrix;
RotationMatrix可以理解为一个局部坐标系,您的切向量为该坐标系的X轴,您还需要构造Y轴和Z轴。Z轴可从当前视图(View)的旋转矩阵中获得。Y轴用X轴(即切向量)和Z轴叉乘(CrossProduct)可获得。得到这三个轴的向量后用FromColumn就能构造出这个旋转矩阵了。
符老师,关于这个Bentley.GeometryNET.DMatrix3d pM3d = new Bentley.GeometryNET.DMatrix3d(1, 0, 0, 0, 1, 0, 0, 0, 1); Dmatrix3d 各个参数的意义能否解释一下,我不太明白。
DMatrix3d是一个3X3的矩阵,构造函数中的九个参数就是去初始化这个3X3的矩阵的。矩阵该设什么样的值需要了解线性代数矩阵变换的 相关知识,这个到网上搜一下,有很多学习资料。