Cloud¶
Cloud of points classes.
- class design3d.cloud.PointCloud2D(points, name: str = '')[source]¶
Bases:
object
Point Cloud2D class.
- Parameters:
points – list of points for point cloud.
- class design3d.cloud.PointCloud3D(points: List[Point3D], name: str = '')[source]¶
Bases:
object
Point Cloud3D, a list of points.
- Parameters:
points – a list of points.
- property bounding_box¶
Property to get the bounding box of the point cloud.
- Returns:
Bounding box object.
- static check_area_polygon(initial_polygons2d, position_plane, normal, vec1, vec2)[source]¶
Checks and processes area of polygons.
- Parameters:
initial_polygons2d – List of 2D polygons.
position_plane – Position of planes.
normal – Normal vector.
vec1 – Vector 1.
vec2 – Vector 2.
- Returns:
List of processed 3D polygons.
- determine_extrusion_vector()[source]¶
Determines the extrusion vector based on the bounding box.
- Returns:
Tuple containing position, normal, vec1, and vec2.
- extract(u, umin, umax)[source]¶
Extracts a subset of points within a given range from a plane.
- Parameters:
u – Normal vector of the plane.
umin – Minimum distance to the plane.
umax – Maximum distance to the plane.
- Returns:
PointCloud3D object containing the extracted points.
- classmethod from_step(step_file: str, name: str = '')[source]¶
Creates a cloud of points from a step file.
- Parameters:
step_file – step file.
name – object’s name.
- Returns:
Point Cloud 3D.
- classmethod from_stl(file_path, name: str = 'from_stl')[source]¶
Creates a point cloud 3d from a stl file.
- Parameters:
file_path – path to stl file.
name – object’s name.
- Returns:
point cloud 3d object.
- classmethod generate_shell(polygons_3d: List[ClosedPolygon3D], normal: Vector3D, vec1: Vector3D, vec2: Vector3D, name: str = '')[source]¶
Generates a shell from a list of polygon 3d, using a sewing algorithm.
- Parameters:
polygons_3d – list of polygon 3d to be sewed.
normal – normal to the sewing plane.
vec1 – u vector in the sewing plane.
vec2 – v vector in the sewing plane.
name – object’s name.
- Returns:
return a shell.
- static offset_to_shell(positions_plane: List[Plane3D], polygons2d: List[ClosedPolygon2D], offset: float)[source]¶
Offsets a Shell.
- position_plane(posmax, resolution)[source]¶
Calculates the position of planes.
- Parameters:
posmax – Position index.
resolution – Resolution of the plane.
- Returns:
Tuple containing distance between planes and position of planes.
- shell_distances(shells: OpenTriangleShell3D) Tuple[PointCloud3D, List[float], List[int]] [source]¶
Computes distance of point to shell for each point in self.points.
- Returns:
The point cloud of points projection on nearest triangle, their distances and the corresponding
triangles index :rtype: Tuple[PointCloud3D, List[float], List[int]]
- shell_distances_ndarray(shells: OpenTriangleShell3D)[source]¶
Computes distance of point to shell for each point in self.points in a numpy formatted data.
- Returns:
The point cloud of points projection on nearest triangle, their distances and the corresponding
triangles index :rtype: Tuple[numpy.ndarray(float), numpy.ndarray(float), numpy.ndarray(int)]
- to_2d(plane_origin, x, y)[source]¶
Projects the point cloud on a 2D plane.
- Parameters:
plane_origin – Origin of the plane in 3D.
x – X-axis vector in 3D.
y – Y-axis vector in 3D.
- Returns:
PointCloud2D object.