Cosmetic: Cosmetic code corrections in QuickStep
[ode.git] / ode / src / gimpact_gim_contact_accessor.h
blob2b252b496d2068e09484a64ccb50a0c5c4ffb13a
1 /*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
24 #ifndef _ODE_GIMPACT_GIM_CONTACT_ACCESSOR_H_
25 #define _ODE_GIMPACT_GIM_CONTACT_ACCESSOR_H_
28 struct dxGIMCContactAccessor
30 dxGIMCContactAccessor(GIM_CONTACT *ptrimeshcontacts, dGeomID g1, dGeomID g2) : m_ptrimeshcontacts(ptrimeshcontacts), m_g1(g1), m_g2(g2), m_gotside2ovr(false), m_side2ovr() {}
31 dxGIMCContactAccessor(GIM_CONTACT *ptrimeshcontacts, dGeomID g1, dGeomID g2, int side2ovr) : m_ptrimeshcontacts(ptrimeshcontacts), m_g1(g1), m_g2(g2), m_gotside2ovr(true), m_side2ovr(side2ovr) {}
33 dReal RetrieveDepthByIndex(unsigned index) const { return m_ptrimeshcontacts[index].m_depth; }
35 void ExportContactGeomByIndex(dContactGeom *pcontact, unsigned index) const
37 const GIM_CONTACT *ptrimeshcontact = m_ptrimeshcontacts + index;
38 pcontact->pos[0] = ptrimeshcontact->m_point[0];
39 pcontact->pos[1] = ptrimeshcontact->m_point[1];
40 pcontact->pos[2] = ptrimeshcontact->m_point[2];
41 pcontact->pos[3] = REAL(1.0);
43 pcontact->normal[0] = ptrimeshcontact->m_normal[0];
44 pcontact->normal[1] = ptrimeshcontact->m_normal[1];
45 pcontact->normal[2] = ptrimeshcontact->m_normal[2];
46 pcontact->normal[3] = 0;
48 pcontact->depth = ptrimeshcontact->m_depth;
49 pcontact->g1 = m_g1;
50 pcontact->g2 = m_g2;
51 pcontact->side1 = ptrimeshcontact->m_feature1;
52 pcontact->side2 = !m_gotside2ovr ? ptrimeshcontact->m_feature2 : m_side2ovr;
55 const GIM_CONTACT *m_ptrimeshcontacts;
56 dGeomID m_g1, m_g2;
57 bool m_gotside2ovr;
58 int m_side2ovr;
62 #endif //_ODE_GIMPACT_GIM_CONTACT_ACCESSOR_H_