ostk.mathematics.geometry.d3.object.PointSet¶
- class PointSet(
- self: ostk.mathematics.geometry.d3.object.PointSet,
- points: list[ostk.mathematics.geometry.d3.object.Point],
Bases:
ObjectA collection of 3D points.
A PointSet is an unordered collection of unique points in 3D space.
Construct a point set from an array of points.
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> point_set.is_defined() # True
Methods
Apply a transformation to all points in the set.
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.
Check if this object contains another object.
Calculate the minimum distance from the point set to a point.
Create an empty point set.
Get the point in the set closest to a given point.
Get the number of points in the set.
Check if this object intersects another object.
Check if the object is a cone.
Check if the point set is defined.
Check if the object is an ellipsoid.
Check if the point set is empty.
Check if the object is a line.
Check if the object is a line string.
Check if another point set is near this one within a tolerance.
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.
- apply_transformation(
- self: ostk.mathematics.geometry.d3.object.PointSet,
- transformation: ostk::mathematics::geometry::d3::Transformation,
Apply a transformation to all points in the set.
- Parameters:
transformation (Transformation) -- The transformation to apply.
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> transformation = Transformation.translation([1.0, 0.0]) >>> point_set.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( ) 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:
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
- distance_to(
- self: ostk.mathematics.geometry.d3.object.PointSet,
- point: ostk.mathematics.geometry.d3.object.Point,
Calculate the minimum distance from the point set to a point.
- Parameters:
point (Point) -- The point to measure distance to.
- Returns:
The minimum distance to any point in the set.
- Return type:
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> point_set.distance_to(Point(0.5, 0.5)) # 0.5
- static empty() ostk.mathematics.geometry.d3.object.PointSet¶
Create an empty point set.
- Returns:
An empty point set.
- Return type:
Example
>>> empty_set = PointSet.empty() >>> empty_set.is_empty() # True >>> empty_set.get_size() # 0
- get_point_closest_to(
- self: ostk.mathematics.geometry.d3.object.PointSet,
- point: ostk.mathematics.geometry.d3.object.Point,
Get the point in the set closest to a given point.
- Parameters:
point (Point) -- The reference point.
- Returns:
The closest point in the set.
- Return type:
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> point_set.get_point_closest_to(Point(0.5, 0.5)) # Point(0.5, 0.5)
- get_size(self: ostk.mathematics.geometry.d3.object.PointSet) int¶
Get the number of points in the set.
- Returns:
The number of points.
- Return type:
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> point_set.get_size() # 2
- intersects( ) bool¶
Check if this object intersects another object.
- Parameters:
object (Object) -- The object to check intersection with.
- Returns:
True if the objects intersect.
- Return type:
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.intersects(other_object) # True
- 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.PointSet) bool¶
Check if the point set is defined.
- Returns:
True if the point set is defined.
- Return type:
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> point_set.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:
- is_empty(self: ostk.mathematics.geometry.d3.object.PointSet) bool¶
Check if the point set is empty.
- Returns:
True if the point set contains no points.
- 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_near(
- self: ostk.mathematics.geometry.d3.object.PointSet,
- point_set: ostk.mathematics.geometry.d3.object.PointSet,
- tolerance: ostk.core.type.Real,
- point_set: ostk.mathematics.geometry.d3.object.PointSet,
Check if another point set is near this one within a tolerance.
- Parameters:
- Returns:
True if the point sets are near each other.
- Return type:
Example
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0)] >>> point_set = PointSet(points) >>> point_set.is_near(PointSet(points), 0.1) # True
- 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: