int main(int, char * [] )
{
using CellTraits = MeshType::CellTraits;
using CellType = MeshType::CellType;
using CellAutoPointer = CellType::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->Update();
myMeshSpatialObject->GetMesh();
std::cout << "Mesh bounds : "
<< myMeshSpatialObject->GetMyBoundingBoxInWorldSpace()->GetBounds()
<< std::endl;
std::cout << "Is my physical point inside? : "
<< myMeshSpatialObject->IsInsideInWorldSpace(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();
using SpatialObjectToImageFilterType =
SpatialObjectToImageFilterType::Pointer imageFilter =
SpatialObjectToImageFilterType::New();
imageFilter->SetInput( reader->GetGroup() );
imageFilter->Update();
ImageType::Pointer myBinaryMeshImage = imageFilter->GetOutput();
return EXIT_SUCCESS;
}