Witam, przyznam otwarcie, że jestem projektantem 3D i wylądowałem na ERASMUSie w Niemczech, gdzie dostałem o dziwo..programistyczne zadanie ;/ Męczę się od tygodnia albo i dwóch ale bez solidnych podstaw niestety nie jestem w stanie ogarnąć mojego problemu.
Może pomożecie ??
Problem: Potrzebuję w funkcji jednej klasy użyć zawartość tabeli [*][3] z funkcji innej klasy. Nie ma między nimi dziedziczenia. Oto fragment kodu:
Plik ParaViewVisualGrid.h
template <class VectorType>
class ParaViewVisualGrid : public FileVisualGridBase,
public VisualGrid <VectorType> {
...
virtual void Write() {
...
WriteVTKASCIIFile ( *out);
}
...
virtual void WriteVTKASCIIFile ( std::ostream &out) {
int nnodes = NNodes();
int ncells = NCells();
const float* xyz = new float [3*nnodes];
SetGridNodes((float (*)[3]) xyz);
register int i;
for ( i=0; i<nnodes; i++){
for ( int d=0; d<3; d++)
out << xyz [3 * i + d) << " "; // TE WARTOŚCI POTRZEBUJE WPISAĆ DO....
}
}
...
};
Plik HDFReader.cxx
#Include "HDFReader.h"
#include "ParaViewVisualGrid.h"
...
#include "vtk*.h" // kilka bibliotek VTK w tym vtkPoints.h
...
void Show (...){
FileVisualGridBase* grid;
...
grid->Write(); // tu wywołuję funkcję WriteWTKASCIIFile
}
int HDFReader :: RequestData (...){
vtkPoints* points = vtkPoints ::New();
...
Show();
...
static float x[2][3] = { {0,0,0}, {1,0,0} };
for (int i = 0; i < 2; i++) points-> InsertPoint( i, x[i]); // .....TEJ FUNKCJI / MIEJSCA
...
}
Plik vtkPoints.h
...
// Insert point into object. Range checking performed and memory
// allocated as necessary
void InsertPoint (vtkIdType id, const float x[3]){
this->Data->InsertTuple( id, x ); }
void InsertPoint (vtkIdType id, const double x[3]){
this->Data->InsertTuple( id, x ); }
void InsertPoint (vtkIdType id, double x, double y, double z);
...