How to use the ecl.util.geometry.GeometryTools.distance function in ecl

To help you get started, we’ve selected a few ecl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OPM / ResInsight / ThirdParty / Ert / python / ecl / grid / faults / fault.py View on Github external
def __ray_intersect(p0, p1, polyline):
        ray_dir = GeometryTools.lineToRay(p0, p1)
        intersections = GeometryTools.rayPolygonIntersections(p1, ray_dir, polyline)
        if intersections:
            if len(intersections) > 1:
                d_list = [ GeometryTools.distance(p1, p[1]) for p in intersections ]
                index = d_list.index(min(d_list))
            else:
                index = 0
            p2 = intersections[index][1]
            return [p1, p2]
        else:
            return None
github equinor / libecl / python / ecl / grid / faults / fault.py View on Github external
def __ray_intersect(p0, p1, polyline):
        ray_dir = GeometryTools.lineToRay(p0, p1)
        intersections = GeometryTools.rayPolygonIntersections(p1, ray_dir, polyline)
        if intersections:
            if len(intersections) > 1:
                d_list = [ GeometryTools.distance(p1, p[1]) for p in intersections ]
                index = d_list.index(min(d_list))
            else:
                index = 0
            p2 = intersections[index][1]
            return [p1, p2]
        else:
            return None
github OPM / ResInsight / ThirdParty / Ert / python / ecl / grid / faults / fault.py View on Github external
def extend_polyline_onto(self, polyline, k):
        if self.intersectsPolyline(polyline, k):
            return None

        if len(polyline) > 1:
            fault_polyline = self.getPolyline(k)
            ext1 = self.__ray_intersect(polyline[-2], polyline[-1], fault_polyline)
            ext2 = self.__ray_intersect(polyline[0] , polyline[1] , fault_polyline)

            if ext1 and ext2:
                d1 = GeometryTools.distance(ext1[0], ext1[1])
                d2 = GeometryTools.distance(ext2[0], ext2[1])

                if d1 < d2:
                    return ext1
                else:
                    return ext2

            if ext1:
                return ext1
            else:
                return ext2
        else:
            raise ValueError("Polyline must have length >= 2")
github equinor / libecl / python / ecl / grid / faults / fault.py View on Github external
def extend_polyline_onto(self, polyline, k):
        if self.intersectsPolyline(polyline, k):
            return None

        if len(polyline) > 1:
            fault_polyline = self.getPolyline(k)
            ext1 = self.__ray_intersect(polyline[-2], polyline[-1], fault_polyline)
            ext2 = self.__ray_intersect(polyline[0] , polyline[1] , fault_polyline)

            if ext1 and ext2:
                d1 = GeometryTools.distance(ext1[0], ext1[1])
                d2 = GeometryTools.distance(ext2[0], ext2[1])

                if d1 < d2:
                    return ext1
                else:
                    return ext2

            if ext1:
                return ext1
            else:
                return ext2
        else:
            raise ValueError("Polyline must have length >= 2")
github OPM / ResInsight / ThirdParty / Ert / python / ecl / grid / faults / fault.py View on Github external
def extend_polyline_onto(self, polyline, k):
        if self.intersectsPolyline(polyline, k):
            return None

        if len(polyline) > 1:
            fault_polyline = self.getPolyline(k)
            ext1 = self.__ray_intersect(polyline[-2], polyline[-1], fault_polyline)
            ext2 = self.__ray_intersect(polyline[0] , polyline[1] , fault_polyline)

            if ext1 and ext2:
                d1 = GeometryTools.distance(ext1[0], ext1[1])
                d2 = GeometryTools.distance(ext2[0], ext2[1])

                if d1 < d2:
                    return ext1
                else:
                    return ext2

            if ext1:
                return ext1
            else:
                return ext2
        else:
            raise ValueError("Polyline must have length >= 2")
github equinor / libecl / python / ecl / grid / faults / fault.py View on Github external
def extend_polyline_onto(self, polyline, k):
        if self.intersectsPolyline(polyline, k):
            return None

        if len(polyline) > 1:
            fault_polyline = self.getPolyline(k)
            ext1 = self.__ray_intersect(polyline[-2], polyline[-1], fault_polyline)
            ext2 = self.__ray_intersect(polyline[0] , polyline[1] , fault_polyline)

            if ext1 and ext2:
                d1 = GeometryTools.distance(ext1[0], ext1[1])
                d2 = GeometryTools.distance(ext2[0], ext2[1])

                if d1 < d2:
                    return ext1
                else:
                    return ext2

            if ext1:
                return ext1
            else:
                return ext2
        else:
            raise ValueError("Polyline must have length >= 2")