import time,sys,thread

from VisualSphere import *
from VisualLattice import *
from VisualGraph import *


class Visuals:
    def __init__(self, nSpinsX, nSpinsY, stripeSpacingX, stripeSpacingY, k):
        self.nSpinsX = nSpinsX
        self.nSpinsY = nSpinsY

        self.stripeSpacingX = stripeSpacingX
        self.stripeSpacingY = stripeSpacingY
        
        self.k = k
      
        self.tracerLength = 120

        self.vSphere = VisualSphere(self.nSpinsX, self.nSpinsY, self.stripeSpacingX, self.stripeSpacingY, self.tracerLength, self.k)
        self.vLattice = VisualLattice(self.nSpinsX, self.nSpinsY, self.stripeSpacingX, self.stripeSpacingY, self.tracerLength, self.k)
##        self.vGraph = VisualGraph(self.nSpinsX, self.nSpinsY)

        self.vSphere.toggleTracers()
        

    def visualLoop(self, nLattice, t):
        self.vSphere.updateVectors(nLattice)
        self.vSphere.updateTracers(nLattice)
        self.vSphere.updatePoints(nLattice)

##        self.vGraph.updateGraph(nLattice, t)

        self.vLattice.updateVectors(nLattice)
        self.vLattice.updateTracers(nLattice)
        self.vLattice.updatePoints(nLattice)
        self.vLattice.updateTorqueVectors(nLattice)     # every piece of data has a trajectory
##        self.vLattice.updateFieldVectors(nLattice)
##        self.vLattice.updateFieldTracers(nLattice)
##        self.vLattice.updateBonds(nLattice)


    def reset(self):
        self.vSphere.resetTracers()
##        self.vGraph.resetPlots() 
        self.vLattice.resetTracers()








