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


Python GeoMath.getFalseIntersectionBetweenTwoEdges3D方法代碼示例

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


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

示例1: checkIntersectionWithTexture

# 需要導入模塊: from lib import GeoMath [as 別名]
# 或者: from lib.GeoMath import getFalseIntersectionBetweenTwoEdges3D [as 別名]
    def checkIntersectionWithTexture(self, points, prim):
        global DEBUG
        global epsilon
        logging.debug("Start method checkIntersectionWithTexture, class Texture")
        # First we check intersection with boundingBox
        if(self.get_prim() and self.get_absolute_points()):
            param_points_bounding_box = BoundingBox.BoundingBox2D(points, prim)
            texture_bounding_box = BoundingBox.BoundingBox2D(
                                                        self.get_absolute_points(),
                                                         self.get_prim())
            intersections = (
            texture_bounding_box.intersect_bounding_box_without_limits_3D(
            param_points_bounding_box))

            if (not intersections):
                return None, None, []
        else:
            if(not self.get_prim()):
                logging.debug("Class Texture, not prim in method check intersection with texture")
            else:
                logging.debug("No object points")
                logging.debug(str(self))
                logging.debug(str(self.get_is_default_texture()))
                logging.debug(str(self.get_absolute_points()))
                logging.debug(str(self.get_absolute_points_not_erasable()))
                logging.debug(str(self.get_delimited_proportions()))
                logging.debug(str(self.get_obj()))

        pointsIntersect = []
        for n in range(len(points) - 1):
            edge = [points[n], points[n + 1]]
            for texIndex in range(len(self.absolutePoints)):
                nextTexIndex = (texIndex + 1) % len(self.absolutePoints)
                texEdge = [self.absolutePoints[texIndex], self.absolutePoints[nextTexIndex]]
                pointIntersect = GeoMath.getFalseIntersectionBetweenTwoEdges3D(edge, texEdge, prim)
                # We have to avoid first point, that surely intersect with some texture.
                # Also avoid the case where two texture are together and pattern intersect with
                # the first texture, but when 'exit' from this texture, it intersect with the
                # other texture anda pattern of length 0 is used; with this method we avoid this
                if(pointIntersect):
                    distacenToLastPoint = GeoMath.vecModul(GeoMath.vecSub(
                                        points[len(points) - 1], pointIntersect))
                    if(GeoMath.vecModul(GeoMath.vecSub(pointIntersect, points[0]))
                        > epsilon and distacenToLastPoint > epsilon):
                        pointsIntersect.append(pointIntersect)

        if(pointsIntersect):
            nearestPointIntersect = None
            # Big number
            minDistance = 999999

            # For each point we look if intersection is the minimum distance intersection
            for pointIntersect in pointsIntersect:
                distance, achieved = GeoMath.takeDistanceInTrackToPoint(points,
                                                     pointIntersect, points[0])
                if(achieved and distance < minDistance and distance > epsilon):
                    # We need the minimun distance, but to avoid errors, we have
                    # to discard the first point and the last
                    minDistance = distance
                    nearestPointIntersect = pointIntersect

            if(not nearestPointIntersect):
                minDistance = None
        else:
            nearestPointIntersect = None
            minDistance = None

        if(nearestPointIntersect):
            logging.debug('End method checkIntersectionWithTexture,'
                          'class Texture. State: Intersection')
        else:
            logging.debug('End method checkIntersectionWithTexture,'
                          'class Texture. State: No intersection')

        return minDistance, nearestPointIntersect, pointsIntersect
開發者ID:csoriano89,項目名稱:BuildingDestruction,代碼行數:77,代碼來源:Texture.py


注:本文中的lib.GeoMath.getFalseIntersectionBetweenTwoEdges3D方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。