/// <summary> /// Применить трансформацию к модели. /// </summary> /// <param name="model">Модель.</param> /// <param name="frameSection">Секция фрейма модели.</param> private void ApplyTransformation(GeometryModel3D model, Frame frameSection) { Matrix3D currentMatrix = this.GetMatrix(frameSection); while (frameSection.ParentFrame >= 0) currentMatrix = Matrix3D.Multiply(currentMatrix, this.GetMatrix(this.ModelGroupMetadata.FrameList.Structure.Frames[frameSection.ParentFrame])); model.Transform = new MatrixTransform3D(currentMatrix); }
private Matrix3D GetMatrix(Frame frameSection) { return new Matrix3D() { M11 = frameSection.RotationMatrix[0].X, M12 = frameSection.RotationMatrix[0].Y, M13 = frameSection.RotationMatrix[0].Z, M21 = frameSection.RotationMatrix[1].X, M22 = frameSection.RotationMatrix[1].Y, M23 = frameSection.RotationMatrix[1].Z, M31 = frameSection.RotationMatrix[2].X, M32 = frameSection.RotationMatrix[2].Y, M33 = frameSection.RotationMatrix[2].Z, M14 = 0, M24 = 0, M34 = 0, M44 = 1, OffsetX = frameSection.Position.X, OffsetY = frameSection.Position.Y, OffsetZ = frameSection.Position.Z }; }