Commit f35b6a51 authored by Will Schroeder's avatar Will Schroeder
Browse files

Initial revision

parent 7a818b06
/*=========================================================================
Program: Visualization Library
Module: Cutter.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Uses user-specified implicit function f(x,y,z)=0 to cut datasets.
//
#ifndef __vlCutter_h
#define __vlCutter_h
#include "DS2PolyF.hh"
#include "ImpFunc.hh"
class vlCutter : public vlDataSetToPolyFilter
{
public:
vlCutter(vlImplicitFunction *cf=0);
~vlCutter();
char *GetClassName() {return "vlCutter";};
vlSetObjectMacro(CutFunction,vlImplicitFunction);
vlGetObjectMacro(CutFunction,vlImplicitFunction);
protected:
void Execute();
vlImplicitFunction *CutFunction;
};
#endif
/*=========================================================================
Program: Visualization Library
Module: ImpFunc.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Abstract interface for implicit functions
//
#ifndef __vlImplicitFunction_h
#define __vlImplicitFunction_h
#include "Object.hh"
class vlImplicitFunction : public vlObject
{
public:
char *GetClassName() {return "vlImplicitFunction";};
virtual float Evaluate(float x, float y, float z) = 0;
};
#endif
/*=========================================================================
Program: Visualization Library
Module: Sphere.hh
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Object for computation on sphere
//
#ifndef __vlSphere_h
#define __vlSphere_h
#include "ImpFunc.hh"
class vlSphere : public vlImplicitFunction
{
public:
vlSphere();
char *GetClassName() {return "vlSphere";};
// ImplicitFunction interface
float Evaluate(float x, float y, float z);
vlSetMacro(Radius,float);
vlGetMacro(Radius,float);
vlSetVector3Macro(Origin,float);
vlGetVectorMacro(Origin,float);
protected:
float Radius;
float Origin[3];
};
#endif
/*=========================================================================
Program: Visualization Library
Module: Cutter.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include "Cutter.hh"
vlCutter::vlCutter(vlImplicitFunction *cf)
{
this->CutFunction = cf;
if ( cf ) cf->Register((void *) this);
}
vlCutter::~vlCutter()
{
if ( this->CutFunction ) this->CutFunction->UnRegister((void *) this);
}
void vlCutter::Execute()
{
vlDebugMacro(<< "Executing cutter");
//
// Initialize self; create output objects
//
this->Initialize();
if ( !this->CutFunction )
{
vlErrorMacro(<<"No cut function specified");
return;
}
}
/*=========================================================================
Program: Visualization Library
Module: Sphere.cc
Language: C++
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <math.h>
#include "Sphere.hh"
vlSphere::vlSphere()
{
this->Radius = 1.0;
this->Origin[0] = 0.0;
this->Origin[1] = 0.0;
this->Origin[2] = 0.0;
}
float vlSphere::Evaluate(float x, float y, float z)
{
return ( sqrt ( this->Radius*this->Radius -
((x - this->Origin[0]) * (x - this->Origin[0]) +
(y - this->Origin[1]) * (y - this->Origin[1]) +
(z - this->Origin[2]) * (z - this->Origin[2])) ) );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment