SphereSource
Introduction
vtkSphereSource is a source object that creates a user-specified number of points within a specified radius about a specified center point. By default location of the points is random within the sphere. It is also possible to generate random points only on the surface of the sphere. The output PolyData has the specified number of points and 1 cell - a vtkPolyVertex containing all of the points.
Usage
import vtkSphereSource from '@kitware/vtk.js/Filters/Sources/SphereSource';
const sphere = vtkSphereSource.newInstance();
const polydata = sphere.getOutputData();Methods
extend
Method used to decorate a given object (publicAPI+model) with vtkSphereSource characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | ISphereSourceInitialValues | No | (default: {}) |
getCenter
Get the center of the sphere.
getCenterByReference
Get the center of the sphere.
getEndPhi
Get the ending latitude angle.
getEndTheta
Set the ending longitude angle.
getLatLongTessellation
getPhiResolution
Get the number of points in the latitude direction (ranging from StartPhi to EndPhi).
getRadius
Get the radius of sphere.
getStartPhi
Get the starting latitude angle in degrees (0 is at north pole).
getStartTheta
Get the starting longitude angle.
getThetaResolution
Get the number of points in the longitude direction (ranging from StartTheta to EndTheta).
newInstance
Method used to create a new instance of vtkSphereSource.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | ISphereSourceInitialValues | No | for pre-setting some of its content |
requestData
| Argument | Type | Required | Description |
|---|---|---|---|
inData | Yes | ||
outData | Yes |
setCenter
Set the center of the sphere.
| Argument | Type | Required | Description |
|---|---|---|---|
center | Vector3 | Yes | The center point's coordinates. |
setCenter
Set the center of the sphere.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The x coordinate. |
y | Number | Yes | The y coordinate. |
z | Number | Yes | The z coordinate. |
setCenterFrom
Set the center of the sphere.
| Argument | Type | Required | Description |
|---|---|---|---|
center | Vector3 | Yes | The center point's coordinates. |
setEndPhi
Set the ending latitude angle.
| Argument | Type | Required | Description |
|---|---|---|---|
endPhi | Number | Yes | The ending latitude angle in degrees. |
setEndTheta
Set the ending longitude angle.
| Argument | Type | Required | Description |
|---|---|---|---|
endTheta | Number | Yes | The ending latitude longitude in degrees. |
setLatLongTessellation
Cause the sphere to be tessellated with edges along the latitude and longitude lines. If off, triangles are generated at non-polar regions, which results in edges that are not parallel to latitude and longitude lines. If on, quadrilaterals are generated everywhere except at the poles. This can be useful for generating a wireframe sphere with natural latitude and longitude lines.
| Argument | Type | Required | Description |
|---|---|---|---|
latLongTessellation | Boolean | Yes |
setPhiResolution
Set the number of points in the latitude direction (ranging from StartPhi to EndPhi).
| Argument | Type | Required | Description |
|---|---|---|---|
phiResolution | Number | Yes | The number of points. |
setRadius
Set the radius of sphere.
| Argument | Type | Required | Description |
|---|---|---|---|
radius | Number | Yes | The radius of sphere. |
setStartPhi
Set the starting latitude angle (0 is at north pole).
| Argument | Type | Required | Description |
|---|---|---|---|
startPhi | Number | Yes | The starting latitude angle in degrees. |
setStartTheta
Set the starting longitude angle.
| Argument | Type | Required | Description |
|---|---|---|---|
startTheta | Number | Yes | The starting longitude angle in degrees. |
setThetaResolution
Set the number of points in the longitude direction (ranging from StartTheta to EndTheta).
| Argument | Type | Required | Description |
|---|---|---|---|
thetaResolution | Number | Yes | The number of points. |