Exemple #1
0
        /// Set the COG frame with respect to the auxiliary reference frame.
        /// Note that this also moves the body absolute COG (the REF is fixed).
        /// The position of contained ChMarker objects, if any, is not changed with respect
        /// to the reference.
        public void SetFrame_COG_to_REF(ChFrame <double> mloc)
        {
            // Problem here, old_cog_to_abs should get changed by this.
            ChFrameMoving <double> old_cog_to_abs = ChFrameMoving <double> .FMNULL; // new ChFrameMoving<double>();//= this.BodyFrame;

            ChFrameMoving <double> tmpref_to_abs = ChFrameMoving <double> .FMNULL;  //new ChFrameMoving<double>();

            this.BodyFrame.TransformLocalToParent(this.auxref_to_cog, tmpref_to_abs);
            tmpref_to_abs.TransformLocalToParent(new ChFrameMoving <double>(mloc), this.BodyFrame); // Gets changed here.

            // or, also, using overloaded operators for frames:
            //   tmpref_to_abs = auxref_to_cog >> *this;
            //   *this         = ChFrameMoving<>(mloc) >> tmpref_to_abs;

            ChFrameMoving <double> new_cog_to_abs = this.BodyFrame;

            auxref_to_cog = mloc.GetInverse();
            this.BodyFrame.TransformLocalToParent(this.auxref_to_cog, this.auxref_to_abs);
            // or, also, using overloaded operators for frames:
            //   *this->auxref_to_abs = this->auxref_to_cog.GetInverse() >> this;

            // Restore marker/forces positions, keeping unchanged respect to aux ref.
            ChFrameMoving <double> cog_oldnew = old_cog_to_abs.BitShiftRight(new_cog_to_abs.GetInverse()); // This is not return correct due to old_cog_to_abs changing by this.BodyFrame!

            for (int i = 0; i < marklist.Count; i++)
            {
                marklist[i].FrameMoving.ConcatenatePreTransformation(cog_oldnew);
                marklist[i].update(ChTime);
            }

            // Forces: ?? to do...

            /*
             * HIER_FORCE_INIT
             * while (HIER_FORCE_NOSTOP)
             * {
             *  FORCEpointer->
             *  FORCEpointer->Update (mytime);
             *
             *  HIER_FORCE_NEXT
             * }
             */
        }
Exemple #2
0
 /// Get the COG frame with respect to the auxiliary reference frame.
 public ChFrame <double> GetFrame_COG_to_REF()
 {
     return(auxref_to_cog.GetInverse());
 }