青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

eryar

PipeCAD - Plant Piping Design Software.
PlantAssistant - Translate AVEVA RVM/SP3D VUE to glTF, STEP, etc.
posts - 606, comments - 590, trackbacks - 0, articles - 0

OpenCASCADE曲面求交之網格離散法1

Posted on 2023-05-14 21:05 eryar 閱讀(976) 評論(0)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

OpenCASCADE曲面求交之網格離散法1

eryar@163.com

 

1 Introduction

由朱心雄等著《自由曲線曲面造型技術》書中對曲面求交之網格離散法描述如下:該法的基本思想是先將曲面離散為由小平面片組成的網格,當網格足夠密時,可以認為已經非常接近真實曲面,對分別表示不同曲面的兩張網格,利用平面片求交法求得的交線,并以此交線近似代表曲面間的交線。這種方法原理簡明,便于實現,適用范圍廣,任意參數曲面均可利用該法求交。但為獲取精確地交線,則必須生成非常細密的網格,這將導致占用內存多,計算花費大。因此,實際工作中很少單一使用離散網格法,而常將其與其他方法結合使用。

OpenCASCADE中對于曲面求交也提供離散網格法,其中曲面的離散網格由類IntPatch_Polyhedron表示,兩個網格面求交使用類IntPatch_InterferencePolyhedron。本文主要介紹曲面的網格表示類IntPatch_Polyhedron。

2 Polyhedron

OpenCASCADE用于曲面求交的網格離散算法相對BRepMesh中的算法要簡單很多,主要思路是根據參數U,V方向上的采樣點數量來計算曲面上的點,再根據固定公式將采樣點連成三角形。其中生成采樣點代碼如下所示:

成員變量CMyPnts是采樣點數組,CMyU和CMyV是采樣點在曲面上的參數。將采樣點連成三角形函數如下圖所示:

根據上述生成采樣點及三角形函數,對于平面生成的三角形如下圖所示:

其中Triangle()函數中變量line表示參數u方向上第幾條線,代入具體的索引Index來看規律:

當參數索引 Index為1時,line為1,得到的三角形為1-4-5;

當參數索引Index為2時,line為1,得到的三角形為1-5-2;

當參數索引Index為3時,line為1,得到的三角形為2-5-6;

當參數索引Index為4時,line為1,得到的三角形為2-6-3;

當參數索引Index為5時,line為2,得到的三角形為4-7-8;

當參數索引Index為6時,line為2,得到的三角形為4-8-5;

 

從上可以得到生成三角形的規律,即根據索引Index計算正在處理的三角形是參數u方向上第幾條線line,生成這條線上在參數v方向上的所有的三角形。生成的三角形都是逆時針的。

下面我們看看對于一些基本曲面,這種離散網格算法生成的網格效果:

球面的離散網格

圓柱面的離散網格

圓環面的離散網格

B樣條曲面

3 Conclusion

綜上所述,類IntPatch_Polyhedron中生成網格的算法主要依賴曲面在參數U,V上的采樣點數量。默認采樣點數量是根據函數NbSamplesV()和NbSamplesU()生成。

也可以指定采樣點數量,當采樣點數量越多,則生成的三角形越多,網格越密。當然這種方式也可用來生成曲面的顯示數據,生成速度很快,唯一的缺陷是生成顯示用網格的精度只能通過采樣點數量來控制,對于曲率變化大的曲面,若指定多的采樣點,則會生成大量三角形,占用大量內存空間。

附上測試代碼:


#include <TColgp_Array2OfPnt.hxx>
#include <Geom_Plane.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAPI_PointsToBSplineSurface.hxx>
#include <IntPatch_Polyhedron.hxx>
#include <IntPatch_InterferencePolyhedron.hxx>
#pragma comment(lib, "TKernel.lib")
#pragma comment(lib, "TKMath.lib")
#pragma comment(lib, "TKG2d.lib")
#pragma comment(lib, "TKG3d.lib")
#pragma comment(lib, "TKGeomBase.lib")
#pragma comment(lib, "TKGeomAlgo.lib")
void makeSurface(Handle(Geom_BSplineSurface)& theSurface)
{
    TColgp_Array2OfPnt aPoints(1, 5, 1, 5);
    aPoints.SetValue(1, 1, gp_Pnt(-4, -4, 5));
    aPoints.SetValue(1, 2, gp_Pnt(-4, -2, 5));
    aPoints.SetValue(1, 3, gp_Pnt(-4, 0, 4));
    aPoints.SetValue(1, 4, gp_Pnt(-4, 2, 5));
    aPoints.SetValue(1, 5, gp_Pnt(-4, 4, 5));
    aPoints.SetValue(2, 1, gp_Pnt(-2, -4, 4));
    aPoints.SetValue(2, 2, gp_Pnt(-2, -2, 4));
    aPoints.SetValue(2, 3, gp_Pnt(-2, 0, 4));
    aPoints.SetValue(2, 4, gp_Pnt(-2, 2, 4));
    aPoints.SetValue(2, 5, gp_Pnt(-2, 5, 4));
    aPoints.SetValue(3, 1, gp_Pnt(0, -4, 3.5));
    aPoints.SetValue(3, 2, gp_Pnt(0, -2, 3.5));
    aPoints.SetValue(3, 3, gp_Pnt(0, 0, 3.5));
    aPoints.SetValue(3, 4, gp_Pnt(0, 2, 3.5));
    aPoints.SetValue(3, 5, gp_Pnt(0, 5, 3.5));
    aPoints.SetValue(4, 1, gp_Pnt(2, -4, 4));
    aPoints.SetValue(4, 2, gp_Pnt(2, -2, 4));
    aPoints.SetValue(4, 3, gp_Pnt(2, 0, 3.5));
    aPoints.SetValue(4, 4, gp_Pnt(2, 2, 5));
    aPoints.SetValue(4, 5, gp_Pnt(2, 5, 4));
    aPoints.SetValue(5, 1, gp_Pnt(4, -4, 5));
    aPoints.SetValue(5, 2, gp_Pnt(4, -2, 5));
    aPoints.SetValue(5, 3, gp_Pnt(4, 0, 5));
    aPoints.SetValue(5, 4, gp_Pnt(4, 2, 6));
    aPoints.SetValue(5, 5, gp_Pnt(4, 5, 5));
    theSurface = GeomAPI_PointsToBSplineSurface(aPoints).Surface();
}
void writeStl(const IntPatch_Polyhedron& thePolyhedron, const std::string& theFileName)
{
    // Dump surface polyhedron to STL file.
    std::ofstream aStlFile(theFileName);
    aStlFile << "solid polyhedron" << std::endl;
    // Dump triangles.
    for (Standard_Integer t = 1; t <= thePolyhedron.NbTriangles(); ++t)
    {
        Standard_Integer aPi1 = 0;
        Standard_Integer aPi2 = 0;
        Standard_Integer aPi3 = 0;
        thePolyhedron.Triangle(t, aPi1, aPi2, aPi3);
        const gp_Pnt& aP1 = thePolyhedron.Point(aPi1);
        const gp_Pnt& aP2 = thePolyhedron.Point(aPi2);
        const gp_Pnt& aP3 = thePolyhedron.Point(aPi3);
        aStlFile << "facet" << std::endl;
        aStlFile << "outer loop" << std::endl;
        aStlFile << "vertex " << aP1.X() << " " << aP1.Y() << " " << aP1.Z() << std::endl;
        aStlFile << "vertex " << aP2.X() << " " << aP2.Y() << " " << aP2.Z() << std::endl;
        aStlFile << "vertex " << aP3.X() << " " << aP3.Y() << " " << aP3.Z() << std::endl;
        aStlFile << "endloop" << std::endl;
        aStlFile << "endfacet" << std::endl;
    }
    aStlFile << "endsolid polyhedron" << std::endl;
    aStlFile.close();
}
void testPolyhedron()
{
    // Plane surface polyhedron.
    Handle(Geom_Plane) aPlane = new Geom_Plane(gp::XOY());
    Handle(GeomAdaptor_Surface) aSurfaceAdaptor = new GeomAdaptor_Surface(aPlane, 0.0, 10.0, 0.0, 20.0);
    IntPatch_Polyhedron aPlanePolyhedron(aSurfaceAdaptor);
    writeStl(aPlanePolyhedron, "d:/plane.stl");
    // Spherical surface polyhedron.
    Handle(Geom_SphericalSurface) aSphericalSurface = new Geom_SphericalSurface(gp::XOY(), 3.0);
    aSurfaceAdaptor = new GeomAdaptor_Surface(aSphericalSurface);
    IntPatch_Polyhedron aSphericalPolyhedron(aSurfaceAdaptor);
    writeStl(aSphericalPolyhedron, "d:/spherical.stl");
    // Cylindrical surface polyhedron.
    Handle(Geom_CylindricalSurface) aCylindricalSurface = new Geom_CylindricalSurface(gp::XOY(), 5.0);
    aSurfaceAdaptor = new GeomAdaptor_Surface(aCylindricalSurface, 0.0, M_PI, 0.0, 8.0);
    IntPatch_Polyhedron aCylindricalPolyhedron(aSurfaceAdaptor);
    writeStl(aCylindricalPolyhedron, "d:/cylindrical.stl");
    // Toroidal Surface polyhedron.
    Handle(Geom_ToroidalSurface) aToroidalSurface = new Geom_ToroidalSurface(gp::XOY(), 10.0, 3.0);
    aSurfaceAdaptor = new GeomAdaptor_Surface(aToroidalSurface);
    IntPatch_Polyhedron aToroidalPolyhedron(aSurfaceAdaptor);
    writeStl(aToroidalPolyhedron, "d:/toroidal.stl");
    // BSpline surface polyhedron.
    Handle(Geom_BSplineSurface) aBSplineSurface;
    makeSurface(aBSplineSurface);
    aSurfaceAdaptor = new GeomAdaptor_Surface(aBSplineSurface);
    IntPatch_Polyhedron aPolyhedron(aSurfaceAdaptor);
    writeStl(aPolyhedron, "d:/bspline.stl");
}
int main(int argc, char* argv[])
{
    testPolyhedron();
    return 0;
}

 

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美日韩美女在线观看| 欧美二区在线播放| 国产欧美日韩综合| 久久久久国产精品一区三寸| 性色av一区二区三区在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲午夜黄色| 欧美专区在线观看| 亚洲国产精品一区二区三区| 亚洲国产精品电影| 欧美精品一区在线发布| 亚洲影院免费观看| 久久精品在线观看| 亚洲理伦电影| 亚洲永久免费视频| 精品动漫一区二区| 亚洲日本乱码在线观看| 国产精品久久久久久久免费软件 | 国产亚洲欧美一区二区三区| 久久午夜影视| 欧美乱妇高清无乱码| 欧美一二三视频| 麻豆精品精品国产自在97香蕉| 亚洲最新在线视频| 欧美在线观看网站| aa级大片欧美三级| 久久动漫亚洲| 亚洲午夜久久久| 免费观看日韩av| 午夜伦理片一区| 男人插女人欧美| 欧美中文日韩| 欧美精品三级日韩久久| 久久精品国产免费观看| 欧美另类专区| 免费高清在线一区| 国产精品夜夜嗨| 亚洲精品日韩在线| 亚洲国产成人一区| 午夜精品久久久久影视| 一本色道久久综合| 久久综合给合| 久久性色av| 国产视频在线观看一区二区| 日韩视频精品在线| 亚洲经典在线| 久久久免费av| 久久久久久久网| 国产区精品视频| 亚洲视频在线观看三级| 亚洲精品午夜| 欧美肥婆bbw| 欧美国产亚洲另类动漫| 国产在线不卡| 欧美一区二区三区电影在线观看| 一区二区三区视频在线| 欧美高清在线视频观看不卡| 免费成人你懂的| 黄色亚洲在线| 久久久久久久高潮| 久久久美女艺术照精彩视频福利播放| 国产精品第13页| 亚洲图片在线观看| 亚洲综合电影| 国产日韩欧美91| 午夜一区在线| 久久久国产视频91| 韩日欧美一区二区三区| 久久九九有精品国产23| 久久综合狠狠综合久久综合88| 国内成人精品视频| 久久精品中文| 亚洲国产精品成人一区二区| 亚洲精品之草原avav久久| 欧美激情2020午夜免费观看| 亚洲精品在线视频观看| 亚洲综合二区| 国产亚洲女人久久久久毛片| 久久国产精品久久久久久久久久| 久久精品免视看| 伊人久久综合| 欧美精品18+| 亚洲深夜福利网站| 欧美一区二区三区啪啪| 国产又爽又黄的激情精品视频| 久久福利视频导航| 欧美激情一区二区三区全黄| 亚洲精选视频在线| 国产九九精品| 每日更新成人在线视频| 亚洲精品久久视频| 亚洲欧美在线磁力| 国模套图日韩精品一区二区| 欧美插天视频在线播放| 99精品福利视频| 久久久999国产| 亚洲精品偷拍| 国产欧美日韩不卡免费| 久久久人成影片一区二区三区观看| 欧美激情成人在线| 午夜精品福利一区二区蜜股av| 国产一区久久| 欧美日韩1234| 久久aⅴ国产紧身牛仔裤| 亚洲黄色影院| 久久久中精品2020中文| 一本久道久久综合婷婷鲸鱼| 国产偷久久久精品专区| 欧美激情精品| 久久本道综合色狠狠五月| 亚洲精品久久久久久久久久久| 久久久www| 亚洲图片欧美一区| 亚洲第一页中文字幕| 国产精品入口| 欧美日韩国产va另类| 久久九九精品| 亚洲欧美日韩天堂| 亚洲靠逼com| 亚洲大胆视频| 免费成人黄色av| 久久久av网站| 久久高清国产| 亚洲综合日本| 亚洲网友自拍| 亚洲精品乱码久久久久久久久| 国产麻豆午夜三级精品| 欧美日韩三级一区二区| 欧美~级网站不卡| 久久久久久综合| 欧美一区二区三区免费观看| 亚洲无吗在线| 亚洲天堂av图片| 日韩午夜在线| 亚洲区第一页| 亚洲激情电影在线| 91久久精品久久国产性色也91| 美女日韩在线中文字幕| 久久久综合免费视频| 久久精品国产精品亚洲| 香蕉乱码成人久久天堂爱免费| 亚洲一区在线免费| 亚洲欧美激情一区| 亚洲一线二线三线久久久| 一本色道久久综合亚洲精品按摩| 亚洲日韩欧美一区二区在线| 亚洲高清成人| 日韩小视频在线观看| 99人久久精品视频最新地址| 一区二区精品| 亚洲欧美另类中文字幕| 亚洲欧美中文日韩v在线观看| 亚洲免费网站| 欧美影院成人| 蜜臀va亚洲va欧美va天堂| 欧美成人午夜激情视频| 亚洲大胆人体在线| 日韩一级片网址| 午夜亚洲伦理| 久久在线免费视频| 欧美激情视频在线播放| 欧美日韩一区二区高清| 国产麻豆一精品一av一免费| 国内外成人免费激情在线视频| 国内欧美视频一区二区| 亚洲日本免费| 亚洲欧美在线网| 免费成人网www| 亚洲精品自在久久| 欧美一区二区三区四区在线观看地址| 久久riav二区三区| 欧美激情va永久在线播放| 国产精品夫妻自拍| 在线精品视频一区二区| 夜夜嗨网站十八久久| 欧美一区二区三区免费视| 免费国产一区二区| 在线视频中文亚洲| 麻豆精品传媒视频| 国产精品欧美在线| 亚洲国产精品一区二区www在线 | 激情欧美一区二区三区在线观看| 亚洲国产高清视频| 亚洲欧美国产视频| 欧美福利视频网站| 午夜久久tv| 欧美日韩高清免费| 在线观看成人一级片| 亚洲资源在线观看| 欧美激情国产精品| 欧美一区亚洲二区| 欧美日韩一区二区在线视频 | 国产在线观看一区| 99视频在线观看一区三区| 久久久久久亚洲综合影院红桃| 日韩视频不卡| 美腿丝袜亚洲色图| 国产综合一区二区| 香蕉久久夜色精品国产使用方法| 亚洲福利视频网站|