ostk.mathematics.geometry.d2.Intersection

class Intersection

Bases: pybind11_object

Methods

access_composite

Access the composite representation of the intersection.

as_composite

Convert the intersection to a Composite.

as_line

Convert the intersection to a Line.

as_line_string

Convert the intersection to a LineString.

as_point

Convert the intersection to a Point.

as_point_set

Convert the intersection to a PointSet.

as_polygon

Convert the intersection to a Polygon.

as_segment

Convert the intersection to a Segment.

empty

Create an empty intersection.

get_type

Get the type of the intersection.

is_complex

Check if the intersection is complex (contains multiple different types).

is_composite

Check if the intersection contains a Composite.

is_defined

Check if the intersection is defined.

is_empty

Check if the intersection is empty (no geometric objects).

is_line

Check if the intersection contains a Line.

is_line_string

Check if the intersection contains a LineString.

is_point

Check if the intersection contains a Point.

is_point_set

Check if the intersection contains a PointSet.

is_polygon

Check if the intersection contains a Polygon.

is_segment

Check if the intersection contains a Segment.

line

Create an intersection containing a line.

point

Create an intersection containing a single point.

point_set

Create an intersection containing a point set.

segment

Create an intersection containing a segment.

string_from_type

Get the string representation of an intersection type.

undefined

Create an undefined intersection.

class Type(self: ostk.mathematics.geometry.d2.Intersection.Type, value: int)

Bases: pybind11_object

Members:

Undefined

Empty

Point

PointSet

Line

LineString

Segment

Polygon

Complex

property name
__add__(
self: ostk.mathematics.geometry.d2.Intersection,
arg0: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.Intersection
access_composite(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.Composite

Access the composite representation of the intersection.

Returns:

Reference to the composite containing all intersection objects.

Return type:

Composite

Example

>>> intersection = Intersection.point(Point(1.0, 2.0))
>>> composite = intersection.access_composite()
as_composite(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.Composite

Convert the intersection to a Composite.

Returns:

The composite contained in the intersection.

Return type:

Composite

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(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.Line

Convert the intersection to a Line.

Returns:

The line contained in the intersection.

Return type:

Line

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(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.LineString

Convert the intersection to a LineString.

Returns:

The line string contained in the intersection.

Return type:

LineString

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(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.Point

Convert the intersection to a Point.

Returns:

The point contained in the intersection.

Return type:

Point

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(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.PointSet

Convert the intersection to a PointSet.

Returns:

The point set contained in the intersection.

Return type:

PointSet

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(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.Polygon

Convert the intersection to a Polygon.

Returns:

The polygon contained in the intersection.

Return type:

Polygon

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(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk.mathematics.geometry.d2.object.Segment

Convert the intersection to a Segment.

Returns:

The segment contained in the intersection.

Return type:

Segment

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:

Intersection

Example

>>> empty_intersection = Intersection.empty()
>>> empty_intersection.is_empty()  # True
get_type(
self: ostk.mathematics.geometry.d2.Intersection,
) ostk::mathematics::geometry::d2::Intersection::Type

Get the type of the intersection.

Returns:

The type of geometry contained in the intersection.

Return type:

Intersection.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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

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:

bool

Example

>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0))
>>> intersection = Intersection.segment(segment)
>>> intersection.is_segment()  # True
static line(
line: ostk.mathematics.geometry.d2.object.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:

Intersection

Example

>>> line = Line(Point(0.0, 0.0), numpy.array([1.0, 1.0]))
>>> intersection = Intersection.line(line)
static point(
point: ostk.mathematics.geometry.d2.object.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:

Intersection

Example

>>> point = Point(1.0, 2.0)
>>> intersection = Intersection.point(point)
static point_set(
point_set: ostk.mathematics.geometry.d2.object.PointSet,
) ostk.mathematics.geometry.d2.Intersection

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:

Intersection

Example

>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)])
>>> intersection = Intersection.point_set(points)
static segment(
segment: ostk.mathematics.geometry.d2.object.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:

Intersection

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,
) ostk.core.type.String

Get the string representation of an intersection type.

Parameters:

type (Intersection.Type) -- The intersection type.

Returns:

String representation of the type.

Return type:

str

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:

Intersection

Example

>>> undefined_intersection = Intersection.undefined()
>>> undefined_intersection.is_defined()  # False