2011-12-09 21:50:25 +01:00
|
|
|
|
|
|
|
#include <knotkit.h>
|
|
|
|
|
|
|
|
planar_diagram::planar_diagram (const std::string &name_, unsigned n_crossings, const int crossings_ar[][4])
|
|
|
|
: name(name_),
|
|
|
|
crossings(n_crossings)
|
|
|
|
{
|
|
|
|
for (unsigned i = 1; i <= n_crossings; i ++)
|
|
|
|
{
|
|
|
|
for (unsigned j = 1; j <= 4; j ++)
|
|
|
|
crossings[i].append (crossings_ar[i - 1][j - 1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
planar_diagram::planar_diagram (const knot_diagram &kd)
|
|
|
|
: name(kd.name),
|
|
|
|
crossings(kd.planar_diagram_crossings ())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-21 16:09:17 +02:00
|
|
|
planar_diagram::show_knottheory () const
|
2011-12-09 21:50:25 +01:00
|
|
|
{
|
2012-05-21 16:09:17 +02:00
|
|
|
printf ("PD[");
|
2011-12-09 21:50:25 +01:00
|
|
|
for (unsigned i = 1; i <= crossings.size (); i ++)
|
|
|
|
{
|
|
|
|
if (i > 1)
|
|
|
|
printf (",");
|
2012-05-21 16:09:17 +02:00
|
|
|
printf ("X[%d,%d,%d,%d]",
|
2011-12-09 21:50:25 +01:00
|
|
|
crossings[i][1],
|
|
|
|
crossings[i][2],
|
|
|
|
crossings[i][3],
|
|
|
|
crossings[i][4]);
|
|
|
|
}
|
2012-05-21 16:09:17 +02:00
|
|
|
printf ("]");
|
2011-12-09 21:50:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
planar_diagram::display_self () const
|
|
|
|
{
|
|
|
|
printf ("planar_diagram %s ", name.c_str ());
|
|
|
|
for (unsigned i = 1; i <= crossings.size (); i ++)
|
|
|
|
{
|
|
|
|
int i1 = crossings[i][1],
|
|
|
|
i2 = crossings[i][2],
|
|
|
|
i3 = crossings[i][3],
|
|
|
|
i4 = crossings[i][4];
|
|
|
|
|
|
|
|
if (i1 >= 10 || i2 >= 10 || i3 >= 10 || i4 >= 10)
|
|
|
|
printf ("X_%d,%d,%d,%d", i1, i2, i3, i4);
|
|
|
|
else
|
|
|
|
printf ("X_%d%d%d%d", i1, i2, i3, i4);
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
}
|