ChatGPTを使って3Dスキャンオブジェクトの体積を求める calculating volume of 3D scanned object using ChatGPT

はじめに

 数日前,Sep. 18, 2023,長男ファミリーが立ち寄って,ぼくがエルゼビアに論文投稿する準備をしていることを知っていて,ChatGPT,を紹介してくれた。マスコミで盛んに取り上げられているが,ほぼ関心がなかった。しかし,実際に使ってみて,かなり賢いことがわかった。

 OpenAIというイーロンマスクなどが出資し,Microsoftが100億ドルの追加出資をした企業が開発したものだ。ChatGPTを検索すると,

質問:Is Japanese edition of ChatGPT original or translation of English ChatGPT?

As of my last knowledge update in September 2021, OpenAI had not released an official Japanese edition of ChatGPT. However, it’s important to note that advancements and updates may have occurred since then.

If a Japanese edition of ChatGPT exists or has been released since my last update, it could be an adaptation or translation of the original English ChatGPT. The translation process involves translating the underlying model, fine-tuning it using Japanese text, and potentially making cultural or linguistic adjustments to ensure the responses are appropriate and natural in a Japanese context.

For the most current and accurate information about a Japanese edition of ChatGPT, I recommend visiting the OpenAI website or referring to official updates and announcements from OpenAI or other relevant sources.

というようなことである。

iPhoneとiPadにも,ChatGPTをインストールした。Plusにすると,月3000円だ。他のサイトの解説では,iOSで質問−回答,の履歴は,macと共有できるという情報があった。mac,iPhone, iPadのそれぞれから発信して,無事,共有することができた。history listのタイトルに必ずしも一貫性が無いので,見出しを開いて確認する必要がある。iOSの良さは,口頭で話すことでテキストに変換してくれることである。英語をより理解してくれるという印象もあるが,日本語の方を理解する場合もある。ぼくの英語?の発音が問題なのだろうね。

macの純正「メモ」memo エディターはiPhoneでもiPadでもiCloudを通じて共有できるので,研究の補助ツールとして使えるように思う。ChatGPTの書式はかなり扱い難いものなので,メモエディターの存在は大きい。

1 四面体に分割して体積を求める

 文学論集Vol. 73, No. 3の『フィールド科学のためのアップルLiDAR測量 Part 2』の「Ⅴ.4 四面体に分割して体積を求める」(Sep. 19, 2023投稿)のコピーをここに示す。ChatGPTを初めて使った報告の一部である。
————————————————
ChatGPTを本日初めて使い,” Do you calculate the volume of a 3D mesh obj file?”って質問すると,多少長いが示唆に富む回答があった。

Load the OBJ file → Triangulate the Faces → Calculate Tetrahedral Volume → Sum Up the Tetrahedral Volumes.

このモデルを手作業で実行した。このモデルではどんな形態でも適応が可能ではあるが大饗石はほぼ一つの六面体と一つの五面体で構成されている。 図33のα)は南壁面,β)は北壁面,γ)は東と西の壁面を示している。西壁面は,いわば新幹線先頭車両の鼻のように,大饗石本体の六面体に四角錐が突出しているようで,こういったイメージの元で,9の9点の座標値を採取した。つまり,CloudCompareの上段メニューアイコン群の左から4番目のアイコン Point list picking(9点)を実行した。図33にその地点を示している。六面体内の四面体構成を図33δ)左手に示す。5個の四面体は,aeと命名しそれらの頂点に対応する頂点にaeを記している。西壁面の五面体は図33δ)右手に示すがf,g二つの四面体で構成される。9の9点の座標値は,(x, y, z)の配列で,次の表5に示している。

図33 7個の四面体から大饗石の体積を求める

Pt. No.xyzPt. No.xyz
11.283460.492800.2460620.997290.805581.92038
3-1.72137-2.782181.926644-1.72197-3.426261.12020
50.011423.18688-0.394756-0.722842.594071.88495
7-3.58718-1.480081.679068-3.21799-1.94289-0.44899
9-3.44079-3.193971.38024   
表5 大饗石の四面体分割のための座標点

一つの四面体と一つの五面体での9点の座標点との関係は,例えば六面体の中央に位置する四面体aでは,座標点4,5,1,2からなる。一つの四面体を構成する4点の座標点は,(x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4)と表現できる。ChatGPTの回答の行列式は,次の式のように計算できるので,Microsoft Excelにこの式を組み込むことで,それぞれの四面体の体積を求めることができるのである。

=abs(((x4-x1)*((y2-y1)*(z3-z1)-(z2-z1)*(y3-y11))+(y4-y1)*((z2-z1)*(x3-x1)-(x2-x1)*(z3-z1))+(z4-z1)*((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)))/6)

それぞれの四面体の体積は,a=6.4159, b=1.4489, c=3.8164, d=4.6968, e=5.3058, f=1.0708, g=0.6273であり,合計23.38㎥となる。これが大饗石の堆積の近似値となる。

なお,大饗石の3Dファイルから算出された体積のうち最大値は,ほぼ53㎥であった。これは,3D点群PLYファイルに対してCloudCompareのTools >Volume > Compute 2.5D volumeを実行することによって得られたもので,大饗石の最低標高値の水平面から大饗石表面までの体積になっている。最低値は,ほぼ35㎥であった。点群系のPLYファイルをメッシュ化してメッシュの欠陥を埋めたエンティティーにCloudCompareのEdit > Mesh > Measure Volumeを実行した結果や,Blenderにメッシュ系のUSDZを取り込んで,OBJファイルに変換してMeshLabで穴埋め処理したエンティティーをBlenderのadd-onを使って求めた結果と一致している。この計算過程は,LiDARスキャンオブジェクトの底を塞ぐ[i],や,Blenderでusdzファイルをobjファイルに変換して体積を求める[ii],などに示している。


[i] https://motochan.info/wp/2023/09/06/closing-the-bottom-hole-of-a-lidar-scanned-object/

[ii] https://motochan.info/wp/wp-admin/post.php?post=23826&action=edit

2 ChatGPTアドバイス: MeshLabやMeshmixerを使って3Dスキャンオブジェクトの底抜けを解消する???

 なお,ChatGPTの情報はmemoに保存したものである。ChatGPTそのものの表示をコピペすると多少問題が出るので,このmemoエディターを利用するのは有効だと感じている。このChatGPTの情報を使って,次章でトライしてみたいと思っている。

2.1 質問: 3D scanned objects inevitablly have a big hole at the bottom. Please show me how to close up it?

ChatGPT回答: 

When you 3D scan an object, it’s common to have holes or gaps in the mesh, especially at the bottom or other areas where the scanning process might not capture data accurately. Closing these holes and creating a watertight mesh is important for 3D printing or further digital modeling. Here’s a step-by-step guide to closing up holes in a 3D scanned mesh:

  • Use 3D Modeling Software:
  • Open the 3D scanning file in a 3D modeling software that allows mesh editing, such as Blender, Autodesk Meshmixer, or MeshLab.(全部オープンソース,Meshmixerは数日前にインストールした。3Dプリンター用の簡易版で使い易そうな印象だ)
  • Identify the Hole:
  • Identify the hole or gaps in the mesh that need to be closed. You can usually visualize these areas by rotating and inspecting the model in the software.
  • Select the Hole:
  • Use the selection tools in the software to select the area around the hole. In most programs, you can click and drag to select vertices, edges, or faces.(MeshLabにこういう機能が欲しいと思っていたがこの手法などにアクセスできていない)
  • Fill the Hole:
  • Once you’ve selected the hole, use the software’s mesh editing tools to fill the hole. This may be called “Fill Hole” or “Bridge Edge Loops” in different software. The tool will automatically generate new geometry to close the gap.
  • Adjust and Smooth:
  • After filling the hole, you may need to adjust the new geometry to match the surrounding surface. Use tools like sculpting, smoothing, or vertex manipulation to refine the area and make it seamless.
  • Check for Watertightness:
  • Ensure the mesh is watertight by using the software’s tools to check for holes, leaks, or non-manifold geometry. This ensures there are no remaining gaps in the mesh.
  • Save the Edited Mesh:
  • Save the edited mesh as a new file to preserve the changes without altering the original scanned data.
  • Export for Further Use:
  • If you intend to use the mesh for 3D printing or other purposes, export the edited and closed mesh in a suitable file format such as STL or OBJ.
  • Validate with 3D Printing Software:
  • If you plan to 3D print the model, import the closed mesh into 3D printing software to confirm that it’s now watertight and ready for printing.

Remember, the exact steps and tools you use may vary based on the 3D modeling software you’re using, but the general process remains similar. Additionally, practice and experimentation will help you become proficient in closing holes and editing 3D scanned meshes effectively.

Regenerate(これをクリックすることで,同じ質問で,どうも別の回答を求めることができるようだ)

流れは理解できる。それでは,Autodesk Meshmixerでどうすればいいのか,次に聞いてみた。

2.2 User 質問: As you know that 3D scanned objects have big holes in the meshes. Please show me how to mend them using Autodesk Meshmixer.

ChatGPT回答:

Certainly! Autodesk Meshmixer is a powerful tool for working with 3D meshes, including repairing holes. Follow these steps to mend holes in 3D scanned objects using Autodesk Meshmixer:

 ってなことで続くのであるが,木枯らしが吹いていた。前述のように,ChatGPTを本日初めて使いー” Do you calculate the volume of a 3D mesh obj file?”ーって質問すると,多少長いが示唆に富む回答があった,と書いていたがすでにぼくの頭の中にその世界があったから,ぼくが反応できたのであって,ChatGPTを使うことで,新たな世界が展開する訳ではない。ChatGPTに具体的な質問をすると,一応返ってくるのであるが,どうでもいい内容で,実際のプロセスを示してくれない。これは,アプリのユーザーマニュアルが役に立たない現象と似ているかも知れない。ChatGPTはこういった分野では使えない。自らの論文の英語チェックには,役立つのではと,今だ期待をしはしている。

以上,Sep. 22, 2023記。