ホーム » 3D » 球が作成できない

2018年4月
1234567
891011121314
15161718192021
22232425262728
2930  

カテゴリー

アーカイブ

ブログ統計情報

  • 77,324 アクセス



球が作成できない

背景画像のアップロードで,球を生成してそれに貼り付ける.
コード自体はそれほど難しくないので,1 日位でできると思ってた.
Windows のコンソール AP で,次の様なコードを書いてテスト.
MakeBG.cpp
make_bg.hxx


#include "MessBar.hxx"
#include "i_Trace.hxx"
#include "gonsprm2.hxx"
#include "Htm_thrj.hxx"

//*******************************************************************************
// make bg files imo and html
// Create : 2018/04/19
//*******************************************************************************
inline bool MakeBG (c_tstring& dibPath)
{
    tstring ext = ::Path_GetExtLow(dibPath) ;
    if      (ext == _T("bmp")) { ;              }
    else if (ext == _T("jpg")) { ;              }
    else if (ext == _T("png")) { ;              }
    else                       { return false ; }
    {
        tstring imoPath = ::Path_ChangeExt(dibPath,_T(".imo")) ;
        tstring htmName = ::Path_ChangeExt(dibPath,_T(".html")) ;
        tstring dmpName = ::Path_ChangeExt(dibPath,_T(".ipl")) ;
        {
            long div = 90/5 ;
            v_Vd3A pntsAry = ::BuildSphere(div) ;
            {
                std::tout << pntsAry.size() << std::endl ;
                if (pntsAry.size() > 0) {
                    Vd3A pnts = pntsAry[0] ;
                    std::tout << pnts.size() << std::endl ;
                    }
                tstring str = ::v_V3_To_tstring(pntsAry,_T(",")) ;
                {
                    std::tout << str << std::endl ;
                    }
                ::SaveText(dmpName.c_str(),str) ;
                }
            v_Vd2A  txuvAry = ::SetTextureUV(pntsAry) ;
                    pntsAry = ::V3_Scale (pntsAry,Vd3(20.)) ;
            Gons1   gons1 = ::Gons_BuildFace(pntsAry,txuvAry,dibPath.c_str()) ;
            GonsA   ga ;
                    ga.push_back(gons1) ;
            Ed3     es = ::GonsA_GetExtent(ga) ;
            {
                std::tout << imoPath << _T("\t") ;
                std::tout << ::V3_To_tstring(es.Volume()) << std::endl ;
                }
            if (es.Volume() != Vd3(0)) {
                es = Ed3(es.L*0.01,es.G*0.01) ;
                ::GonsA_ToOBJ(ga,imoPath.c_str()) ;
                ::HT_Make_three_js_html(imoPath.c_str(),es) ;
                }
            }
        }
    return true ;
    }

//*******************************************************************************
// Make BG
// Create : 2018/04/19
//*******************************************************************************
int _tmain (int argc,TCHAR* argv[])
{
    _tsetlocale(LC_ALL,_T("")) ;
    {
        double s = sin(rad(30)) ;
        double c = cos(rad(30)) ;
        std::tout << ::To_tstring(rad(30)) << _T("\t") << ::To_tstring(s) << _T("\t") << ::To_tstring(c) << std::endl ;
        }
    if (argc > 1) {
        v_tstring argAry ;
        for (int index=1 ; index<argc ; index++) {
            tstring av = argv[index] ;
            ::MakeBG(av) ;
            }
        }
    else {
        tstring buf ;
        buf.resize(1000) ;
        {
            while (std::terr << _T("dib ? =") , std::tin.getline(&buf[0],buf.size()))
            {
                tstring str = buf.c_str() ;
                if      (str == _T("q"))   { break ; }
                else if (str == _T("Q"))   { break ; }
                str = ::QuotM_Del_All(str) ;
                if (str.empty())           { continue ; }
                if (::File_IsNothing(str)) { continue ; }
                tstring dib_file = str ;
                ::MakeBG(dib_file) ;
                }
            }
        }
    return 0 ;
    }

#include "MessBar.cxx"

今度は,DS116 でビルドして実行すると,

Iwao@DS116:/var/.../Test/up_bg/data$ ./a.out
0.523599        98314745853377985068733249901357667205561433229409406145971019710277043155206326909160297391588106447153156445277590513896008090831662627743743127151181611161993303763348552511914898438567008016612049817143085994563143448055356356529593034366351316506187159487365573007925410016860727208738652774465536.000000  98321247861193438769252981549279948821735544950351014769381393881588573259178110828643912278175146924986161470094082713103803921735703931192359519739047155548857037547932930737608178537416409042994283830606984599100883034181136178714087912736395732787698542049681305006129736011480288874859116047106048.000000
dib ? =

本当は,

C:\Users\Iwao\...\i_Tools.tmp>\\DevXP\C_Drive\Temp\DS11x\MakeBG\Release.060\MakeBG.exe
0.523599        0.500000        0.866025
dib ? =

cmath が使えない様で,検索すると「-lm でコンパイルが通る」と言うのは見つかる.
が,コンパイルの問題ではなく,実行でうまくない.


当然ではあるが,DS115j でも同様.
試しに,opkg update と opkg install gcc .
root@DS116:/var/…/Iwao# opkg update
Downloading http://pkg.entware.net/binaries/armv7/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/packages
root@DS116:/var/…/Iwao# opkg install gcc
Upgrading gcc on root from 6.3.0-1 to 6.3.0-1a…
Downloading http://pkg.entware.net/binaries/armv7/gcc_6.3.0-1a_armv7soft.ipk
Configuring gcc.
root@DS116:/var/…/Iwao#
もう一度,ビルドして実行すると,
Iwao@DS116:/var/…/Test/up_bg/data$ g++ MakeBG.cpp
Iwao@DS116:/var/…/Test/up_bg/data$ ./a.out
0.523599 0.500000 0.866025
dib ? =
予想以上に時間がかかってしまったが,何とか…
daikoku_edit.html


2019/02/13 リンクなどを修正

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コメントする

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

%d人のブロガーが「いいね」をつけました。