~ubuntu-branches/ubuntu/maverick/gnome-chemistry-utils/maverick

« back to all changes in this revision

Viewing changes to libs/gcp/bond.cc

  • Committer: Bazaar Package Importer
  • Author(s): Micah Gersten
  • Date: 2010-03-29 10:49:13 UTC
  • mfrom: (1.1.6 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100329104913-o335elk75e3emtf8
Tags: 0.10.12-2ubuntu1
* Merge from debian testing (LP: #550972).  Remaining changes:
  - debian/patches/disable_check_omf.dpatch: Added to disable check-doc-omf
    as it requires Internet access
  - debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * GChemPaint library
5
5
 * bond.cc 
6
6
 *
7
 
 * Copyright (C) 2001-2008 Jean Bréfort <jean.brefort@normalesup.org>
 
7
 * Copyright (C) 2001-2010 Jean Bréfort <jean.brefort@normalesup.org>
8
8
 *
9
9
 * This program is free software; you can redistribute it and/or 
10
10
 * modify it under the terms of the GNU General Public License as 
207
207
                                Bond *bond = reinterpret_cast <Bond*> (m_Begin->GetFirstBond (it));
208
208
                                if (bond == this)
209
209
                                        bond = reinterpret_cast <Bond*> (m_Begin->GetNextBond (it));
210
 
                                double a0 = atan2 (*y1 - *y2, *x2 - *x1), a1 = bond->GetAngle2DRad (reinterpret_cast <Atom*> (m_Begin)), a2, a;
 
210
                                double a0 = atan2 (*y1 - *y2, *x2 - *x1), a1 = bond->GetAngle2DRad (reinterpret_cast <Atom*> (m_Begin)), a;
211
211
                                if (fabs (fabs (a0 - a1) - M_PI) > 0.01) {
212
212
                                        double sign = sin (a0 - a1) > 0.0 ? 1.0 : -1.0;
213
213
                                        double tanb = ((m_Begin->GetZ () == 6)? fabs (tan ((M_PI - a0 + a1) / 2)): 0.), cosa = cos (a0), sina = sin (a0);
214
214
                                        m_coords[4] = *x1 + BondDist * cosa * tanb - dy * sign;
215
215
                                        m_coords[5] = *y1 + dx * sign - BondDist * sina * tanb;
216
216
                                        tanb = 0.;
217
 
                                        a2 = M_PI + a0;
218
 
                                        if (a2 > 2 * M_PI)
219
 
                                                a2 -= 2 * M_PI;
220
217
                                        bond = reinterpret_cast <Bond*> (m_End->GetFirstBond (it));
221
218
                                        if (m_End->GetZ () == 6)
222
219
                                                while (bond) {
228
225
                                                        }
229
226
                                                        bond = reinterpret_cast <Bond*> (m_End->GetNextBond (it));
230
227
                                                }
231
 
                                        m_coords[6] = *x2 + BondDist * cosa * tanb - dy * sign;
232
 
                                        m_coords[7] = *y2 + dx * sign - BondDist * sina * tanb;
 
228
                                        m_coords[6] = *x2 + (BondDist * cosa * tanb - dy) * sign;
 
229
                                        m_coords[7] = *y2 +(dx - BondDist * sina * tanb) * sign;
233
230
                                        goto done;
234
231
                                }
235
232
                        } else if (n1 > 1 && n2 > 0) {
256
253
                                                                }
257
254
                                                                bond = reinterpret_cast <Bond*> (m_Begin->GetNextBond (it));
258
255
                                                        }
259
 
                                                m_coords[4] = *x1 - BondDist * cosa * tanb - dy * sign;
260
 
                                                m_coords[5] = *y1 + dx * sign + BondDist * sina * tanb;
 
256
                                                m_coords[4] = *x1 - (BondDist * cosa * tanb + dy) * sign;
 
257
                                                m_coords[5] = *y1 + (dx + BondDist * sina * tanb) * sign;
261
258
                                                tanb = (m_End->GetZ () == 6)? fabs (tan ((a1 - a0) / 2)): 0.;
262
259
                                                m_coords[6] = *x2 - BondDist * cosa * tanb - dy * sign;
263
260
                                                m_coords[7] = *y2 + dx * sign + BondDist * sina * tanb;