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.
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).
/** * Set the center of the sphere. * @param {Number} x The x coordinate. * @param {Number} y The y coordinate. * @param {Number} z The z coordinate. */ setCenter(x: number, y: number, z: number): boolean;
/** * Set the center of the sphere. * @param {Vector3} center The center point's coordinates. */ setCenter(center: Vector3): boolean;
/** * Set the center of the sphere. * @param {Vector3} center The center point's coordinates. */ setCenterFrom(center: Vector3): boolean;
/** * Set the ending latitude angle. * @param {Number} endPhi The ending latitude angle in degrees. */ setEndPhi(endPhi: number): boolean;
/** * Set the ending longitude angle. * @param {Number} endTheta The ending latitude longitude in degrees. */ setEndTheta(endTheta: number): boolean;
/** * 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. * @param {Boolean} latLongTessellation */ setLatLongTessellation(latLongTessellation: boolean): boolean;
/** * Set the number of points in the latitude direction (ranging from StartPhi to EndPhi). * @param {Number} phiResolution The number of points. */ setPhiResolution(phiResolution: number): boolean;
/** * Set the radius of sphere. * @param {Number} radius The radius of sphere. */ setRadius(radius: number): boolean;
/** * Set the starting longitude angle. * @param {Number} startTheta The starting longitude angle in degrees. */ setStartTheta(startTheta: number): boolean;
/** * Set the starting latitude angle (0 is at north pole). * @param {Number} startPhi The starting latitude angle in degrees. */ setStartPhi(startPhi: number): boolean;
/** * Set the number of points in the longitude direction (ranging from StartTheta to EndTheta). * @param {Number} thetaResolution The number of points. */ setThetaResolution(thetaResolution: number): boolean; }
/** * Method used to decorate a given object (publicAPI+model) with vtkSphereSource characteristics. * * @param publicAPI object on which methods will be bounds (public) * @param model object on which data structure will be bounds (protected) * @param {ISphereSourceInitialValues} [initialValues] (default: {}) */ exportfunctionextend( publicAPI: object, model: object, initialValues?: ISphereSourceInitialValues ): void;
/** * Method used to create a new instance of vtkSphereSource. * @param {ISphereSourceInitialValues} [initialValues] for pre-setting some of its content */ exportfunctionnewInstance( initialValues?: ISphereSourceInitialValues ): vtkSphereSource;
/** * 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. * * @example * ```js * import vtkSphereSource from '@kitware/vtk.js/Filters/Sources/SphereSource'; * * const sphere = vtkSphereSource.newInstance(); * const polydata = sphere.getOutputData(); * ``` */ export declare constvtkSphereSource: { newInstance: typeof newInstance; extend: typeof extend; }; exportdefault vtkSphereSource;
// around north pole if (model.startPhi <= 0.0) { for (let i = 0; i < thetaResolution; i++) { polys[cellLocation++] = 3; polys[cellLocation++] = phiResolution * i + numPoles; polys[cellLocation++] = ((phiResolution * (i + 1)) % base) + numPoles; polys[cellLocation++] = 0; } }
// around south pole if (model.endPhi >= 180.0) { const numOffset = phiResolution - 1 + numPoles;
for (let i = 0; i < thetaResolution; i++) { polys[cellLocation++] = 3; polys[cellLocation++] = phiResolution * i + numOffset; polys[cellLocation++] = numPoles - 1; polys[cellLocation++] = ((phiResolution * (i + 1)) % base) + numOffset; } }
// bands in-between poles for (let i = 0; i < thetaResolution; i++) { for (let j = 0; j < phiResolution - 1; j++) { const a = phiResolution * i + j + numPoles; const b = a + 1; const c = ((phiResolution * (i + 1) + j) % base) + numPoles + 1;