ostk.mathematics.geometry.d3.object.Pyramid

class Pyramid(
self: ostk.mathematics.geometry.d3.object.Pyramid,
base: ostk.mathematics.geometry.d3.object.Polygon,
apex: ostk.mathematics.geometry.d3.object.Point,
)

Bases: Object

A pyramid in 3D space.

A Pyramid is defined by a polygonal base and an apex point, with triangular lateral faces connecting the base edges to the apex.

Construct a pyramid from a base polygon and apex point.

Parameters:
  • base (Polygon) -- The polygonal base of the pyramid.

  • apex (Point) -- The apex point of the pyramid.

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)

Methods

apply_transformation

Apply a transformation to the pyramid.

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

Overloaded function.

get_apex

Get the apex point of the pyramid.

get_base

Get the base polygon of the pyramid.

get_lateral_face_at

Get the lateral face at a given index.

get_lateral_face_count

Get the number of lateral faces.

get_rays_of_lateral_face_at

Get rays from the apex through a specific lateral face.

get_rays_of_lateral_faces

Get rays from the apex through all lateral faces.

intersection_with

Overloaded function.

intersects

Check if the pyramid intersects an ellipsoid.

is_cone

Check if the object is a cone.

is_defined

Check if the pyramid 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_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 pyramid.

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

Apply a transformation to the pyramid.

Parameters:

transformation (Transformation) -- The transformation to apply.

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> transformation = Transformation.identity()
>>> pyramid.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(*args, **kwargs)

Overloaded function.

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

    Check if the pyramid contains a point.

    Args:

    point (Point): The point to check.

    Returns:

    bool: True if the pyramid contains the point.

    Example:
    >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
    >>> apex = Point(0.0, 0.0, 1.0)
    >>> pyramid = Pyramid(base, apex)
    >>> pyramid.contains(Point(0.5, 0.5, 0.5))
    
  2. contains(self: ostk.mathematics.geometry.d3.object.Pyramid, point_set: ostk.mathematics.geometry.d3.object.PointSet) -> bool

    Check if the pyramid contains all points in a point set.

    Args:

    point_set (PointSet): The point set to check.

    Returns:

    bool: True if the pyramid contains all points.

    Example:
    >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
    >>> apex = Point(0.0, 0.0, 1.0)
    >>> pyramid = Pyramid(base, apex)
    >>> pyramid.contains(PointSet([Point(0.5, 0.5, 0.5), Point(0.6, 0.6, 0.6)]))
    
  3. contains(self: ostk.mathematics.geometry.d3.object.Pyramid, segment: ostk.mathematics.geometry.d3.object.Segment) -> bool

    Check if the pyramid contains a segment.

    Args:

    segment (Segment): The segment to check.

    Returns:

    bool: True if the pyramid contains the segment.

    Example:
    >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
    >>> apex = Point(0.0, 0.0, 1.0)
    >>> pyramid = Pyramid(base, apex)
    >>> pyramid.contains(Segment(Point(0.5, 0.5, 0.5), Point(0.6, 0.6, 0.6)))
    
  4. contains(self: ostk.mathematics.geometry.d3.object.Pyramid, ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid) -> bool

    Check if the pyramid contains an ellipsoid.

    Args:

    ellipsoid (Ellipsoid): The ellipsoid to check.

    Returns:

    bool: True if the pyramid contains the ellipsoid.

    Example:
    >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
    >>> apex = Point(0.0, 0.0, 1.0)
    >>> pyramid = Pyramid(base, apex)
    >>> pyramid.contains(Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 1.0, 1.0))
    
get_apex(
self: ostk.mathematics.geometry.d3.object.Pyramid,
) ostk.mathematics.geometry.d3.object.Point

Get the apex point of the pyramid.

Returns:

The apex point.

Return type:

Point

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.get_apex()
get_base(
self: ostk.mathematics.geometry.d3.object.Pyramid,
) ostk.mathematics.geometry.d3.object.Polygon

Get the base polygon of the pyramid.

Returns:

The base polygon.

Return type:

Polygon

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.get_base()
get_lateral_face_at(
self: ostk.mathematics.geometry.d3.object.Pyramid,
index: int,
) ostk.mathematics.geometry.d3.object.Polygon

Get the lateral face at a given index.

Parameters:

index (int) -- The index of the lateral face.

Returns:

The lateral face polygon.

Return type:

Polygon

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.get_lateral_face_at(0)
get_lateral_face_count(self: ostk.mathematics.geometry.d3.object.Pyramid) int

Get the number of lateral faces.

Returns:

The number of lateral faces.

Return type:

int

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.get_lateral_face_count()
get_rays_of_lateral_face_at(
self: ostk.mathematics.geometry.d3.object.Pyramid,
lateral_face_index: int,
ray_count: int = 2,
) list[ostk.mathematics.geometry.d3.object.Ray]

Get rays from the apex through a specific lateral face.

Parameters:
  • lateral_face_index (int) -- The index of the lateral face.

  • ray_count (int) -- The number of rays to generate (default: 2).

Returns:

Array of rays.

Return type:

list[Ray]

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.get_rays_of_lateral_face_at(0)
get_rays_of_lateral_faces(
self: ostk.mathematics.geometry.d3.object.Pyramid,
ray_count: int = 0,
) list[ostk.mathematics.geometry.d3.object.Ray]

Get rays from the apex through all lateral faces.

Parameters:

ray_count (int, optional) -- The number of rays per face. Defaults to 0.

Returns:

Array of rays.

Return type:

list[Ray]

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.get_rays_of_lateral_faces(ray_count=1)
intersection_with(*args, **kwargs)

Overloaded function.

  1. intersection_with(self: ostk.mathematics.geometry.d3.object.Pyramid, sphere: ostk.mathematics.geometry.d3.object.Sphere, only_in_sight: bool = False, discretization_level: int = 40) -> ostk::mathematics::geometry::d3::Intersection

    Compute the intersection of the pyramid with a sphere.

    Args:

    sphere (Sphere): The sphere to intersect with. only_in_sight (bool): Only compute intersection in sight of the apex. discretization_level (int): The level of discretization for the computation.

    Returns:

    Intersection: The intersection result.

    Example:
    >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
    >>> apex = Point(0.0, 0.0, 1.0)
    >>> pyramid = Pyramid(base, apex)
    >>> pyramid.intersection_with(Sphere(Point(0.0, 0.0, 0.0), 1.0))
    
  2. intersection_with(self: ostk.mathematics.geometry.d3.object.Pyramid, ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid, only_in_sight: bool = False, discretization_level: int = 40) -> ostk::mathematics::geometry::d3::Intersection

    Compute the intersection of the pyramid with an ellipsoid.

    Args:

    ellipsoid (Ellipsoid): The ellipsoid to intersect with. only_in_sight (bool): Only compute intersection in sight of the apex. discretization_level (int): The level of discretization for the computation.

    Returns:

    Intersection: The intersection result.

    Example:
    >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
    >>> apex = Point(0.0, 0.0, 1.0)
    >>> pyramid = Pyramid(base, apex)
    >>> pyramid.intersection_with(Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 1.0, 1.0))
    
intersects(
self: ostk.mathematics.geometry.d3.object.Pyramid,
ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid,
discretization_level: int = 40,
) bool

Check if the pyramid intersects an ellipsoid.

Parameters:
  • ellipsoid (Ellipsoid) -- The ellipsoid to check intersection with.

  • discretization_level (int) -- The level of discretization for the check.

Returns:

True if the pyramid intersects the ellipsoid.

Return type:

bool

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.Pyramid) bool

Check if the pyramid is defined.

Returns:

True if the pyramid is defined.

Return type:

bool

Example

>>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
>>> apex = Point(0.0, 0.0, 1.0)
>>> pyramid = Pyramid(base, apex)
>>> pyramid.is_defined()
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_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.Pyramid

Create an undefined pyramid.

Returns:

An undefined pyramid.

Return type:

Pyramid

Example

>>> undefined_pyramid = Pyramid.undefined()
>>> undefined_pyramid.is_defined()  # False