net.sourceforge.jartoolkit.util
Class ARPattern

java.lang.Object
  extended bynet.sourceforge.jartoolkit.util.ARPattern

public class ARPattern
extends java.lang.Object

Class encapsulate a pattern for the AR-Toolkit.

Author:
Jörg Stöcklein (ozone_abandon at sourceforge.net)

Constructor Summary
ARPattern(JARToolKit jar_tk)
          Constructor.
ARPattern(JARToolKit jar_tk, java.lang.String filename)
          Constructor.
ARPattern(JARToolKit jar_tk, java.lang.String filename, int width, float centerX, float centerY)
          Constructor.
 
Method Summary
 void activate()
          Activate the pattern to be recognized by the AR-Toolkit.
 void deactivate()
          Deactivate the pattern to be net recognized by the AR-Toolkit.
 float[] getCenter()
          Return the center of the pattern.
 java.lang.String getFilename()
          Return the filename of the pattern.
 int getId()
          Return the internal id given by the AR-Toolkit.
 double[] getTransMatrix()
          Return the transformation-matrix of the pattern as an array of 16 doubles.
 boolean getTransMatrix(double[] matrix)
          Fills the transformation-matrix of the pattern as an array of 16 doubles.
 boolean getTransMatrixJava3D(double[] matrix)
          Fills the transformation-matrix of the pattern as an array of 16 doubles.
 int getWidth()
          Return the width of the pattern.
 void loadPattern(java.lang.String filename)
          Loads a new pattern.
 void setCenter(float centerX, float centerY)
          Set the center of the pattern.
 void setWidth(int width)
          Set the width of the pattern.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ARPattern

public ARPattern(JARToolKit jar_tk)
          throws java.lang.InstantiationException
Constructor. Constructs a JARPattern. If an error occurs, an InstantiationException will be thrown.

Parameters:
jar_tk - Reference to the JARToolKit.

ARPattern

public ARPattern(JARToolKit jar_tk,
                 java.lang.String filename)
          throws java.lang.InstantiationException
Constructor. Constructs a JARPattern. The values width, centerX and centerY will be set to defaultvalues (width=80, centerX=0.0f, centerY=0.0f). If an error occurs, an InstantiationException will be thrown.

Parameters:
jar_tk - Reference to the JARToolKit.
filename - The filename of the pattern to load.

ARPattern

public ARPattern(JARToolKit jar_tk,
                 java.lang.String filename,
                 int width,
                 float centerX,
                 float centerY)
          throws java.lang.InstantiationException
Constructor. Constructs a JARPattern. If an error occurs, an InstantiationException will be thrown.

Parameters:
jar_tk - Reference to the JARToolKit.
filename - The filename of the pattern to load.
width - The width of the pattern.
centerX - The center of the pattern, x component.
centerY - The center of the pattern, y component.
Method Detail

activate

public void activate()
Activate the pattern to be recognized by the AR-Toolkit.


deactivate

public void deactivate()
Deactivate the pattern to be net recognized by the AR-Toolkit.


getCenter

public float[] getCenter()
Return the center of the pattern.

Returns:
Center of the pattern.

getFilename

public java.lang.String getFilename()
Return the filename of the pattern.

Returns:
Filename of the pattern.

getId

public int getId()
Return the internal id given by the AR-Toolkit.

Returns:
ID of the pattern.

getTransMatrix

public double[] getTransMatrix()
Return the transformation-matrix of the pattern as an array of 16 doubles.

Returns:
transformation-matrix of the pattern.

getTransMatrix

public boolean getTransMatrix(double[] matrix)
Fills the transformation-matrix of the pattern as an array of 16 doubles.

Parameters:
matrix - The doublearray filled with.
Returns:
true, if the pattern was recognized, else false.

getTransMatrixJava3D

public boolean getTransMatrixJava3D(double[] matrix)
Fills the transformation-matrix of the pattern as an array of 16 doubles. Special method for Java3D.

Parameters:
matrix - The doublearray filled with.
Returns:
true, if the pattern was recognized, else false.

getWidth

public int getWidth()
Return the width of the pattern.

Returns:
Width of the pattern.

loadPattern

public void loadPattern(java.lang.String filename)
                 throws java.lang.InstantiationException
Loads a new pattern. If an error occurs, an InstantiationException will be thrown.

Parameters:
filename - The filename of the pattern to load.
Throws:
java.lang.InstantiationException

setCenter

public void setCenter(float centerX,
                      float centerY)
Set the center of the pattern.

Parameters:
centerX - The center of the pattern, x component.
centerY - The center of the pattern, y component.

setWidth

public void setWidth(int width)
Set the width of the pattern.

Parameters:
width - The width of the pattern.