## Facemorph.oesf Class Template3D

```java.lang.Object
Facemorph.oesf.Template3D
```

`public class Template3Dextends java.lang.Object`

Stores a 3D set of points and connecting edges.

Constructor Summary
`Template3D()`
Construct an empty Template3D

Method Summary
` void` `copy(Template3D t3d)`
Copies the given template into this
` boolean` ```fitTo2DOrtho(Template template, int width, int height, Vector3 centre, BigMat R, double[] T, double[] scale)```

` boolean` `getActive(int i)`

` int` `getActiveCount()`
Gets the number of points in this Template3D
` java.util.ArrayList<java.lang.Boolean>` `getActiveFlags()`
Gets this template3D's list of Active Points
` Vector3` `getCentre()`
Returns the centre of mass of this Template3D
` Vector3` `getCentre(java.util.ArrayList<java.lang.Boolean> active2)`
Returns the centre of mass of this Template3D
` java.util.ArrayList<Vector3>` `getCoords()`
Gets this template3D's list of Points
` int` `getCount()`
Gets the number of points in this Template3D
` double` `getMeanRadius(Vector3 centre)`
Finds the average distance from the point given
` double` ```getMeanRadius(Vector3 centre, java.util.ArrayList<java.lang.Boolean> active2)```
Finds the average distance from the point given
` double` `getMeanRadiusSquared(Vector3 centre)`
Finds the average distance from the point given
` double` ```getMeanRadiusSquared(Vector3 centre, java.util.ArrayList<java.lang.Boolean> active2)```
Finds the average distance from the point given
` Vector3` `getPoint(int i)`
Retrieve a specific point in this Template3D
` void` `readTemplate(java.lang.String filename)`
Reads a Template from the file specified
` void` `saveTemplate(java.lang.String objfilename)`
Writes the template to file
` void` ```setActive(int i, boolean b)```
Set a specific point in this Template3D as Active
` void` ```setPoint(int i, Vector3 p)```
Retrieve a specific point in this Template3D
` void` `subtract(Template3D t3d)`

` void` ```transform(BigMat R, double[] T, double scale)```

` void` `unvectorise(double[] vec)`

` double[]` `vectorise()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Template3D

`public Template3D()`
Construct an empty Template3D

Method Detail

```public void readTemplate(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException```
Reads a Template from the file specified

Parameters:
`filename` - The name of the file to read
Throws:
`java.io.FileNotFoundException` - if the file name is not valid
`java.io.IOException` - If there is some other I/ problem

### saveTemplate

```public void saveTemplate(java.lang.String objfilename)
throws java.io.IOException```
Writes the template to file

Parameters:
`objfilename` - The name of the output file to write to.
Throws:
`java.io.IOException` - If there is a problem writing the file

### getCount

`public int getCount()`
Gets the number of points in this Template3D

Returns:
The number of points in this Template3D

### getActiveCount

`public int getActiveCount()`
Gets the number of points in this Template3D

Returns:
The number of points in this Template3D

### getCoords

`public java.util.ArrayList<Vector3> getCoords()`
Gets this template3D's list of Points

Returns:
The list of 3D points in this Template3D

### getActiveFlags

`public java.util.ArrayList<java.lang.Boolean> getActiveFlags()`
Gets this template3D's list of Active Points

Returns:
The list of active booleans in this Template3D

### getActive

`public boolean getActive(int i)`

### getPoint

`public Vector3 getPoint(int i)`
Retrieve a specific point in this Template3D

Parameters:
`i` - The index of the point in the coords list
Returns:
The 3D coord of the point

### setPoint

```public void setPoint(int i,
Vector3 p)```
Retrieve a specific point in this Template3D

Parameters:
`i` - The index of the point in the coords list

### setActive

```public void setActive(int i,
boolean b)```
Set a specific point in this Template3D as Active

Parameters:
`i` - The index of the point in the coords list

### copy

`public void copy(Template3D t3d)`
Copies the given template into this

Parameters:
`t3d` - The template to copy

### getCentre

`public Vector3 getCentre()`
Returns the centre of mass of this Template3D

Returns:
The midpoint of the 3d points in this template3d

### getCentre

`public Vector3 getCentre(java.util.ArrayList<java.lang.Boolean> active2)`
Returns the centre of mass of this Template3D

Returns:
The midpoint of the 3d points in this template3d

`public double getMeanRadiusSquared(Vector3 centre)`
Finds the average distance from the point given

Parameters:
`centre` - A point to measure the radius from
Returns:
The average distance from the point

`public double getMeanRadius(Vector3 centre)`
Finds the average distance from the point given

Parameters:
`centre` - A point to measure the radius from
Returns:
The average distance from the point

```public double getMeanRadius(Vector3 centre,
java.util.ArrayList<java.lang.Boolean> active2)```
Finds the average distance from the point given

Parameters:
`centre` - A point to measure the radius from
`active2` - the list of active flags for the target template
Returns:
The average distance from the point

```public double getMeanRadiusSquared(Vector3 centre,
java.util.ArrayList<java.lang.Boolean> active2)```
Finds the average distance from the point given

Parameters:
`centre` - A point to measure the radius from
`active2` - the list of active flags for the target template
Returns:
The average distance from the point

### transform

```public void transform(BigMat R,
double[] T,
double scale)```

### subtract

`public void subtract(Template3D t3d)`

### fitTo2DOrtho

```public boolean fitTo2DOrtho(Template template,
int width,
int height,
Vector3 centre,
BigMat R,
double[] T,
double[] scale)```

### vectorise

`public double[] vectorise()`

### unvectorise

`public void unvectorise(double[] vec)`