コード例 #1
0
ファイル: lseg3f.cpp プロジェクト: Rillke/indigo
float LSeg3f::distToPoint(const Vec3f &point, Vec3f *closest) const
{
   if (_is_degenerate)
   {
      if (closest != 0)
         closest->copy(_beg);

      return Vec3f::dist(point, _beg);
   }

   Vec3f p;
   float t;

   p.diff(point, _beg);
   t = Vec3f::dot(p, _diff) / _length_sqr;

   if (t < 0.f)
      p.copy(_beg);
   else if (t > 1.f)
      p.copy(_end);
   else
      p.lineCombin(_beg, _diff, t);

   if (closest != 0)
      closest->copy(p);

   return Vec3f::dist(point, p);
}
コード例 #2
0
ファイル: render_context.cpp プロジェクト: mojca/indigo
void RenderContext::drawTextItemText (const TextItem& ti)
{
   bool bold = ti.highlighted && opt.highlightThicknessEnable;

   Vec3f color;
   if (ti.ritype == RenderItem::RIT_AAM)
      color.copy(opt.aamColor);
   else if (ti.ritype == RenderItem::RIT_DATASGROUP)
      color.copy(opt.dataGroupColor);
   else if (ti.ritype == RenderItem::RIT_COMMENT)
      color.copy(opt.commentColor);
   else if (ti.ritype == RenderItem::RIT_TITLE)
      color.copy(opt.titleColor);
   else
   {
      getColorVec(color, ti.color);
      if (ti.highlighted && opt.highlightColorEnable)
         color.copy(opt.highlightColor);
   }
   drawTextItemText (ti, color, bold);
}
コード例 #3
0
void MoleculeSubstructureMatcher::getAtomPos (Graph &graph, int vertex_idx, Vec3f &pos)
{
   pos.copy(((BaseMolecule &)graph).getAtomXyz(vertex_idx));
}