[英]How can I get a vector type in C#?
I want to use Vectors in a C# application I'm writing, sepcifically a Vector3. 我想在我正在编写的C#应用程序中使用Vectors,特别是Vector3。
What's the best way for me to get a Vector type without writing my own? 如果没有自己编写Vector类型,最好的方法是什么?
I used one in a POC that I found on CodeProject . 我在CodeProject上找到的POC中使用了一个。 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.
然而,当时它没有一种方法来反映关于给定法线的Vector3,但从那以后可能已经改变了。
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. 如果你不介意使用DirectX(有些人因为某种原因远离它),那么该库中也有一个Vector3类型。
Well, there's a struct called Microsoft.DirectX.Vector3
if that's what you're looking for. 好吧,有一个叫做
Microsoft.DirectX.Vector3
的结构,如果这就是你要找的东西。 You need to reference Microsoft.DirectX.dll
to use it. 您需要引用
Microsoft.DirectX.dll
才能使用它。
For completeness, there is also one in XNA: Microsoft.XNA.Framework.Vector3. 为了完整起见,XNA中还有一个:Microsoft.XNA.Framework.Vector3。
Sounds like something in dire need of consolidation. 听起来像需要整合的东西。
In WPF you have: 在WPF中你有:
System.Windows.Media.Media3D.Vector3D System.Windows.Media.Media3D.Vector3D
You should be able to use the vector classes in SlimDX: http://code.google.com/p/slimdx/ 您应该能够使用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/ 您还可以从XNATouch等开源XNA端口中提取矢量/数学类: http ://xnatouch.codeplex.com/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.