Esempio n. 1
0
exports.findSeparatingAxis = function(test){
    var axis = vec2.create();
    Narrowphase.findSeparatingAxis(convex,[0,0],0,convex,[0,1+eps],0,axis);

    // Check length
    var l = vec2.length(axis);
    test.ok(l > 1-eps);
    test.ok(l < 1+eps);

    // Check direction - should be quite near up/down direction
    var d = vec2.dot(axis, [0,1]);
    test.ok(Math.abs(d) > 1-eps);



    // Check what happens if there is overlap
    Narrowphase.findSeparatingAxis(convex,[0,0],0,convex,[0,0.5],0,axis);

    // Check direction - should still be quite near up/down direction
    var d = vec2.dot(axis, [0,1]);
    test.ok(Math.abs(d) > 1-eps);



    // Check what happens if there is diagonal overlap
    Narrowphase.findSeparatingAxis(convex,[0,0],0,convex,[0.5,0.5],0,axis);

    // Check direction
    var d = vec2.dot(axis, vec2.normalize([1,1],[1,1]));
    test.ok(Math.abs(d) > 1-eps);

    test.done();
};
Esempio n. 2
0
 setZeroForce: function(test){
     var b = new Body({ force:[1,2], angularForce:3 });
     b.setZeroForce();
     test.equal(vec2.length(b.force),0);
     test.equal(b.angularForce,0);
     test.done();
 },
Esempio n. 3
0
gulp.task('indexPage', function() {

  var book = require(path.join(__dirname, 'crust', 'plugins', 'length.js'));
  var bookLength = book.length();
  var contentString = '';

  for (var index = 1; index <= bookLength; index++) {

    contentString += "<div class='page'>" +
      "<iframe src='/build/renders/page-" + index + ".html'>" +
      "</iframe></div>";

  }

  var packageJson = JSON.parse(fs.readFileSync('package.json').toString());
  var bookname = packageJson.name;

  var templateData = {
    CONTENT: contentString,
    BOOKNAME: bookname
  };

  gulp.src(path.join('.', 'crust', 'index-template.html'))
    .pipe(handlebars(templateData, {}))
    .pipe(concat('index.html'))
    .pipe(gulp.dest('.'))
    .pipe(browserSync.stream());

});
Esempio n. 4
0
 .action(function() {
   try {
     console.log(book.length());
   } catch (ex) {
     console.error(ex.stack);
   }
 }).on('--help', function() {
Esempio n. 5
0
 test(`Paths are only added once to the queue`, () => {
   loader.enqueue(`/about/me/`)
   loader.enqueue(`/about/`)
   loader.enqueue(`/about/`)
   loader.enqueue(`/about/me/`)
   loader.enqueue(`/about/`)
   loader.enqueue(`/about/me/`)
   expect(loader.length()).toEqual(2)
 })
Esempio n. 6
0
 length : function(){
     return V3Math.length(this);
 },
Esempio n. 7
0
	it('Should get length', () => {
		const note = new Note(8, 2);
		expect(note.length()).toBe(2);
	});