Sharp3D.Math Resurected on CodePlex

Posted in  | .  

Although it has been practically dead for a long time, I've recently decided to resurect my open-source C# math library.
Up until yesterday, the project's home at Codeplex only contained the last release's (1.1.3) source and binaries which I developed long time ago on .NET 1.1.
Yesterday I've uploaded to the source control the new code based I have started to work on using .NET 2.0 and generics.

I will try to keep the sources updated and fix the occasional bugs I get (which I usually recieve via email which is less comfortable than using CodePlex for tracking).

As always, any contribution is appreciated...


Sharp3D.Math is moving to CodePlex

Posted in  |  | .  
I just got a new project created on CodePlex.com for Sharp3D.Math.
I'll be moving all the Sharp3D.Math sources and files to that workspace within the next two days and start planning the next version using
their TFS system. I'm also looking for members to help and contribute to the project...

The workspace URL is http://www.codeplex.com/Wiki/View.aspx?ProjectName=Sharp3D


JPGL Graphics Engine

Posted in  |  |  | .  

A graphics engine written in C# and OpenGL which uses Sharp3D.Math can be found at http://www.jordodesigns.com/jpgl.html.

From the web site:

JPGL is a graphics engine coded in C# using the OpenGL graphics API. The engine is partially based off the CSS450/451 graphics library, which is written in C++ and uses Direct3D. There are some major structural diversions from the CSS450/451 library, mainly to accommodate a more modular design - allowing for transparent interchangeability in three layers within the graphics engine.
The default implementation of JPGL provides an OpenGL graphics API layer. Included features are:
  • scene graph/node object
  • 2D and 3D shape primitives
  • camera object
  • light objects
  • a GLSL shader implementation
  • textures
  • materials (with ability to load from Wavefront .MTL file)
  • transformation object
  • Wavefront .OBJ model importer
  • screenshot support
  • support for multiple OpenGL contexts
  • OpenGL display list caching for selected drawing
  • geometry data is shared between all shape primitives of same type
  • dynamically deformable mesh object
  • loft object (lofts from one profile line to another)
  • particle system object with OpenGL PointSprite extension support
  • vector, matrix, and quaternion wrappers (using Sharp3D.Math underneath)

Sharp3D.Math donations

Posted in  | .  

I was recently asked by wout (www.woutware.com) about ways to donate money to Sharp3D.Math.
The best way for me to recieve money (without the banks taking most of it as fees) is simple by sending an amazon gift certificate to my email address which is eran *AT* ekampf.com.

Of course, all donations are welcome... ;-)

Btw, if you wish to donate code or have any other comments\questions about the project feel free to email me to the address above...


DXF Library\Viewer using Sharp3D.Math

Posted in  | .  

I got an email from Wout who is using Sharp3D.Math for his DXF class library\viewer projects.

Check his site out at http://www.woutware.com


Organizing your code

Posted in  |  |  |  | .  

Scott Hanselman has posted a very interesting blog entry about organizing the code for software projects.

A particular interest in the post is the use of NTFS Junction points.
It could be usefull for sharing version information (take versioning out of AssemblyInfo.cs and put it in a shared file using junctions).

My own projects are organized in a rather hectic way which currently makes the process of building and releasing much more complex than it should be.

Note to self : Organize Sharp3D's code :)


It has been a while...

Posted in  |  | .  

It has been a while since I last bloged and I regret that....

So whats new?

I quit my job at the IDF and applied for a position as a .NET programmer at SAP.
This means I will be also moving to my own place somewhere near SAP to avoid the long trips to\from work (now that I'll be able to afford it)

I just finished the final project at the Compilers course I am taking this semester and currently busy studying for the finals at the end of January.

I have neglected Sharp3D.Math 2.0 for a while but I plan to get back on it ASAP.
I would like to thank Wout de Zeeuw for donating 150$ for Sharp3D.Math (through Amazon.com which does not charge outrageous fees like them banks...).

On the 12.2-18.2 I plan to be on a ski vocation at Val Thorens Freestyle (everyone deserves a vocation :) )


Sharp3D.Math performance improvements

Posted in  | .  

After doing some performance tests (suggested by Wout de Zeeuw) it became clear to me that using public fields instead of properties can boost the libraries performance by 10%-20% (!!!).

Replacing the static arithmetics methods also yields another 1%-2% performance boost.

Wout has applied these changes to the latest Sharp3D.Math release and I will go over these changes and make an official Sharp3D.Math release as soon as possible after my finals are over.

I will also release a test preview of version 2.0 of the library ASAP...

Stay tuned... :)


Sharp3D.Math v1.1.3 Released

Posted in  | .  

The new release contains several bug fixes.

Download the new release and check out the changes at the project's homepage.


Test Driven Development (TDD) first impressions...

Posted in  |  |  | .  

Well,

I have been using TDD for Sharp3D's development process for few days now and it already helped me find several bugs.

At first I thought having to write all the tests code will just be a waste of time I could spend on adding features to the library but after some actuall work I noticed that working on the tests isn't time cosuming as I thought and it helps me find some bugs I wouldn't find otherwise and deliver a better product.

Having said that, I really have to say that the testing and refactoring capabilities in VS2005 are awsom. I only wish they would add performance testing capabilities (So I can define “test methods“ that would run and be time measured).

Oh and btw, notice the new Stopwatch class used to accuratly meaure times (for peformance etc...)

 


Started working on Sharp3D.Math 2.0

Posted in  | .  

I started working on Sharp3D.Math v2.0 using using Visual Studio 2005 (.NET 2.0).
I am using TDD (Test Driven Development) to develop the next version to avoid bugs and make the library more efficient and usable...

Among the new features:

  • Better documentation.
  • Support for .NET 2.0 standards (Like adding TryParse in addition to Parse).
  • Revised code.
  • Better integration support. Trapezoid, Simpson, Romberg integration with accuracy\max iterations support.
  • Statistics.
  • Random and distribution dependent number generators.
  • 3D Surfaces
  • 2D\3D Curves
  • And more...

Sharp3D.Math v1.1.2.2 released!

Posted in  | .  

Few minor bug fixes on this release...

Check it out on the Sharp3D.Math Project Page.


Matrix4 benchmark results - take two

Posted in  |  |  | .  

Here's an update on the report at http://www.ekampf.com/blog/PermaLink.aspx?guid=8626ee5a-3002-4e77-bfdd-e3a3f3d4a8e4.

The last test compared the generic class compiled with the new C# 2.0 compiler against the non-generic class (from the Sharp3D.Math library) compiled for .NET 1.1.

I decided to make another test were both generic and non-generic classes are in the same project and compiled for .NET 2.0.

Oddly enough, when I ran the second test on my machine the results showed that the generic class runs faster than the non generic class.
However on my friend's machine the results were more like the ones in the first test (non-generic slightly faster).

Here's the test code and executable:
Matrix4PerfTest.zip (26.94 KB)


Started working on the next major version of Sharp3D.Math

Posted in  | .  

I started working on the next major version of Sharp3D.Math (2.0) using version 2.0 of the .NET Framework.

Some of the features I am adding:

  • Non-uniform real number random generetors.
  • Signal processing framework.
  • Statistics methods.
  • 3D surfaces.
  • and more....

I would appreciate comments, suggestions etc...

 


Matrix4 benchmark results

Posted in  |  |  | .  

The benchmark measured the time (in seconds) of 1,000,000 random matrix multiply operations on the different matrix implementations.
The test used the latest Sharp3D.Math build (compiled using VS2003), DirectX october update and VS2005 beta 1.

The results are:

  1. Sharp3D.Math.Core.Matrix4F - 0.2857308100 seconds
  2. Matrix4<float> C# Kernel - 0.3076677100 seconds
  3. Matrix4<float> DirectX Kernel - 0.9436617200 seconds
  4. DirectX - 0.1269457500 seconds.

As expected, the DirectX CPU optimized code runs the fastest.

I thought that using a DirectX kernel will make Matrix4<float> faster than using a C# implementation but it seems that the Matrix4<float> <--> Microsoft.DirectX.Matrix conversions are killing the performance benefits...

I expected the generic Matrix4 C# implementation to run just as fast as its non-generic counterpart but unfortunately it is slower. This is probably caused by using an interface for the kernel operations...

If anyone has an idea about how to make the conversion too\from DirectX faster and\or how to make the C# implementation just as fast as its non generic counter part I'd appreciate a comment or mail...


Moving on to Sharp3D.Math 2.0 - testing the use of generic types

Posted in  |  |  | .  

I've started doing tests on the use of generics (introduced in the new .NET framework 2.0) for the next versio  of Sharp3D.Math.

Doing numerics on generic types is a bit of a problem because unconstrained type parameters are assumed to be of type System.Object which does not define arithmetic operations (like +, - etc...).
Using a constrained type parameter, the interfaces the type parameter has to implement could be defined but it is not possible to define operator constraints.

You can read a detailed discussion about the problem here and at this codeproject article.

The two suggested workarounds for this problems are:

  1. Define an IArithmetic interface that defines the basic operations needed for math calculations (addition etc...) and use it to wrap around numeric types (float, double etc...)
  2. Use a separated type for the operators.

The suggested workaround of using a separate type for the operators could be a good idea for Sharp3D.Math as it can also be used for platform specific performance tuning.
Say an IKernelMatrix4 implements all arithmetics for a 4x4 matrix structure, besides a native .NET implementation of IKernelMatrix4 there could also implementations using platform specific libraries such as the DirectX math library (which uses SSE optimizations for matrix arithmetics), Intel's Math Kernel library and other unmanaged optimized libraries.

Currently I am implementing a 4x4 matrix structure using the method specified above for the purpose of performance testing:
Generic matrix4x4 (.NET implementation) vs. Generic matrix4x4 (DirectX implementation) vs. Sharp3D.Math.Core.Matrix4F

I'll post the results soon...

 


Generic numerics with .NET

Posted in  |  |  | .  

I've been playing with .NET generics trying to find a way to convert the current Sharp3D.Math structures to be generic templates.

The problem with .NET generic templates and numerics code is that there is no way to constraint a type parameter to require the existence of static method that we require for calculations (arithmetic operators etc.)

I found a very good workaround in this article.

Though I do not plan on converting Sharp3D.Math to use generics any time soon I assume I will use this solution when the time to move to .NET 2.0 comes...


Sharp3D.Math v1.1.2.1 released!

Posted in  | .  
You can download the new release from here.
You can also check out the change log and browse the online documentation.

SEHException when serializing value types

Posted in  |  |  | .  

When implementing ISerializable the MSDN documentation recommends on applying the [SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
attribute on the GetObjectData method (Check out the FxCop rule).

When trying to serialize a structure with the above CAS attribute on its GetObjectData I got a nasty SEHException. When I removed the CAS attribute serialization worked fine...

I've included a test code that produces this exception with this post.
I've also sent it to Microsoft to see what's their take on this bug...

In the meanwhile I commented all the CAS attributes on the GetObjectData methods in the Sharp3D.Math library...

SerializationTest.zip (1.05 KB)


Math for 3D Game Programming & Computer Graphics

Posted in  |  |  | .  
I've been thinking about starting a tutorials series about 3D math. I could use Sharp3D.Math for code samples etc...
Anyway, I hope I'll have an update about that soon.


Sharp3D.Math v1.1.2 is released!

Posted in  | .  
You can download the new release from here.
You can also check out the change log and browse the online documentation.

Sharp3D.Math used by Hortilux Schreder

Posted in  | .  
Just got a word about Sharp3D.Math being used by Hortilux Schreder (www.hortilux.com) for their software.
I added the details to the Sharp3D.Math page. Thanks to Wout de Zeeuw for his comments and notes...

About

Eran Kampf draws upon 8+ years of experience in software development and research. Eran served in the IDF's elite geospatial-intelligence as a senior software developer and is currently working at SAP as an R&D Engineer working on Duet which is jointly developed by SAP & Microsoft.
AddThis Feed Button Give Feedback

On this page...

Recent Comments

Tags

Statistics

Total Posts: 481
This Year: 61
This Month: 0
This Week: 0
Comments: 281

Google Ads