1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkSphere.h,v $
6 Date: $Date: 2002/01/22 15:28:12 $
7 Version: $Revision: 1.36 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkSphere - implicit function for a sphere
19 // .SECTION Description
20 // vtkSphere computes the implicit function and/or gradient for a sphere.
21 // vtkSphere is a concrete implementation of vtkImplicitFunction.
26 #include "vtkImplicitFunction.h"
28 class VTK_FILTERING_EXPORT vtkSphere : public vtkImplicitFunction
31 vtkTypeRevisionMacro(vtkSphere,vtkImplicitFunction);
32 void PrintSelf(ostream& os, vtkIndent indent);
35 // Construct sphere with center at (0,0,0) and radius=0.5.
36 static vtkSphere *New();
39 // Evaluate sphere equation ((x-x0)^2 + (y-y0)^2 + (z-z0)^2) - R^2.
40 float EvaluateFunction(float x[3]);
41 float EvaluateFunction(float x, float y, float z)
42 {return this->vtkImplicitFunction::EvaluateFunction(x, y, z); } ;
45 // Evaluate sphere gradient.
46 void EvaluateGradient(float x[3], float n[3]);
49 // Set / get the radius of the sphere.
50 vtkSetMacro(Radius,float);
51 vtkGetMacro(Radius,float);
54 // Set / get the center of the sphere.
55 vtkSetVector3Macro(Center,float);
56 vtkGetVectorMacro(Center,float,3);
66 vtkSphere(const vtkSphere&); // Not implemented.
67 void operator=(const vtkSphere&); // Not implemented.