How can I get a vector type in C#?

二次信任 提交于 2019-12-10 02:02:08

问题


I want to use Vectors in a C# application I'm writing, sepcifically a Vector3.

What's the best way for me to get a Vector type without writing my own?


回答1:


I used one in a POC that I found on CodeProject. It's not ideal, but it worked for our situation. At the time, however, it did not have a method to reflect a Vector3 about a given normal, but that may have changed since then.

If you don't mind using DirectX (some stay away from it for whatever reason), then there is a Vector3 type in that library as well.




回答2:


Well, there's a struct called Microsoft.DirectX.Vector3 if that's what you're looking for. You need to reference Microsoft.DirectX.dll to use it.




回答3:


For completeness, there is also one in XNA: Microsoft.XNA.Framework.Vector3.

Sounds like something in dire need of consolidation.




回答4:


In WPF you have:

System.Windows.Media.Media3D.Vector3D




回答5:


You should be able to use the vector classes in SlimDX: http://code.google.com/p/slimdx/

You could also pull out the vector/math classes from an open source XNA port like XNATouch: http://xnatouch.codeplex.com/



来源:https://stackoverflow.com/questions/499432/how-can-i-get-a-vector-type-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!