How to use the ecl.util.geometry.CPolyline 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 equinor / libecl / python / ecl / util / geometry / cpolyline_collection.py View on Github external
def addPolyline(self , polyline , name = None):
        if not isinstance(polyline , CPolyline):
            polyline = CPolyline( init_points = polyline , name = name)
        else:
            if not name is None:
                raise ValueError("The name keyword argument can only be supplied when add not CPOlyline object")

        name = polyline.getName()
        if name and name in self:
            raise KeyError("The polyline collection already has an object:%s" % name)

        if polyline.isReference():
            self._add_polyline( polyline , False)
        else:
            polyline.convertToCReference( self )
            self._add_polyline( polyline , True)
github equinor / libecl / python / ecl / grid / faults / fault_line.py View on Github external
def __init_polyline(self):
        pl = CPolyline()
        for (i,j) in self.getIJPolyline():
            x,y,z = self.__grid.getNodeXYZ(i, j, self.__k)
            pl.addPoint(x, y)
        self.__polyline = pl
github equinor / libecl / python / ecl / util / geometry / cpolyline_collection.py View on Github external
def addPolyline(self , polyline , name = None):
        if not isinstance(polyline , CPolyline):
            polyline = CPolyline( init_points = polyline , name = name)
        else:
            if not name is None:
                raise ValueError("The name keyword argument can only be supplied when add not CPOlyline object")

        name = polyline.getName()
        if name and name in self:
            raise KeyError("The polyline collection already has an object:%s" % name)

        if polyline.isReference():
            self._add_polyline( polyline , False)
        else:
            polyline.convertToCReference( self )
            self._add_polyline( polyline , True)
github equinor / libecl / python / ecl / grid / ecl_region.py View on Github external
def select_outside_polygon( self , points , intersect = False):
        """
        Will select all points outside polygon.

        See select_inside_polygon for more docuemntation.
        """
        self._select_outside_polygon( CPolyline( init_points = points ))
github equinor / libecl / python / ecl / grid / ecl_region.py View on Github external
def deselect_inside_polygon( self , points ):
        """
        Will select all points outside polygon.

        See select_inside_polygon for more docuemntation.
        """
        self._deselect_inside_polygon( CPolyline( init_points = points ))
github equinor / libecl / python / ecl / grid / faults / fault.py View on Github external
p0 = fault_polyline[1]
            p1 = fault_polyline[0]
        else:
            p0 = fault_polyline[-2]
            p1 = fault_polyline[-1]

        ray_dir = GeometryTools.lineToRay(p0,p1)
        intersections = GeometryTools.rayPolygonIntersections(p1, ray_dir, bbox)
        if intersections:
            p2 = intersections[0][1]
            if self.getName():
                name = "Extend:%s" % self.getName()
            else:
                name = None

            return CPolyline(name=name, init_points=[(p1[0], p1[1]), p2])
        else:
            raise Exception("Logical error - must intersect with bounding box")
github equinor / libecl / python / ecl / grid / faults / fault.py View on Github external
def get_polyline(self, name=None):
        polyline = CPolyline(name=name)
        for fl in self:
            polyline += fl.getPolyline()
        return polyline
github OPM / ResInsight / ThirdParty / Ert / python / ecl / grid / faults / fault.py View on Github external
p0 = fault_polyline[1]
            p1 = fault_polyline[0]
        else:
            p0 = fault_polyline[-2]
            p1 = fault_polyline[-1]

        ray_dir = GeometryTools.lineToRay(p0,p1)
        intersections = GeometryTools.rayPolygonIntersections(p1, ray_dir, bbox)
        if intersections:
            p2 = intersections[0][1]
            if self.getName():
                name = "Extend:%s" % self.getName()
            else:
                name = None

            return CPolyline(name=name, init_points=[(p1[0], p1[1]), p2])
        else:
            raise Exception("Logical error - must intersect with bounding box")
github equinor / libecl / python / ecl / grid / ecl_region.py View on Github external
def deselect_outside_polygon( self , points ):
        """
        Will select all points outside polygon.

        See select_inside_polygon for more docuemntation.
        """
        self._deselect_outside_polygon( CPolyline( init_points = points ))