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

Initial revision

parent 3b837b58
/*=========================================================================
Program: Visualization Library
Module: DS2SPtsF.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
=========================================================================*/
//
// PolyToStructuredPointsFilter are filters that take PolyData in and
// generate StructuredPoints data
//
#ifndef __vlPolyToStructuredPointsFilter_h
#define __vlPolyToStructuredPointsFilter_h
#include "PolyF.hh"
#include "SPoints.hh"
class vlPolyToStructuredPointsFilter : public vlStructuredPoints, public vlPolyFilter
{
public:
void Update();
char *GetClassName() {return "vlPolyToStructuredPointsFilter";};
void PrintSelf(ostream& os, vlIndent indent);
};
#endif
/*=========================================================================
Program: Visualization Library
Module: ImpMod.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
=========================================================================*/
//
// Generate implicit volume model from PolyData
//
#ifndef __vlImplicitModeller_h
#define __vlImplicitModeller_h
#include "P2SPtsF.hh"
class vlImplicitModeller : public vlPolyToStructuredPointsFilter
{
public:
vlImplicitModeller();
~vlImplicitModeller() {};
char *GetClassName() {return "vlImplicitModeller";};
void PrintSelf(ostream& os, vlIndent indent);
vlSetClampMacro(MaximumDistance,float,0.0,1.0);
vlGetMacro(MaximumDistance,float);
void SetModelBounds(float *bounds);
void SetModelBounds(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax);
vlGetVectorMacro(ModelBounds,float);
protected:
void Execute();
float MaximumDistance;
float ModelBounds[6];
};
#endif
/*=========================================================================
Program: Visualization Library
Module: StrPts.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
=========================================================================*/
//
// Structured points (e.g., volume, image, etc.)
//
#ifndef __vlStructuredPoints_h
#define __vlStructuredPoints_h
#include "DataSet.hh"
#include "IdList.hh"
#include "FPoints.hh"
class vlStructuredPoints : public vlDataSet {
public:
vlStructuredPoints();
vlStructuredPoints(const vlStructuredPoints& v);
~vlStructuredPoints();
vlDataSet *MakeObject() {return new vlStructuredPoints(*this);};
char *GetClassName() {return "vlStructuredPoints";};
void PrintSelf(ostream& os, vlIndent indent);
int NumberOfCells()
{int nCells=(Dimension[0]-1)*(Dimension[1]-1)*(Dimension[2]-1);
return (nCells < 0 ? 0 : nCells);};
int NumberOfPoints()
{int nPts=Dimension[0]*Dimension[1]*Dimension[2];
return (nPts < 0 ? 0 : nPts);};
int CellDimension(int cellId);
float *GetPoint(int i);
void GetPoints(vlIdList& ptId, vlFloatPoints& fp);
void CellPoints(int cellId, vlIdList& ptId);
vlMapper *MakeMapper() {return (vlMapper *)0;};
vlSetVector3Macro(Dimension,int);
vlGetVectorMacro(Dimension,int);
vlSetVector3Macro(AspectRatio,float);
vlGetVectorMacro(AspectRatio,float);
vlSetVector3Macro(Origin,float);
vlGetVectorMacro(Origin,float);
protected:
int Dimension[3];
float AspectRatio[3];
float Origin[3];
};
#endif
/*=========================================================================
Program: Visualization Library
Module: DS2SPtsF.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 "P2SPtsF.hh"
void vlPolyToStructuredPointsFilter::Update()
{
vlPolyFilter::Update();
}
void vlPolyToStructuredPointsFilter::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlPolyToStructuredPointsFilter::GetClassName()))
{
this->PrintWatchOn(); // watch for multiple inheritance
vlStructuredPoints::PrintSelf(os,indent);
vlPolyFilter::PrintSelf(os,indent);
this->PrintWatchOff(); // stop worrying about it now
}
}
/*=========================================================================
Program: Visualization Library
Module: ImpMod.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 "ImpMod.hh"
vlImplicitModeller::vlImplicitModeller()
{
this->MaximumDistance = 0.1;
this->ModelBounds[0] = 0.0;
this->ModelBounds[1] = 0.0;
this->ModelBounds[2] = 0.0;
this->ModelBounds[3] = 0.0;
this->ModelBounds[4] = 0.0;
this->ModelBounds[5] = 0.0;
this->Dimension[0] = 50;
this->Dimension[1] = 50;
this->Dimension[2] = 50;
}
void vlImplicitModeller::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlImplicitModeller::GetClassName()))
{
vlPolyToStructuredPointsFilter::PrintSelf(os,indent);
os << indent << "Maximum Distance: " << this->MaximumDistance << "\n";
os << indent << "ModelBounds: \n";
os << indent << " Xmin,Xmax: (" << this->ModelBounds[0] << ", " << this->ModelBounds[1] << ")\n";
os << indent << " Ymin,Ymax: (" << this->ModelBounds[2] << ", " << this->ModelBounds[3] << ")\n";
os << indent << " Zmin,Zmax: (" << this->ModelBounds[4] << ", " << this->ModelBounds[5] << ")\n";
}
}
void vlImplicitModeller::SetModelBounds(float *bounds)
{
vlImplicitModeller::SetModelBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
}
void vlImplicitModeller::SetModelBounds(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
{
if (this->ModelBounds[0] != xmin || this->ModelBounds[1] != xmax ||
this->ModelBounds[2] != ymin || this->ModelBounds[3] != ymax ||
this->ModelBounds[4] != zmin || this->ModelBounds[5] != zmax )
{
float length;
this->Modified();
this->ModelBounds[0] = xmin;
this->ModelBounds[1] = xmax;
this->ModelBounds[2] = ymin;
this->ModelBounds[3] = ymax;
this->ModelBounds[4] = zmin;
this->ModelBounds[5] = zmax;
this->Origin[0] = xmin;
this->Origin[1] = ymin;
this->Origin[2] = zmin;
if ( (length = xmin - xmax) == 0.0 ) length = 1.0;
this->AspectRatio[0] = 1.0;
this->AspectRatio[1] = (ymax - ymin) / length;
this->AspectRatio[2] = (zmax - zmin) / length;
}
}
void vlImplicitModeller::Execute()
{
//
// Initialize self; check input
//
this->Initialize();
}
/*=========================================================================
Program: Visualization Library
Module: StrPts.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 "SPoints.hh"
vlStructuredPoints::vlStructuredPoints()
{
this->Dimension[0] = 0;
this->Dimension[1] = 0;
this->Dimension[2] = 0;
this->AspectRatio[0] = 1.0;
this->AspectRatio[1] = 1.0;
this->AspectRatio[2] = 1.0;
this->Origin[0] = 0.0;
this->Origin[1] = 0.0;
this->Origin[2] = 0.0;
}
vlStructuredPoints::vlStructuredPoints(const vlStructuredPoints& v)
{
this->Dimension[0] = v.Dimension[0];
this->Dimension[1] = v.Dimension[1];
this->Dimension[2] = v.Dimension[2];
this->AspectRatio[0] = v.AspectRatio[0];
this->AspectRatio[1] = v.AspectRatio[1];
this->AspectRatio[2] = v.AspectRatio[2];
this->Origin[0] = v.Origin[0];
this->Origin[1] = v.Origin[1];
this->Origin[2] = v.Origin[2];
}
vlStructuredPoints::~vlStructuredPoints()
{
}
int vlStructuredPoints::CellDimension(int cellId)
{
int i, dim;
for (dim=3, i=0; i<3; i++)
{
if (this->Dimension[i] == 1) dim--;
if (this->Dimension[i] < 1) return 0;
}
return dim;
}
float *vlStructuredPoints::GetPoint(int i)
{
static float x[3];
int loc[3];
loc[0] = i % (this->Dimension[0]-1);
loc[1] = i % ((this->Dimension[0]-1)*(this->Dimension[1]-1))
/ (this->Dimension[0]-1);
loc[2] = i / ((this->Dimension[0]-1)*(this->Dimension[1]-1));
for (i=0; i<3; i++)
x[i] = this->Origin[i] + loc[i] * this->AspectRatio[i];
return x;
}
void GetPoints(vlIdList& ptId, vlFloatPoints& fp)
{
}
void vlStructuredPoints::CellPoints(int cellId, vlIdList& ptId)
{
}
void vlStructuredPoints::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlStructuredPoints::GetClassName()))
{
vlDataSet::PrintSelf(os,indent);
os << indent << "Dimension: (" << this->Dimension[0] << ", "
<< this->Dimension[1] << ", "
<< this->Dimension[2] << ")\n";
os << indent << "Origin: (" << this->Origin[0] << ", "
<< this->Origin[1] << ", "
<< this->Origin[2] << ")\n";
os << indent << "AspectRatio: (" << this->AspectRatio[0] << ", "
<< this->AspectRatio[1] << ", "
<< this->AspectRatio[2] << ")\n";
}
}
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