本文整理汇总了C++中MolAtomPtr::getParentChain方法的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr::getParentChain方法的具体用法?C++ MolAtomPtr::getParentChain怎么用?C++ MolAtomPtr::getParentChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MolAtomPtr
的用法示例。
在下文中一共展示了MolAtomPtr::getParentChain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawRingImpl
void BallStickRenderer::drawRingImpl(const std::list<int> atoms, DisplayContext *pdl)
{
MolCoordPtr pMol = getClientMol();
double len;
int i, nsize = atoms.size();
Vector4D *pvecs = MB_NEW Vector4D[nsize];
Vector4D cen;
std::list<int>::const_iterator iter = atoms.begin();
std::list<int>::const_iterator eiter = atoms.end();
MolAtomPtr pPivAtom, pAtom;
for (i=0; iter!=eiter; ++iter, i++) {
MolAtomPtr pAtom = pMol->getAtom(*iter);
if (pAtom.isnull()) return;
MolResiduePtr pres = pAtom->getParentResidue();
MolChainPtr pch = pAtom->getParentChain();
MB_DPRINTLN("RING %s %s", pres->toString().c_str(), pAtom->getName().c_str());
pvecs[i] = pAtom->getPos();
cen += pvecs[i];
if (pPivAtom.isnull() && pAtom->getElement()==ElemSym::C)
pPivAtom = pAtom;
}
if (pPivAtom.isnull())
pPivAtom = pAtom; // no carbon atom --> last atom becomes pivot
cen = cen.divide(nsize);
// calculate the normal vector
Vector4D norm;
for (i=0; i<nsize; i++) {
int ni = (i+1)%nsize;
Vector4D v1 = pvecs[ni] - pvecs[i];
Vector4D v2 = cen - pvecs[i];
Vector4D ntmp;
ntmp = v1.cross(v2);
len = ntmp.length();
if (len<=F_EPS8) {
LOG_DPRINTLN("BallStick> *****");
return;
}
//ntmp.scale(1.0/len);
ntmp = ntmp.divide(len);
norm += ntmp;
}
len = norm.length();
norm = norm.divide(len);
Vector4D dv = norm.scale(m_tickness);
ColorPtr col = evalMolColor(m_ringcol, ColSchmHolder::getColor(pPivAtom));
/*
ColorPtr col = m_ringcol;
// check molcol reference
gfx::MolColorRef *pMolCol = dynamic_cast<gfx::MolColorRef *>(col.get());
if (pMolCol!=NULL) {
// molcol ref case --> resolve the pivot's color
col = ColSchmHolder::getColor(pPivAtom);
}
*/
pdl->setPolygonMode(gfx::DisplayContext::POLY_FILL_NOEGLN);
pdl->startTriangleFan();
pdl->normal(norm);
pdl->color(col);
pdl->vertex(cen+dv);
for (i=0; i<=nsize; i++) {
pdl->vertex(pvecs[i%nsize]+dv);
}
pdl->end();
pdl->startTriangleFan();
pdl->normal(-norm);
pdl->color(col);
pdl->vertex(cen-dv);
for (i=nsize; i>=0; i--) {
pdl->vertex(pvecs[i%nsize]-dv);
}
pdl->end();
pdl->setPolygonMode(gfx::DisplayContext::POLY_FILL);
delete [] pvecs;
}