VTK/Examples/Cxx/Math/PerpendicularVector

From KitwarePublic

Jump to: navigation, search

Perpendiculars.cxx

This example finds a vector perpendicular to the x axis (1,0,0). Since theta is specified as 0, the negative z axis (0, 0, -1) is returned.

#include <vtkSmartPointer.h>
#include <vtkMath.h>
 
int main(int, char *[])
{
  double x[3] = {1,0,0};
  double y[3];
  vtkMath::Perpendiculars(x, y, NULL, 0);
 
  std::cout << "y: " << y[0] << " " << y[1] << " " << y[2] << std::endl;
 
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(Perpendiculars)
 
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 
ADD_EXECUTABLE(Perpendiculars Perpendiculars.cxx)
TARGET_LINK_LIBRARIES(Perpendiculars vtkHybrid)
Personal tools