protected override void Algorithm(ref Cl3DModel p_Model)
        {
            string name = p_Model.ModelFileFolder + p_Model.ModelFileName + m_sFilePostFix;

            if (m_bBinaryMode)
            {
                p_Model.SaveModel(name);
            }
            else
            {
                name += ".model";
                Cl3DModel.Cl3DModelPointIterator iter = p_Model.GetIterator();
                if (!iter.IsValid())
                    throw new Exception("Iterator in the model is not valid");

                using (TextWriter tw = new StreamWriter(name, false))
                {
                    tw.WriteLine("@----------------------------------------");
                    tw.WriteLine("@     Przemyslaw Szeptycki LIRIS 2008");
                    tw.WriteLine("@                Face model");
                    tw.WriteLine("@  Model name: " + p_Model.ModelFileName);
                    tw.WriteLine("@----------------------------------------");
                    tw.WriteLine("@ PointID X Y Z (TextureX TextureY) (Neighbors PointID)");
                    do
                    {
                        string line = iter.PointID.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " + iter.X.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " + iter.Y.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " + iter.Z.ToString(System.Globalization.CultureInfo.InvariantCulture) + " ( " + iter.RangeImageX.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " + iter.RangeImageY.ToString(System.Globalization.CultureInfo.InvariantCulture) + " ) ( ";
                        List<Cl3DModel.Cl3DModelPointIterator> neighbors = iter.GetListOfNeighbors();
                        foreach (Cl3DModel.Cl3DModelPointIterator neighbor in neighbors)
                            line += neighbor.PointID.ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";
                        line += ")";

                        tw.WriteLine(line);

                    } while (iter.MoveToNext());

                    int nop = p_Model.GetAllSpecificPoints().Count;
                    if(nop != 0)
                    {
                        tw.WriteLine("Landmark points (ptID): "+nop.ToString());
                        foreach (KeyValuePair<string, Cl3DModel.Cl3DModelPointIterator> specificPoint in p_Model.GetAllSpecificPoints())
                        {
                            tw.WriteLine(specificPoint.Key + " " + specificPoint.Value.PointID.ToString());
                        }
                    }

                    tw.Close();
                }
            }
        }