Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good library for 3D math in C#? [closed]

Tags:

c#

math

3d

I'm writing a tool that is going to be used to process a bunch of 3D data, doing things like rotating objects, translating, scaling and all that good stuff. Does anyone know of a good library that already does some of this common 3D stuff?

I'm not interested in visualizing the data at the moment, and am primarily interested in performing the operations.

Things I know I will need at this point:

  • 2D/3D/4D vectors
    • (adding, subtracting, dot product, cross product, etc...)
  • Rotation/Translation/Scaling using matrices
  • Quaternions

I was able to locate the Sharp3D library, but it seems like it might do what I want but hasn't been updated in a long time. Has anyone used this before? Any other (better) suggestions?

like image 267
Anton Avatar asked Mar 03 '09 17:03

Anton


2 Answers

Microsoft.Xna.Framework (ship this XNA) could do the work.

The XNA Framework Math library has multiple basic geometric types that can be used to manipulate objects in 2D or 3D space. The primitive objects in this library represent the data required to represent a geometric object or an operation on that object. Each geometric type has a number of mathematical operations that are supported for the type.

Vector

The XNA Framework provides the Vector2, Vector3 and Vector4 classes for representing and manipulating vectors. A vector is typically used to represent a direction and magnitude. However, in the XNA framework it might also be used to store a coordinate or some other data type with the same storage requirements.

Each vector class has methods for performing standard vector operations such as:

  • Dot product
  • Cross product
  • Normalization
  • Transformation
  • Linear, Cubic, Catmull-Rom, or Hermite spline interpolation.

Matrices

The XNA Framework provides the Matrix class for transformation of geometry. The Matrix class uses a row major order to address matrices, which means that the row is specified before the column when describing an element of a two-dimensional matrix. The Matrix class provides methods for performing standard matrix operations such as calculating the determinate or inverse of a matrix, in addition to helper methods for creating scale, translation, and rotation matrices.

Quaternions

The XNA Framework provides the Quaternion structure to represent and calculate the efficient rotation about a vector around a specified angle.

like image 79
Julien Hoarau Avatar answered Oct 18 '22 18:10

Julien Hoarau


I've never used it before but I just grabbed Sharp3D and it seems to work well (aside from some issue about strong names that took a few minutes to work around). My impression is that it's not exactly light weight but far from being on the heavy side.

As to no recent updates, it's not like math is changing or anything...

like image 43
BCS Avatar answered Oct 18 '22 20:10

BCS