ostk.mathematics.geometry.d3.object.Cone

class Cone(self: ostk.mathematics.geometry.d3.object.Cone, apex: ostk.mathematics.geometry.d3.object.Point, axis: numpy.ndarray[numpy.float64[3, 1]], angle: ostk::mathematics::geometry::Angle)

Bases: Object

Create a 3D cone with specified apex, axis, and angle.

Parameters:
  • apex (Point) -- The apex (tip) point of the cone.

  • axis (numpy.array) -- The axis direction vector of the cone.

  • angle (Angle) -- The half-angle of the cone opening.

Example

>>> apex = Point(0.0, 0.0, 0.0)
>>> axis = numpy.array([0.0, 0.0, 1.0])
>>> angle = Angle.degrees(30.0)
>>> cone = Cone(apex, axis, angle)

Methods

apply_transformation

Apply a transformation to the cone 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

Overloaded function.

distance_to

Calculate the distance from the cone to a point.

get_angle

Get the half-angle of the cone opening.

get_apex

Get the apex (tip) point of the cone.

get_axis

Get the axis direction vector of the cone.

get_rays_of_lateral_surface

Get rays representing the lateral surface of the cone.

intersection_with

Overloaded function.

intersects

Overloaded function.

is_cone

Check if the object is a cone.

is_defined

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

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

Apply a transformation to the cone in place.

Parameters:

transformation (Transformation) -- The transformation to apply.

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> transformation = Translation([1.0, 2.0, 3.0])
>>> cone.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.Cone, point: ostk.mathematics.geometry.d3.object.Point) -> bool

    Check if the cone contains a point.

    Args:

    point (Point): The point to check.

    Returns:

    bool: True if the cone contains the point, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> cone.contains(Point(0.1, 0.1, 1.0))  # True for point inside cone
    
  2. contains(self: ostk.mathematics.geometry.d3.object.Cone, point_set: ostk.mathematics.geometry.d3.object.PointSet) -> bool

    Check if the cone contains a point set.

    Args:

    point_set (PointSet): The point set to check.

    Returns:

    bool: True if the cone contains the point set, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> cone.contains(PointSet([Point(0.1, 0.1, 1.0), Point(0.2, 0.2, 1.0)]))  # True for points inside cone
    
  3. contains(self: ostk.mathematics.geometry.d3.object.Cone, segment: ostk.mathematics.geometry.d3.object.Segment) -> bool

    Check if the cone contains a segment.

    Args:

    segment (Segment): The segment to check.

    Returns:

    bool: True if the cone contains the segment, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> cone.contains(Segment(Point(0.1, 0.1, 1.0), Point(0.2, 0.2, 1.0)))  # True for segment inside cone
    
  4. contains(self: ostk.mathematics.geometry.d3.object.Cone, ray: ostk.mathematics.geometry.d3.object.Ray) -> bool

    Check if the cone contains a ray.

    Args:

    ray (Ray): The ray to check.

    Returns:

    bool: True if the cone contains the ray, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> cone.contains(Ray(Point(0.1, 0.1, 1.0), numpy.array([0.0, 0.0, 1.0])))  # True for ray inside cone
    
  5. contains(self: ostk.mathematics.geometry.d3.object.Cone, sphere: ostk.mathematics.geometry.d3.object.Sphere) -> bool

    Check if the cone contains a sphere.

    Args:

    sphere (Sphere): The sphere to check.

    Returns:

    bool: True if the cone contains the sphere, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> cone.contains(Sphere(Point(0.1, 0.1, 1.0), 0.1))  # True for sphere inside cone
    
  6. contains(self: ostk.mathematics.geometry.d3.object.Cone, ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid) -> bool

    Check if the cone contains an ellipsoid. Args:

    ellipsoid (Ellipsoid): The ellipsoid to check.

    Returns:

    bool: True if the cone contains the ellipsoid, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> cone.contains(Ellipsoid(Point(0.1, 0.1, 1.0), 0.1, 0.1, 0.1))  # True for ellipsoid inside cone
    
distance_to(
self: ostk.mathematics.geometry.d3.object.Cone,
point: ostk.mathematics.geometry.d3.object.Point,
) ostk.core.type.Real

Calculate the distance from the cone to a point.

Parameters:

point (Point) -- The point to calculate distance to.

Returns:

The minimum distance from the cone surface to the point.

Return type:

float

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> distance = cone.distance_to(Point(2.0, 0.0, 0.0))
get_angle(
self: ostk.mathematics.geometry.d3.object.Cone,
) ostk::mathematics::geometry::Angle

Get the half-angle of the cone opening.

Returns:

The half-angle of the cone.

Return type:

Angle

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> angle = cone.get_angle()  # 30 degrees
get_apex(
self: ostk.mathematics.geometry.d3.object.Cone,
) ostk.mathematics.geometry.d3.object.Point

Get the apex (tip) point of the cone.

Returns:

The apex point of the cone.

Return type:

Point

Example

>>> cone = Cone(Point(1.0, 2.0, 3.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> apex = cone.get_apex()  # Point(1.0, 2.0, 3.0)
get_axis(
self: ostk.mathematics.geometry.d3.object.Cone,
) numpy.ndarray[numpy.float64[3, 1]]

Get the axis direction vector of the cone.

Returns:

The axis direction vector.

Return type:

Vector3d

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> axis = cone.get_axis()  # [0.0, 0.0, 1.0]
get_rays_of_lateral_surface(
self: ostk.mathematics.geometry.d3.object.Cone,
ray_count: int = 0,
) list[ostk.mathematics.geometry.d3.object.Ray]

Get rays representing the lateral surface of the cone.

Parameters:

ray_count (int) -- Number of rays to generate around the surface.

Returns:

Array of Ray objects representing the lateral surface.

Return type:

list

Example

>>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
>>> rays = cone.get_rays_of_lateral_surface(8)
intersection_with(*args, **kwargs)

Overloaded function.

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

    Compute intersection of cone with sphere.

    Args:

    sphere (Sphere): The sphere to intersect with. only_in_sight (bool): If true, only return intersection points that are in sight. discretization_level (int): The discretization level for the intersection.

    Returns:

    Intersection: The intersection of the cone with the sphere.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> sphere = Sphere(Point(2.0, 0.0, 0.0), 1.0)
    >>> intersection = cone.intersection_with(sphere)
    >>> intersection.get_point()  # Point(2.0, 0.0, 0.0)
    
  2. intersection_with(self: ostk.mathematics.geometry.d3.object.Cone, ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid, only_in_sight: bool = False, discretization_level: int = 40) -> ostk::mathematics::geometry::d3::Intersection

    Compute intersection of cone with ellipsoid.

    Args:

    ellipsoid (Ellipsoid): The ellipsoid to intersect with. only_in_sight (bool): If true, only return intersection points that are in sight. discretization_level (int): The discretization level for the intersection.

    Returns:

    Intersection: The intersection of the cone with the ellipsoid.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> ellipsoid = Ellipsoid(Point(2.0, 0.0, 0.0), 1.0, 1.0, 1.0)
    >>> intersection = cone.intersection_with(ellipsoid)
    >>> intersection.get_point()  # Point(2.0, 0.0, 0.0)
    
intersects(*args, **kwargs)

Overloaded function.

  1. intersects(self: ostk.mathematics.geometry.d3.object.Cone, sphere: ostk.mathematics.geometry.d3.object.Sphere, discretization_level: int = 40) -> bool

    Check if the cone intersects with a sphere.

    Args:

    sphere (Sphere): The sphere to check intersection with. discretization_level (int): Level of discretization for intersection calculation.

    Returns:

    bool: True if the cone intersects the sphere, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> sphere = Sphere(Point(1.0, 0.0, 1.0), 0.5)
    >>> cone.intersects(sphere)
    
  2. intersects(self: ostk.mathematics.geometry.d3.object.Cone, ellipsoid: ostk.mathematics.geometry.d3.object.Ellipsoid, discretization_level: int = 40) -> bool

    Check if the cone intersects with an ellipsoid.

    Args:

    ellipsoid (Ellipsoid): The ellipsoid to check intersection with. discretization_level (int): Level of discretization for intersection calculation.

    Returns:

    bool: True if the cone intersects the ellipsoid, False otherwise.

    Example:
    >>> cone = Cone(Point(0.0, 0.0, 0.0), numpy.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
    >>> ellipsoid = Ellipsoid(Point(1.0, 0.0, 1.0), 1.0, 0.8, 0.6)
    >>> cone.intersects(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:

bool

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

Check if the cone is defined.

Returns:

True if the cone is defined, 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))
>>> cone.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_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.Cone

Create an undefined cone.

Returns:

An undefined cone object.

Return type:

Cone

Example

>>> undefined_cone = Cone.undefined()
>>> undefined_cone.is_defined()  # False