本文整理汇总了Python中lib.buffer_utils.BufferUtils.get_buffer_size方法的典型用法代码示例。如果您正苦于以下问题:Python BufferUtils.get_buffer_size方法的具体用法?Python BufferUtils.get_buffer_size怎么用?Python BufferUtils.get_buffer_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.buffer_utils.BufferUtils
的用法示例。
在下文中一共展示了BufferUtils.get_buffer_size方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def setup(self):
self.num_strands, self.num_pixels = BufferUtils.get_buffer_size(self._app)
self.scene_bb = self._app.scene.get_fixture_bounding_box()
self.scene_center = (self.scene_bb[0] + (self.scene_bb[2] - self.scene_bb[0]) / 2, self.scene_bb[1] + (self.scene_bb[3] - self.scene_bb[1]) / 2)
dx = self.scene_bb[2] - self.scene_center[0]
dy = self.scene_bb[3] - self.scene_center[1]
self.radius = math.sqrt(math.pow(dx,2) + math.pow(dy, 2))
示例2: setup
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def setup(self):
self.num_strands, self.num_pixels = BufferUtils.get_buffer_size(self._app)
bb = self._app.scene.get_fixture_bounding_box()
self.scene_center = np.asarray([bb[0] + (bb[2] - bb[0]) / 2, bb[1] + (bb[3] - bb[1]) / 2])
self.bb = bb
self.reset()
示例3: setup
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def setup(self):
self.x, self.y = BufferUtils.get_buffer_size(self._app)
self.pixel_locations = self._app.scene.get_all_pixel_locations()
self.pixel_addr = {}
for pixel, _ in self.pixel_locations:
self.pixel_addr[pixel] = BufferUtils.get_buffer_address(self._app, pixel)
self.reset()
示例4: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
self.buffer_size = BufferUtils.get_buffer_size()
self.mask = np.tile(False, self.buffer_size)
np.random.seed()
self.rand_index = np.arange(self.buffer_size)
np.random.shuffle(self.rand_index)
self.last_idx = 0
示例5: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
x, y = BufferUtils.get_buffer_size(self._app)
self.mask = np.tile(False, (x, y, 3))
np.random.seed()
self.rand_index = np.arange(len(self.fixtures))
np.random.shuffle(self.rand_index)
self.last_idx = 0
示例6: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
x, y = BufferUtils.get_buffer_size(self._app)
self.mask = np.tile(False, (x, y, 3))
num_elements = np.ndarray.flatten(self.mask).size
np.random.seed()
self.rand_index = np.arange(num_elements)
np.random.shuffle(self.rand_index)
self.last_idx = 0
示例7: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
self.fixtures = self._app.scene.fixtures()
buffer_size = BufferUtils.get_buffer_size()
self.mask = np.tile(False, (buffer_size, 3))
np.random.seed()
self.rand_index = np.arange(len(self.fixtures))
np.random.shuffle(self.rand_index)
self.last_idx = 0
示例8: setup
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def setup(self):
self.num_strands, self.num_pixels = BufferUtils.get_buffer_size(self._app)
self.scene_bb = self._app.scene.get_fixture_bounding_box()
self.scene_center = (self.scene_bb[0] + (self.scene_bb[2] - self.scene_bb[0]) / 2, self.scene_bb[1] + (self.scene_bb[3] - self.scene_bb[1]) / 2)
dx = self.scene_bb[2] - self.scene_center[0]
dy = self.scene_bb[3] - self.scene_center[1]
self.scene_radius = sqrt(pow(dx,2) + pow(dy, 2))
self.locations = self._app.scene.get_all_pixel_locations()
self.buffer_addr = {}
self.angles = {}
self.radii = {}
for pixel, location in self.locations:
self.buffer_addr[pixel] = BufferUtils.get_buffer_address(self._app, pixel)
dy = location[1] - self.scene_center[1]
dx = location[0] - self.scene_center[0]
angle = (atan2(dy, dx) + pi) / (2.0 * pi)
self.radii[pixel] = sqrt(pow(dx,2) + pow(dy, 2))
self.angles[pixel] = angle
示例9: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
self.buffer_size = BufferUtils.get_buffer_size()
self.scene_bb = self._app.scene.get_fixture_bounding_box()
self.scene_center = (self.scene_bb[0] + (self.scene_bb[2] - self.scene_bb[0]) / 2, self.scene_bb[1] + (self.scene_bb[3] - self.scene_bb[1]) / 2)
dx = self.scene_bb[2] - self.scene_center[0]
dy = self.scene_bb[3] - self.scene_center[1]
self.scene_radius = sqrt(pow(dx,2) + pow(dy, 2))
self.locations = self._app.scene.get_all_pixel_locations()
self.angles = {}
self.radii = {}
for pixel, location in enumerate(self.locations):
dy = location[1] - self.scene_center[1]
dx = location[0] - self.scene_center[0]
angle = (atan2(dy, dx) + pi) / (2.0 * pi)
self.radii[pixel] = sqrt(pow(dx,2) + pow(dy, 2))
self.angles[pixel] = angle
self.mask = np.tile(False, (self.buffer_size, 3))
self.angle = 0.0
self.radius = 0.0
self.active = deepcopy(self.locations)
示例10: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
self.buffer_size = BufferUtils.get_buffer_size()
self.scene_bb = self._app.scene.get_fixture_bounding_box()
self.scene_center = (self.scene_bb[0] + old_div((self.scene_bb[2] - self.scene_bb[0]), 2), self.scene_bb[1] + old_div((self.scene_bb[3] - self.scene_bb[1]), 2))
dx = self.scene_bb[2] - self.scene_center[0]
dy = self.scene_bb[3] - self.scene_center[1]
self.locations = self._app.scene.get_all_pixel_locations()
self.angles = {}
self.radii = {}
for pixel, location in enumerate(self.locations):
dy = location[1] - self.scene_center[1]
dx = location[0] - self.scene_center[0]
angle = old_div((atan2(dy, dx) + pi), (2.0 * pi))
self.radii[pixel] = sqrt(pow(dx,2) + pow(dy, 2))
self.angles[pixel] = angle
self.scene_radius = max(self.radii)
self.mask = np.tile(False, self.buffer_size)
self.angle = 0.0
self.radius = 0.0
self.active = [True,] * len(self.locations)
示例11: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
x, y = BufferUtils.get_buffer_size(self._app)
self.frame = np.tile(0.0, (x, y, 3))
示例12: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
buffer_size = BufferUtils.get_buffer_size()
self.frame = np.tile(0.0, (buffer_size, 3))
self.pixel_locations = self._app.scene.get_all_pixel_locations()
示例13: reset
# 需要导入模块: from lib.buffer_utils import BufferUtils [as 别名]
# 或者: from lib.buffer_utils.BufferUtils import get_buffer_size [as 别名]
def reset(self):
self.buffer_len = BufferUtils.get_buffer_size()
self.frame = np.tile(np.array([0.0], dtype=np.float), (self.buffer_len, 3))