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


Python GeoMath.centerOfPoints方法代码示例

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


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

示例1: display_on

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import centerOfPoints [as 别名]
 def display_on(self, name = 'floor', HI = None):
     if(not HI):
         HI = HouInterface.HouInterface()
     # Get the size of the floor using its points
     bounding_box = GeoMath.boundingBox(self.get_absolute_points())
     size = bounding_box.sizevec()
     # Put the size 'y' that user wants the floor to be
     size[1] = self.extract_parm_from_user_restrictions('floor_default_size_y')
     center = GeoMath.centerOfPoints(self.get_absolute_points())
     nodeName = HI.showCube(name, size, center)
     self.associate_nodes = HI.cubes[nodeName]
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:13,代码来源:floor.py

示例2: create_grid

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import centerOfPoints [as 别名]
    def create_grid(self, floor_):
        global FLOOR_SIZE
        reload(HouInterface)

        points = floor_.get_absolute_points()
        center = GeoMath.centerOfPoints(points)

        vec1 = GeoMath.vecSub(points[0], points[1])
        vec2 = GeoMath.vecSub(points[2], points[1])

        if (vec1[0] != 0):
            vecx = GeoMath.vecModul(vec1)
            vecz = GeoMath.vecModul(vec2)
        else:
            vecx = GeoMath.vecModul(vec2)
            vecz = GeoMath.vecModul(vec1)
        columns = vecx / TILE_SIZE
        rows = vecz / TILE_SIZE
        gridName = self.hout.showGrid('floor', center, vecx, vecz, rows, columns)

        return gridName
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:23,代码来源:destroyfloorstructure.py

示例3: calculate_tubes_position

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import centerOfPoints [as 别名]
    def calculate_tubes_position(self):
        for floor in self.floor_structure.get_floors():
            center = GeoMath.centerOfPoints(floor.get_absolute_points())
            # ==================================================================
            # Guess how many tubes for each part. We divide the floor into 4 parts
            # in a half in x direction and in a half in z direction.
            # ==================================================================
            boun = GeoMath.boundingBox(floor.get_absolute_points())

            height_x_tubes = boun.sizevec()[2]
            height_z_tubes = boun.sizevec()[0]
            orientation_x_tubes = "z"
            orientation_z_tubes = "x"
            size_x_half_section = boun.sizevec()[0] / 2.0
            put_tube_each_x = self.extract_parm_from_user_restrictions(
                "tube_default_put_each_x", DEFAULT_PUT_TUBE_EACH_X
            )
            n_tubes_x_half_section = int(math.floor(size_x_half_section / put_tube_each_x))

            size_z_half_section = boun.sizevec()[2] / 2.0
            put_tube_each_z = self.extract_parm_from_user_restrictions(
                "tube_default_put_each_z", DEFAULT_PUT_TUBE_EACH_Z
            )
            n_tubes_z_half_section = int(math.floor(size_z_half_section / put_tube_each_z))

            # The first time putting tubes in x we put a tube in the middle
            tube_instance = tube.Tube(self.tube_params, center, height_x_tubes, orientation_x_tubes)
            self.tubes["x"].append(tube_instance)
            # To the right in x, so we will adding 'x' value to the center
            # point
            increment = [put_tube_each_x, 0, 0]
            tube_center = GeoMath.vecPlus(center, increment)

            for _ in range(n_tubes_x_half_section):
                tube_instance = tube.Tube(self.tube_params, tube_center, height_x_tubes, orientation_x_tubes)
                self.tubes["x"].append(tube_instance)
                tube_center = GeoMath.vecPlus(tube_center, increment)

            # To the left
            increment = [-put_tube_each_x, 0, 0]
            tube_center = GeoMath.vecPlus(center, increment)
            for _ in range(n_tubes_x_half_section):
                tube_instance = tube.Tube(self.tube_params, tube_center, height_x_tubes, orientation_x_tubes)
                self.tubes["x"].append(tube_instance)
                tube_center = GeoMath.vecPlus(tube_center, increment)

            # The first time putting tubes in z we put a tube in the middle
            tube_instance = tube.Tube(self.tube_params, center, height_z_tubes, orientation_z_tubes)
            self.tubes["z"].append(tube_instance)
            # To the right in x, so we will adding 'x' value to the center
            # point
            increment = [0, 0, put_tube_each_z]
            tube_center = GeoMath.vecPlus(center, increment)

            for _ in range(n_tubes_z_half_section):
                tube_instance = tube.Tube(self.tube_params, tube_center, height_z_tubes, orientation_z_tubes)
                self.tubes["z"].append(tube_instance)
                tube_center = GeoMath.vecPlus(tube_center, increment)

            # To the left
            increment = [0, 0, -put_tube_each_z]
            tube_center = GeoMath.vecPlus(center, increment)
            for _ in range(n_tubes_z_half_section):
                tube_instance = tube.Tube(self.tube_params, tube_center, height_z_tubes, orientation_z_tubes)
                self.tubes["z"].append(tube_instance)
                tube_center = GeoMath.vecPlus(tube_center, increment)
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:68,代码来源:metallicstructure.py


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