Now I think I can explain my problem better
if(_mstate->getSize()>5)
{
(*_mstate->getX0())[0].x() = thetaX; //error here
(*_mstate->getX0())[1].x() = thetaZ;
(*_mstate->getX0())[2].x() = state.toolRoll;
(*_mstate->getX0())[3].x() = state.toolDepth*Scale.getValue();
(*_mstate->getX0())[4].x() =state.opening;
(*_mstate->getX0())[5].x() =state.opening;
}
////////////////////////////////////////////////////////////////////////////////
Here _mstate is a pointer to a BaseMechanical state object
core::componentmodel::behavior::BaseMechanicalState* _mstate; |
_mstate has been typecasted to MechanicalState pointer (srry if some terms are wrong)
this->_mstate = dynamic_cast<core::behavior::MechanicalState<Vec1dTypes>*> (context->getMechanicalState()); |
MechanicalState is inherited from BaseMechanicalState class
class MechanicalState : public BaseMechanicalState |
BaseMechanical state contains VecCoord type members which which contains a set of vectors.
getX0 is defined in MechanicalState class
virtual VecCoord* getX0() = 0; |
virtual VecCoord* getX0() = 0; |
the operator is defined as follows:
const_reference operator[](size_type n) const |
reference operator[](size_type n) |
// here I am not getting it
x() is defined as
const real& sofa::defaulttype::Vec< N, real >::x( ) const |
And the error message is
error C3892: 'sofa::helper::vector<T>::operator []' : you cannot assign to a variable that is const
1> with
1> [
1> T=sofa::defaulttype::Vec<1,double>
1> ] |
Now I think I am clear enough.I tried to do lot of things but I am stuck here.
Could you please help?