ostk.mathematics.geometry.d2.Object

class Object

Bases: pybind11_object

Methods

apply_transformation

Apply a transformation to the 2D object in place.

contains

Check if this 2D object contains another object.

intersects

Check if this 2D object intersects with another object.

is_defined

Check if the 2D object is defined.

class Format(self: ostk.mathematics.geometry.d2.Object.Format, value: int)

Bases: pybind11_object

Members:

Undefined

Standard

WKT

property name
apply_transformation(
self: ostk.mathematics.geometry.d2.Object,
transformation: ostk::mathematics::geometry::d2::Transformation,
) None

Apply a transformation to the 2D object in place.

Parameters:

transformation (Transformation) -- The 2D transformation to apply.

Example

>>> point = Point(1.0, 2.0)
>>> transformation = Translation([1.0, 1.0])
>>> point.apply_transformation(transformation)
contains(
self: ostk.mathematics.geometry.d2.Object,
object: ostk.mathematics.geometry.d2.Object,
) bool

Check if this 2D object contains another object.

Parameters:

object (Object) -- The object to check containment for.

Returns:

True if this object contains the other, False otherwise.

Return type:

bool

Example

>>> polygon = Polygon([Point(0.0, 0.0), Point(2.0, 0.0), Point(2.0, 2.0)])
>>> point = Point(1.0, 1.0)
>>> polygon.contains(point)  # True
intersects(
self: ostk.mathematics.geometry.d2.Object,
object: ostk.mathematics.geometry.d2.Object,
) bool

Check if this 2D object intersects with another object.

Parameters:

object (Object) -- The object to check intersection with.

Returns:

True if objects intersect, False otherwise.

Return type:

bool

Example

>>> line1 = Line(Point(0.0, 0.0), numpy.array([1.0, 0.0]))
>>> line2 = Line(Point(0.0, -1.0), numpy.array([0.0, 1.0]))
>>> line1.intersects(line2)  # True
is_defined(self: ostk.mathematics.geometry.d2.Object) bool

Check if the 2D object is defined.

Returns:

True if the object is defined, False otherwise.

Return type:

bool

Example

>>> point = Point(1.0, 2.0)
>>> point.is_defined()  # True