def set_bar_height(self, height): """ Sets the height of the bar to the given value. The given height should be between 0 and 1. """ reader = GeomVertexReader(self.bar_vdata, 'vertex') writer = GeomVertexWriter(self.bar_vdata, 'vertex') while not reader.isAtEnd(): v = reader.getData3f() if v[2] > 0: writer.setData3f(v[0],v[1],height) else: writer.setData3f(v) # I have to call the writer setData method in any case
def _set_z_on_shaft(self, z): for vdata in self.shaft_vdata: reader = GeomVertexReader(vdata, 'vertex') writer = GeomVertexWriter(vdata, 'vertex') while not reader.isAtEnd(): v = reader.getData3f() if v[2] > 0: writer.setData3f(v[0],v[1],z) else: writer.setData3f(v) # I have to call the writer setData method in any case
def set_bar_height(self, height): """ Sets the height of the bar to the given value. The given height should be between 0 and 1. """ reader = GeomVertexReader(self.bar_vdata, 'vertex') writer = GeomVertexWriter(self.bar_vdata, 'vertex') while not reader.isAtEnd(): v = reader.getData3f() if v[2] > 0: writer.setData3f(v[0], v[1], height) else: writer.setData3f( v) # I have to call the writer setData method in any case
def _set_z_on_shaft(self, z): for vdata in self.shaft_vdata: reader = GeomVertexReader(vdata, 'vertex') writer = GeomVertexWriter(vdata, 'vertex') while not reader.isAtEnd(): v = reader.getData3f() if v[2] > 0: writer.setData3f(v[0], v[1], z) else: writer.setData3f( v ) # I have to call the writer setData method in any case
def scale_vertices(self, multiplier): """ Scale the working vertices as the given multiplier to the original vertices. @type multiplier: number @param multiplier: Coefficient to apply to original vertices. """ for i,geom in self.__get_geoms(): orig_vdata = self.orig_vertices[i] working_vdata = self.working_vertices[i] reader = GeomVertexReader(orig_vdata, 'vertex') writer = GeomVertexWriter(working_vdata, 'vertex') while not reader.isAtEnd(): data = reader.getData3f() writer.setData3f(data[0] * multiplier, data[1] * multiplier, data[2] * multiplier)
def _set_threshold(self, vdata, t_value): reader = GeomVertexReader(vdata, 'vertex') writer = GeomVertexWriter(vdata, 'vertex') while not reader.isAtEnd(): v = reader.getData3f() writer.setData3f(v[0], v[1], t_value + self.padding)
def _set_threshold(self, vdata, t_value): reader = GeomVertexReader(vdata, 'vertex') writer = GeomVertexWriter(vdata, 'vertex') while not reader.isAtEnd(): v = reader.getData3f() writer.setData3f(v[0],v[1],t_value+self.padding)