int main(int, char * [] )
{
typedef MeshType::CellTraits CellTraits;
typedef MeshType::PointType PointType;
typedef MeshType::CellType CellType;
typedef CellType::CellAutoPointer CellAutoPointer;
MeshType::Pointer myMesh = MeshType::New();
MeshType::CoordRepType testPointCoords[4][3]
= { {0,0,0}, {9,0,0}, {9,9,0}, {0,0,9} };
MeshType::PointIdentifier tetraPoints[4] = {0,1,2,4};
int i;
for(i=0; i < 4; ++i)
{
myMesh->SetPoint(i, PointType(testPointCoords[i]));
}
myMesh->SetCellsAllocationMethod(
MeshType::CellsAllocatedDynamicallyCellByCell );
CellAutoPointer testCell1;
testCell1.TakeOwnership( new TetraCellType );
testCell1->SetPointIds(tetraPoints);
myMesh->SetCell(0, testCell1 );
MeshSpatialObjectType::Pointer myMeshSpatialObject =
MeshSpatialObjectType::New();
myMeshSpatialObject->SetMesh(myMesh);
myMeshSpatialObject->GetMesh();
std::cout << "Mesh bounds : " <<
myMeshSpatialObject->GetBoundingBox()->GetBounds() << std::endl;
MeshSpatialObjectType::PointType myPhysicalPoint;
myPhysicalPoint.Fill(1);
std::cout << "Is my physical point inside? : " <<
myMeshSpatialObject->IsInside(myPhysicalPoint) << std::endl;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(myMeshSpatialObject);
writer->SetFileName("myMesh.meta");
writer->Update();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("myMesh.meta");
reader->Update();
SpatialObjectToImageFilterType;
SpatialObjectToImageFilterType::Pointer imageFilter =
SpatialObjectToImageFilterType::New();
imageFilter->SetInput( reader->GetGroup() );
imageFilter->Update();
ImageType::Pointer myBinaryMeshImage = imageFilter->GetOutput();
return EXIT_SUCCESS;
}