System.Windows.Media.Media3D.Matrix3D如何工作

地球引擎

定义这样的函数似乎很简单

/// <summary>
/// Build 3D transform matrix with image of unit vectors of axes, and the image of the origin
/// </summary>
/// <param name="xUnit">The image of x axis unit vector</param>
/// <param name="yUnit">The image of y axis unit vector</param>
/// <param name="zUnit">The image of z axis unit vector</param>
/// <param name="offset">The image of the origin</param>
/// <returns>The matrix</returns>
public static Matrix3D MatrixFromVectors(Vector3D xUnit, Vector3D yUnit, Vector3D zUnit, Vector3D offset)
{
    var m = new Matrix3D(
        xUnit.X, xUnit.Y, xUnit.Z, 0.0, 
        yUnit.X, yUnit.Y, yUnit.Z, 0.0, 
        zUnit.X, zUnit.Y, zUnit.Z, 0.0, 
        0, 0, 0, 1);
    m.Translate(offset);
    return m;
}

但是测试代码

...
var m = Geo.MatrixFromVectors(vx,vy,vz,new Vector3D(1,2,3));
var result = m.transform(new Vector3D(1,0,0)) //result: equal to vx
...

表明它根本不使用偏移量。如何使其运作?

赫兹格

Media3D命名空间中的结构区分了矢量和点。Vector3D用于指定空间中与位置无关的值(例如Axis,Surface法线,加速度等),而Point3D用于指定位置。

因为不支持向量携带位置,所以信息Matrix3D.Transform(Vector3D)不会应用偏移量。它仅改变Vector方向

如果将aPoint3D而不是a传递Vector3DMatrix3D.Transform(Point3D)它将按预期工作:

...
var m = Geo.MatrixFromVectors(vx,vy,vz,new Vector3D(1,2,3));
var result = m.transform(new Point3D(0,0,0)) // result is 1,2,3
...

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

没有为类型定义序列化程序:System.Windows.Media.Media3D.Point3D

来自分类Dev

如何确定System.Windows.Media.DrawingContext的锚点?

来自分类Dev

如何处置System.Windows.Media.MediaPlayer

来自分类Dev

UWP中的System.Windows.Media

来自分类Dev

UWP中的System.Windows.Media

来自分类Dev

C#如何将system.windows.media.brush转换为system.drawing.brush

来自分类Dev

如何从HEX Windows 8应用程序获取System.Windows.Media.Color

来自分类Dev

如何使用Windows Media Player?

来自分类Dev

.Net如何使用System.Windows.Media.MediaPlayer()在网站的根目录中播放音频

来自分类Dev

如何将System.Windows.Media.DrawingImage转换为Stream?

来自分类Dev

Xaml参考静态属性,例如System.Windows.Media.Colors

来自分类Dev

将System.Windows.Media.ImageSource转换为ByteArray

来自分类Dev

WPF ComboBox作为System.Windows.Media.Colors

来自分类Dev

C# - 获取所有 System.Windows.Media.Fonts

来自分类Dev

Windows Media功能包无法正常工作

来自分类Dev

如何从Windows 8删除Media Center

来自分类Dev

Windows Media Player 7

来自分类Dev

将System.Drawing.Bitmap转换为WPF的System.Windows.Media.BitmapImage

来自分类Dev

Windows 10中的新对象System.Windows.Media.Imaging.BitmapImage失败

来自分类Dev

如何使Windows Media Player忽略Windows 7中的全局热键?

来自分类Dev

如何使Windows Media Player 12从mp3文件中读取刷新的标签?

来自分类Dev

如何在Windows Media Player中编辑MP3标签以具有正确的曲目列表

来自分类Dev

如何确保使用 Python 中的 Windows Media Player 打开 .mp3 文件?

来自分类Dev

无法添加“使用System.Windows.Media.Imaging;” 在WPF桌面应用程序中

来自分类Dev

System.Media.SoundPlayer在Windows Service应用程序中不起作用

来自分类Dev

“ Windows.Media.SpeechSynthesis”和“ System.Speech.Synthesis”之间有什么区别?

来自分类Dev

在什么情况下System.Windows.Media.Transform.Inverse将返回null

来自分类Dev

System.Media.SoundPlayer在Windows Service应用程序中不起作用

来自分类Dev

PresentationCore.dll System.Windows.Media.Imaging BitmapSource.create()返回CachedBitmap

Related 相关文章

  1. 1

    没有为类型定义序列化程序:System.Windows.Media.Media3D.Point3D

  2. 2

    如何确定System.Windows.Media.DrawingContext的锚点?

  3. 3

    如何处置System.Windows.Media.MediaPlayer

  4. 4

    UWP中的System.Windows.Media

  5. 5

    UWP中的System.Windows.Media

  6. 6

    C#如何将system.windows.media.brush转换为system.drawing.brush

  7. 7

    如何从HEX Windows 8应用程序获取System.Windows.Media.Color

  8. 8

    如何使用Windows Media Player?

  9. 9

    .Net如何使用System.Windows.Media.MediaPlayer()在网站的根目录中播放音频

  10. 10

    如何将System.Windows.Media.DrawingImage转换为Stream?

  11. 11

    Xaml参考静态属性,例如System.Windows.Media.Colors

  12. 12

    将System.Windows.Media.ImageSource转换为ByteArray

  13. 13

    WPF ComboBox作为System.Windows.Media.Colors

  14. 14

    C# - 获取所有 System.Windows.Media.Fonts

  15. 15

    Windows Media功能包无法正常工作

  16. 16

    如何从Windows 8删除Media Center

  17. 17

    Windows Media Player 7

  18. 18

    将System.Drawing.Bitmap转换为WPF的System.Windows.Media.BitmapImage

  19. 19

    Windows 10中的新对象System.Windows.Media.Imaging.BitmapImage失败

  20. 20

    如何使Windows Media Player忽略Windows 7中的全局热键?

  21. 21

    如何使Windows Media Player 12从mp3文件中读取刷新的标签?

  22. 22

    如何在Windows Media Player中编辑MP3标签以具有正确的曲目列表

  23. 23

    如何确保使用 Python 中的 Windows Media Player 打开 .mp3 文件?

  24. 24

    无法添加“使用System.Windows.Media.Imaging;” 在WPF桌面应用程序中

  25. 25

    System.Media.SoundPlayer在Windows Service应用程序中不起作用

  26. 26

    “ Windows.Media.SpeechSynthesis”和“ System.Speech.Synthesis”之间有什么区别?

  27. 27

    在什么情况下System.Windows.Media.Transform.Inverse将返回null

  28. 28

    System.Media.SoundPlayer在Windows Service应用程序中不起作用

  29. 29

    PresentationCore.dll System.Windows.Media.Imaging BitmapSource.create()返回CachedBitmap

热门标签

归档