Vibrant 1.5

bearophile bearophileHUGS at lycos.com
Mon Sep 20 19:38:37 PDT 2010


ponce:

> Vibrant has been open source'd (again):
> http://bitbucket.org/ponce/vibrant

Very good. I have seen 2D vectors implemented something like ten times in D code, so I think it's time to stop this. They need to go in the standard library:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec2.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec3.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec4.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vectorop.d

Useful math, fast too:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/common.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/rounding.d

Half floats, I don't know if they are better than user defined floats of Phobos2:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/half.d

Quaternions:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/quat.d

A color module is useful:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/misc/colors.d
Python std lib has colorsys:
http://docs.python.org/library/colorsys.html

More useful general matrix code:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/mat4.d

Some very basic geometry code fit for a std.geometry module:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/math2d.d

I think all those things (maybe with a little more docs, improvements, unittests, contracts) are fit to be added to Phobos, because:
- they are basic things that are commonly useful;
- they aren't a lot of code;
- they will be useful ten years from now too, they will not become obsolete;
- I have seen them implemented in user D code several times;
- Some of them are present in my dlibs1 and I have used them several times.

Advanced modules for computational geometry, colorimetry, statistics, etc, are beyond the scope of Phobos2. But short, simple to use, frequently useful functions are fit for the standard library. So I think there are modules that should be added to Phobos:

std.geometry
std.color
std.quaternions
std.halffloats
std.vectors
std.combinatorics (or std.comb) for permutations, combiantions, subsets, and few more.
Plus more code for std.math and std.array (for the matrix code) and std.numerics.

Eventually I'd like to write a basic std.combinatorics module for Phobos2.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list