Progress (ViSLAB JavaScript Library)

Vertex Search on GeodesicDome

posted 15 Sep 2011, 07:29 by Masahiro Takatsuka

To use the GeodesicDome data structure, I need to be able to search the neighborhood of a specified vertex according to the distance from it.
I implemented a simple algorithm, which builds a tree whose root is the specified vertex. The depth of the tree corresponds to the distance from vertices to the root vertex.
The following GeodesicDome was colored to confirm the tree structure.

Hashtable/map with an object as a key

posted 15 Sep 2011, 00:26 by Masahiro Takatsuka

To efficiently store 3D float array, I tried to use a hashtable [new Array() or new Object()]:

var hash = new Array(); (or new Object())
var key = new SomeObject();
var value = 3.4.5;
if (!hash[key])
    hash[key] = value;

However,  I'm dynamically configure what type of Array to be used to store 3D vectors and matrix : 

if (typeof DoubleArray != 'undefined') {
glMatrixArray = DoubleArray;
} else if (typeof Float64Array != 'undefined') {
glMatrixArray = Float64Array;
} else if (typeof FloatArray != 'undefined') {
glMatrixArray = FloatArray
} else if(typeof WebGLFloatArray != 'undefined') {
glMatrixArray = WebGLFloatArray;
} else {
glMatrixArray = Array;

With Safari 5.1.1 on OS X Lion, glMatrixArray == Array; and you can use the Array object as a key for the hashtable.  However, with Chrome 13.0.782.220 on OS X Lion, glMatrixArray == Float64Array and you cannot use Float64Array object as a key.  
So, I now use goog.getHashCode(obj) (from Google Closure Library) to get a unique hashcode.


posted 14 Sep 2011, 06:56 by Masahiro Takatsuka   [ updated 14 Sep 2011, 07:54 ]

First implementation of GeodesicDome.  

LU decomposition

posted 12 Sep 2011, 06:19 by Masahiro Takatsuka

In the past LU decomposition was a very useful tool for Computer Vision/Computer Graphics, etc.
I've ported LU code.  I've also ported my VecMath (java).


posted 10 Sep 2011, 07:28 by Masahiro Takatsuka

Following Closure Library, created all_tests.html/alltests.js to execute all XXX_test.html.

posted 10 Sep 2011, 06:45 by Masahiro Takatsuka   [ updated 10 Sep 2011, 06:48 ]

added class with StringReader_test.html.
The test .html now use good.testing.jsunit for unit testing.
StringReader allows you to read tokens from a string.  You can also specify a set of delimiters (such as ' ' (space), \n, \t \f).  
Its basic reading method readToken() returns a string.  You can also extract tokens in the form of Boolean (readBoolean()), Number (readNumber()).

Testing vislab package

posted 10 Sep 2011, 00:46 by Masahiro Takatsuka   [ updated 10 Sep 2011, 00:47 ]

Added vislab.math.FFT in vislab/math/FFT.js to test the use of good.require()/provide() function.
I also added FFT_test.html for testing.

Initial commit

posted 10 Sep 2011, 00:42 by Masahiro Takatsuka   [ updated 10 Sep 2011, 00:46 ]

Created the basic dev structure.  The repo has the following structure:

        | (shell script to build vislab-deps.js for Closure Library's dependency function)
            sub packages

1-8 of 8