Show
Ignore:
Timestamp:
03/21/12 18:36:20 (3 years ago)
Author:
robert
Message:

Ran script to remove trailing spaces and tabs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgParticle/BounceOperator.cpp

    r12292 r13041  
    1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield  
     1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield 
    22 * 
    3  * This library is open source and may be redistributed and/or modified under   
    4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or  
     3 * This library is open source and may be redistributed and/or modified under 
     4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
    55 * (at your option) any later version.  The full license is in LICENSE file 
    66 * included with this distribution, and on the openscenegraph.org website. 
    7  *  
     7 * 
    88 * This library is distributed in the hope that it will be useful, 
    99 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
     10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1111 * OpenSceneGraph Public License for more details. 
    1212*/ 
     
    2424    float distance = domain.plane.distance( P->getPosition() ); 
    2525    if ( distance*domain.plane.distance(nextpos)>=0 ) return; 
    26      
     26 
    2727    osg::Vec3 normal = domain.plane.getNormal(); 
    2828    float nv = normal * P->getVelocity(); 
    2929    osg::Vec3 hitPoint = P->getPosition() - P->getVelocity() * (distance / nv); 
    30      
     30 
    3131    float upos = (hitPoint - domain.v1) * domain.s1; 
    3232    float vpos = (hitPoint - domain.v1) * domain.s2; 
    3333    if ( upos<0.0f || vpos<0.0f || (upos + vpos)>1.0f ) return; 
    34      
     34 
    3535    // Compute tangential and normal components of velocity 
    3636    osg::Vec3 vn = normal * nv; 
    3737    osg::Vec3 vt = P->getVelocity() - vn; 
    38      
     38 
    3939    // Compute new velocity 
    4040    if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); 
     
    4747    float distance = domain.plane.distance( P->getPosition() ); 
    4848    if ( distance*domain.plane.distance(nextpos)>=0 ) return; 
    49      
     49 
    5050    osg::Vec3 normal = domain.plane.getNormal(); 
    5151    float nv = normal * P->getVelocity(); 
    5252    osg::Vec3 hitPoint = P->getPosition() - P->getVelocity() * (distance / nv); 
    53      
     53 
    5454    float upos = (hitPoint - domain.v1) * domain.s1; 
    5555    float vpos = (hitPoint - domain.v1) * domain.s2; 
    5656    if ( upos<0.0f || upos>1.0f || vpos<0.0f || vpos>1.0f ) return; 
    57      
     57 
    5858    // Compute tangential and normal components of velocity 
    5959    osg::Vec3 vn = normal * nv; 
    6060    osg::Vec3 vt = P->getVelocity() - vn; 
    61      
     61 
    6262    // Compute new velocity 
    6363    if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); 
     
    7070    float distance = domain.plane.distance( P->getPosition() ); 
    7171    if ( distance*domain.plane.distance(nextpos)>=0 ) return; 
    72      
     72 
    7373    osg::Vec3 normal = domain.plane.getNormal(); 
    7474    float nv = normal * P->getVelocity(); 
    75      
     75 
    7676    // Compute tangential and normal components of velocity 
    7777    osg::Vec3 vn = normal * nv; 
    7878    osg::Vec3 vt = P->getVelocity() - vn; 
    79      
     79 
    8080    // Compute new velocity 
    8181    if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience ); 
     
    9191        float distance2 = (nextpos - domain.v1).length(); 
    9292        if ( distance2<=domain.r1 ) return; 
    93          
     93 
    9494        // Bounce back in if going outside 
    9595        osg::Vec3 normal = domain.v1 - P->getPosition(); normal.normalize(); 
    9696        float nmag = P->getVelocity() * normal; 
    97          
     97 
    9898        // Compute tangential and normal components of velocity 
    9999        osg::Vec3 vn = normal * nmag; 
    100100        osg::Vec3 vt = P->getVelocity() - vn; 
    101101        if ( nmag<0 ) vn = -vn; 
    102          
     102 
    103103        // Compute new velocity 
    104104        float tanscale = (vt.length2()<=_cutoff) ? 1.0f : (1.0f - _friction); 
    105105        P->setVelocity( vt * tanscale + vn * _resilience ); 
    106          
     106 
    107107        // Make sure the particle is fixed to stay inside 
    108108        nextpos = P->getPosition() + P->getVelocity() * dt; 
     
    111111        { 
    112112            normal = domain.v1 - nextpos; normal.normalize(); 
    113              
     113 
    114114            osg::Vec3 wishPoint = domain.v1 - normal * (0.999f * domain.r1); 
    115115            P->setVelocity( (wishPoint - P->getPosition()) / dt ); 
     
    120120        float distance2 = (nextpos - domain.v1).length(); 
    121121        if ( distance2>domain.r1 ) return; 
    122          
     122 
    123123        // Bounce back out if going inside 
    124124        osg::Vec3 normal = P->getPosition() - domain.v1; normal.normalize(); 
    125125        float nmag = P->getVelocity() * normal; 
    126          
     126 
    127127        // Compute tangential and normal components of velocity 
    128128        osg::Vec3 vn = normal * nmag; 
    129129        osg::Vec3 vt = P->getVelocity() - vn; 
    130130        if ( nmag<0 ) vn = -vn; 
    131          
     131 
    132132        // Compute new velocity 
    133133        float tanscale = (vt.length2()<=_cutoff) ? 1.0f : (1.0f - _friction); 
     
    141141    float distance = domain.plane.distance( P->getPosition() ); 
    142142    if ( distance*domain.plane.distance(nextpos)>=0 ) return; 
    143      
     143 
    144144    osg::Vec3 normal = domain.plane.getNormal(); 
    145145    float nv = normal * P->getVelocity(); 
    146146    osg::Vec3 hitPoint = P->getPosition() - P->getVelocity() * (distance / nv); 
    147      
     147 
    148148    float radius = (hitPoint - domain.v1).length(); 
    149149    if ( radius>domain.r1 || radius<domain.r2 ) return; 
    150      
     150 
    151151    // Compute tangential and normal components of velocity 
    152152    osg::Vec3 vn = normal * nv; 
    153153    osg::Vec3 vt = P->getVelocity() - vn; 
    154      
     154 
    155155    // Compute new velocity 
    156156    if ( vt.length2()<=_cutoff ) P->setVelocity( vt - vn*_resilience );