Skip to content
Snippets Groups Projects
Select Git revision
  • 61ff4824a904d156e719ab2967b613cf095e908e
  • master default protected
  • LUFA-170418
  • LUFA-151115
  • LUFA-140928
  • LUFA-140302
  • LUFA-130901
  • LUFA-130901-BETA
  • LUFA-130303
  • LUFA-120730
  • LUFA-120730-BETA
  • LUFA-120219
  • LUFA-120219-BETA
  • LUFA-111009
  • LUFA-111009-BETA
  • LUFA-110528
  • LUFA-110528-BETA
17 results

Descriptors.h

Blame
  • TetraStackedLattice.js 2.02 KiB
    /**
     * Created by aghassaei on 6/4/15.
     */
    
    define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'threeModel'],
        function(_, Backbone, appState, globals, plist, THREE, three){
    
        var TetraStackedLattice = {
    
            _initLatticeType: function(){
                require(['octaBaseplane'], function(OctaBasePlane){
                    globals.basePlane = new OctaBasePlane();
                });
                require([this.getHighlighterFile()], function(DefaultHighlighter){
                    globals.highlighter = new DefaultHighlighter();
                });
            },
    
            getHighlighterFile: function(){
                return "defaultHighlighter";
            },
    
            getIndexForPosition: function(absPosition){
                var index = this._indexForPosition(absPosition);
                if (index.y%2 != 0) {
                    absPosition.x += this.xScale()/2;
                    index = this._indexForPosition(absPosition);
                }
                return index;
            },
    
            getPositionForIndex: function(index){
                var position = this._positionForIndex(index);
                if ((index.y%2) != 0) position.x -= this.xScale()/2;
                return position;
            },
    
            xScale: function(cellSeparation){
                if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
                return 1+2*cellSeparation;
            },
    
            yScale: function(cellSeparation){
                return this.xScale(cellSeparation)/2*Math.sqrt(3);
            },
    
            zScale: function(cellSeparation){
                if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
                return 2/Math.sqrt(6)+2*cellSeparation;
            },
    
            getCellSubclassFile: function(){
                return "tetraStackedCell";
            },
    
            _undo: function(){//remove all the mixins, this will help with debugging later
                var self = this;
                _.each(_.keys(TetraStackedLattice), function(key){
                    self[key] = null;
                });
            }
        };
    
        return TetraStackedLattice;
    });