示例#1
0
double CCopasiSpringLayout::potSpeciesSpecies(const CLMetabGlyph & a, const CLMetabGlyph & b) const
{
  double tmp;
  tmp = bound_distance(a.getX() + a.getWidth() / 2, a.getY() + a.getHeight() / 2,
                       b.getX() + b.getWidth() / 2, b.getY() + b.getHeight() / 2, 200);

  if (tmp < 1) tmp = 1;

  return /*a.charge*b.charge*/ 1 / tmp; //TODO: reintroduce the charge
}
/*
  return ret;
}

 */
double CCopasiSpringLayout::potSpeciesCompartment(const CLMetabGlyph & s, const CLCompartmentGlyph & c) const
{
  double tmp = 0;
  double dist = fabs((s.getX() + 0.5 * s.getWidth()) - (c.getX() + 0.5 * c.getWidth()));

  if (dist > (0.5 * c.getWidth() - 50))
    tmp += pow(dist - 0.5 * c.getWidth() + 50, 2);

  dist = fabs((s.getY() + 0.5 * s.getHeight()) - (c.getY() + 0.5 * c.getHeight()));

  if (dist > (0.5 * c.getHeight() - 50))
    tmp += pow(dist - 0.5 * c.getHeight() + 50, 2);

  return tmp /**s.charge*/; //TODO reintroduce charge
}