Exemplo n.º 1
0
//==== Update ====//
void CustomXSec::Update()
{

    m_Type = XSEC_CUSTOM;

    m_LateUpdateFlag = false;

    XSecSurf* xsecsurf = (XSecSurf*) GetParentContainerPtr();

    // apply the needed transformation to get section into body orientation
    Matrix4d mat;
    xsecsurf->GetBasicTransformation( m_XSCurve->GetWidth(), mat );

    VspCurve baseCurve = GetUntransformedCurve();

    baseCurve.Transform( mat );

    //==== Apply Transform ====//
    m_TransformedCurve = baseCurve;

    Matrix4d tran_mat;
    tran_mat.translatef( m_Loc.x(),  m_Loc.y(),  m_Loc.z() );

    Matrix4d rotate_mat;
    rotate_mat.rotateX( m_Rot.x() );
    rotate_mat.rotateY( m_Rot.y() );
    rotate_mat.rotateZ( m_Rot.z() );

    Matrix4d cent_mat;
    vec3d cent = m_CenterRot + m_Loc;
    cent_mat.translatef( -cent.x(), -cent.y(), -cent.z() );

    Matrix4d inv_cent_mat;
    inv_cent_mat.translatef(  cent.x(),  cent.y(),  cent.z() );

    m_Transform.loadIdentity();

    m_Transform.postMult( tran_mat.data() );
    m_Transform.postMult( cent_mat.data() );
    m_Transform.postMult( rotate_mat.data() );
    m_Transform.postMult( inv_cent_mat.data() );

    m_Transform.postMult( xsecsurf->GetGlobalXForm().data() );

    m_TransformedCurve.Transform( m_Transform );
}
Exemplo n.º 2
0
//==== Update ====//
void WingSect::Update()
{
    m_LateUpdateFlag = false;

    XSecSurf* xsecsurf = (XSecSurf*) GetParentContainerPtr();

    // apply the needed transformation to get section into body orientation
    Matrix4d mat;
    xsecsurf->GetBasicTransformation( m_XSCurve->GetWidth(), mat );

    VspCurve baseCurve = GetUntransformedCurve();

    baseCurve.Transform( mat );

    //==== Apply Transform ====//
    m_TransformedCurve = baseCurve;

    Matrix4d tran_mat;
    tran_mat.translatef( m_XDelta, m_YDelta, m_ZDelta );

    Matrix4d rotate_mat;
    rotate_mat.rotateX( m_XRotate );
    rotate_mat.rotateY( m_YRotate );
    rotate_mat.rotateZ( m_ZRotate );

    Matrix4d cent_mat;
    cent_mat.translatef( -m_XCenterRot, -m_YCenterRot, -m_ZCenterRot );

    Matrix4d inv_cent_mat;
    inv_cent_mat.translatef( m_XCenterRot, m_YCenterRot, m_ZCenterRot );

    m_Transform.loadIdentity();

    m_Transform.postMult( tran_mat.data() );
    m_Transform.postMult( cent_mat.data() );
    m_Transform.postMult( rotate_mat.data() );
    m_Transform.postMult( inv_cent_mat.data() );

    m_Transform.postMult( xsecsurf->GetGlobalXForm().data() );

    m_TransformedCurve.Transform( m_Transform );


    //==== Inform Outboard Section of Change ====//
    int indx = xsecsurf->FindXSecIndex( m_ID );
    if( indx < xsecsurf->NumXSec() - 1 )
    {
        WingSect* nextxs = (WingSect*) xsecsurf->FindXSec( indx + 1);
        if( nextxs )
        {
            nextxs->SetLateUpdateFlag( true );
        }
    }

}