# Aligning Point Clouds

The code shows how to align point clouds.

## C++

```cpp
#include <eVision/Easy3D/EFeaturesAligner.h>
```

```cpp
using namespace eVision;
using namespace eVision::Easy3D;

EFeaturesAligner alignTool;
E3DTransformMatrix alignBase;
E3DPoint ex, ey, ez, t;
std::vector<E3DPoint> model3d;
std::vector<E3DPoint> points3d;

// add points to model3d and points3d
// ...

alignTool.SetModelPoints(model3d);
alignBase = alignTool.Compute(points3d);

// Get the orthogonal basis and store it in ex, ey, ez and t
alignBase.GetOrthoBasis(ex, ey, ez, t);

// Applying the transformation on point P1, results in point P1b
E3DPoint P1 = E3DPoint(1.4f, 0.2f, 3.6f);
E3DPoint P1b = alignBase*P1;
```

## C#

```cs
using eVision;
using eVision.Easy3D;
```

```cs
EFeaturesAligner alignTool = new EFeaturesAligner();
E3DTransformMatrix alignBase = new E3DTransformMatrix();
E3DPoint ex = new E3DPoint(), ey = new E3DPoint(), ez = new E3DPoint(), t = new E3DPoint(); 
E3DPoint[] model3d = new E3DPoint[10]; 
E3DPoint[] points3d = new E3DPoint[10]; 

// add points to model3d and points3d 
// ...

alignTool.ModelPoints = model3d;
alignBase = alignTool.Compute(points3d); 

// Get the orthogonal basis and store it in ex, ey, ez and t
alignBase.GetOrthoBasis(out ex, out ey, out ez, out t);

// Applying the transformation on point P1, results in point P1b 
E3DPoint P1 = new E3DPoint(1.4f, 0.2f, 3.6f);
E3DPoint P1b = alignBase*P1;
```

## Python

```py
from eVision import Easy3D

alignTool = Easy3D.EFeaturesAligner()
alignBase = Easy3D.E3DTransformMatrix()
ex = Easy3D.E3DPoint()
ey = Easy3D.E3DPoint()
ez = Easy3D.E3DPoint()
t = Easy3D.E3DPoint()
model3d = []
points3d = []

# add points to model3d and points3d
# ...

alignTool.ModelPoints = model3d
alignBase = alignTool.Compute(points3d)

# Get the orthogonal basis and store it in ex, ey, ez and t
alignBase.GetOrthoBasis(ex, ey, ez, t)

# Applying the transformation on point P1, results in point P1b 
P1 = Easy3D.E3DPoint(1.4, 0.2, 3.6)
P1b = Easy3D.EAffineTransformer.ApplyMatrix(alignBase, P1)
```
