Skip to content
Snippets Groups Projects
Select Git revision
  • a8b66f318dda3cc18dfcedaa3af3d01ab68b82e8
  • 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

XPLAINBridge.txt

Blame
  • LatticeOther.js 4.57 KiB
    /**
     * Created by aghassaei on 3/10/15.
     */
    
    
    ////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////CUBE LATTICE//////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////
    
    OtherLatticeSubclasses = {
    
        CubeLattice: {
    
            _initLatticeType: function(){
                this.set("basePlane", new SquareBasePlane({scale:this.get("scale")}));
                this.set("highlighter", new CubeHighlighter({scale:this.get("scale")}));
            },
    
            getIndexForPosition: function(absPosition){
                return this._indexForPosition(absPosition);
            },
    
            getPositionForIndex: function(index){
                return this._positionForIndex(index);
            },
    
            xScale: function(scale){
                if (!scale) scale = this.get("scale");
                return scale*(1+2*this.get("cellSeparation").xy);
            },
    
            yScale: function(scale){
                return this.xScale(scale);
            },
    
            zScale: function(scale){
                if (!scale) scale = this.get("scale");
                return scale*(1+2*this.get("cellSeparation").z);
            },
    
            makeCellForLatticeType: function(indices, scale){
                return new DMACubeCell(indices, scale);
            },
    
            _undo: function(){//remove all the mixins, this will help with debugging later
                var self = this;
                _.each(_.keys(this.CubeLattice), function(key){
                    self[key] = null;
                });
            }
        },
    
    ////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////TRUNCATED CUBE LATTICE////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////
    
        TruncatedCubeLattice: {
    
            _initLatticeType: function(){
                this.set("basePlane", new SquareBasePlane({scale:this.get("scale")}));
                this.set("highlighter", new TruncatedCubeHighlighter({scale:this.get("scale")}));
            },
    
            getIndexForPosition: function(absPosition){
                return this._indexForPosition(absPosition);
            },
    
            getPositionForIndex: function(index){
                return this._positionForIndex(index);
            },
    
            xScale: function(scale){
                if (!scale) scale = this.get("scale");
                return scale*(Math.sqrt(2)+2*this.get("cellSeparation").xy);
            },
    
            yScale: function(scale){
                return this.xScale(scale);
            },
    
            zScale: function(scale){
                if (!scale) scale = this.get("scale");
                return scale*(Math.sqrt(2)+2*this.get("cellSeparation").z);
            },
    
            makeCellForLatticeType: function(indices, scale){
                return new DMATruncCubeCell(indices, scale);
            },
    
            _undo: function(){//remove all the mixins, this will help with debugging later
                var self = this;
                _.each(_.keys(this.TruncatedCubeLattice), function(key){
                    self[key] = null;
                });
            }
    
        },
    
    
        ////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////TRUNCATED CUBE LATTICE////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////
    
        KelvinLattice: {
    
            _initLatticeType: function(){
                this.set("basePlane", new SquareBasePlane({scale:this.get("scale")}));
                this.set("highlighter", new TruncatedCubeHighlighter({scale:this.get("scale")}));
            },
    
            getIndexForPosition: function(absPosition){
                return this._indexForPosition(absPosition);
            },
    
            getPositionForIndex: function(index){
                return this._positionForIndex(index);
            },
    
            xScale: function(scale){
                if (!scale) scale = this.get("scale");
                return scale*(2*Math.sqrt(2)+2*this.get("cellSeparation").xy);
            },
    
            yScale: function(scale){
                return this.xScale(scale);
            },
    
            zScale: function(scale){
                if (!scale) scale = this.get("scale");
                return scale*(2*Math.sqrt(2)+2*this.get("cellSeparation").z);
            },
    
            makeCellForLatticeType: function(indices, scale){
                return new DMATruncOctaCell(indices, scale);
            },
    
            _undo: function(){//remove all the mixins, this will help with debugging later
                var self = this;
                _.each(_.keys(this.KelvinLattice), function(key){
                    self[key] = null;
                });
            }
    
        }
    
    };