本文整理汇总了Python中Camera.Camera.set_params方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.set_params方法的具体用法?Python Camera.set_params怎么用?Python Camera.set_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.set_params方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Scene
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import set_params [as 别名]
#.........这里部分代码省略.........
uses a density criterion for getting the point of view. If this is
not a good option for your problem, you can choose among:
|'minmax'|'density'|'median'|'mean'|. If None of the previous methods
work well, you may define the camera params by yourself.
"""
self.Camera.set_autocamera(self._Particles,mode=mode)
self._camera_params = self.Camera.get_params()
self.__x, self.__y, self.__hsml, self.__kview = self.__compute_scene()
def get_scene(self):
"""
- get_scene(): It return the x and y position, the smoothing length
of the particles and the index of the particles that are active in
the scene. In principle this is an internal function and you don't
need this data.
"""
return self.__x, self.__y, self.__hsml, self.__kview
def get_extent(self):
"""
- get_extent(): It returns the extent array needed for converting
the image coordinates (given in pixels units) into physical coordinates.
It is an array like the following one: [xmin,xmax,ymin,ymax]; it is to say,
an array that contains the extreme values of the scene.
"""
return self.__extent
def update_camera(self,**kargs):
"""
- update_camera(**kwarg): By using this method you can define all
the new paramenters of the camera. Read the available **kwarg in
the sphviewer.Camera documentation.
"""
self.Camera.set_params(**kargs)
self.__x, self.__y, self.__hsml, self.__kview = self.__compute_scene()
def __compute_scene(self):
import extensions.scene as scene
pos = self._Particles.get_pos().astype(np.float32)
hsml = self._Particles.get_hsml().astype(np.float32)
#I recast the variables just in case
xcam = np.float32(self._camera_params['x'])
ycam = np.float32(self._camera_params['y'])
zcam = np.float32(self._camera_params['z'])
theta = np.float32(self._camera_params['t'])
phi = np.float32(self._camera_params['p'])
roll = np.float32(self._camera_params['roll'])
zoom = np.float32(self._camera_params['zoom'])
xsize = np.int32(self._camera_params['xsize'])
ysize = np.int32(self._camera_params['ysize'])
if(self._camera_params['r'] == 'infinity'):
projection = 0
rcam = np.float32(0)
if(self._camera_params['extent'] == None):
xmin = np.min(pos[0,:]).astype(np.float32)
xmax = np.max(pos[0,:]).astype(np.float32)
ymin = np.min(pos[1,:]).astype(np.float32)
ymax = np.max(pos[1,:]).astype(np.float32)
self.__extent = np.array([xmin-xcam,
xmax-xcam,
ymin-ycam,
ymax-ycam],dtype=np.float32)
else: