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,
- base: ostk.mathematics.geometry.d3.object.Polygon,
Bases:
ObjectA 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:
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 a transformation to the pyramid.
Convert the object to a cone.
Convert the object to an ellipsoid.
Convert the object to a line.
Convert the object to a line string.
Convert the object to a plane.
Convert the object to a point.
Convert the object to a point set.
Convert the object to a polygon.
Convert the object to a pyramid.
Convert the object to a ray.
Convert the object to a segment.
Convert the object to a sphere.
Overloaded function.
Get the apex point of the pyramid.
Get the base polygon of the pyramid.
Get the lateral face at a given index.
Get the number of lateral faces.
Get rays from the apex through a specific lateral face.
Get rays from the apex through all lateral faces.
Overloaded function.
Check if the pyramid intersects an ellipsoid.
Check if the object is a cone.
Check if the pyramid is defined.
Check if the object is an ellipsoid.
Check if the object is a line.
Check if the object is a line string.
Check if the object is a plane.
Check if the object is a point.
Check if the object is a point set.
Check if the object is a polygon.
Check if the object is a pyramid.
Check if the object is a ray.
Check if the object is a segment.
Check if the object is a sphere.
Create an undefined pyramid.
- apply_transformation(
- self: ostk.mathematics.geometry.d3.object.Pyramid,
- transformation: ostk::mathematics::geometry::d3::Transformation,
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( ) ostk::mathematics::geometry::d3::object::Cone¶
Convert the object to a cone.
- Returns:
The cone.
- Return type:
- as_ellipsoid( ) ostk::mathematics::geometry::d3::object::Ellipsoid¶
Convert the object to an ellipsoid.
- Returns:
The ellipsoid.
- Return type:
- as_line( ) ostk::mathematics::geometry::d3::object::Line¶
Convert the object to a line.
- Returns:
The line.
- Return type:
- as_line_string( ) ostk::mathematics::geometry::d3::object::LineString¶
Convert the object to a line string.
- Returns:
The line string.
- Return type:
- as_plane( ) ostk::mathematics::geometry::d3::object::Plane¶
Convert the object to a plane.
- Returns:
The plane.
- Return type:
- as_point( ) ostk::mathematics::geometry::d3::object::Point¶
Convert the object to a point.
- Returns:
The point.
- Return type:
- as_point_set( ) ostk::mathematics::geometry::d3::object::PointSet¶
Convert the object to a point set.
- Returns:
The point set.
- Return type:
- as_polygon( ) ostk::mathematics::geometry::d3::object::Polygon¶
Convert the object to a polygon.
- Returns:
The polygon.
- Return type:
- as_pyramid( ) ostk::mathematics::geometry::d3::object::Pyramid¶
Convert the object to a pyramid.
- Returns:
The pyramid.
- Return type:
- as_ray( ) ostk::mathematics::geometry::d3::object::Ray¶
Convert the object to a ray.
- Returns:
The ray.
- Return type:
- as_segment( ) ostk::mathematics::geometry::d3::object::Segment¶
Convert the object to a segment.
- Returns:
The segment.
- Return type:
- as_sphere( ) ostk::mathematics::geometry::d3::object::Sphere¶
Convert the object to a sphere.
- Returns:
The sphere.
- Return type:
- contains(*args, **kwargs)¶
Overloaded function.
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))
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)]))
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)))
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( ) ostk.mathematics.geometry.d3.object.Point¶
Get the apex point of the pyramid.
- Returns:
The apex point.
- Return type:
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( ) ostk.mathematics.geometry.d3.object.Polygon¶
Get the base polygon of the pyramid.
- Returns:
The base polygon.
- Return type:
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,
Get the lateral face at a given index.
- Parameters:
index (int) -- The index of the lateral face.
- Returns:
The lateral face polygon.
- Return type:
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:
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,
- lateral_face_index: int,
Get rays from the apex through a specific lateral face.
- Parameters:
- Returns:
Array of rays.
- Return type:
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,
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:
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.
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))
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,
- ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid,
Check if the pyramid intersects an ellipsoid.
- 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:
- 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:
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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- static undefined() ostk.mathematics.geometry.d3.object.Pyramid¶
Create an undefined pyramid.
- Returns:
An undefined pyramid.
- Return type:
Example
>>> undefined_pyramid = Pyramid.undefined() >>> undefined_pyramid.is_defined() # False