1
0
Fork 0

Push SGMaterial use into these classes that need it.

This commit is contained in:
Mathias Froehlich 2012-08-27 20:51:16 +02:00
parent 7e97a4c693
commit 26664aaff0
20 changed files with 74 additions and 58 deletions

View file

@ -498,9 +498,10 @@ void FGAIBallistic::setForcePath(const string& p) {
} }
bool FGAIBallistic::getHtAGL(double start){ bool FGAIBallistic::getHtAGL(double start){
const SGMaterial* material = 0; const simgear::BVHMaterial* mat = 0;
if (getGroundElevationM(SGGeod::fromGeodM(pos, start), if (getGroundElevationM(SGGeod::fromGeodM(pos, start),
_elevation_m, &material)) { _elevation_m, &mat)) {
const SGMaterial* material = dynamic_cast<const SGMaterial*>(mat);
_ht_agl_ft = pos.getElevationFt() - _elevation_m * SG_METER_TO_FEET; _ht_agl_ft = pos.getElevationFt() - _elevation_m * SG_METER_TO_FEET;
if (material) { if (material) {

View file

@ -607,7 +607,7 @@ SGVec3d FGAIBase::getCartPos() const {
} }
bool FGAIBase::getGroundElevationM(const SGGeod& pos, double& elev, bool FGAIBase::getGroundElevationM(const SGGeod& pos, double& elev,
const SGMaterial** material) const { const simgear::BVHMaterial** material) const {
return globals->get_scenery()->get_elevation_m(pos, elev, material, return globals->get_scenery()->get_elevation_m(pos, elev, material,
_model.get()); _model.get());
} }

View file

@ -38,7 +38,9 @@
using std::string; using std::string;
class SGMaterial; namespace simgear {
class BVHMaterial;
}
class FGAIManager; class FGAIManager;
class FGAIFlightPlan; class FGAIFlightPlan;
class FGFX; class FGFX;
@ -114,7 +116,7 @@ public:
SGVec3d getCartPos() const; SGVec3d getCartPos() const;
bool getGroundElevationM(const SGGeod& pos, double& elev, bool getGroundElevationM(const SGGeod& pos, double& elev,
const SGMaterial** material) const; const simgear::BVHMaterial** material) const;
double _elevation_m; double _elevation_m;

View file

@ -190,8 +190,9 @@ bool FGAIEscort::getGroundElev(SGGeod inpos) {
double height_m ; double height_m ;
const SGMaterial* material = 0; const simgear::BVHMaterial* mat = 0;
if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(inpos, 3000), height_m, &material,0)){ if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(inpos, 3000), height_m, &mat, 0)){
const SGMaterial* material = dynamic_cast<const SGMaterial*>(mat);
_ht_agl_ft = inpos.getElevationFt() - height_m * SG_METER_TO_FEET; _ht_agl_ft = inpos.getElevationFt() - height_m * SG_METER_TO_FEET;
if (material) { if (material) {

View file

@ -1330,7 +1330,7 @@ FGJSBsim::get_agl_ft(double t, const double pt[3], double alt_off,
double contact[3], double normal[3], double vel[3], double contact[3], double normal[3], double vel[3],
double angularVel[3], double *agl) double angularVel[3], double *agl)
{ {
const SGMaterial* material; const simgear::BVHMaterial* material;
simgear::BVHNode::Id id; simgear::BVHNode::Id id;
if (!FGInterface::get_agl_ft(t, pt, alt_off, contact, normal, vel, if (!FGInterface::get_agl_ft(t, pt, alt_off, contact, normal, vel,
angularVel, material, id)) angularVel, material, id))

View file

@ -26,7 +26,7 @@ void FGGround::getGroundPlane(const double pos[3],
{ {
// Return values for the callback. // Return values for the callback.
double cp[3], dvel[3], dangvel[3]; double cp[3], dvel[3], dangvel[3];
const SGMaterial* material; const simgear::BVHMaterial* material;
simgear::BVHNode::Id id; simgear::BVHNode::Id id;
_iface->get_agl_m(_toff, pos, 2, cp, plane, dvel, dangvel, material, id); _iface->get_agl_m(_toff, pos, 2, cp, plane, dvel, dangvel, material, id);
@ -38,7 +38,7 @@ void FGGround::getGroundPlane(const double pos[3],
void FGGround::getGroundPlane(const double pos[3], void FGGround::getGroundPlane(const double pos[3],
double plane[4], float vel[3], double plane[4], float vel[3],
const SGMaterial **material) const simgear::BVHMaterial **material)
{ {
// Return values for the callback. // Return values for the callback.
double cp[3], dvel[3], dangvel[3]; double cp[3], dvel[3], dangvel[3];

View file

@ -4,7 +4,9 @@
#include "Ground.hpp" #include "Ground.hpp"
class FGInterface; class FGInterface;
class SGMaterial; namespace simgear {
class BVHMaterial;
}
namespace yasim { namespace yasim {
@ -21,7 +23,7 @@ public:
virtual void getGroundPlane(const double pos[3], virtual void getGroundPlane(const double pos[3],
double plane[4], float vel[3], double plane[4], float vel[3],
const SGMaterial **material); const simgear::BVHMaterial **material);
virtual bool caughtWire(const double pos[4][3]); virtual bool caughtWire(const double pos[4][3]);

View file

@ -7,7 +7,8 @@
#include "BodyEnvironment.hpp" #include "BodyEnvironment.hpp"
#include "RigidBody.hpp" #include "RigidBody.hpp"
#include <simgear/scene/material/mat.hxx> #include <cfloat>
#include <simgear/bvh/BVHMaterial.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include "Gear.hpp" #include "Gear.hpp"
namespace yasim { namespace yasim {
@ -146,7 +147,7 @@ void Gear::setInitialLoad(float l)
void Gear::setGlobalGround(double *global_ground, float* global_vel, void Gear::setGlobalGround(double *global_ground, float* global_vel,
double globalX, double globalY, double globalX, double globalY,
const SGMaterial *material) const simgear::BVHMaterial *material)
{ {
int i; int i;
double frictionFactor,rollingFriction,loadCapacity,loadResistance,bumpiness; double frictionFactor,rollingFriction,loadCapacity,loadResistance,bumpiness;

View file

@ -1,7 +1,9 @@
#ifndef _GEAR_HPP #ifndef _GEAR_HPP
#define _GEAR_HPP #define _GEAR_HPP
class SGMaterial; namespace simgear {
class BVHMaterial;
}
namespace yasim { namespace yasim {
@ -50,7 +52,7 @@ public:
void setIgnoreWhileSolving(bool c); void setIgnoreWhileSolving(bool c);
void setGlobalGround(double* global_ground, float* global_vel, void setGlobalGround(double* global_ground, float* global_vel,
double globalX, double globalY, double globalX, double globalY,
const SGMaterial *material); const simgear::BVHMaterial *material);
void getPosition(float* out); void getPosition(float* out);
void getCompression(float* out); void getCompression(float* out);
void getGlobalGround(double* global_ground); void getGlobalGround(double* global_ground);

View file

@ -4,7 +4,7 @@
#include "Glue.hpp" #include "Glue.hpp"
#include <simgear/scene/material/mat.hxx> #include <simgear/bvh/BVHMaterial.hxx>
#include "Ground.hpp" #include "Ground.hpp"
namespace yasim { namespace yasim {
@ -35,7 +35,7 @@ void Ground::getGroundPlane(const double pos[3],
void Ground::getGroundPlane(const double pos[3], void Ground::getGroundPlane(const double pos[3],
double plane[4], float vel[3], double plane[4], float vel[3],
const SGMaterial **material) const simgear::BVHMaterial **material)
{ {
getGroundPlane(pos,plane,vel); getGroundPlane(pos,plane,vel);
} }

View file

@ -1,7 +1,9 @@
#ifndef _GROUND_HPP #ifndef _GROUND_HPP
#define _GROUND_HPP #define _GROUND_HPP
class SGMaterial; namespace simgear {
class BVHMaterial;
}
namespace yasim { namespace yasim {
class Ground { class Ground {
@ -14,7 +16,7 @@ public:
virtual void getGroundPlane(const double pos[3], virtual void getGroundPlane(const double pos[3],
double plane[4], float vel[3], double plane[4], float vel[3],
const SGMaterial **material); const simgear::BVHMaterial **material);
virtual bool caughtWire(const double pos[4][3]); virtual bool caughtWire(const double pos[4][3]);

View file

@ -326,7 +326,7 @@ void Model::updateGround(State* s)
// Ask for the ground plane in the global coordinate system // Ask for the ground plane in the global coordinate system
double global_ground[4]; double global_ground[4];
float global_vel[3]; float global_vel[3];
const SGMaterial* material; const simgear::BVHMaterial* material;
_ground_cb->getGroundPlane(pt, global_ground, global_vel, &material); _ground_cb->getGroundPlane(pt, global_ground, global_vel, &material);
g->setGlobalGround(global_ground, global_vel, pt[0], pt[1], material); g->setGlobalGround(global_ground, global_vel, pt[0], pt[1], material);
} }

View file

@ -693,13 +693,13 @@ bool
FGInterface::get_agl_m(double t, const double pt[3], double max_altoff, FGInterface::get_agl_m(double t, const double pt[3], double max_altoff,
double contact[3], double normal[3], double contact[3], double normal[3],
double linearVel[3], double angularVel[3], double linearVel[3], double angularVel[3],
SGMaterial const*& material, simgear::BVHNode::Id& id) simgear::BVHMaterial const*& material, simgear::BVHNode::Id& id)
{ {
SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down(); SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
SGVec3d _contact, _normal, _linearVel, _angularVel; SGVec3d _contact, _normal, _linearVel, _angularVel;
const simgear::BVHMaterial* m = 0; material = 0;
bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel, bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
_angularVel, id, m); _angularVel, id, material);
// correct the linear velocity, since the line intersector delivers // correct the linear velocity, since the line intersector delivers
// values for the start point and the get_agl function should // values for the start point and the get_agl function should
// traditionally deliver for the contact point // traditionally deliver for the contact point
@ -709,7 +709,6 @@ FGInterface::get_agl_m(double t, const double pt[3], double max_altoff,
assign(normal, _normal); assign(normal, _normal);
assign(linearVel, _linearVel); assign(linearVel, _linearVel);
assign(angularVel, _angularVel); assign(angularVel, _angularVel);
material = dynamic_cast<const SGMaterial*>(m);
return ret; return ret;
} }
@ -717,15 +716,15 @@ bool
FGInterface::get_agl_ft(double t, const double pt[3], double max_altoff, FGInterface::get_agl_ft(double t, const double pt[3], double max_altoff,
double contact[3], double normal[3], double contact[3], double normal[3],
double linearVel[3], double angularVel[3], double linearVel[3], double angularVel[3],
SGMaterial const*& material, simgear::BVHNode::Id& id) simgear::BVHMaterial const*& material, simgear::BVHNode::Id& id)
{ {
// Convert units and do the real work. // Convert units and do the real work.
SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down(); SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
pt_m *= SG_FEET_TO_METER; pt_m *= SG_FEET_TO_METER;
SGVec3d _contact, _normal, _linearVel, _angularVel; SGVec3d _contact, _normal, _linearVel, _angularVel;
const simgear::BVHMaterial* m = 0; material = 0;
bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel, bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
_angularVel, id, m); _angularVel, id, material);
// correct the linear velocity, since the line intersector delivers // correct the linear velocity, since the line intersector delivers
// values for the start point and the get_agl function should // values for the start point and the get_agl function should
// traditionally deliver for the contact point // traditionally deliver for the contact point
@ -736,7 +735,6 @@ FGInterface::get_agl_ft(double t, const double pt[3], double max_altoff,
assign( normal, _normal ); assign( normal, _normal );
assign( linearVel, SG_METER_TO_FEET*_linearVel ); assign( linearVel, SG_METER_TO_FEET*_linearVel );
assign( angularVel, _angularVel ); assign( angularVel, _angularVel );
material = dynamic_cast<const SGMaterial*>(m);
return ret; return ret;
} }
@ -744,19 +742,18 @@ bool
FGInterface::get_nearest_m(double t, const double pt[3], double maxDist, FGInterface::get_nearest_m(double t, const double pt[3], double maxDist,
double contact[3], double normal[3], double contact[3], double normal[3],
double linearVel[3], double angularVel[3], double linearVel[3], double angularVel[3],
SGMaterial const*& material, simgear::BVHMaterial const*& material,
simgear::BVHNode::Id& id) simgear::BVHNode::Id& id)
{ {
SGVec3d _contact, _linearVel, _angularVel; SGVec3d _contact, _linearVel, _angularVel;
const simgear::BVHMaterial* m = 0; material = 0;
if (!ground_cache.get_nearest(t, SGVec3d(pt), maxDist, _contact, _linearVel, if (!ground_cache.get_nearest(t, SGVec3d(pt), maxDist, _contact, _linearVel,
_angularVel, id, m)) _angularVel, id, material))
return false; return false;
assign(contact, _contact); assign(contact, _contact);
assign(linearVel, _linearVel); assign(linearVel, _linearVel);
assign(angularVel, _angularVel); assign(angularVel, _angularVel);
material = dynamic_cast<const SGMaterial*>(m);
return true; return true;
} }
@ -764,20 +761,19 @@ bool
FGInterface::get_nearest_ft(double t, const double pt[3], double maxDist, FGInterface::get_nearest_ft(double t, const double pt[3], double maxDist,
double contact[3], double normal[3], double contact[3], double normal[3],
double linearVel[3], double angularVel[3], double linearVel[3], double angularVel[3],
SGMaterial const*& material, simgear::BVHMaterial const*& material,
simgear::BVHNode::Id& id) simgear::BVHNode::Id& id)
{ {
SGVec3d _contact, _linearVel, _angularVel; SGVec3d _contact, _linearVel, _angularVel;
const simgear::BVHMaterial* m = 0; material = 0;
if (!ground_cache.get_nearest(t, SG_FEET_TO_METER*SGVec3d(pt), if (!ground_cache.get_nearest(t, SG_FEET_TO_METER*SGVec3d(pt),
SG_FEET_TO_METER*maxDist, _contact, _linearVel, SG_FEET_TO_METER*maxDist, _contact, _linearVel,
_angularVel, id, m)) _angularVel, id, material))
return false; return false;
assign(contact, SG_METER_TO_FEET*_contact); assign(contact, SG_METER_TO_FEET*_contact);
assign(linearVel, SG_METER_TO_FEET*_linearVel); assign(linearVel, SG_METER_TO_FEET*_linearVel);
assign(angularVel, _angularVel); assign(angularVel, _angularVel);
material = dynamic_cast<const SGMaterial*>(m);
return true; return true;
} }
@ -831,7 +827,7 @@ FGInterface::get_groundlevel_m(const SGGeod& geod)
} }
double contact[3], normal[3], vel[3], angvel[3]; double contact[3], normal[3], vel[3], angvel[3];
const SGMaterial* material; const simgear::BVHMaterial* material;
simgear::BVHNode::Id id; simgear::BVHNode::Id id;
// Ignore the return value here, since it just tells us if // Ignore the return value here, since it just tells us if
// the returns stem from the groundcache or from the coarse // the returns stem from the groundcache or from the coarse

View file

@ -89,7 +89,9 @@ using std::list;
using std::vector; using std::vector;
using std::string; using std::string;
class SGMaterial; namespace simgear {
class BVHMaterial;
}
/** /**
* A little helper class to update the track if * A little helper class to update the track if
@ -693,11 +695,11 @@ public:
// contact point. // contact point.
bool get_agl_m(double t, const double pt[3], double max_altoff, bool get_agl_m(double t, const double pt[3], double max_altoff,
double contact[3], double normal[3], double linearVel[3], double contact[3], double normal[3], double linearVel[3],
double angularVel[3], SGMaterial const*& material, double angularVel[3], simgear::BVHMaterial const*& material,
simgear::BVHNode::Id& id); simgear::BVHNode::Id& id);
bool get_agl_ft(double t, const double pt[3], double max_altoff, bool get_agl_ft(double t, const double pt[3], double max_altoff,
double contact[3], double normal[3], double linearVel[3], double contact[3], double normal[3], double linearVel[3],
double angularVel[3], SGMaterial const*& material, double angularVel[3], simgear::BVHMaterial const*& material,
simgear::BVHNode::Id& id); simgear::BVHNode::Id& id);
double get_groundlevel_m(double lat, double lon, double alt); double get_groundlevel_m(double lat, double lon, double alt);
double get_groundlevel_m(const SGGeod& geod); double get_groundlevel_m(const SGGeod& geod);
@ -708,11 +710,11 @@ public:
// position pt. // position pt.
bool get_nearest_m(double t, const double pt[3], double maxDist, bool get_nearest_m(double t, const double pt[3], double maxDist,
double contact[3], double normal[3], double linearVel[3], double contact[3], double normal[3], double linearVel[3],
double angularVel[3], SGMaterial const*& material, double angularVel[3], simgear::BVHMaterial const*& material,
simgear::BVHNode::Id& id); simgear::BVHNode::Id& id);
bool get_nearest_ft(double t, const double pt[3], double maxDist, bool get_nearest_ft(double t, const double pt[3], double maxDist,
double contact[3], double normal[3],double linearVel[3], double contact[3], double normal[3],double linearVel[3],
double angularVel[3], SGMaterial const*& material, double angularVel[3], simgear::BVHMaterial const*& material,
simgear::BVHNode::Id& id); simgear::BVHNode::Id& id);

View file

@ -382,10 +382,9 @@ FGGroundCache::prepare_ground_cache(double startSimTime, double endSimTime,
if (!found_ground) { if (!found_ground) {
// Ok, still nothing here?? Last resort ... // Ok, still nothing here?? Last resort ...
double alt = 0; double alt = 0;
const SGMaterial* m = NULL; _material = 0;
found_ground = globals->get_scenery()-> found_ground = globals->get_scenery()->
get_elevation_m(SGGeod::fromGeodM(geodPt, 10000), alt, &m); get_elevation_m(SGGeod::fromGeodM(geodPt, 10000), alt, &_material);
_material = m;
if (found_ground) if (found_ground)
_altitude = alt; _altitude = alt;
} }

View file

@ -210,9 +210,10 @@ agRadar::setUserVec(double az, double el)
bool bool
agRadar::getMaterial(){ agRadar::getMaterial(){
const SGMaterial* material = 0; const simgear::BVHMaterial* mat = 0;
if (globals->get_scenery()->get_elevation_m(hitpos, _elevation_m, &material)){ if (globals->get_scenery()->get_elevation_m(hitpos, _elevation_m, &mat)){
//_ht_agl_ft = pos.getElevationFt() - _elevation_m * SG_METER_TO_FEET; //_ht_agl_ft = pos.getElevationFt() - _elevation_m * SG_METER_TO_FEET;
const SGMaterial* material = dynamic_cast<const SGMaterial*>(mat);
if (material) { if (material) {
const std::vector<std::string>& names = material->get_names(); const std::vector<std::string>& names = material->get_names();

View file

@ -323,10 +323,12 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
while (elevations.size() <= e_size) { while (elevations.size() <= e_size) {
probe_distance += point_distance; probe_distance += point_distance;
SGGeod probe = SGGeod::fromGeoc(center.advanceRadM( course, probe_distance )); SGGeod probe = SGGeod::fromGeoc(center.advanceRadM( course, probe_distance ));
const SGMaterial *mat = 0; const simgear::BVHMaterial *material = 0;
double elevation_m = 0.0; double elevation_m = 0.0;
if (scenery->get_elevation_m( probe, elevation_m, &mat )) { if (scenery->get_elevation_m( probe, elevation_m, &material )) {
const SGMaterial *mat;
mat = dynamic_cast<const SGMaterial*>(material);
if((transmission_type == 3) || (transmission_type == 4)) { if((transmission_type == 3) || (transmission_type == 4)) {
elevations.push_back(elevation_m); elevations.push_back(elevation_m);
if(mat) { if(mat) {

View file

@ -262,7 +262,8 @@ void FGScenery::unbind() {
bool bool
FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff, FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
double& alt, const SGMaterial** material, double& alt,
const simgear::BVHMaterial** material,
const osg::Node* butNotFrom) const osg::Node* butNotFrom)
{ {
SGGeod geod = SGGeod::fromCart(pos); SGGeod geod = SGGeod::fromCart(pos);
@ -272,7 +273,7 @@ FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
bool bool
FGScenery::get_elevation_m(const SGGeod& geod, double& alt, FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
const SGMaterial** material, const simgear::BVHMaterial** material,
const osg::Node* butNotFrom) const osg::Node* butNotFrom)
{ {
SGVec3d start = SGVec3d::fromGeod(geod); SGVec3d start = SGVec3d::fromGeod(geod);
@ -291,7 +292,7 @@ FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
geodEnd = SGGeod::fromCart(intersectVisitor.getLineSegment().getEnd()); geodEnd = SGGeod::fromCart(intersectVisitor.getLineSegment().getEnd());
alt = geodEnd.getElevationM(); alt = geodEnd.getElevationM();
if (material) if (material)
*material = dynamic_cast<const SGMaterial*>(intersectVisitor.getMaterial()); *material = intersectVisitor.getMaterial();
return true; return true;
} }

View file

@ -38,7 +38,9 @@
#include "SceneryPager.hxx" #include "SceneryPager.hxx"
class SGMaterial; namespace simgear {
class BVHMaterial;
}
// Define a structure containing global scenery parameters // Define a structure containing global scenery parameters
class FGScenery : public SGSubsystem { class FGScenery : public SGSubsystem {
@ -72,7 +74,7 @@ public:
/// value is undefined. /// value is undefined.
/// All values are meant to be in meters or degrees. /// All values are meant to be in meters or degrees.
bool get_elevation_m(const SGGeod& geod, double& alt, bool get_elevation_m(const SGGeod& geod, double& alt,
const SGMaterial** material, const simgear::BVHMaterial** material,
const osg::Node* butNotFrom = 0); const osg::Node* butNotFrom = 0);
/// Compute the elevation of the scenery below the cartesian point pos. /// Compute the elevation of the scenery below the cartesian point pos.
@ -87,7 +89,8 @@ public:
/// value is undefined. /// value is undefined.
/// All values are meant to be in meters. /// All values are meant to be in meters.
bool get_cart_elevation_m(const SGVec3d& pos, double max_altoff, bool get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
double& elevation, const SGMaterial** material, double& elevation,
const simgear::BVHMaterial** material,
const osg::Node* butNotFrom = 0); const osg::Node* butNotFrom = 0);
/// Compute the nearest intersection point of the line starting from /// Compute the nearest intersection point of the line starting from

View file

@ -894,10 +894,11 @@ static naRef f_geodinfo(naContext c, naRef me, int argc, naRef* args)
double lat = naNumValue(args[0]).num; double lat = naNumValue(args[0]).num;
double lon = naNumValue(args[1]).num; double lon = naNumValue(args[1]).num;
double elev = argc == 3 ? naNumValue(args[2]).num : 10000; double elev = argc == 3 ? naNumValue(args[2]).num : 10000;
const SGMaterial *mat; const simgear::BVHMaterial *material;
SGGeod geod = SGGeod::fromDegM(lon, lat, elev); SGGeod geod = SGGeod::fromDegM(lon, lat, elev);
if(!globals->get_scenery()->get_elevation_m(geod, elev, &mat)) if(!globals->get_scenery()->get_elevation_m(geod, elev, &material))
return naNil(); return naNil();
const SGMaterial *mat = dynamic_cast<const SGMaterial *>(material);
naRef vec = naNewVector(c); naRef vec = naNewVector(c);
naVec_append(vec, naNum(elev)); naVec_append(vec, naNum(elev));
naRef matdata = naNil(); naRef matdata = naNil();