- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp
rbe21fa rd555b8 44 44 45 45 // check whether Axis is valid 46 if (params.Axis. IsZero())46 if (params.Axis.get().IsZero()) 47 47 return Action::failure; 48 48 49 49 // convert from degrees to radian 50 params.angle *=M_PI/180.;50 double radian = params.angle.get() * M_PI/180.; 51 51 52 52 // 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()); 54 54 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() << "."); 56 56 // TODO: use AtomSet::rotate? 57 57 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)); 59 59 } 60 60 LOG(0, "done."); … … 65 65 AtomRotateAroundOriginByAngleState *state = assert_cast<AtomRotateAroundOriginByAngleState*>(_state.get()); 66 66 67 // convert from degrees to radian 68 double radian = params.angle.get() * M_PI/180.; 69 67 70 // 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()); 69 72 70 73 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)); 72 75 } 73 76 … … 78 81 AtomRotateAroundOriginByAngleState *state = assert_cast<AtomRotateAroundOriginByAngleState*>(_state.get()); 79 82 83 // convert from degrees to radian 84 double radian = params.angle.get() * M_PI/180.; 85 80 86 // 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()); 82 88 83 89 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)); 85 91 } 86 92
Note:
See TracChangeset
for help on using the changeset viewer.