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


Python GeoMath.pointInEdges方法代码示例

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


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

示例1: getFirstLayer

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import pointInEdges [as 别名]
 def getFirstLayer(self, pointIni):
     first = self.getLayers()[0]
     texEdges = []
     texPoints = first.get_absolute_points()
     for n in range(len(texPoints) - 1):
         texEdges.append([texPoints[n], texPoints[n + 1]])
     if(GeoMath.pointInEdges(pointIni, texEdges)):
         firstLayer = first
     else:
         firstLayer = self.defaultTexture
     return firstLayer
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:13,代码来源:TextureForPrim.py

示例2: findUpperTextureContainingPoint

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import pointInEdges [as 别名]
    def findUpperTextureContainingPoint(self, point):

        if(not self.reverseListOfTextures):
            # Get ordered layers
            layers = list(self.getLayers())
            # We want to start from the upper texture, so we inverse the list
            layers.reverse()
            self.reverseListOfTextures = layers

        layerInPoint = None
        for layer in self.reverseListOfTextures:
            if(layer.pointInTexture(point)):
                if(GeoMath.pointInEdges(point, GeoMath.getEdgesFromPoints(layer.get_absolute_points()))):
                    # Warning!!! point are in the edge of a texture, so if you call this method to know
                    # the next texture be careful, it will be error
                    logging.warning('Method findUpperTextureContainingPoint, Point lie in a edge of texture')
                layerInPoint = layer
                break
        if(not layerInPoint):
            layerInPoint = self.getDefaultTexture()
        return layerInPoint
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:23,代码来源:TextureForPrim.py

示例3: intersect_bounding_box_without_limits_3D

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import pointInEdges [as 别名]
    def intersect_bounding_box_without_limits_3D(self, bounding_box, DISPLAY=False):
        global littleEpsilon
        try:
            if not self.get_prim():
                raise Errors.CantBeNoneError("Prim cant be none", "We need a prim to calculate tbn some steps after")
        except Errors.CantBeNoneError as e:
            Errors.Error.display_exception(e)
            exit()

        if not self.get_points_tangent_space():
            self.convert_3D_to_2D(self.get_prim())
        this_point_relative = self.get_tbn_class().get_point_which_is_relative()
        this_tbn_inverse_matrix = self.get_tbn_class().get_tbn_inverse()
        param_bounding_box_points_in_this_tangent_space = []
        for point in bounding_box.get_rectangle_object_space():
            point_relative = GeoMath.vecSub(point, this_point_relative)
            point_tangent_space = this_tbn_inverse_matrix.mulPoint3ToMatrix3(point_relative)
            param_bounding_box_points_in_this_tangent_space.append(point_tangent_space)
        intersections = GeoMath.getIntersectionsBetweenEdges2D(
            self.get_edges_tangent_space(), GeoMath.getEdgesFromPoints(param_bounding_box_points_in_this_tangent_space)
        )
        if intersections:
            # ===============================================================
            # Check if the limits are touching and if it are touching it,
            # check if the intersection is in there. If it is in there,
            # the intersection lie in the limit, so we dont consider an
            # intersection
            # ===============================================================
            edges_shared_between_bounding_boxes = GeoMath.getEdgesBetweenEdges(
                self.get_edges_tangent_space(),
                GeoMath.getEdgesFromPoints(param_bounding_box_points_in_this_tangent_space),
            )
            inside = False
            print "Edges shared between"
            print edges_shared_between_bounding_boxes
            for intersection in intersections:
                inside = GeoMath.pointInEdges(intersection, edges_shared_between_bounding_boxes)
                if not inside:
                    break
            # ===============================================================
            # If all intersections lie in the edges shared between bounding
            # boxes we discart its
            # ===============================================================
            if inside:
                intersections = []
            else:
                # check if intersections are in the corner, because we consider corner as limit
                shared_points_between_bounding_boxes = GeoMath.getSharedPoints(
                    self.get_rectangle_tangent_space(), param_bounding_box_points_in_this_tangent_space
                )
                # If all intersections lie in the corner we doen't consider intersections as intersections
                true_intersections = list(intersections)
                for intersection in intersections:
                    for corner in shared_points_between_bounding_boxes:
                        if GeoMath.vecModul(GeoMath.vecSub(corner, intersection)) <= littleEpsilon:
                            true_intersections.remove(intersection)
                            break
                intersections = true_intersections

        if DISPLAY:
            # TEMP: exit
            1 / 0
            exit()
            for intersection in intersections:
                this_tbn_matrix = self.get_tbn_class().get_tbn()
                point_object_space = this_tbn_matrix.mulPoint3ToMatrix3(intersection)
                point_absolute = GeoMath.vecPlus(point_object_space, this_point_relative)
                self.to_display_intersections.append(point_absolute)
            self.display_intersections()
        return intersections
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:72,代码来源:BoundingBox.py


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