def to_json(self): # TODO: account for point size data = [] # Tempoary bug fix: default Point color should be black not white face_color = self.face_color if list(face_color.to_rgba()[:3]) == [1,1,1]: face_color = RGBColor(components=(0,0,0,face_color.to_rgba()[3])) for line in self.lines: data.append({ 'type': 'point', 'coords': [coords.pos() for coords in line], 'color': face_color.to_rgba(), }) return data
def to_asy(self): face_color = self.face_color # Tempoary bug fix: default Point color should be black not white if list(face_color.to_rgba()[:3]) == [1, 1, 1]: face_color = RGBColor( components=(0, 0, 0, face_color.to_rgba()[3])) pen = create_pens(face_color=face_color, is_face_element=False) return ''.join('path3 g={0}--cycle;dot(g, {1});'.format( '--'.join('({0},{1},{2})'.format(*coords.pos()[0]) for coords in line), pen) for line in self.lines)
def to_asy(self): face_color = self.face_color # Tempoary bug fix: default Point color should be black not white if list(face_color.to_rgba()[:3]) == [1, 1, 1]: face_color = RGBColor(components=(0, 0, 0, face_color.to_rgba()[3])) pen = create_pens(face_color=face_color, is_face_element=False) return ''.join('path3 g={0}--cycle;dot(g, {1});'.format( '--'.join('({0},{1},{2})'.format(*coords.pos()[0]) for coords in line), pen) for line in self.lines)
def to_asy(self): face_color = self.face_color # Tempoary bug fix: default Point color should be black not white if list(face_color.to_rgba()[:3]) == [1,1,1]: face_color = RGBColor(components=(0,0,0,face_color.to_rgba()[3])) pen = create_pens(face_color=face_color, is_face_element=False) asy = '' for line in self.lines: asy += 'path3 g=' + '--'.join(['(%s,%s,%s)' % coords.pos()[0] for coords in line]) + '--cycle;' asy += 'dot(g, %s);' % (pen) return asy