int
main(int, char *[])
{
using TubePointer = TubeType::Pointer;
using TubePointType = TubeType::TubePointType;
using PointType = TubeType::PointType;
using CovariantVectorType = TubePointType::CovariantVectorType;
const TubePointer tube = TubeType::New();
TubeType::TubePointListType list;
for (unsigned int i = 0; i < 5; ++i)
{
TubePointType p;
PointType pnt;
pnt[0] = i;
pnt[1] = i + 1;
pnt[2] = i + 2;
p.SetPositionInObjectSpace(pnt);
p.SetRadiusInObjectSpace(1);
CovariantVectorType normal1;
CovariantVectorType normal2;
for (unsigned int j = 0; j < 3; ++j)
{
normal1[j] = j;
normal2[j] = j * 2;
}
p.SetNormal1InObjectSpace(normal1);
p.SetNormal2InObjectSpace(normal2);
p.SetColor(1, 0, 0, 1);
list.push_back(p);
}
tube->GetProperty().SetName("Tube1");
tube->SetId(1);
tube->SetPoints(list);
tube->Update();
const TubeType::TubePointListType pointList = tube->GetPoints();
std::cout << "Number of points representing the tube: ";
std::cout << pointList.size() << std::endl;
tube->ComputeTangentsAndNormals();
{
unsigned int i = 0;
for (auto & currentPoint : tube->GetPoints())
{
std::cout << std::endl;
std::cout << "Point #" << i << std::endl;
std::cout << "Position: " << currentPoint.GetPositionInObjectSpace()
<< std::endl;
std::cout << "Radius: " << currentPoint.GetRadiusInObjectSpace()
<< std::endl;
std::cout << "Tangent: " << currentPoint.GetTangentInObjectSpace()
<< std::endl;
std::cout << "First Normal: " << currentPoint.GetNormal1InObjectSpace()
<< std::endl;
std::cout << "Second Normal: " << currentPoint.GetNormal2InObjectSpace()
<< std::endl;
std::cout << "Color = " << currentPoint.GetColor() << std::endl;
++i;
}
}
return EXIT_SUCCESS;
}
Representation of a tube based on the spatial object classes.