ostk.mathematics.geometry.d3.object.Composite

class Composite(
self: ostk.mathematics.geometry.d3.object.Composite,
object: ostk.mathematics.geometry.d3.Object,
)

Bases: Object

Create a composite object from a single geometric object.

Parameters:

object (Object) -- The geometric object to wrap in the composite.

Example

>>> point = Point(1.0, 2.0, 3.0)
>>> composite = Composite(point)

Methods

access_object_at

Access the object at a specific index in the composite.

apply_transformation

Apply a transformation to all objects in the composite in place.

as_composite

Convert the composite to a Composite object.

as_cone

Convert the composite to a Cone object.

as_ellipsoid

Convert the composite to an Ellipsoid object.

as_line

Convert the composite to a Line object.

as_line_string

Convert the composite to a LineString object.

as_plane

Convert the composite to a Plane object.

as_point

Convert the composite to a Point object.

as_point_set

Convert the composite to a PointSet object.

as_polygon

Convert the composite to a Polygon object.

as_pyramid

Convert the composite to a Pyramid object.

as_ray

Convert the composite to a Ray object.

as_segment

Convert the composite to a Segment object.

as_sphere

Convert the composite to a Sphere object.

contains

Overloaded function.

empty

Create an empty composite (containing no objects).

get_object_count

Get the number of objects contained in the composite.

intersection_with

Overloaded function.

intersects

Overloaded function.

is_composite

Check if the composite contains another Composite object.

is_cone

Check if the composite contains a Cone object.

is_defined

Check if the composite is defined.

is_ellipsoid

Check if the composite contains an Ellipsoid object.

is_empty

Check if the composite is empty (contains no objects).

is_line

Check if the composite contains a Line object.

is_line_string

Check if the composite contains a LineString object.

is_plane

Check if the composite contains a Plane object.

is_point

Check if the composite contains a Point object.

is_point_set

Check if the composite contains a PointSet object.

is_polygon

Check if the composite contains a Polygon object.

is_pyramid

Check if the composite contains a Pyramid object.

is_ray

Check if the composite contains a Ray object.

is_segment

Check if the composite contains a Segment object.

is_sphere

Check if the composite contains a Sphere object.

undefined

Create an undefined composite.

__add__(
self: ostk.mathematics.geometry.d3.object.Composite,
arg0: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Composite
access_object_at(
self: ostk.mathematics.geometry.d3.object.Composite,
index: int,
) ostk.mathematics.geometry.d3.Object

Access the object at a specific index in the composite.

Parameters:

index (int) -- The index of the object to access.

Returns:

Reference to the object at the specified index.

Return type:

Object

Raises:

IndexError -- If the index is out of bounds.

Example

>>> composite = Composite(Point(1.0, 2.0, 3.0))
>>> obj = composite.access_object_at(0)
apply_transformation(
self: ostk.mathematics.geometry.d3.object.Composite,
transformation: ostk::mathematics::geometry::d3::Transformation,
) None

Apply a transformation to all objects in the composite in place.

Parameters:

transformation (Transformation) -- The transformation to apply.

Example

>>> composite = Composite(Point(1.0, 2.0, 3.0))
>>> transformation = Translation([1.0, 1.0, 1.0])
>>> composite.apply_transformation(transformation)
as_composite(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Composite

Convert the composite to a Composite object.

Returns:

The composite object contained in the composite.

Return type:

Composite

Raises:

RuntimeError -- If the composite does not contain a Composite.

Example

>>> inner_composite = Composite(Point(1.0, 2.0, 3.0))
>>> outer_composite = Composite(inner_composite)
>>> extracted_composite = outer_composite.as_composite()
as_cone(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Cone

Convert the composite to a Cone object.

Returns:

The cone object contained in the composite.

Return type:

Cone

Raises:

RuntimeError -- If the composite does not contain a Cone.

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> composite = Composite(cone)
>>> extracted_cone = composite.as_cone()
as_ellipsoid(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Ellipsoid

Convert the composite to an Ellipsoid object.

Returns:

The ellipsoid object contained in the composite.

Return type:

Ellipsoid

Raises:

RuntimeError -- If the composite does not contain an Ellipsoid.

Example

>>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 0.8, 0.6)
>>> composite = Composite(ellipsoid)
>>> extracted_ellipsoid = composite.as_ellipsoid()
as_line(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Line

Convert the composite to a Line object.

Returns:

The line object contained in the composite.

Return type:

Line

Raises:

RuntimeError -- If the composite does not contain a Line.

Example

>>> line = Line(Point(0.0, 0.0, 0.0), numpy.array([1.0, 0.0, 0.0]))
>>> composite = Composite(line)
>>> extracted_line = composite.as_line()
as_line_string(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.LineString

Convert the composite to a LineString object.

Returns:

The line string object contained in the composite.

Return type:

LineString

Raises:

RuntimeError -- If the composite does not contain a LineString.

Example

>>> points = [Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0), Point(2.0, 2.0, 2.0)]
>>> line_string = LineString(points)
>>> composite = Composite(line_string)
>>> extracted_line_string = composite.as_line_string()
as_plane(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Plane

Convert the composite to a Plane object.

Returns:

The plane object contained in the composite.

Return type:

Plane

Raises:

RuntimeError -- If the composite does not contain a Plane.

Example

>>> plane = Plane(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]))
>>> composite = Composite(plane)
>>> extracted_plane = composite.as_plane()
as_point(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Point

Convert the composite to a Point object.

Returns:

The point object contained in the composite.

Return type:

Point

Raises:

RuntimeError -- If the composite does not contain a Point.

Example

>>> composite = Composite(Point(1.0, 2.0, 3.0))
>>> point = composite.as_point()
as_point_set(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.PointSet

Convert the composite to a PointSet object.

Returns:

The point set object contained in the composite.

Return type:

PointSet

Raises:

RuntimeError -- If the composite does not contain a PointSet.

Example

>>> point_set = PointSet([Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)])
>>> composite = Composite(point_set)
>>> extracted_set = composite.as_point_set()
as_polygon(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Polygon

Convert the composite to a Polygon object.

Returns:

The polygon object contained in the composite.

Return type:

Polygon

Raises:

RuntimeError -- If the composite does not contain a Polygon.

Example

>>> vertices = [Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)]
>>> polygon = Polygon(vertices)
>>> composite = Composite(polygon)
>>> extracted_polygon = composite.as_polygon()
as_pyramid(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Pyramid

Convert the composite to a Pyramid object.

Returns:

The pyramid object contained in the composite.

Return type:

Pyramid

Raises:

RuntimeError -- If the composite does not contain a Pyramid.

Example

>>> apex = Point(0.0, 0.0, 1.0)
>>> base = Polygon([Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)])
>>> pyramid = Pyramid(base, apex)
>>> composite = Composite(pyramid)
>>> extracted_pyramid = composite.as_pyramid()
as_ray(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Ray

Convert the composite to a Ray object.

Returns:

The ray object contained in the composite.

Return type:

Ray

Raises:

RuntimeError -- If the composite does not contain a Ray.

Example

>>> ray = Ray(Point(0.0, 0.0, 0.0), numpy.array([1.0, 0.0, 0.0]))
>>> composite = Composite(ray)
>>> extracted_ray = composite.as_ray()
as_segment(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Segment

Convert the composite to a Segment object.

Returns:

The segment object contained in the composite.

Return type:

Segment

Raises:

RuntimeError -- If the composite does not contain a Segment.

Example

>>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
>>> composite = Composite(segment)
>>> extracted_segment = composite.as_segment()
as_sphere(
self: ostk.mathematics.geometry.d3.object.Composite,
) ostk.mathematics.geometry.d3.object.Sphere

Convert the composite to a Sphere object.

Returns:

The sphere object contained in the composite.

Return type:

Sphere

Raises:

RuntimeError -- If the composite does not contain a Sphere.

Example

>>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
>>> composite = Composite(sphere)
>>> extracted_sphere = composite.as_sphere()
contains(*args, **kwargs)

Overloaded function.

  1. contains(self: ostk.mathematics.geometry.d3.object.Composite, object: ostk.mathematics.geometry.d3.Object) -> bool

    Check if the composite contains another geometric object.

    Args:

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

    Returns:

    bool: True if the composite contains the object, False otherwise.

    Example:
    >>> composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 2.0))
    >>> point = Point(0.5, 0.0, 0.0)
    >>> composite.contains(point)  # True
    
  2. contains(self: ostk.mathematics.geometry.d3.object.Composite, composite: ostk.mathematics.geometry.d3.object.Composite) -> bool

    Check if the composite contains another composite.

    Args:

    composite (Composite): The composite to check containment for.

    Returns:

    bool: True if this composite contains the other composite, False otherwise.

    Example:
    >>> outer_composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 2.0))
    >>> inner_composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
    >>> outer_composite.contains(inner_composite)  # True
    
static empty() ostk.mathematics.geometry.d3.object.Composite

Create an empty composite (containing no objects).

Returns:

An empty composite object.

Return type:

Composite

Example

>>> empty_composite = Composite.empty()
>>> empty_composite.is_empty()  # True
>>> empty_composite.get_object_count()  # 0
get_object_count(self: ostk.mathematics.geometry.d3.object.Composite) int

Get the number of objects contained in the composite.

Returns:

The number of objects in the composite.

Return type:

int

Example

>>> composite = Composite(Point(1.0, 2.0, 3.0))
>>> count = composite.get_object_count()  # 1
intersection_with(*args, **kwargs)

Overloaded function.

  1. intersection_with(self: ostk.mathematics.geometry.d3.object.Composite, object: ostk.mathematics.geometry.d3.Object) -> ostk::mathematics::geometry::d3::Intersection

    Compute the intersection of the composite with another geometric object.

    Args:

    object (Object): The object to compute intersection with.

    Returns:

    Intersection: The intersection result.

    Example:
    >>> composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
    >>> line = Line(Point(-2.0, 0.0, 0.0), numpy.array([1.0, 0.0, 0.0]))
    >>> intersection = composite.intersection_with(line)
    
  2. intersection_with(self: ostk.mathematics.geometry.d3.object.Composite, composite: ostk.mathematics.geometry.d3.object.Composite) -> ostk::mathematics::geometry::d3::Intersection

    Compute the intersection of the composite with another composite.

    Args:

    composite (Composite): The composite to compute intersection with.

    Returns:

    Intersection: The intersection result.

    Example:
    >>> composite1 = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
    >>> composite2 = Composite(Sphere(Point(1.5, 0.0, 0.0), 1.0))
    >>> intersection = composite1.intersection_with(composite2)
    
intersects(*args, **kwargs)

Overloaded function.

  1. intersects(self: ostk.mathematics.geometry.d3.object.Composite, object: ostk.mathematics.geometry.d3.Object) -> bool

    Check if the composite intersects with another geometric object.

    Args:

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

    Returns:

    bool: True if the composite intersects the object, False otherwise.

    Example:
    >>> composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
    >>> point = Point(0.5, 0.0, 0.0)
    >>> composite.intersects(point)  # True
    
  2. intersects(self: ostk.mathematics.geometry.d3.object.Composite, composite: ostk.mathematics.geometry.d3.object.Composite) -> bool

    Check if the composite intersects with another composite.

    Args:

    composite (Composite): The composite to check intersection with.

    Returns:

    bool: True if the composites intersect, False otherwise.

    Example:
    >>> composite1 = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
    >>> composite2 = Composite(Sphere(Point(1.5, 0.0, 0.0), 1.0))
    >>> composite1.intersects(composite2)  # True
    
is_composite(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains another Composite object.

Returns:

True if the composite contains a Composite, False otherwise.

Return type:

bool

Example

>>> inner_composite = Composite(Point(1.0, 2.0, 3.0))
>>> outer_composite = Composite(inner_composite)
>>> outer_composite.is_composite()  # True
is_cone(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Cone object.

Returns:

True if the composite contains a Cone, False otherwise.

Return type:

bool

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> composite = Composite(cone)
>>> composite.is_cone()  # True
is_defined(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite is defined.

Returns:

True if the composite is defined, False otherwise.

Return type:

bool

Example

>>> composite = Composite(Point(1.0, 2.0, 3.0))
>>> composite.is_defined()  # True
is_ellipsoid(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains an Ellipsoid object.

Returns:

True if the composite contains an Ellipsoid, False otherwise.

Return type:

bool

Example

>>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 0.8, 0.6)
>>> composite = Composite(ellipsoid)
>>> composite.is_ellipsoid()  # True
is_empty(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite is empty (contains no objects).

Returns:

True if the composite is empty, False otherwise.

Return type:

bool

Example

>>> empty_composite = Composite.empty()
>>> empty_composite.is_empty()  # True
is_line(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Line object.

Returns:

True if the composite contains a Line, False otherwise.

Return type:

bool

Example

>>> line = Line(Point(0.0, 0.0, 0.0), numpy.array([1.0, 0.0, 0.0]))
>>> composite = Composite(line)
>>> composite.is_line()  # True
is_line_string(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a LineString object.

Returns:

True if the composite contains a LineString, False otherwise.

Return type:

bool

Example

>>> points = [Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0), Point(2.0, 2.0, 2.0)]
>>> line_string = LineString(points)
>>> composite = Composite(line_string)
>>> composite.is_line_string()  # True
is_plane(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Plane object.

Returns:

True if the composite contains a Plane, False otherwise.

Return type:

bool

Example

>>> plane = Plane(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]))
>>> composite = Composite(plane)
>>> composite.is_plane()  # True
is_point(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Point object.

Returns:

True if the composite contains a Point, False otherwise.

Return type:

bool

Example

>>> composite = Composite(Point(1.0, 2.0, 3.0))
>>> composite.is_point()  # True
is_point_set(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a PointSet object.

Returns:

True if the composite contains a PointSet, False otherwise.

Return type:

bool

Example

>>> point_set = PointSet([Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)])
>>> composite = Composite(point_set)
>>> composite.is_point_set()  # True
is_polygon(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Polygon object.

Returns:

True if the composite contains a Polygon, False otherwise.

Return type:

bool

Example

>>> vertices = [Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)]
>>> polygon = Polygon(vertices)
>>> composite = Composite(polygon)
>>> composite.is_polygon()  # True
is_pyramid(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Pyramid object.

Returns:

True if the composite contains a Pyramid, False otherwise.

Return type:

bool

Example

>>> apex = Point(0.0, 0.0, 1.0)
>>> base = Polygon([Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)])
>>> pyramid = Pyramid(base, apex)
>>> composite = Composite(pyramid)
>>> composite.is_pyramid()  # True
is_ray(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Ray object.

Returns:

True if the composite contains a Ray, False otherwise.

Return type:

bool

Example

>>> ray = Ray(Point(0.0, 0.0, 0.0), numpy.array([1.0, 0.0, 0.0]))
>>> composite = Composite(ray)
>>> composite.is_ray()  # True
is_segment(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Segment object.

Returns:

True if the composite contains a Segment, False otherwise.

Return type:

bool

Example

>>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
>>> composite = Composite(segment)
>>> composite.is_segment()  # True
is_sphere(self: ostk.mathematics.geometry.d3.object.Composite) bool

Check if the composite contains a Sphere object.

Returns:

True if the composite contains a Sphere, False otherwise.

Return type:

bool

Example

>>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
>>> composite = Composite(sphere)
>>> composite.is_sphere()  # True
static undefined() ostk.mathematics.geometry.d3.object.Composite

Create an undefined composite.

Returns:

An undefined composite object.

Return type:

Composite

Example

>>> undefined_composite = Composite.undefined()
>>> undefined_composite.is_defined()  # False