当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix4d::scale方法代码示例

本文整理汇总了C++中Matrix4d::scale方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4d::scale方法的具体用法?C++ Matrix4d::scale怎么用?C++ Matrix4d::scale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix4d的用法示例。


在下文中一共展示了Matrix4d::scale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateTexture

/** Store the Direct Volume Rendering of the dataset and store it in the
 *  texture buffer. */
void GLDvrWidget::updateTexture() {
    assert(mp_volume);
    assert(mp_transferFunction);

    // TODO (CA2): perform Direct Volume Rendering here

    Vector3d C00 = Vector3d(0,0,0);
    Vector3d C01 = Vector3d(0,m_texHeight,0);
    Vector3d C10 = Vector3d(m_texWidth,0,0);
    Vector3d C11 = Vector3d(m_texWidth,m_texHeight,0);

    Matrix4d rotate;

    rotate = m_matRotX * m_matRotY;

    Matrix4d scale;
    scale.scale(Vector3d(m_prevMouseScale,m_prevMouseScale,m_prevMouseScale));

    int m_maxDim = m_texHeight;

    Matrix4d T;
    T.translate(Vector3d(mp_volume->getWidth(),mp_volume->getHeight(),mp_volume->getDepth()));
    Matrix4d Tv_center = T.getTranslated( 0.5*Vector3d(mp_volume->getWidth(),mp_volume->getHeight(),mp_volume->getDepth())) ;
    Matrix4d Tz = T.getTranslated(Vector3d(0.,0.,(double)(-2*m_maxDim)));

    Matrix4d M = Tv_center*rotate*scale*Tz*Tv_center;

    C00 *= M;




} /* updateTexture() */
开发者ID:Zeroxk,项目名称:Assignments-Exercises,代码行数:35,代码来源:gl_dvr_widget.cpp

示例2: UpdateDrawObj

void WingGeom::UpdateDrawObj()
{
    Geom::UpdateDrawObj();

    Matrix4d attachMat;
    Matrix4d relTrans;
    attachMat = ComposeAttachMatrix();
    relTrans = attachMat;
    relTrans.affineInverse();
    relTrans.matMult( m_ModelMatrix.data() );
    relTrans.postMult( attachMat.data() );

    int nxsec = m_XSecSurf.NumXSec();
    m_XSecDrawObj_vec.resize( nxsec, DrawObj() );

    //==== Tesselate Surface ====//
    for ( int i = 0 ; i < nxsec ; i++ )
    {
        m_XSecDrawObj_vec[i].m_PntVec = m_XSecSurf.FindXSec( i )->GetDrawLines( m_TessW(), relTrans );
        m_XSecDrawObj_vec[i].m_GeomChanged = true;
    }

    m_HighlightXSecDrawObj.m_PntVec = m_XSecSurf.FindXSec( m_ActiveAirfoil )->GetDrawLines( m_TessW(), relTrans );
    m_HighlightXSecDrawObj.m_GeomChanged = true;

    double w = m_XSecSurf.FindXSec( m_ActiveAirfoil )->GetXSecCurve()->GetWidth();

    Matrix4d mat;
    m_XSecSurf.GetBasicTransformation( Z_DIR, X_DIR, XS_SHIFT_MID, false, 1.0, mat );
    mat.scale( 1.0/w );

    VspCurve crv = m_XSecSurf.FindXSec( m_ActiveAirfoil )->GetUntransformedCurve();
    crv.Transform( mat );

    vector< vec3d > pts;
    crv.Tesselate( m_TessW(), pts );

    m_CurrentXSecDrawObj.m_PntVec = pts;
    m_CurrentXSecDrawObj.m_LineWidth = 1.0;
    m_CurrentXSecDrawObj.m_LineColor = vec3d( 0.0, 0.0, 0.0 );
    m_CurrentXSecDrawObj.m_Type = DrawObj::VSP_LINES;
    m_CurrentXSecDrawObj.m_GeomChanged = true;


    VspCurve inbd = m_XSecSurf.FindXSec( m_ActiveXSec - 1 )->GetCurve();
    inbd.Transform( relTrans );

    VspCurve outbd = m_XSecSurf.FindXSec( m_ActiveXSec )->GetCurve();
    outbd.Transform( relTrans );

    BndBox iBBox, oBBox;
    inbd.GetBoundingBox( iBBox );
    outbd.GetBoundingBox( oBBox );
    oBBox.Update( iBBox );

    m_HighlightWingSecDrawObj.m_PntVec = oBBox.GetBBoxDrawLines();

}
开发者ID:Mr-Kumar-Abhishek,项目名称:OpenVSP,代码行数:58,代码来源:WingGeom.cpp

示例3: Update

void PropPositioner::Update()
{
    m_NeedsUpdate = false;

    m_TransformedCurve = m_Curve;

    Matrix4d mat;
    mat.scale( m_Chord );

    if ( m_Reverse < 0 )
    {
        mat.translatef( 1.0, 0.0, 0.0 );
        mat.flipx();
    }

    m_TransformedCurve.Transform( mat );

    if ( !m_ParentProp )
    {
        return;
    }

    // Basic transformation orients curve before other transformations.
    m_ParentProp->GetBasicTransformation( m_Chord, mat );
    m_TransformedCurve.Transform( mat );

    mat.loadIdentity();

    // Propeller rotation first because order is reversed.
    mat.rotateX( -m_Reverse * m_PropRot );

    mat.translatef( m_FoldOrigin.x(), m_FoldOrigin.y(), m_FoldOrigin.z() );
    mat.rotate( m_FoldAngle * PI / 180.0, m_FoldDirection );
    mat.translatef( -m_FoldOrigin.x(), -m_FoldOrigin.y(), -m_FoldOrigin.z() );

    mat.rotateY( m_Reverse * m_Feather );

    mat.translatef( 0, m_Radius, 0 );

    mat.rotateY( m_Reverse * m_Twist );

    mat.rotateX( m_XRotate ); // About rake direction

    mat.translatef( m_Rake, 0, m_Reverse * m_Skew );

    mat.rotateZ( m_ZRotate ); // About chord

    m_TransformedCurve.Transform( mat );
}
开发者ID:SteveDoyle2,项目名称:OpenVSP,代码行数:49,代码来源:PropGeom.cpp


注:本文中的Matrix4d::scale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。