pyvista.SolidSphere#
- SolidSphere(
- outer_radius: float = 0.5,
- inner_radius: float = 0.0,
- radius_resolution: int = 5,
- start_theta: float = 0.0,
- end_theta: float | None = None,
- theta_resolution: int = 30,
- start_phi: float = 0.0,
- end_phi: float | None = None,
- phi_resolution: int = 30,
- center: VectorLike[float] = (0.0, 0.0, 0.0),
- direction: VectorLike[float] = (0.0, 0.0, 1.0),
- radians: bool = False,
- tol_radius: float = 1e-08,
- tol_angle: float | None = None,
中身が全部詰まった球体を作ります.
2Dの表面である
pyvista.Sphere()と比較して,ソリッドな球体は3Dの空間を埋めます.pyvista.SolidSphereGeneric()では一様でないサンプリングが可能です.角度はデフォルトで度単位で指定されます.PyVistaでは,
thetaが方位角(地球上の経度のようなもの)を表し,phiが極角(地球上の緯度のようなもの)を表すという慣例を使っています.地球上の緯度とは対照的に,ここではphiは北極で0度,南極で180度です.デフォルトではphi=0が正のZ軸になります.また,theta=0はデフォルトで正のX軸上にあります.θの値は最大360度の範囲であればどのような値でも良いが,大きな値は終点の重なり検出で問題が生じる可能性があります.
- パラメータ:
- outer_radius
float, default: 0.5 球の外側の半径.非負でなければなりません.
- inner_radius
float, default: 0.0 球の内側の半径.負でなく,
outer_radiusよりも小さくなければならない.- radius_resolution
int, default: 5 半径方向の点の数.
- start_theta
float, default: 0.0 開始方位角.
- end_theta
float, default: 360.0 終了方位角.
end_thetaはstart_thetaよりも大きくなければなりません.- theta_resolution
int, default: 30 theta方向の点の数.- start_phi
float, default: 0.0 極角を開始します.
phiは0度から180度の間でなければなりません.- end_phi
float, default: 180.0 極角を終了します.
phiは0度から180度の間でなければなりません.end_phiはstart_phiより大きくなければなりません.- phi_resolution
int, default: 30 極軸を含む
phi方向の点数,つまりphi=0とphi=180の度数,該当する場合.- centersequence[
float], default: (0.0, 0.0, 0.0) [x, y, z]の中心座標ベクトル.- directionsequence[
float], default: (0.0, 0.0, 1.0) 中心から緯度phi度の球の北極を指す[x, y, z]の方向座標ベクトル.- radiansbool, default:
False thetaとphiにラジアンを使うかどうか.デフォルトは度です.- tol_radius
float, default: 1.0e-8 radiusに対する終点検出の絶対許容誤差.- tol_angle
float,optional phi``と``θ``の端点検出の絶対許容誤差,単位は
radiansパラメータの選択によって決定されます.デフォルトは1.0e-8度,または1.0e-8度をラジアンに変換した値です.
- outer_radius
- 戻り値:
pyvista.UnstructuredGridソリッド球体メッシュ.
参考
pyvista.Sphere外側の2次元表面を表す球体.
pyvista.SolidSphereGenericより柔軟なパラメータ定義を使用します.
例
中身が全部詰まった球体を作ります.
>>> import pyvista as pv >>> import numpy as np >>> solid_sphere = pv.SolidSphere() >>> solid_sphere.plot(show_edges=True)
立体の球体は2次元の
pyvista.Sphere()に比べて3次元です.内部構造を見るために,立体の半球を生成してください.>>> isinstance(solid_sphere, pv.UnstructuredGrid) True >>> partial_solid_sphere = pv.SolidSphere(start_theta=180, end_theta=360) >>> partial_solid_sphere.plot(show_edges=True)
固い球体内部のセルの構造を見るために,球体の1/4だけが生成します.セルは分解され,半径方向の位置で色分けされています.
>>> partial_solid_sphere = pv.SolidSphere( ... start_theta=180, ... end_theta=360, ... start_phi=0, ... end_phi=90, ... radius_resolution=5, ... theta_resolution=8, ... phi_resolution=8, ... ) >>> partial_solid_sphere['cell_radial_pos'] = np.linalg.norm( ... partial_solid_sphere.cell_centers().points, axis=-1 ... ) >>> partial_solid_sphere.explode(1).plot()