Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp

    rbe21fa rd555b8  
    4444
    4545  // check whether Axis is valid
    46   if (params.Axis.IsZero())
     46  if (params.Axis.get().IsZero())
    4747    return Action::failure;
    4848
    4949  // convert from degrees to radian
    50   params.angle *= M_PI/180.;
     50  double radian = params.angle.get() * M_PI/180.;
    5151
    5252  // Creation Line that is the rotation axis
    53   Line RotationAxis(Vector(0.,0.,0.), params.Axis);
     53  Line RotationAxis(Vector(0.,0.,0.), params.Axis.get());
    5454
    55   LOG(0, "Rotate around origin by " << params.angle << " radian, axis from origin to " << params.Axis << ".");
     55  LOG(0, "Rotate around origin by " << radian << " radian, axis from origin to " << params.Axis.get() << ".");
    5656  // TODO: use AtomSet::rotate?
    5757  for (std::vector<atom *>::iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter) {
    58     (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), params.angle));
     58    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), radian));
    5959  }
    6060  LOG(0, "done.");
     
    6565  AtomRotateAroundOriginByAngleState *state = assert_cast<AtomRotateAroundOriginByAngleState*>(_state.get());
    6666
     67  // convert from degrees to radian
     68  double radian = params.angle.get() * M_PI/180.;
     69
    6770  // Creation Line that is the rotation axis
    68   Line RotationAxis(Vector(0.,0.,0.), state->params.Axis);
     71  Line RotationAxis(Vector(0.,0.,0.), state->params.Axis.get());
    6972
    7073  for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) {
    71     (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->params.angle));
     74    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -radian));
    7275  }
    7376
     
    7881  AtomRotateAroundOriginByAngleState *state = assert_cast<AtomRotateAroundOriginByAngleState*>(_state.get());
    7982
     83  // convert from degrees to radian
     84  double radian = params.angle.get() * M_PI/180.;
     85
    8086  // Creation Line that is the rotation axis
    81   Line RotationAxis(Vector(0.,0.,0.), state->params.Axis);
     87  Line RotationAxis(Vector(0.,0.,0.), state->params.Axis.get());
    8288
    8389  for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) {
    84     (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->params.angle));
     90    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), radian));
    8591  }
    8692
Note: See TracChangeset for help on using the changeset viewer.