Data Structure For Piece-Wise Linear Curve

Synopsis

A data structure for a piece-wise linear curve.

Results

Output:

[0, 0]
[0, 1]
[0, 2]
[0, 3]
[0, 4]
[0, 5]
[0, 6]
[0, 7]
[0, 8]
[0, 9]
[0, 10]
[0, 11]
[0, 12]
[0, 13]
[0, 14]
[0, 15]
[0, 16]
[0, 17]
[0, 18]
[0, 19]

Code

C++

#include "itkPolyLineParametricPath.h"

int
main(int, char *[])
{
  using PathType = itk::PolyLineParametricPath<2>;

  PathType::Pointer path = PathType::New();
  path->Initialize();

  using ContinuousIndexType = PathType::ContinuousIndexType;

  // Create a line
  for (unsigned int i = 0; i < 20; ++i)
  {
    ContinuousIndexType cindex;
    cindex[0] = 0;
    cindex[1] = i;
    path->AddVertex(cindex);
  }

  const PathType::VertexListType * vertexList = path->GetVertexList();

  for (unsigned int i = 0; i < vertexList->Size(); ++i)
  {
    std::cout << vertexList->GetElement(i) << std::endl;
  }

  return EXIT_SUCCESS;
}

Classes demonstrated