當前位置: 首頁>>代碼示例>>Python>>正文


Python GeoMath.getEdgesBetweenEdges方法代碼示例

本文整理匯總了Python中lib.GeoMath.getEdgesBetweenEdges方法的典型用法代碼示例。如果您正苦於以下問題:Python GeoMath.getEdgesBetweenEdges方法的具體用法?Python GeoMath.getEdgesBetweenEdges怎麽用?Python GeoMath.getEdgesBetweenEdges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lib.GeoMath的用法示例。


在下文中一共展示了GeoMath.getEdgesBetweenEdges方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: intersect_bounding_box_with_limits_2D

# 需要導入模塊: from lib import GeoMath [as 別名]
# 或者: from lib.GeoMath import getEdgesBetweenEdges [as 別名]
 def intersect_bounding_box_with_limits_2D(self, bounding_box, DISPLAY=False):
     intersection = GeoMath.getIntersectionBetweenEdgesWithoutLimits2D(
         self.get_edges_object_space(), bounding_box.get_edges_object_edges(), 1
     )
     intersection_bool = intersection or GeoMath.getEdgesBetweenEdges(
         self.get_points_object_space(), bounding_box.get_points_object_space(), 1
     )
     if DISPLAY:
         # TEMP: exit
         1 / 0
         exit()
         self.to_display_intersections.append(intersection)
     return intersection_bool
開發者ID:csoriano89,項目名稱:BuildingDestruction,代碼行數:15,代碼來源:BoundingBox.py

示例2: intersect_bounding_box_with_limits_3D

# 需要導入模塊: from lib import GeoMath [as 別名]
# 或者: from lib.GeoMath import getEdgesBetweenEdges [as 別名]
    def intersect_bounding_box_with_limits_3D(self, bounding_box, DISPLAY=False):
        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)
        )

        # =======================================================================
        # work in object space because we only has to know if the bounding boxes
        # share some edge between
        # =======================================================================
        edges_shared_between_bounding_boxes = GeoMath.getEdgesBetweenEdges(
            self.get_edges_tangent_space(), GeoMath.getEdgesFromPoints(param_bounding_box_points_in_this_tangent_space)
        )

        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, edges_shared_between_bounding_boxes
開發者ID:csoriano89,項目名稱:BuildingDestruction,代碼行數:42,代碼來源:BoundingBox.py

示例3: intersect_bounding_box_without_limits_3D

# 需要導入模塊: from lib import GeoMath [as 別名]
# 或者: from lib.GeoMath import getEdgesBetweenEdges [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.getEdgesBetweenEdges方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。