.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/point_cloud_generators/plot_generate_point_clouds.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_point_cloud_generators_plot_generate_point_clouds.py: Point Cloud Generators ========================================= This gallery shows how to generate several different types of point clouds. .. GENERATED FROM PYTHON SOURCE LINES 7-13 .. code-block:: Python import oat_python as oat import plotly.graph_objects as go .. GENERATED FROM PYTHON SOURCE LINES 14-16 Stanford Dragon ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 16-33 .. code-block:: Python points = oat.point_cloud.stanford_dragon() trace = go.Scatter3d( x=points[:,0], y=points[:,1], z=points[:,2], mode="markers", marker=dict(opacity=1, size=4, color=points[:,2], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( height=500, ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 34-36 Fibonacci sphere ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 38-39 Whole sphere: .. GENERATED FROM PYTHON SOURCE LINES 39-56 .. code-block:: Python points = oat.point_cloud.sphere_or_slice( n_points=300, ) trace = go.Scatter3d( x=points[:,0], y=points[:,1], z=points[:,2], mode="markers", marker=dict(opacity=1, size=4, color=points[:,2], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( height=500, ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 57-59 Slice of sphere: ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 59-80 .. code-block:: Python points = oat.point_cloud.sphere_or_slice( n_points=300, xmin=-0.5, xmax=0.5, ) trace = go.Scatter3d( x=points[:,0], y=points[:,1], z=points[:,2], mode="markers", marker=dict(opacity=1, size=4, color=points[:,2], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( height=500, ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 81-83 Spiral sphere ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 83-103 .. code-block:: Python points = oat.point_cloud.sphere_or_slice_spiral( n_points=300, noise_scale=0.07, random_seed=0 ) trace = go.Scatter3d( x=points[:,0], y=points[:,1], z=points[:,2], mode="markers", marker=dict(opacity=1, size=4, color=points[:,2], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( height=500 ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 104-106 Torus ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 106-136 .. code-block:: Python points = oat.point_cloud.torus( radius_outer = 4, radius_inner = 1, n_points_outer = 60, n_points_inner = 20, repeat_last = True, ) trace = go.Scatter3d( x=points[:,0], y=points[:,1], z=points[:,2], mode="markers", marker=dict(opacity=1, size=4, color=points[:,2], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( height=500, scene = dict( aspectratio=go.layout.scene.Aspectratio(x=1, y=1, z=1), xaxis = dict(range=[-5,5],), # x axis limits yaxis = dict(range=[-5,5],), # y axis limits zaxis = dict(range=[-5,5],), # z axis limits ), ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 137-139 Torus curve ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 139-168 .. code-block:: Python points = oat.point_cloud.torus_curve( n_points=300, inner_radius=0.2, outer_radius=1.0, angle_initial=0, nturns=10, ) trace = go.Scatter3d( x=points[:,0], y=points[:,1], z=points[:,2], mode="markers", marker=dict(opacity=1, size=4, color=points[:,2], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( height=500, scene = dict( aspectratio=go.layout.scene.Aspectratio(x=1, y=1, z=1), xaxis = dict(range=[-1.5,1.5],), # x axis limits yaxis = dict(range=[-1.5,1.5],), # y axis limits zaxis = dict(range=[-1.5,1.5],), # z axis limits ), ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 169-171 Annulus ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 171-196 .. code-block:: Python points = oat.point_cloud.annulus( n_points=300, inner_radius=0.5, outer_radius=1.0, random_seed=0 ) trace = go.Scatter( x=points[:,0], y=points[:,1], mode="markers", marker=dict(opacity=1, size=4, color=points[:,1], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( yaxis=dict( # Ensure an equal x-y aspect ratio by .. scaleanchor="x", # Anchoring y-axis scaling to x-axis scaleratio=1.0 # Setting the aspect ratio (1.0 for square aspect) ), ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 197-199 Circle ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 201-202 Uniform spacing: .. GENERATED FROM PYTHON SOURCE LINES 202-223 .. code-block:: Python points = oat.point_cloud.circle( n_points=80, radius=1.0, mode="uniform", ) trace = go.Scatter( x=points[:,0], y=points[:,1], mode="markers", marker=dict(opacity=1, size=4, color=points[:,1], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( yaxis=dict( # Ensure an equal x-y aspect ratio by .. scaleanchor="x", # Anchoring y-axis scaling to x-axis scaleratio=1.0 # Setting the aspect ratio (1.0 for square aspect) ), ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 224-225 Random spacing: .. GENERATED FROM PYTHON SOURCE LINES 225-249 .. code-block:: Python points = oat.point_cloud.circle( n_points=80, radius=1.0, mode="random", random_seed=0 ) trace = go.Scatter( x=points[:,0], y=points[:,1], mode="markers", marker=dict(opacity=1, size=4, color=points[:,1], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( yaxis=dict( # Ensure an equal x-y aspect ratio by .. scaleanchor="x", # Anchoring y-axis scaling to x-axis scaleratio=1.0 # Setting the aspect ratio (1.0 for square aspect) ), ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 250-252 Disk ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 252-276 .. code-block:: Python points = oat.point_cloud.disk( n_points=200, radius=1.0, random_seed=0, ) trace = go.Scatter( x=points[:,0], y=points[:,1], mode="markers", marker=dict(opacity=1, size=4, color=points[:,1], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( yaxis=dict( # Ensure an equal x-y aspect ratio by .. scaleanchor="x", # Anchoring y-axis scaling to x-axis scaleratio=1.0 # Setting the aspect ratio (1.0 for square aspect) ), ) fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 277-279 Two circles ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 279-295 .. code-block:: Python points = oat.point_cloud.two_circles() trace = go.Scatter( x=points[:,0], y=points[:,1], mode="markers", marker=dict(opacity=1, size=4, color=points[:,1], colorscale="Aggrnyl") ) fig = go.Figure(data=trace) fig.update_layout( yaxis=dict( # Ensure an equal x-y aspect ratio by .. scaleanchor="x", # Anchoring y-axis scaling to x-axis scaleratio=1.0 # Setting the aspect ratio (1.0 for square aspect) ), ) fig .. raw:: html


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.133 seconds) .. _sphx_glr_download_auto_examples_point_cloud_generators_plot_generate_point_clouds.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_generate_point_clouds.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_generate_point_clouds.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_generate_point_clouds.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_