Skip to content
Snippets Groups Projects
Select Git revision
  • dadef243272d97b66a22fd4b72e7d1e081ad38fd
  • master default
  • dev
3 results

AllAppPLists.js

Blame
  • OctaRotEdgeLattice.js 1.85 KiB
    /**
     * Created by aghassaei on 5/26/15.
     */
    
    define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'threeModel'],
        function(_, Backbone, appState, globals, plist, THREE, three){
    
        var OctaRotEdgeLattice = {
    
            _initLatticeType: function(){
                require(['rotEdgeOctaBaseplane'], function(RotEdgeOctaBasePlane){
                    globals.basePlane = new RotEdgeOctaBasePlane();
                });
                require([this.getHighlighterFile()], function(DefaultHighlighter){
                    globals.highlighter = new DefaultHighlighter();
                });
            },
    
            getHighlighterFile: function(){
                return "defaultHighlighter";
            },
    
            getIndexForPosition: function(absPosition){
                return this._indexForPosition(absPosition);
            },
    
            getPositionForIndex: function(index){
                index = index.clone();
                if (index.z %2 != 0){
                    index.x += 0.5;
                    index.y += 0.5;
                }
                return this._positionForIndex(index);
            },
    
            xScale: function(cellSeparation){
                if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
                return 1 + 2*cellSeparation;
            },
    
            yScale: function(cellSeparation){
                return this.xScale(cellSeparation);
            },
    
            zScale: function(cellSeparation){
                if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
                return Math.sqrt(2)/2 + 2*cellSeparation;
            },
    
            getCellSubclassFile: function(){
                return "octaRotEdgeCell";
            },
    
            _undo: function(){//remove all the mixins
                var self = this;
                _.each(_.keys(OctaRotEdgeLattice), function(key){
                    self[key] = null;
                });
            }
        };
    
        return OctaRotEdgeLattice;
    });