0

私は大学で comp-sci プロジェクトを行っていますが、これにはやや困惑しています。 1 [Project Link]このリンクから Web サイトに移動します。プロジェクトは「LiDAR データと 3D アレイ」という PDF です。このプロジェクトの基本的な前提は、データを読み取って 3D char 配列に格納し、実際のデータを画像の形式で表示できるようにすることです。これは、クラス array3d に書き込むように割り当てられた 3 つのメソッドを含む私のコードです。

#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <fstream>
using namespace std ;

// -----------------------------------------------------------------
// array3d class with variables for 3D Matrix boundaries, 3D Matrix itself,
// Methods to store data in 3D Matrix, and display LiDAR data

class array3d
{
    private:
    int m, n, p;
    int a, b, c;
    char *** G;
    public:
    array3d();
    ~array3d();
    bool read(char * fname);//Method to read file and store data in 3D    Matrix
    void get_sizes(int & a, int & b, int & c);//Method to fine values of m, n, and p 
    int get_zmap_value(int x, int y);// Method to return highest occupied cell for pos. x, y
};
// -----------------------------------------------------------------
bool array3d::read(char * fname)
{
    //Read the data into a 3D matrix
    ifstream ifs;
    ifs.open(fname);
    if(!ifs.is_open())
    {
        cerr << "Can not open (read) file '" << fname << "'" << endl;
        return false;
    }
    ifs >> m;
    ifs >> n;
    ifs >> p;
    G = new (nothrow) char **[m];
    for(int i = 0; i < m; i++)
    {
        G[n] = new (nothrow) char *[n];
        for(int j = 0; j < n; j++)
        {
            G[n][p] = new (nothrow) char [p];
            for(int k = 0; k < p; k++)
            {
                ifs >> G[m][n][p];
            }
        }
    }
    ifs.close();
    return true;
}
// -----------------------------------------------------------------
void array3d::get_sizes(int & a, int & b, int & c)
{
    //Get values for m, n, and p using pass-by-reference semantics
    a = m;
    b = n;
    c = p;
}
// -----------------------------------------------------------------
int array3d::get_zmap_value(int x, int y)
{
    //Returns the highest occupied cell (z-index) for pos. x, y in the  ground plane
    for(int z = 0; z < p; z++)
    {
        if(G[x][y][z] == 1)
        {
            return z;
        }
    } 
}
// -----------------------------------------------------------------

そして、これも作成することになっている MakeFile のコードです

##
## FILE: MakeFile
##
zview:      array3d.o main.o
        g++ -o zview array3d.o main.o -L/user/local/lib -lppm_graphic 
##
array3d.o: array3d.cc
        g++ -c array3d.cc
##
##
clean:
        /bin/rm array3d.o main.o zview

makefile については、main.o ファイルが提供されていますが、アクセスできません。また、ライブラリ ファイルは別のディレクトリにあるため、さまざまなコマンド ライン オプションを使用してアクセスする必要があります。

コードを実行して zview を実行すると、画像を表示するはずのプログラムが開きますが、画像は表示されず、画像プログラムのタイトルとその他のオプションだけが表示されます。基本的に、ここで私の問題が何であるかはわかりませんが、助けていただければ幸いです。また、答えを教えてください。これが機能しない理由を実際に理解したいので、建設的な助けをいただければ幸いです。

4

0 に答える 0