• <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 Trihedron Law

            Posted on 2018-04-03 23:17 eryar 閱讀(2231) 評論(3)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

            OpenCASCADE Trihedron Law

            eryar@163.com

            Abstract. In differential geometry the Frenet-Serret formulas describe the kinematic properties of a particle moving along a continuous, differentiable curve in 3d space, or the geometric properties of the curve itself irrespective of any motion. More specifically, the formulas describe the derivatives of the so-called Tangent, Normal and Binormal unit vectors in terms of each other. 

            Key Words. Frenet-Serret Frame, TNB frame, Trihedron Law

            1. Introduction

            參數曲線上的局部坐標系,也稱為標架Frame,OpenCASCADE中叫Trihedron。這個局部坐標系隨著曲線上點的運動而運動,所以也稱為活動坐標系。活動坐標系中各坐標軸的選取:

            l T是參數曲線的切線方向;

            l N是曲線的主法線方向,或稱主法矢;主法矢總是指向曲線凹入的方向;

            l B是副法矢;當T 和N確定后,通過叉乘即得到B。

            wps_clip_image-12476

            Figure 1. T, N, B frame of a curve (from wiki)

            定義一個活動標架有什么作用呢?把這個問題先保留一下。本文先介紹OpenCASCADE中的標架規則Trihedron Law。

            2.Trihedron Law

            在OpenCASCADE中,類GeomFill_TrihedronLaw定義了曲線活動標架。其類圖如下所示:

            wps_clip_image-18899

            Figure 2. Trihedron Law define Trihedron along a Curve

            從基類GeomFill_TrihedronLaw派生出了各種標架,如:

            l GeomFill_Fixed:固定的活動動標架,即標架沿著曲線移動時,標架的三個方向是固定的;

            l GeomFill_Frenet: Frenet標架;

            l GeomFill_Darboux :Darboux標架;

            l GeomFill_ConstantBiNormal:副法矢固定的標架;

            3. Code Demo

            下面通過示例代碼來顯示出曲線上的Frenet標架,GeomFill_TrihedronLaw子類的用法類似。

            /*
            Copyright(C) 2018 Shing Liu(eryar@163.com)

            Permission is hereby granted, free of charge, to any person obtaining a copy
            of this software and associated documentation files(the "Software"), to deal
            in the Software without restriction, including without limitation the rights
            to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
            copies of the Software, and to permit persons to whom the Software is
            furnished to do so, subject to the following conditions :

            The above copyright notice and this permission notice shall be included in all
            copies or substantial portions of the Software.

            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
            SOFTWARE.
            */


            #include <TColgp_Array1OfPnt.hxx>

            #include <math_BullardGenerator.hxx>

            #include <GCPnts_UniformAbscissa.hxx>
            #include <GCPnts_UniformDeflection.hxx>
            #include <GCPnts_TangentialDeflection.hxx>
            #include <GCPnts_QuasiUniformDeflection.hxx>

            #include <Geom_BSplineCurve.hxx>

            #include <GeomAdaptor_HCurve.hxx>

            #include <GeomAPI_PointsToBSpline.hxx>

            #include <GeomFill_Fixed.hxx>
            #include <GeomFill_Frenet.hxx>
            #include <GeomFill_ConstantBiNormal.hxx>
            #include <GeomFill_CorrectedFrenet.hxx>
            #include <GeomFill_Darboux.hxx>
            #include <GeomFill_DiscreteTrihedron.hxx>
            #include <GeomFill_GuideTrihedronAC.hxx>
            #include <GeomFill_GuideTrihedronPlan.hxx>

            #include <BRepBuilderAPI_MakeEdge.hxx>

            #include <BRepTools.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")

            #pragma comment(lib, "TKBRep.lib")
            #pragma comment(lib, "TKTopAlgo.lib")


            void test()
            {
                TColgp_Array1OfPnt aPoints(1, 6);
                math_BullardGenerator aBullardGenerator;
                for (Standard_Integer i = aPoints.Lower(); i <= aPoints.Upper(); ++i)
                {
                    Standard_Real aX = aBullardGenerator.NextReal() * 50.0;
                    Standard_Real aY = aBullardGenerator.NextReal() * 50.0;
                    Standard_Real aZ = aBullardGenerator.NextReal() * 50.0;

                    aPoints.SetValue(i, gp_Pnt(aX, aY, aZ));
                }

                GeomAPI_PointsToBSpline aBSplineFitter(aPoints);
                if (!aBSplineFitter.IsDone())
                {
                    return;
                }

                std::ofstream aTclFile("d:/tcl/trihedron.tcl");

                aTclFile << std::fixed;
                aTclFile << "vclear" << std::endl;

                Handle(Geom_BSplineCurve) aBSplineCurve = aBSplineFitter.Curve();
                Handle(GeomAdaptor_HCurve) aCurveAdaptor = new GeomAdaptor_HCurve(aBSplineCurve);

                BRepBuilderAPI_MakeEdge anEdgeMaker(aBSplineCurve);
                BRepTools::Write(anEdgeMaker, "d:/edge.brep");

                aTclFile << "restore " <<  " d:/edge.brep e" << std::endl;
                aTclFile << "incmesh e " << " 0.01" << std::endl;
                aTclFile << "vdisplay e " << std::endl;

                Handle(GeomFill_Frenet) aFrenet = new GeomFill_Frenet();
                aFrenet->SetCurve(aCurveAdaptor);

                GCPnts_UniformAbscissa aPointSampler(aCurveAdaptor->Curve(), 5.0);
                for (Standard_Integer i = 1; i <= aPointSampler.NbPoints(); ++i)
                {
                    Standard_Real aParam = aPointSampler.Parameter(i);
                    gp_Pnt aP = aCurveAdaptor->Value(aParam);

                    gp_Vec aT;
                    gp_Vec aN;
                    gp_Vec aB;

                    aFrenet->D0(aParam, aT, aN, aB);

                    // vtrihedron in opencascade draw 6.9.1
                    /*aTclFile << "vtrihedron vt" << i << " " << aP.X() << " " << aP.Y() << " " << aP.Z() << " "
                             << " " << aB.X() << " " << aB.Y() << " " << aB.Z() << " "
                             << " " << aT.X() << " " << aT.Y() << " " << aT.Z() << std::endl;
            */

                    // vtrihedron in opencascade draw 7.1.0 has bug.
                    /*aTclFile << "vtrihedron vt" << i << " -origin " << aP.X() << " " << aP.Y() << " " << aP.Z() << " "
                        << " -zaxis " << aB.X() << " " << aB.Y() << " " << aB.Z() << " "
                        << " -xaxis " << aT.X() << " " << aT.Y() << " " << aT.Z() << std::endl;
            */

                    // vtrihedron in opencascade draw 7.2.0
                    aTclFile << "vtrihedron vt" << i << " -origin " << aP.X() << " " << aP.Y() << " " << aP.Z() << " "
                        << " -zaxis " << aB.X() << " " << aB.Y() << " " << aB.Z() << " "
                        << " -xaxis " << aT.X() << " " << aT.Y() << " " << aT.Z() << std::endl;
                    aTclFile << "vtrihedron vt" << i << " -labels xaxis T 1" << std::endl;
                    aTclFile << "vtrihedron vt" << i << " -labels yaxis N 1" << std::endl;
                    aTclFile << "vtrihedron vt" << i << " -labels zaxis B 1" << std::endl;

                    aTclFile << "vsize vt" << i << " 2" << std::endl;
                }
            }

            int main(int argc, char* argv[])
            {
                test();

                return 0;
            }

            程序通過擬合幾個隨機產生的點生成B樣條曲線,再將曲線按弧長等距采樣,將得到的參數計算出曲線上的點,及Frenet標架。再生成Draw腳本文件,最后將生成的Draw腳本文件trihedron.tcl加載到Draw Test Harness中顯示結果如下圖所示:

            wps_clip_image-22393

            Figure 3. Frenet Frame

            由上圖可知,局部坐標系的T方向為曲線的切線方向。主法向N總是指向曲線凹側。

            4. Conclusion

            曲線的活動標架是《微分幾何》中一個很基礎的概念。有了曲線的活動標架,掃掠造型Sweep算法的實現有了一些思路。當給定一個輪廓線后,將輪廓線沿著路徑曲線掃掠可以理解為將輪廓線變換到曲線的活動標架中。

            本文主要演示了Frenet活動標架的例子,讀者可以將GeomFill_TrihedronLaw其他的子類表示的其他類型活動標架自己實現,加深理解。

            5. References

            1. 趙罡, 穆國旺, 王拉柱. 非均勻有理B樣條. 清華大學出版社. 2010

            2. 陳維桓. 微分幾何. 北京大學出版社. 2006

            3. 朱心雄. 自由曲線曲面造型技術. 科學出版社.  2000


            為了方便大家在移動端也能看到我的博文和討論交流,現已注冊微信公眾號,歡迎大家掃描下方二維碼關注。
            Shing Liu(eryar@163.com)

             

            Feedback

            # re: OpenCASCADE Trihedron Law  回復  更多評論   

            2018-06-08 16:21 by birds
            博主您好
            又有問題請教了,我如何用vs+qt來顯示如上圖DRAW所示的各個點的坐標方向?謝謝

            # re: OpenCASCADE Trihedron Law  回復  更多評論   

            2018-06-09 09:00 by eryar
            @birds
            你好!

            如果理解了活動標架的概念,就沒有問題了。

            # re: OpenCASCADE Trihedron Law  回復  更多評論   

            2018-06-09 14:34 by birds
            謝謝
            日韩人妻无码精品久久免费一 | 少妇被又大又粗又爽毛片久久黑人 | 2021国产成人精品久久| 亚洲国产精品久久久久婷婷老年| 国产日韩久久久精品影院首页| 中文字幕亚洲综合久久菠萝蜜| 中文字幕人妻色偷偷久久| 国内精品久久久久久99蜜桃| 免费精品久久久久久中文字幕| 久久久亚洲欧洲日产国码二区| 亚洲综合精品香蕉久久网97| 久久久久久曰本AV免费免费| www亚洲欲色成人久久精品| 亚洲色大成网站WWW久久九九| 亚洲嫩草影院久久精品| 欧洲人妻丰满av无码久久不卡| 国产精品久久久久久久久久免费| 久久精品国产乱子伦| 国产A级毛片久久久精品毛片| 久久丫精品国产亚洲av| 一本久道久久综合狠狠躁AV| 亚洲国产成人久久精品影视| 久久久久久毛片免费播放| 欧美大战日韩91综合一区婷婷久久青草 | 久久综合给合久久狠狠狠97色| 国产女人aaa级久久久级| 高清免费久久午夜精品| 久久精品国产亚洲av高清漫画| 久久综合鬼色88久久精品综合自在自线噜噜| 久久精品无码一区二区三区| 麻豆AV一区二区三区久久| 一本一本久久a久久综合精品蜜桃| 亚洲乱码日产精品a级毛片久久| 国产高潮久久免费观看| 97精品国产97久久久久久免费| 久久天堂电影网| 91精品国产综合久久四虎久久无码一级 | 国产A级毛片久久久精品毛片| 亚洲国产精品综合久久一线| 亚洲国产精品无码久久青草| 久久精品中文字幕一区|