Skip to content

**** ****

for my bad memories..

윈도우즈10 마우스/키보드 끊김 현상

2021-10-08


Windows7에서 10 에서는 전력 설정 항목이 추가되면서 저전력 모드로 자동으로 바뀌게 되는 경우가 있음.
이 저전력 모드 때문에 마우스 / 키보드 프리징 현상이 발생할 수 있음.

저전력 모드 끄기

1. 키보드의 Windows Key + X 버튼을 누름.
2. Windows Powershell(관리자) 버튼 클릭 하여 파워쉘을 실행.
3. bcdedit /set disabledynamictick yes 입력

이후 Windows 10 재부팅을 하시면 저전력 모드가 해지가 됨.
특히 Laptop 사용자에게 발생되는 프리징 현상은 저전력 문제일 확률이 매우 높음..


OpenGL + Mesh + CAD 표시

2021-09-17


사실 오랫동안 이것저것 CAD 파일을 OpenGL로 뿌려주는 기능을 구현중이었음.

이것저것 코드 분석해보고.. (흠.. CAD 관련 코드가 그리 많지않음)
테스트하고.. 짬짬히 알아보느라 시간이 한달정도 걸린것 같음.

어쨌건 현재 쓸 수 있는 오픈소스중 OpenCASCADE 만한게 없는것 같음.
처음엔 꽤 괜찮아 보이는 OpenCASCADE의 기본 Viewer를 내 프로그램에 내장시켜볼까
코드도 뜯어보고.. 해봤는데.. 이건 답이 안나옴..
왜냐하면 내 프로그램은 Mesh 와 CAD를 둘다 표시해줘야하기 때문에.. 결국 포기함.

그래서 Mesh 표시 기능은 구현했고.. 여기에 CAD 표시 기능만 추가해야겠단 생각이 들어서
처음엔 nurbs 형태로 뿌려줄까해서 다른 코드들도 좀 보고 했는데.. 이것도 도저히 아닌것 같아서..
OpenCASCADE의 BRepMesh_IncrementalMesh 를 사용해서 CAD를 매시를 치고..
이걸 매시 형태로 불러들여 보여줌. 여기에 smooth shading 를 적용하니 꽤 그럴싸함.

근데 아무래도 기본 BRepMesh_IncrementalMesh 이 클래스 자체가 매시를 그리 잘 쳐주는게 아님..
결국 매시 기능만 돈 주고 사야하나… 에효…
어쩐지 Express Mesh 라는 콤포넌트를 팔더라니.. (https://www.opencascade.com/components/express-mesh-component/)

암튼 아래는 이것저것 step, iges 파일을 읽어들인 화면.


투명으로 바꿔봄


꽤 큰 파일도 불러와봄


OpenCASCADE topology

2021-09-14


출처: https://dev.opencascade.org/content/exploring-compound

OpenCASCADE의 topology는 다음과 같음.

아래와 같이 탐색.

MainWindow::MainWindow(QMainWindow *parent):QMainWindow(parent)
{
    //! ---------
    //! a viewer
    //! ---------
    occViewPort aViewer = new occViewPort(this);
    if(aViewer->getContext().IsNull()) aViewer->init();
    this->setCentralWidget(aViewer);

    //! ------------------------
    //! load the file from disk
    //! ------------------------
    STEPControl_Reader aReader;
    IFSelect_ReturnStatus stat = aReader.ReadFile(FILENAME);

    if(stat!=IFSelect_RetDone) exit(1);

    aReader.TransferRoots();
    TopoDS_Shape aShape = aReader.OneShape();

    //! ----------------
    //! list of shapes
    //! ----------------
    QList<TopoDS_Shape> csolids;
    QList<TopoDS_Shape> solids;
    QList<TopoDS_Shape> wires;
    QList<TopoDS_Shape> edges;
    QList<TopoDS_Shape> shells;
    QList<TopoDS_Shape> faces;

    for(TopoDS_Iterator anIt(aShape); anIt.More(); anIt.Next())
    {
        const TopoDS_Shape &curShape = anIt.Value();
        TopAbs_ShapeEnum type = curShape.ShapeType();

        if(type==TopAbs_COMPOUND)
        {
            cout<<"____COMPOUND____"<<endl;

            TopoDS_Builder aShellBuilder;
            TopoDS_Shell aShell;

            TopoDS_Builder aWireBuilder;
            TopoDS_Wire aWire;

            aShellBuilder.MakeShell(aShell);
            aWireBuilder.MakeWire(aWire);

            int faceCount = 0;
            int edgeCount = 0;

            for(TopoDS_Iterator anExp(curShape); anExp.More(); anExp.Next())
            {
                const TopoDS_Shape &curShape1 = anExp.Value();
                TopAbs_ShapeEnum type1 = curShape1.ShapeType();

                if(type1==TopAbs_SHELL)
                {
                    for(TopExp_Explorer anExp(curShape1,TopAbs_FACE);anExp.More();anExp.Next())
                    {
                        const TopoDS_Shape &curShape2 = anExp.Current();
                        aShellBuilder.Add(aShell,curShape2);
                        faceCount++;
                    }
                }

                if(type1==TopAbs_EDGE)
                {
                    aWireBuilder.Add(aWire,curShape1);
                    edgeCount++;
                }
            }

            if(faceCount>1) shells<<aShell;
            if(edgeCount>1) wires<<aWire;
            else if(edgeCount==1)
            {
                //! --------------------------------------
                //! remove "aWire" from the list of wires
                //! --------------------------------------
                wires.removeOne(aWire);
                for(TopExp_Explorer anExp(aWire,TopAbs_EDGE); anExp.More(); anExp.Next())
                {
                    const TopoDS_Shape &curEdge = anExp.Current();
                    edges<<curEdge;
                }
            }
        }

        //! -----------------
        //! composite solids
        //! -----------------
        if(type==TopAbs_COMPSOLID)
        {
            cout<<"____COMPSOLID____"<<endl;
            csolids<<curShape;
        }

        //! -------
        //! solids
        //! -------
        if(type==TopAbs_SOLID)
        {
            solids<<curShape;
        }

        //! ------
        //! faces
        //! ------
        if(type==TopAbs_SHELL)
        {
            for(TopExp_Explorer anExp(curShape,TopAbs_FACE);anExp.More();anExp.Next())
            {
                const TopoDS_Shape &curShape1 = anExp.Current();
                faces<<curShape1;
            }
        }
    }

    cout<<"____Nb solids: "<<solids.length()<<"____"<<endl;
    cout<<"____Nb shells: "<<shells.length()<<"____"<<endl;
    cout<<"____Nb faces: "<<faces.length()<<"____"<<endl;
    cout<<"____Nb wires: "<<wires.length()<<"____"<<endl;
    cout<<"____Nb edges: "<<edges.length()<<"____"<<endl;

    //! --------
    //! display
    //! --------
    QList<TopoDS_Shape> listOfShapes;
    listOfShapes<<csolids<<solids<<shells<<faces<<wires<<edges;
    for(int i=0; i<listOfShapes.length(); i++)
    {
        const Handle(AIS_Shape) &anAIS_Shape = new AIS_Shape(listOfShapes.at(i));
        aViewer->getContext()->Display(anAIS_Shape,AIS_Shaded,-1,true,false);
    }
    aViewer->FitAll();
    aViewer->setAction3D_Rotation();
}

It gives

____Nb solids: 1____
____Nb shells: 2____
____Nb faces: 1____
____Nb wires: 1____
____Nb edges: 1____

for file 000000000_mixed_1

and

____Nb solids: 1____
____Nb shells: 1____
____Nb faces: 3____
____Nb wires: 1____
____Nb edges: 1____

for 000000000_mixed_2.stp

sample.zip


CentOS 6.5 repository 변경

2021-09-11


CentOS 6.x 버전의 업데이트는 2020.11.30 일부로 종료됨.

$ yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
repo id                        repo name                                  status
base                           CentOS-6 - Base                            0
extras                         CentOS-6 - Extras                          0
updates                        CentOS-6 - Updates                         0
repolist: 0

종료된 버전의 경우 CentOS는 따로 vault 업데이트 서버를 운영중임.
해당 서버로 아래와 같이 CentOS-Base.repo 파일의 전체 내용을 변경하면 업데이트 가능.

$ cd /etc/yum.repos.d/
$ cp CentOS-Base.repo CentOS-Base.repo.old

$ vim CentOS-Base.repo (아래의 내용으로 교체)

[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

$ yum clean all

$ yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id                        repo name                                  status
base                           CentOS-6 - Base                            6,713
extras                         CentOS-6 - Extras                             47
updates                        CentOS-6 - Updates                         1,193
repolist: 7,953

opennurbs for MinGW

2021-08-06


Rhino사의 nurbs 취급 라이브러리인 opennurbs 를 mingw로 컴파일 하기 위해서 약간의 수정이 필요한데..
https://www.rhino3d.com/kr/opennurbs/

본 소스는 현재 최신버전으로 아래에서 받았음.
https://github.com/mcneel/opennurbs/archive/refs/tags/v7.6.21127.19001.tar.gz

기본으로 opennurbs 는 윈도우즈상에서의 컴파일은 VC++ 7.0 & 9.0 Community 버전만 지원함.
난 MinGW 를 주로 쓰기 때문에 직접 opennurbs 코드를 수정해서 컴파일 및 테스트까지 성공한 diff 를 올려둠

opennurbs-7.6.21127.19001.diff.zip

그리고 컴파일을 위해서는 MinGW용 uuid가 필요함. (http://blog.tcltk.co.kr/?p=4434)

사용된 MinGW g++ 버전은 아래와 같음

[MIN@DESKTOP-RSH0QT3 build]$ g++ --version
g++.exe (Rev2, Built by MSYS2 project) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

암튼 아래는 diff

diff -ur opennurbs-7.6.21127.19001/makefile opennurbs-7.6.21127.19001.mingw/makefile
--- opennurbs-7.6.21127.19001/makefile	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/makefile	2021-08-07 01:25:29.550215500 +0900
@@ -15,7 +15,7 @@
 # asks too many questions, then uncomment the next line.
 # RM = /bin/rm -f
 
-AR = ar qvl
+AR = ar r
 
 # If your system doesn't use ranlib, uncomment the "echo" define.
 RANLIB = ranlib
@@ -27,11 +27,11 @@
 
 # Choose one of the following definitions for GCC_OPTIMIZER_FLAGS
 # unoptimized debug build
-ON_GNU_OPTIMIZER_FLAGS = -g
+#ON_GNU_OPTIMIZER_FLAGS = -g
 # optimized release build
-#ON_GNU_OPTIMIZER_FLAGS = -O
+ON_GNU_OPTIMIZER_FLAGS = -O
 
-ON_GNU_WARNING_FLAGS = -Wall \
+#ON_GNU_WARNING_FLAGS = -Wall \
 	-Wno-overloaded-virtual \
 	-Wno-switch \
 	-Wno-unknown-pragmas \
@@ -277,6 +277,7 @@
 	opennurbs_fsp.cpp \
 	opennurbs_function_list.cpp \
 	opennurbs_geometry.cpp \
+	opennurbs_gl.cpp \
 	opennurbs_glyph_outline.cpp \
 	opennurbs_group.cpp \
 	opennurbs_hash_table.cpp \
@@ -454,6 +455,7 @@
 	opennurbs_fsp.o \
 	opennurbs_function_list.o \
 	opennurbs_geometry.o \
+	opennurbs_gl.o \
 	opennurbs_glyph_outline.o \
 	opennurbs_group.o \
 	opennurbs_hash_table.o \
@@ -843,22 +845,22 @@
 ##	$(RANLIB) $@
 
 example_read/example_read : example_read/example_read.o example_userdata/example_ud.o $(OPENNURBS_LIB_FILE)
-	$(LINK) $(LINKFLAGS) example_read/example_read.o example_userdata/example_ud.o -L. -l$(OPENNURBS_LIB_NAME) -lm -o $@
+	$(LINK) $(LINKFLAGS) example_read/example_read.o example_userdata/example_ud.o -L. -l$(OPENNURBS_LIB_NAME) -lm -luuid_mingw -lrpcrt4 -o $@
 
 example_write/example_write : example_write/example_write.o example_userdata/example_ud.o $(OPENNURBS_LIB_FILE)
-	$(LINK) $(LINKFLAGS) example_write/example_write.o example_userdata/example_ud.o -L. -l$(OPENNURBS_LIB_NAME) -lm -o $@
+	$(LINK) $(LINKFLAGS) example_write/example_write.o example_userdata/example_ud.o -L. -l$(OPENNURBS_LIB_NAME) -lm -luuid_mingw -lrpcrt4 -o $@
 
 example_test/example_test : example_test/example_test.o $(OPENNURBS_LIB_FILE)
-	$(LINK) $(LINKFLAGS) example_test/example_test.o -L. -l$(OPENNURBS_LIB_NAME) -lm -o $@
+	$(LINK) $(LINKFLAGS) example_test/example_test.o -L. -l$(OPENNURBS_LIB_NAME) -lm -luuid_mingw -lrpcrt4 -o $@
 
 example_convert/example_convert : example_convert/example_convert.o example_userdata/example_ud.o $(OPENNURBS_LIB_FILE)
-	$(LINK) $(LINKFLAGS) example_convert/example_convert.o example_userdata/example_ud.o -L. -l$(OPENNURBS_LIB_NAME) -lm -o $@
+	$(LINK) $(LINKFLAGS) example_convert/example_convert.o example_userdata/example_ud.o -L. -l$(OPENNURBS_LIB_NAME) -lm -luuid_mingw -lrpcrt4 -o $@
 
 example_brep/example_brep : example_brep/example_brep.o $(OPENNURBS_LIB_FILE)
-	$(LINK) $(LINKFLAGS) example_brep/example_brep.o -L. -l$(OPENNURBS_LIB_NAME) -lm -o $@
+	$(LINK) $(LINKFLAGS) example_brep/example_brep.o -L. -l$(OPENNURBS_LIB_NAME) -lm -luuid_mingw -lrpcrt4 -o $@
 
 example_userdata/example_userdata : example_userdata/example_userdata.o $(OPENNURBS_LIB_FILE)
-	$(LINK) $(LINKFLAGS) example_userdata/example_userdata.o -L. -l$(OPENNURBS_LIB_NAME) -lm -o $@
+	$(LINK) $(LINKFLAGS) example_userdata/example_userdata.o -L. -l$(OPENNURBS_LIB_NAME) -lm -luuid_mingw -lrpcrt4 -o $@
 
 clean :
 	-$(RM) $(OPENNURBS_LIB_FILE)
Only in opennurbs-7.6.21127.19001.mingw: opennurbs-7.6.21127.19001.diff
diff -ur opennurbs-7.6.21127.19001/opennurbs_defines.cpp opennurbs-7.6.21127.19001.mingw/opennurbs_defines.cpp
--- opennurbs-7.6.21127.19001/opennurbs_defines.cpp	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_defines.cpp	2021-08-06 11:53:33.991438200 +0900
@@ -503,7 +503,11 @@
   //fcloseall is not supported on OS X
   return EOF;
 #elif defined(ON_COMPILER_GNU)
+#ifdef __MINGW32__
+  return _fcloseall(); // ANSI C name
+#else
   fcloseall();
+#endif
 #else
   // I can't find an fcloseall() or _fcloseall() in
   // gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
diff -ur opennurbs-7.6.21127.19001/opennurbs_file_utilities.cpp opennurbs-7.6.21127.19001.mingw/opennurbs_file_utilities.cpp
--- opennurbs-7.6.21127.19001/opennurbs_file_utilities.cpp	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_file_utilities.cpp	2021-08-06 11:34:33.475516900 +0900
@@ -2261,7 +2261,11 @@
   ON_String m_utf8_file_name_filter;
   DIR* m_dir = nullptr;
   struct dirent m_dirent;
+#ifdef __MINGW32__
+  char m_dirent_name_buffer[FILENAME_MAX+1]; // < this field provide storage for m_dirent.d_name[]
+#else
   char m_dirent_name_buffer[NAME_MAX+1]; // < this field provide storage for m_dirent.d_name[]
+#endif
 
   // information about the current file
   wchar_t m_current_name[1024];
@@ -2521,6 +2525,7 @@
   {
     current_file_attributes = 0;
     struct dirent* dp = 0;
+#ifndef __MINGW32__
     int readdir_errno = readdir_r(m_impl->m_dir, &m_impl->m_dirent, &dp);
     if ( 0 !=  readdir_errno )
       break;
@@ -2528,6 +2533,7 @@
       break;
     if ( 0 == m_impl->m_dirent.d_name[0] )
       break;
+#endif
 
     if ( IsDotOrDotDotDir(m_impl->m_dirent.d_name) )
       continue;
diff -ur opennurbs-7.6.21127.19001/opennurbs_gl.cpp opennurbs-7.6.21127.19001.mingw/opennurbs_gl.cpp
--- opennurbs-7.6.21127.19001/opennurbs_gl.cpp	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_gl.cpp	2021-08-07 01:28:05.000549100 +0900
@@ -16,6 +16,7 @@
 
 #include "opennurbs.h"
 #include "opennurbs_gl.h" // ON_GL() function declarations
+#include "opennurbs_material.h" // ON_GL() function declarations
 
 void ON_GL( const int order,     // ON_NurbsCurve order
               const int cv_count,  // ON_NurbsCurve cv count
@@ -600,7 +601,7 @@
     ON_GL( pMat->Diffuse(), alpha, diffuse );
     ON_GL( pMat->Specular(), alpha, specular );
     ON_GL( pMat->Emission(), alpha, emission );
-    GLint shine = (GLint)(128.0*(pMat->Shine() / ON_Material::MaxShine()));
+    GLint shine = (GLint)(128.0*(pMat->Shine() / ON_Material::MaxShine));
     if ( shine == 0 ) {
       specular[0]=specular[1]=specular[2]=(GLfloat)0.0;
     }
diff -ur opennurbs-7.6.21127.19001/opennurbs_lock.h opennurbs-7.6.21127.19001.mingw/opennurbs_lock.h
--- opennurbs-7.6.21127.19001/opennurbs_lock.h	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_lock.h	2021-08-06 11:20:52.843563800 +0900
@@ -115,8 +115,12 @@
 #if defined(ON_COMPILER_CLANG)
     std::atomic<int> m_lock_value;
 #else
+#ifdef __MINGW32__
+  std::atomic<int> m_lock_value = {ON_Lock::UnlockedValue};
+#else
   std::atomic<int> m_lock_value = ON_Lock::UnlockedValue;
 #endif
+#endif
 #pragma ON_PRAGMA_WARNING_POP
 };
 
diff -ur opennurbs-7.6.21127.19001/opennurbs_public_version.h opennurbs-7.6.21127.19001.mingw/opennurbs_public_version.h
--- opennurbs-7.6.21127.19001/opennurbs_public_version.h	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_public_version.h	2021-08-06 11:41:02.424272500 +0900
@@ -73,9 +73,11 @@
 // At this time, verrsrc.h does not have protection against multiple includes.
 // Testing for VS_FF_PRERELEASE seems to prevent double incudes and the
 // redef errors it generates.
+#ifndef __MINGW32__
 #include "verrsrc.h"
 #endif
 #endif
+#endif
 
 #define RHINO_FILE_FLAGS_MASK VS_FF_PRERELEASE
 
diff -ur opennurbs-7.6.21127.19001/opennurbs_statics.cpp opennurbs-7.6.21127.19001.mingw/opennurbs_statics.cpp
--- opennurbs-7.6.21127.19001/opennurbs_statics.cpp	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_statics.cpp	2021-08-06 11:39:25.652762400 +0900
@@ -497,7 +497,11 @@
 const ON_SHA1_Hash ON_SHA1_Hash::EmptyContentHash = ON_SHA1_Hash_EmptyContentHash();
 const ON_SHA1_Hash ON_SHA1_Hash::ZeroDigest ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_SHA1_Hash);
 
+#ifdef __MINGW32__
+const ONX_ModelTest ONX_ModelTest::Unset {ON_CLANG_CONSTRUCTOR_BUG_INIT(ONX_ModelTest)};
+#else
 const ONX_ModelTest ONX_ModelTest::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ONX_ModelTest);
+#endif
 
 // Works with Microsoft's CL, fails for Apple's CLang
 ////   const struct ON_UnicodeErrorParameters ON_UnicodeErrorParameters::MaskErrors   = { 0, 0xFFFFFFFF, ON_UnicodeCodePoint::ON_ReplacementCharacter };
@@ -713,7 +717,11 @@
 const ON_LengthValue ON_LengthValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_LengthValue);
 const ON_LengthValue ON_LengthValue::Zero = ON_LengthValue::Create(0.0, ON::LengthUnitSystem::None, 0, ON_LengthValue::StringFormat::CleanDecimal);
 
+#ifdef __MINGW32__
+const ON_AngleValue ON_AngleValue::Unset {ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_AngleValue)};
+#else
 const ON_AngleValue ON_AngleValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_AngleValue);
+#endif
 const ON_AngleValue ON_AngleValue::Zero = ON_AngleValue::Create(0.0, ON::AngleUnitSystem::None, 0, ON_AngleValue::StringFormat::CleanDecimal );
 
 const ON_ScaleValue ON_ScaleValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_ScaleValue);
diff -ur opennurbs-7.6.21127.19001/opennurbs_system.h opennurbs-7.6.21127.19001.mingw/opennurbs_system.h
--- opennurbs-7.6.21127.19001/opennurbs_system.h	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_system.h	2021-08-06 11:28:05.427679200 +0900
@@ -22,6 +22,10 @@
 ////////////////////////////////////////////////////////////////
 */
 
+#ifdef __MINGW32__
+#define ON_NO_WINDOWS
+#endif
+
 #if !defined(OPENNURBS_SYSTEM_INC_)
 #define OPENNURBS_SYSTEM_INC_
 
diff -ur opennurbs-7.6.21127.19001/opennurbs_system_runtime.h opennurbs-7.6.21127.19001.mingw/opennurbs_system_runtime.h
--- opennurbs-7.6.21127.19001/opennurbs_system_runtime.h	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_system_runtime.h	2021-08-06 11:28:45.137120900 +0900
@@ -61,6 +61,11 @@
 #endif
 
 #endif
+
+#ifdef __MINGW32__
+#undef ON_RUNTIME_WIN
+#define ON_RUNTIME_LINUX
+#endif
 /*
 //
 // END - ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID defines
diff -ur opennurbs-7.6.21127.19001/opennurbs_uuid.h opennurbs-7.6.21127.19001.mingw/opennurbs_uuid.h
--- opennurbs-7.6.21127.19001/opennurbs_uuid.h	2021-05-24 10:38:07.000000000 +0900
+++ opennurbs-7.6.21127.19001.mingw/opennurbs_uuid.h	2021-08-06 11:26:23.434502300 +0900
@@ -24,9 +24,9 @@
   // opennurbs.dll builds.
   #define ON_UUID_DEFINED
   // ON_UUID is a 16 byte universally unique identifier
-  #if defined(UUID_DEFINED)
+  #if defined(UUID_DEFINED) && !defined(__MINGW32__)
   typedef UUID ON_UUID;
-  #elif defined(GUID_DEFINED)
+  #elif defined(GUID_DEFINED) && !defined(__MINGW32__)
   typedef GUID ON_UUID;
   #else
   typedef struct ON_UUID_struct


uuid for MinGW

2021-08-06


출처: https://github.com/h0tw1r3/libuuid-mingw

다운로드: libuuid-mingw-master.zip

빌드 방법

libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure
make

테스트 코드

//
//  libuuid sample program
//
//  source: https://gist.github.com/yoggy/4483031
//  author: yoggy
//
#include <stdio.h>
#include <uuid/uuid.h>

int main(int argc, char *argv[])
{
        // typedef unsigned char uuid_t[16];
        uuid_t uuid;

        // generate
        uuid_generate_time_safe(uuid);

        // unparse (to string)
        char uuid_str[37];      // ex. "1b4e28ba-2fa1-11d2-883f-0016d3cca427" + "\0"
        uuid_unparse_lower(uuid, uuid_str);
        printf("generate uuid=%s\n", uuid_str);

        // parse (from string)
        uuid_t uuid2;
        uuid_parse(uuid_str, uuid2);

        // compare (rv == 0)
        int rv;
        rv = uuid_compare(uuid, uuid2);
        printf("uuid_compare() result=%d\n", rv);

        // compare (rv == 1)
        uuid_t uuid3;
        uuid_parse("1b4e28ba-2fa1-11d2-883f-0016d3cca427", uuid3);
        rv = uuid_compare(uuid, uuid3);
        printf("uuid_compare() result=%d\n", rv);

        // is null? (rv == 0)
        rv = uuid_is_null(uuid);
        printf("uuid_null() result=%d\n", rv);

        // is null? (rv == 1)
        uuid_clear(uuid);
        rv = uuid_is_null(uuid);
        printf("uuid_null() result=%d\n", rv);

        return 0;
}

링크시 아래를 추가

-luuid_mingw -lrpcrt4 

Quad meshing by using gmsh

2021-07-29


Mesh.Algorithm = 9; // Packing for Parallelograms

lc = 0.1; 

// vertices.
Point(1) = {0, 0, 0, lc};
Point(2) = {0.5, 0, 0, lc};
Point(3) = {1.0, 0, 0, lc};
Point(4) = {1.0, 0.5, 0.5, lc};
Point(5) = {1.0, 1.0, 1.0, lc};
Point(6) = {1.0, 1.5, 0.5, lc};
Point(7) = {1.0, 2.0, 0.0, lc};
Point(8) = {0.5, 2.0, 0.0, lc};
Point(9) = {0.0, 2.0, 0.0, lc};
Point(10) = {0.0, 1.5, 0.5, lc};
Point(11) = {0.0, 1.0, 1.0, lc};
Point(12) = {0.0, 0.5, 0.5, lc};

// curves.
Spline(1) = {1,2,3};
Spline(2) = {3,4,5,6,7};
Spline(3) = {7,8,9};
Spline(4) = {9,10,11,12,1};
Physical Line("bottom") = {1};
Physical Line("top") = {3};
Curve Loop(1) = {2, 3, 4, 1};
Surface(1) = {1};
Recombine Surface{1};

Physical Surface("mysurface") = {1};