当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkCubeSource方法代码示例

本文整理汇总了Python中vtk.vtkCubeSource方法的典型用法代码示例。如果您正苦于以下问题:Python vtk.vtkCubeSource方法的具体用法?Python vtk.vtkCubeSource怎么用?Python vtk.vtkCubeSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vtk的用法示例。


在下文中一共展示了vtk.vtkCubeSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Cube

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkCubeSource [as 别名]
def Cube(center=(0., 0., 0.), x_length=1.0, y_length=1.0, z_length=1.0, bounds=None):
    """Create a cube.

    It's possible to specify either the center and side lengths or just
    the bounds of the cube. If ``bounds`` are given, all other arguments are
    ignored.

    Parameters
    ----------
    center : np.ndarray or list
        Center in [x, y, z].

    x_length : float
        length of the cube in the x-direction.

    y_length : float
        length of the cube in the y-direction.

    z_length : float
        length of the cube in the z-direction.

    bounds : np.ndarray or list
        Specify the bounding box of the cube. If given, all other arguments are
        ignored. ``(xMin,xMax, yMin,yMax, zMin,zMax)``

    """
    src = vtk.vtkCubeSource()
    if bounds is not None:
        if np.array(bounds).size != 6:
            raise TypeError('Bounds must be given as length 6 tuple: (xMin,xMax, yMin,yMax, zMin,zMax)')
        src.SetBounds(bounds)
    else:
        src.SetCenter(center)
        src.SetXLength(x_length)
        src.SetYLength(y_length)
        src.SetZLength(z_length)
    src.Update()
    return pyvista.wrap(src.GetOutput()) 
开发者ID:pyvista,项目名称:pyvista,代码行数:40,代码来源:geometric_objects.py

示例2: segmentDoorHandle

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkCubeSource [as 别名]
def segmentDoorHandle(otdfType, point1, point2):

    inputObj = om.findObjectByName('pointcloud snapshot')
    polyData = inputObj.polyData

    viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())

    polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)

    wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])
    updatePolyData(wallPoints, 'wall points', parent=getDebugFolder(), visible=False)

    handlePoint = np.array([0.005, 0.065, 0.011])

    xaxis = -normal
    zaxis = [0, 0, 1]
    yaxis = np.cross(zaxis, xaxis)
    yaxis /= np.linalg.norm(yaxis)
    zaxis = np.cross(xaxis, yaxis)

    xwidth = 0.01
    ywidth = 0.13
    zwidth = 0.022
    cube = vtk.vtkCubeSource()
    cube.SetXLength(xwidth)
    cube.SetYLength(ywidth)
    cube.SetZLength(zwidth)
    cube.Update()
    cube = shallowCopy(cube.GetOutput())

    t = getTransformFromAxes(xaxis, yaxis, zaxis)
    #t.PreMultiply()
    #t.Translate(-handlePoint)
    t.PostMultiply()
    t.Translate(point2)

    name = 'door handle'
    obj = showPolyData(cube, name, cls=FrameAffordanceItem, parent='affordances')
    obj.actor.SetUserTransform(t)
    obj.addToView(app.getDRCView())

    params = dict(origin=origin, xwidth=xwidth, ywidth=ywidth, zwidth=zwidth, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, friendly_name=name, otdf_type=otdfType)
    obj.setAffordanceParams(params)
    obj.updateParamsFromActorTransform()

    frameObj = showFrame(obj.actor.GetUserTransform(), name + ' frame', parent=obj, visible=False)
    frameObj.addToView(app.getDRCView()) 
开发者ID:RobotLocomotion,项目名称:director,代码行数:49,代码来源:segmentation.py


注:本文中的vtk.vtkCubeSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。