def getEnvelopes(self): envelopes =[] with open('externalEnvelope.txt', mode = 'r', encoding = 'utf-8-sig') as csv_ext: csvReaderExt = csv.reader(csv_ext, delimiter = ',') extPs = [] for row in csvReaderExt: extPs.append(Point(int(round(float(row[0]))), int(round(float(row[1][1:]))), int(round(float(row[2][1:]))))) externalEnvelope = Box(pygame.Color(0,100,0), extPs[0], extPs[3], extPs[2], extPs[1], extPs[4].z - extPs[0].z) for i in range(self.stories): envelopes.append([externalEnvelope]) with open('internalEnvelopes.txt', mode = 'r', encoding = 'utf-8-sig') as csv_int: csvReaderInt = csv.reader(csv_int, delimiter = ',') intPoints = [] for row in csvReaderInt: intPoints.append(Point(int(round(float(row[0]))), int(round(float(row[1][1:]))), int(round(float(row[2][1:]))))) for i in range(int(len(intPoints)/ 8)): envPs = [] for j in range(8): envPs.append(intPoints[i* 8 + j]) env = Box(pygame.Color(0,100,0), envPs[0], envPs[3], envPs[2], envPs[1], envPs[4].z - envPs[0].z) levelSpan = int(env.h / 3500) grLevel = int(env.pA.z/3500) for x in range(levelSpan): envelopes[x + grLevel].append(env) return envelopes
def getBox(self): a = self.origin b = a.translated(self.width * self.orientation[0], self.width * self.orientation[1], self.width * self.orientation[2]) d = a.translated(self.depth * -self.orientation[1], self.depth * self.orientation[0], self.depth * self.orientation[2]) c = b.translated(self.depth * -self.orientation[1], self.depth * self.orientation[0], self.depth * self.orientation[2]) box = Box(self.colour, a, b, c, d, self.height) return box
def getBox(self): if self.height == 0 and self.depth == 0 and self.width == 0: for s in self.shelves: self.height += s.highestBook + s.height if s.depth > self.depth: self.depth = s.depth if s.width > self.width: self.width = s.width a = self.origin b = a.translated(self.width * self.orientation[0], self.width * self.orientation[1], self.width * self.orientation[2]) d = a.translated(self.depth * -self.orientation[1], self.depth * self.orientation[0], self.depth * self.orientation[2]) c = b.translated(self.depth * -self.orientation[1], self.depth * self.orientation[0], self.depth * self.orientation[2]) self.box = Box(self.colour, a, b, c, d, self.height) return self.box
def __init__(self, col, walkWidth, height, pWalkway, v): self.walkWidth = walkWidth self.pWalkway = pWalkway self.height = height self.col = col self.orientation = col.orientation self.v = v self.pA = col.box.pA.translated(0, 0, -100) self.pB = col.box.pB.translated(0, 0, -100) self.pC = col.box.pC.translated( self.walkWidth * -col.orientation[1], self.walkWidth * col.orientation[0], self.walkWidth * col.orientation[2] - 100) self.pD = col.box.pD.translated( self.walkWidth * -col.orientation[1], self.walkWidth * col.orientation[0], self.walkWidth * col.orientation[2] - 100) self.box = Box(pygame.Color(0, 0, 255), self.pA, self.pB, self.pC, self.pD, 100) self.pillar = [] self.pillarExt = [] self.finaliseWalkway()
def getBox(self): self.box = Box(pygame.Color(0, 0, 255), self.pA, self.pB, self.pC, self.pD, 100)