Skip to content

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

js
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.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesISphereSourceInitialValuesNo(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.

ArgumentTypeRequiredDescription
initialValuesISphereSourceInitialValuesNofor pre-setting some of its content

requestData

ArgumentTypeRequiredDescription
inDataYes
outDataYes

setCenter

Set the center of the sphere.

ArgumentTypeRequiredDescription
centerVector3YesThe center point's coordinates.

setCenter

Set the center of the sphere.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

setCenterFrom

Set the center of the sphere.

ArgumentTypeRequiredDescription
centerVector3YesThe center point's coordinates.

setEndPhi

Set the ending latitude angle.

ArgumentTypeRequiredDescription
endPhiNumberYesThe ending latitude angle in degrees.

setEndTheta

Set the ending longitude angle.

ArgumentTypeRequiredDescription
endThetaNumberYesThe 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.

ArgumentTypeRequiredDescription
latLongTessellationBooleanYes

setPhiResolution

Set the number of points in the latitude direction (ranging from StartPhi to EndPhi).

ArgumentTypeRequiredDescription
phiResolutionNumberYesThe number of points.

setRadius

Set the radius of sphere.

ArgumentTypeRequiredDescription
radiusNumberYesThe radius of sphere.

setStartPhi

Set the starting latitude angle (0 is at north pole).

ArgumentTypeRequiredDescription
startPhiNumberYesThe starting latitude angle in degrees.

setStartTheta

Set the starting longitude angle.

ArgumentTypeRequiredDescription
startThetaNumberYesThe starting longitude angle in degrees.

setThetaResolution

Set the number of points in the longitude direction (ranging from StartTheta to EndTheta).

ArgumentTypeRequiredDescription
thetaResolutionNumberYesThe number of points.