ostk.mathematics.geometry.d3.object.Cuboid

class Cuboid(
self: ostk.mathematics.geometry.d3.object.Cuboid,
center: ostk.mathematics.geometry.d3.object.Point,
axes: list,
extent: list,
)

Bases: Object

Create a 3D cuboid with specified center, axes, and extents.

Parameters:
  • center (Point) -- The center point of the cuboid.

  • axes (list) -- List of three Vector3d objects defining the cuboid's orientation.

  • extent (list) -- List of three float values defining the half-extents along each axis.

Example

>>> center = Point(0.0, 0.0, 0.0)
>>> axes = [numpy.array([1.0, 0.0, 0.0]), numpy.array([0.0, 1.0, 0.0]), numpy.array([0.0, 0.0, 1.0])]
>>> extent = [1.0, 2.0, 3.0]
>>> cuboid = Cuboid(center, axes, extent)

Methods

apply_transformation

Apply a transformation to the cuboid in place.

as_cone

Convert the object to a cone.

as_ellipsoid

Convert the object to an ellipsoid.

as_line

Convert the object to a line.

as_line_string

Convert the object to a line string.

as_plane

Convert the object to a plane.

as_point

Convert the object to a point.

as_point_set

Convert the object to a point set.

as_polygon

Convert the object to a polygon.

as_pyramid

Convert the object to a pyramid.

as_ray

Convert the object to a ray.

as_segment

Convert the object to a segment.

as_sphere

Convert the object to a sphere.

contains

Check if this object contains another object.

cube

Create a cube (equal extents along all axes) centered at a point.

get_center

Get the center point of the cuboid.

get_first_axis

Get the first axis vector of the cuboid.

get_first_extent

Get the first half-extent of the cuboid.

get_second_axis

Get the second axis vector of the cuboid.

get_second_extent

Get the second half-extent of the cuboid.

get_third_axis

Get the third axis vector of the cuboid.

get_third_extent

Get the third half-extent of the cuboid.

get_vertices

Get all vertices of the cuboid.

intersects

Overloaded function.

is_cone

Check if the object is a cone.

is_defined

Check if the cuboid is defined.

is_ellipsoid

Check if the object is an ellipsoid.

is_line

Check if the object is a line.

is_line_string

Check if the object is a line string.

is_near

Check if this cuboid is near another cuboid.

is_plane

Check if the object is a plane.

is_point

Check if the object is a point.

is_point_set

Check if the object is a point set.

is_polygon

Check if the object is a polygon.

is_pyramid

Check if the object is a pyramid.

is_ray

Check if the object is a ray.

is_segment

Check if the object is a segment.

is_sphere

Check if the object is a sphere.

undefined

Create an undefined cuboid.

apply_transformation(
self: ostk.mathematics.geometry.d3.object.Cuboid,
transformation: ostk::mathematics::geometry::d3::Transformation,
) None

Apply a transformation to the cuboid in place.

Parameters:

transformation (Transformation) -- The transformation to apply.

Example

>>> cuboid = Cuboid(center, axes, extent)
>>> transformation = Translation([1.0, 2.0, 3.0])
>>> cuboid.apply_transformation(transformation)
as_cone(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Cone

Convert the object to a cone.

Returns:

The cone.

Return type:

Cone

as_ellipsoid(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Ellipsoid

Convert the object to an ellipsoid.

Returns:

The ellipsoid.

Return type:

Ellipsoid

as_line(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Line

Convert the object to a line.

Returns:

The line.

Return type:

Line

as_line_string(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::LineString

Convert the object to a line string.

Returns:

The line string.

Return type:

LineString

as_plane(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Plane

Convert the object to a plane.

Returns:

The plane.

Return type:

Plane

as_point(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Point

Convert the object to a point.

Returns:

The point.

Return type:

Point

as_point_set(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::PointSet

Convert the object to a point set.

Returns:

The point set.

Return type:

PointSet

as_polygon(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Polygon

Convert the object to a polygon.

Returns:

The polygon.

Return type:

Polygon

as_pyramid(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Pyramid

Convert the object to a pyramid.

Returns:

The pyramid.

Return type:

Pyramid

as_ray(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Ray

Convert the object to a ray.

Returns:

The ray.

Return type:

Ray

as_segment(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Segment

Convert the object to a segment.

Returns:

The segment.

Return type:

Segment

as_sphere(
self: ostk.mathematics.geometry.d3.Object,
) ostk::mathematics::geometry::d3::object::Sphere

Convert the object to a sphere.

Returns:

The sphere.

Return type:

Sphere

contains(
self: ostk.mathematics.geometry.d3.Object,
arg0: ostk.mathematics.geometry.d3.Object,
) bool

Check if this object contains another object.

Parameters:

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

Returns:

True if this object contains the other object.

Return type:

bool

Example

>>> object = Cone(Point(1.0, 2.0, 3.0), [0.0, 0.0, 1.0], Angle.degrees(30.0))
>>> other_object = Point(1.0, 2.0, 3.1)
>>> object.contains(other_object)  # True
static cube(
center: ostk.mathematics.geometry.d3.object.Point,
extent: ostk.core.type.Real,
) ostk.mathematics.geometry.d3.object.Cuboid

Create a cube (equal extents along all axes) centered at a point.

Parameters:
  • center (Point) -- The center point of the cube.

  • extent (float) -- The half-extent along all axes.

Returns:

A cuboid representing a cube.

Return type:

Cuboid

Example

>>> center = Point(0.0, 0.0, 0.0)
>>> cube = Cuboid.cube(center, 1.0)  # 2x2x2 cube
get_center(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) ostk.mathematics.geometry.d3.object.Point

Get the center point of the cuboid.

Returns:

The center point of the cuboid.

Return type:

Point

Example

>>> cuboid = Cuboid(Point(1.0, 2.0, 3.0), axes, extent)
>>> center = cuboid.get_center()  # Point(1.0, 2.0, 3.0)
get_first_axis(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) numpy.ndarray[numpy.float64[3, 1]]

Get the first axis vector of the cuboid.

Returns:

The first axis direction vector.

Return type:

Vector3d

Example

>>> cuboid = Cuboid(center, axes, extent)
>>> first_axis = cuboid.get_first_axis()
get_first_extent(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) ostk.core.type.Real

Get the first half-extent of the cuboid.

Returns:

The half-extent along the first axis.

Return type:

float

Example

>>> cuboid = Cuboid(center, axes, [1.0, 2.0, 3.0])
>>> first_extent = cuboid.get_first_extent()  # 1.0
get_second_axis(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) numpy.ndarray[numpy.float64[3, 1]]

Get the second axis vector of the cuboid.

Returns:

The second axis direction vector.

Return type:

Vector3d

Example

>>> cuboid = Cuboid(center, axes, extent)
>>> second_axis = cuboid.get_second_axis()
get_second_extent(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) ostk.core.type.Real

Get the second half-extent of the cuboid.

Returns:

The half-extent along the second axis.

Return type:

float

Example

>>> cuboid = Cuboid(center, axes, [1.0, 2.0, 3.0])
>>> second_extent = cuboid.get_second_extent()  # 2.0
get_third_axis(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) numpy.ndarray[numpy.float64[3, 1]]

Get the third axis vector of the cuboid.

Returns:

The third axis direction vector.

Return type:

Vector3d

Example

>>> cuboid = Cuboid(center, axes, extent)
>>> third_axis = cuboid.get_third_axis()
get_third_extent(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) ostk.core.type.Real

Get the third half-extent of the cuboid.

Returns:

The half-extent along the third axis.

Return type:

float

Example

>>> cuboid = Cuboid(center, axes, [1.0, 2.0, 3.0])
>>> third_extent = cuboid.get_third_extent()  # 3.0
get_vertices(
self: ostk.mathematics.geometry.d3.object.Cuboid,
) list[ostk.mathematics.geometry.d3.object.Point]

Get all vertices of the cuboid.

Returns:

Array of Point objects representing the 8 vertices of the cuboid.

Return type:

list

Example

>>> cuboid = Cuboid(center, axes, extent)
>>> vertices = cuboid.get_vertices()  # 8 corner points
intersects(*args, **kwargs)

Overloaded function.

  1. intersects(self: ostk.mathematics.geometry.d3.object.Cuboid, point: ostk.mathematics.geometry.d3.object.Point) -> bool

    Check if the cuboid intersects a point.

    Args:

    point (Point): The point to check.

    Returns:

    bool: True if the cuboid intersects the point, False otherwise.

    Example:
    >>> cuboid = Cuboid(Point(0.0, 0.0, 0.0), axes, extent)
    >>> cuboid.intersects(Point(1.0, 2.0, 3.0))  # True
    
  2. intersects(self: ostk.mathematics.geometry.d3.object.Cuboid, point_set: ostk.mathematics.geometry.d3.object.PointSet) -> bool

    Check if the cuboid intersects a point set.

    Args:

    point_set (PointSet): The point set to check.

    Returns:

    bool: True if the cuboid intersects the point set, False otherwise.

    Example:
    >>> cuboid = Cuboid(Point(0.0, 0.0, 0.0), axes, extent)
    >>> cuboid.intersects(PointSet([Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)]))  # True
    
  3. intersects(self: ostk.mathematics.geometry.d3.object.Cuboid, line: ostk.mathematics.geometry.d3.object.Line) -> bool

    Check if the cuboid intersects a line.

    Args:

    line (Line): The line to check.

    Returns:

    bool: True if the cuboid intersects the line, False otherwise.

    Example:
    >>> cuboid = Cuboid(Point(0.0, 0.0, 0.0), axes, extent)
    >>> cuboid.intersects(Line(Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)))  # True
    
  4. intersects(self: ostk.mathematics.geometry.d3.object.Cuboid, cuboid: ostk.mathematics.geometry.d3.object.Cuboid) -> bool

    Check if the cuboid intersects a cuboid.

    Args:

    cuboid (Cuboid): The cuboid to check.

    Returns:

    bool: True if the cuboid intersects the cuboid, False otherwise.

is_cone(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a cone.

Returns:

True if the object is a cone.

Return type:

bool

is_defined(self: ostk.mathematics.geometry.d3.object.Cuboid) bool

Check if the cuboid is defined.

Returns:

True if the cuboid is defined, False otherwise.

Return type:

bool

Example

>>> cuboid = Cuboid(center, axes, extent)
>>> cuboid.is_defined()  # True
is_ellipsoid(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is an ellipsoid.

Returns:

True if the object is an ellipsoid.

Return type:

bool

is_line(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a line.

Returns:

True if the object is a line.

Return type:

bool

is_line_string(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a line string.

Returns:

True if the object is a line string.

Return type:

bool

is_near(
self: ostk.mathematics.geometry.d3.object.Cuboid,
arg0: ostk.mathematics.geometry.d3.object.Cuboid,
arg1: ostk.core.type.Real,
) bool

Check if this cuboid is near another cuboid.

Parameters:
  • cuboid (Cuboid) -- The cuboid to compare with.

  • tolerance (float) -- The tolerance for comparison.

Returns:

True if cuboids are within tolerance, False otherwise.

Return type:

bool

Example

>>> cuboid1 = Cuboid(center1, axes1, extent1)
>>> cuboid2 = Cuboid(center2, axes2, extent2)
>>> cuboid1.is_near(cuboid2, 1e-6)
is_plane(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a plane.

Returns:

True if the object is a plane.

Return type:

bool

is_point(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a point.

Returns:

True if the object is a point.

Return type:

bool

is_point_set(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a point set.

Returns:

True if the object is a point set.

Return type:

bool

is_polygon(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a polygon.

Returns:

True if the object is a polygon.

Return type:

bool

is_pyramid(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a pyramid.

Returns:

True if the object is a pyramid.

Return type:

bool

is_ray(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a ray.

Returns:

True if the object is a ray.

Return type:

bool

is_segment(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a segment.

Returns:

True if the object is a segment.

Return type:

bool

is_sphere(self: ostk.mathematics.geometry.d3.Object) bool

Check if the object is a sphere.

Returns:

True if the object is a sphere.

Return type:

bool

static undefined() ostk.mathematics.geometry.d3.object.Cuboid

Create an undefined cuboid.

Returns:

An undefined cuboid object.

Return type:

Cuboid

Example

>>> undefined_cuboid = Cuboid.undefined()
>>> undefined_cuboid.is_defined()  # False