{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Point clouds in vedo "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from vedo import *\n",
"settings.default_backend = \"vtk\" # or k3d, ipyvtk, or 2d"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
" \n",
" | \n",
" \n",
"vedo.pointcloud.Points\n",
"\n",
" bounds (x/y/z) | 2.902e-4 ... 0.9993 5.838e-6 ... 0.9999 3.116e-4 ... 0.9995 | \n",
" center of mass | (0.507, 0.497, 0.501) | \n",
" average size | 0.483 | \n",
" nr. points | 2000 | \n",
"\n",
"\n",
" \n",
" |
"
],
"text/plain": [
""
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"points = np.random.rand(2000, 3)\n",
"\n",
"pts = Points(points)\n",
"pln = Plane(pos=(0.5, 0.5, 0.6), normal=(1, 0, 0), s=(1.5, 1.5))\n",
"pln.alpha(0.5)\n",
"pts"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"show(pts, pln, axes=1).close()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"\n",
" \n",
" | \n",
" \n",
"vedo.pointcloud.Points\n",
"\n",
" bounds (x/y/z) | 0.5004 ... 0.9993 2.823e-3 ... 0.9999 3.116e-4 ... 0.9995 | \n",
" center of mass | (0.751, 0.488, 0.503) | \n",
" average size | 0.411 | \n",
" nr. points | 1025 | \n",
"\n",
"\n",
" \n",
" |
"
],
"text/plain": [
""
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pts = Points(points)\n",
"pts.cut_with_plane((0.5, 0.5, 0.6))"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"show(pts, pln, axes=1).close()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}