ostk.mathematics.geometry.d2.Intersection¶
- class Intersection¶
Bases:
pybind11_objectMethods
Access the composite representation of the intersection.
Convert the intersection to a Composite.
Convert the intersection to a Line.
Convert the intersection to a LineString.
Convert the intersection to a Point.
Convert the intersection to a PointSet.
Convert the intersection to a Polygon.
Convert the intersection to a Segment.
Create an empty intersection.
Get the type of the intersection.
Check if the intersection is complex (contains multiple different types).
Check if the intersection contains a Composite.
Check if the intersection is defined.
Check if the intersection is empty (no geometric objects).
Check if the intersection contains a Line.
Check if the intersection contains a LineString.
Check if the intersection contains a Point.
Check if the intersection contains a PointSet.
Check if the intersection contains a Polygon.
Check if the intersection contains a Segment.
Create an intersection containing a line.
Create an intersection containing a single point.
Create an intersection containing a point set.
Create an intersection containing a segment.
Get the string representation of an intersection type.
Create an undefined intersection.
- class Type(self: ostk.mathematics.geometry.d2.Intersection.Type, value: int)¶
Bases:
pybind11_objectMembers:
Undefined
Empty
Point
PointSet
Line
LineString
Segment
Polygon
Complex
- property name¶
- __add__( ) ostk.mathematics.geometry.d2.Intersection¶
- access_composite( ) ostk.mathematics.geometry.d2.object.Composite¶
Access the composite representation of the intersection.
- Returns:
Reference to the composite containing all intersection objects.
- Return type:
Example
>>> intersection = Intersection.point(Point(1.0, 2.0)) >>> composite = intersection.access_composite()
- as_composite( ) ostk.mathematics.geometry.d2.object.Composite¶
Convert the intersection to a Composite.
- Returns:
The composite contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a Composite.
Example
>>> composite = Composite(Point(1.0, 2.0)) >>> # intersection = Intersection.composite(composite) >>> # extracted_composite = intersection.as_composite()
- as_line( ) ostk.mathematics.geometry.d2.object.Line¶
Convert the intersection to a Line.
- Returns:
The line contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a Line.
Example
>>> line = Line(Point(0.0, 0.0), numpy.array([1.0, 1.0])) >>> intersection = Intersection.line(line) >>> extracted_line = intersection.as_line()
- as_line_string( ) ostk.mathematics.geometry.d2.object.LineString¶
Convert the intersection to a LineString.
- Returns:
The line string contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a LineString.
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0), Point(2.0, 2.0)] >>> line_string = LineString(points) >>> # intersection = Intersection.line_string(line_string) >>> # extracted_line_string = intersection.as_line_string()
- as_point( ) ostk.mathematics.geometry.d2.object.Point¶
Convert the intersection to a Point.
- Returns:
The point contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a Point.
Example
>>> intersection = Intersection.point(Point(1.0, 2.0)) >>> point = intersection.as_point()
- as_point_set( ) ostk.mathematics.geometry.d2.object.PointSet¶
Convert the intersection to a PointSet.
- Returns:
The point set contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a PointSet.
Example
>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)]) >>> intersection = Intersection.point_set(points) >>> point_set = intersection.as_point_set()
- as_polygon( ) ostk.mathematics.geometry.d2.object.Polygon¶
Convert the intersection to a Polygon.
- Returns:
The polygon contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a Polygon.
Example
>>> vertices = [Point(0.0, 0.0), Point(1.0, 0.0), Point(1.0, 1.0)] >>> polygon = Polygon(vertices) >>> # intersection = Intersection.polygon(polygon) >>> # extracted_polygon = intersection.as_polygon()
- as_segment( ) ostk.mathematics.geometry.d2.object.Segment¶
Convert the intersection to a Segment.
- Returns:
The segment contained in the intersection.
- Return type:
- Raises:
RuntimeError -- If the intersection does not contain a Segment.
Example
>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0)) >>> intersection = Intersection.segment(segment) >>> extracted_segment = intersection.as_segment()
- static empty() ostk.mathematics.geometry.d2.Intersection¶
Create an empty intersection.
- Returns:
An empty intersection containing no geometry.
- Return type:
Example
>>> empty_intersection = Intersection.empty() >>> empty_intersection.is_empty() # True
- get_type( ) ostk::mathematics::geometry::d2::Intersection::Type¶
Get the type of the intersection.
- Returns:
The type of geometry contained in the intersection.
- Return type:
Example
>>> intersection = Intersection.point(Point(1.0, 2.0)) >>> intersection.get_type() # Intersection.Type.Point
- is_complex(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection is complex (contains multiple different types).
- Returns:
True if the intersection is complex, False otherwise.
- Return type:
Example
>>> # Complex intersections contain multiple geometric types >>> intersection.is_complex()
- is_composite(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a Composite.
- Returns:
True if the intersection contains a Composite, False otherwise.
- Return type:
Example
>>> composite = Composite(Point(1.0, 2.0)) >>> # intersection = Intersection.composite(composite) >>> # intersection.is_composite() # True
- is_defined(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection is defined.
- Returns:
True if the intersection is defined, False otherwise.
- Return type:
Example
>>> intersection = Intersection.point(Point(1.0, 2.0)) >>> intersection.is_defined() # True
- is_empty(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection is empty (no geometric objects).
- Returns:
True if the intersection is empty, False otherwise.
- Return type:
Example
>>> empty_intersection = Intersection.empty() >>> empty_intersection.is_empty() # True
- is_line(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a Line.
- Returns:
True if the intersection contains a Line, False otherwise.
- Return type:
Example
>>> line = Line(Point(0.0, 0.0), numpy.array([1.0, 1.0])) >>> intersection = Intersection.line(line) >>> intersection.is_line() # True
- is_line_string(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a LineString.
- Returns:
True if the intersection contains a LineString, False otherwise.
- Return type:
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0), Point(2.0, 2.0)] >>> line_string = LineString(points) >>> # intersection = Intersection.line_string(line_string) >>> # intersection.is_line_string() # True
- is_point(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a Point.
- Returns:
True if the intersection contains a Point, False otherwise.
- Return type:
Example
>>> intersection = Intersection.point(Point(1.0, 2.0)) >>> intersection.is_point() # True
- is_point_set(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a PointSet.
- Returns:
True if the intersection contains a PointSet, False otherwise.
- Return type:
Example
>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)]) >>> intersection = Intersection.point_set(points) >>> intersection.is_point_set() # True
- is_polygon(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a Polygon.
- Returns:
True if the intersection contains a Polygon, False otherwise.
- Return type:
Example
>>> vertices = [Point(0.0, 0.0), Point(1.0, 0.0), Point(1.0, 1.0)] >>> polygon = Polygon(vertices) >>> # intersection = Intersection.polygon(polygon) >>> # intersection.is_polygon() # True
- is_segment(self: ostk.mathematics.geometry.d2.Intersection) bool¶
Check if the intersection contains a Segment.
- Returns:
True if the intersection contains a Segment, False otherwise.
- Return type:
Example
>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0)) >>> intersection = Intersection.segment(segment) >>> intersection.is_segment() # True
- static line( ) ostk.mathematics.geometry.d2.Intersection¶
Create an intersection containing a line.
- Parameters:
line (Line) -- The line to include in the intersection.
- Returns:
An intersection containing the line.
- Return type:
Example
>>> line = Line(Point(0.0, 0.0), numpy.array([1.0, 1.0])) >>> intersection = Intersection.line(line)
- static point( ) ostk.mathematics.geometry.d2.Intersection¶
Create an intersection containing a single point.
- Parameters:
point (Point) -- The point to include in the intersection.
- Returns:
An intersection containing the point.
- Return type:
Example
>>> point = Point(1.0, 2.0) >>> intersection = Intersection.point(point)
- static point_set(
- point_set: ostk.mathematics.geometry.d2.object.PointSet,
Create an intersection containing a point set.
- Parameters:
point_set (PointSet) -- The point set to include in the intersection.
- Returns:
An intersection containing the point set.
- Return type:
Example
>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)]) >>> intersection = Intersection.point_set(points)
- static segment( ) ostk.mathematics.geometry.d2.Intersection¶
Create an intersection containing a segment.
- Parameters:
segment (Segment) -- The segment to include in the intersection.
- Returns:
An intersection containing the segment.
- Return type:
Example
>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0)) >>> intersection = Intersection.segment(segment)
- static string_from_type(
- type: ostk::mathematics::geometry::d2::Intersection::Type,
Get the string representation of an intersection type.
- Parameters:
type (Intersection.Type) -- The intersection type.
- Returns:
String representation of the type.
- Return type:
Example
>>> Intersection.string_from_type(Intersection.Type.Point) # "Point"
- static undefined() ostk.mathematics.geometry.d2.Intersection¶
Create an undefined intersection.
- Returns:
An undefined intersection.
- Return type:
Example
>>> undefined_intersection = Intersection.undefined() >>> undefined_intersection.is_defined() # False