MatrixInverse

VTKExamples/Java/Math/MatrixInverse

Description

vtkMatrix3x3 object is used to represent and manipulate 3x3 matrices. Specifically, it is designed to work on 3x3 transformation matrices found in 2D rendering using homogeneous coordinates [x y w].

Other Languages

See (Cxx)

Question

If you have a simple question about this example contact us at VTKExamplesProject If your question is more complex and may require extended discussion, please use the VTK Discourse Forum

Code

MatrixInverse.java

import vtk.vtkNativeLibrary;
import vtk.vtkMatrix3x3;


public class MatrixInverse 
{
  // -----------------------------------------------------------------
  // Load VTK library and print which library was not properly loaded
  static 
  {
    if (!vtkNativeLibrary.LoadAllNativeLibraries()) 
    {
      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) 
      {
        if (!lib.IsLoaded()) 
        {
          System.out.println(lib.GetLibraryName() + " not loaded");
        }
      }
    }
    vtkNativeLibrary.DisableOutputWindow(null);
  }
  // -----------------------------------------------------------------

  public static void main(String args[]) 
  {
    // For a 3x3 matrices
    vtkMatrix3x3 Matrix = new vtkMatrix3x3();

    Matrix.SetElement(2, 1, 2.0); // Set element (0,0) to 1.0

    System.out.println(Matrix);

    Matrix.Invert();

    System.out.println(Matrix); 
  }
}