コード例 #1
0
ファイル: dot.js プロジェクト: phetsims/dot
define( function( require ) {
  'use strict';

  var Namespace = require( 'PHET_CORE/Namespace' );

  var dot = new Namespace( 'dot' );

  dot.register( 'v2', function( x, y ) { return new dot.Vector2( x, y ); } );
  dot.register( 'v3', function( x, y, z ) { return new dot.Vector3( x, y, z ); } );
  dot.register( 'v4', function( x, y, z, w ) { return new dot.Vector4( x, y, z, w ); } );

  // TODO: performance: check browser speed to compare how fast this is. We may need to add a 32 option for GL ES.
  dot.register( 'FastArray', window.Float64Array ? window.Float64Array : window.Array );

  // will be filled in by other modules
  return dot;
} );
コード例 #2
0
ファイル: kite.js プロジェクト: phetsims/kite
define( function( require ) {
  'use strict';

  var Namespace = require( 'PHET_CORE/Namespace' );

  var kite = new Namespace( 'kite' );

  // Since SVG doesn't support parsing scientific notation (e.g. 7e5), we need to output fixed decimal-point strings.
  // Since this needs to be done quickly, and we don't particularly care about slight rounding differences (it's
  // being used for display purposes only, and is never shown to the user), we use the built-in JS toFixed instead of
  // Dot's version of toFixed. See https://github.com/phetsims/kite/issues/50
  kite.register( 'svgNumber', function( n ) {
    return n.toFixed( 20 );
  } );

  // will be filled in by other modules
  return kite;
} );