• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            eryar

            PipeCAD - Plant Piping Design Software.
            RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.
            posts - 603, comments - 590, trackbacks - 0, articles - 0

            OpenCASCADE Color Scale

            Posted on 2014-09-20 20:11 eryar 閱讀(4311) 評論(0)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

            OpenCASCADE Color Scale

            eryar@163.com

            Abstract. The color scale is a specialized label object that displays a color map and an accompanying numerical scale for color mapped or contour data plots. As the geometry modeling kernel of SALOME, OpenCASCADE provides the color scale function. The paper focus on the usage of color scale in OpenCASCADE.

            Key Words. OpenCASCADE, Color Scale, 應(yīng)力云圖, 顏色映射表

            1. Introduction

            應(yīng)力云圖是一種應(yīng)用廣泛的標(biāo)量場可視化方法,也經(jīng)常用于表達(dá)矢量場或張量場的一個分量。云圖在顏色與標(biāo)量數(shù)據(jù)之間建立某種確定的映射關(guān)系,在計(jì)算機(jī)屏幕上繪制一個顏色離散變化的圖像來顯示科學(xué)計(jì)算結(jié)果。云圖將標(biāo)量場定義域內(nèi)的數(shù)據(jù)值映射成不同的顏色,從而通過顏色變化來反映數(shù)據(jù)場中數(shù)據(jù)的變化規(guī)律。

            很多數(shù)值分析軟件后處理的結(jié)果都有繪制云圖的功能。如下圖所示為Abaqus軟件產(chǎn)生的云圖:

            wps_clip_image-8337

            Figure 1.1 A Colored Stress Patterns by Abaqus

            OpenCASCADE作為SALOME開源數(shù)值分析軟件的幾何造型內(nèi)核,也提供了云圖可視化的功能。本文主要介紹如何使用OpenCASCADE來顯示模型的應(yīng)力云圖中的顏色映射表(Color Scale)。

            2. Color Scale

            云圖繪制依賴于顏色集合與標(biāo)量場數(shù)值集合之間的一一映射,即顏色映射表(Color Scale)。顏色映射表為區(qū)域填充時建立數(shù)值與顏色的映射關(guān)系。如下圖所示:

            wps_clip_image-10285

            Figure 2.1 Color Scale

            作為分析對比參照標(biāo)準(zhǔn),用戶可以根據(jù)顏色線性表對應(yīng)的數(shù)值范圍,來判斷某區(qū)域內(nèi)數(shù)值分布規(guī)律。顏色線性表不僅應(yīng)用于云圖繪制,也應(yīng)用于其他計(jì)算可視化算法中。

            顏色線性表可以定義成不同的形式,多以對比鮮明的色彩作為線性表段顏色,在兩個對比色之間采用過渡顏色。

            在OpenCASCADE中顏色映射表的繪制是由Viewer來實(shí)現(xiàn)的。其Tcl命令為vcolorscale,如下所示:

            wps_clip_image-28256

            Figure 2.2 Color Scale Tcl Command: vcolorscale

            默認(rèn)的顏色映射表的顯示效果如下圖所示:

            wps_clip_image-22753

            Figure 2.3 Color Scale in Draw Test Harness

            3. Tcl Test

            OpenCASCADE基于Tcl/Tk的Draw Test Harness環(huán)境很方便測試一些想法。現(xiàn)在在Draw Test Harness中來顯示一個完整的云圖,如下圖所示:

            wps_clip_image-9599

            Figure 3.1 Color Scale in Draw Test Harness

            實(shí)現(xiàn)上圖的Tcl腳本代碼如下所示:

            #
            #    Copyright (c) 2014 eryar All Rights Reserved.
            #
            #        File    : colorscale.tcl
            #        Author  : eryar@163.com
            #        Date    : 2014-09-20 18:10
            #        Version : 1.0v
            #
            #    Description : Demonstrate the usage of OpenCASCADE color scale.
            #

            pload ALL

            meshfromstl m data
            /stl/head.stl

            meshcolors m nodaltex 
            0

            # show the color sacle.
            vcolorscale

            vfit

            首先加載所需要的所有模塊,再從head.stl中加載網(wǎng)格模型;設(shè)置網(wǎng)格頂點(diǎn)顏色后就用vcolorscale命令打開發(fā)顏色映射表。

            4.Code Analysis

            根據(jù)Tcl命令找到對應(yīng)的C++實(shí)現(xiàn)代碼如下所示:

             

            //=============================================================================
            //function : VColorScale
            //purpose  : representation color scale
            //=============================================================================
            #include <V3d_ColorScale.hxx>

            static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
            {
              
            if ( argc != 1 && argc != 4 && argc != 5 && argc != 6 && argc != 8 )
              {
                di 
            << "Usage : " << argv[0<< " [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = Right X = 0 Y = 0]  " << "\n";
                
            return 1;
              }

              Handle(AIS_InteractiveContext) aContext 
            = ViewerTest::GetAISContext();
              
            if(aContext.IsNull()) {
                di 
            << argv[0<< " ERROR : use 'vinit' command before " << "\n";
                
            return -1;
              }

              Standard_Real minRange 
            = 0. , maxRange = 100. ;

              Standard_Integer numIntervals 
            = 10 ;
              Standard_Integer textHeight 
            = 16;
              Aspect_TypeOfColorScalePosition position 
            = Aspect_TOCSP_RIGHT;
              Standard_Real X 
            = 0., Y = 0. ;

              
            if ( argc < 9 )
              {
                 
            if( argc > 3 )
                 {
                   minRange 
            = Draw::Atof( argv[1] );
                   maxRange 
            = Draw::Atof( argv[2] );
                   numIntervals 
            = Draw::Atoi( argv[3] );
                 }
                 
            if ( argc > 4 )
                   textHeight 
            = Draw::Atoi( argv[4] );
                 
            if ( argc > 5 )
                   position 
            = (Aspect_TypeOfColorScalePosition)Draw::Atoi( argv[5] );
                 
            if ( argc > 7 )
                 {
                   X 
            = Draw::Atof( argv[6] );
                   Y 
            = Draw::Atof( argv[7] );
                 }
              }
              Handle(V3d_View) curView 
            = ViewerTest::CurrentView( );
              
            if ( curView.IsNull( ) )
                
            return 1;
              Handle(Aspect_ColorScale) aCSV 
            = curView->ColorScale( );
              Handle(V3d_ColorScale) aCS 
            = ( Handle( V3d_ColorScale )::DownCast( aCSV ) );
              
            if! aCS.IsNull( ) )
              {
                aCS
            ->SetPosition( X , Y );
                aCS
            ->SetHeight( 0.95) ;
                aCS
            ->SetTextHeight( textHeight );
                aCS
            ->SetRange( minRange , maxRange );
                aCS
            ->SetNumberOfIntervals( numIntervals );
                aCS
            ->SetLabelPosition( position );
                
            if!curView->ColorScaleIsDisplayed() )
                  curView
            ->ColorScaleDisplay( );
              }
              
            return 0;
            }

            由上述代碼可知,顏色映射表主要是設(shè)置當(dāng)前View中的Aspect_ColorScale。顯示顏色映射表主要是由類V3d_ColorScale實(shí)現(xiàn)。取得當(dāng)前視圖的顏色表對象后,設(shè)置相關(guān)參數(shù),即可調(diào)用視圖的ColorScaleDisplay()來顯示了。

            根據(jù)上述Draw Test Harness中的實(shí)現(xiàn)代碼,可以很容易地在自己的程序中實(shí)現(xiàn)相關(guān)的功能了。

            5.Conclusion

            OpenCASCADE的視圖也提供了顯示顏色映射表的功能,通過設(shè)置視圖的V3d_ColorScale的相關(guān)參數(shù),即可顯示出顏色映射表了。

             

            6. References

            1. 王成恩. 面向科學(xué)計(jì)算的網(wǎng)格劃分與可視化技術(shù). 科學(xué)出版社. 2011

             

            PDF Version and Tcl Script: OpenCASCADE Color Scale

            99久久99久久精品国产片果冻| 久久久久久夜精品精品免费啦| 国产精品gz久久久| 久久美女人爽女人爽| 久久青草国产精品一区| 激情五月综合综合久久69| 久久久久久亚洲精品不卡| 日韩人妻无码精品久久久不卡| 国产99精品久久| 久久婷婷五月综合成人D啪 | 婷婷综合久久中文字幕蜜桃三电影 | 色8久久人人97超碰香蕉987| 99久久99久久精品免费看蜜桃 | 99久久精品久久久久久清纯| 人人狠狠综合久久亚洲高清| 久久综合精品国产二区无码| 欧美午夜精品久久久久久浪潮| 久久婷婷成人综合色综合| 欧美日韩精品久久久久| 国产精品久久久久国产A级| 国产精品成人久久久| 精品综合久久久久久97超人| 一本色道久久综合狠狠躁| 国产福利电影一区二区三区久久老子无码午夜伦不 | 精品久久久久久国产| 久久精品国产WWW456C0M| 99国产精品久久| 久久久久亚洲精品天堂| 国产69精品久久久久APP下载 | 日韩久久久久久中文人妻| 亚洲精品乱码久久久久久蜜桃 | 一本久久a久久精品综合香蕉| av国内精品久久久久影院 | 久久精品无码免费不卡| 久久精品一区二区三区不卡| 色综合久久久久无码专区| 精品综合久久久久久97| 99久久这里只精品国产免费| 久久亚洲色一区二区三区| 久久男人中文字幕资源站| 久久er国产精品免费观看8|