ALTA  alpha
Using the C++ interface

It is possible to create your own programs and make use of ALTA's plugin possibilities. To do so, you only need to link you program with the core library (libcore.a on GNU/Linux). The core library provides all the generic objects for BRDF, data, and fitter. You can load a plugin and create an object using the plugins_manager.

The following program produces slices of data files and outputs it on a gnuplot compliant data file. It requires an interpolant data format such as data_merl, data_interpolant (our internal data format is not):

#include <core/args.h>
#include <core/data.h>
#include <core/function.h>
#include <core/fitter.h>
#include <core/plugins_manager.h>
#include <core/common.h>
#include <iostream>
#include <cmath>
int main(int argc, char** argv) {
arguments args(argc, argv);
ptr<data> d = plugins_manager::get_data(args["data"]);
std::ofstream file(args["output"].c_str(), std::ios_base::trunc);
double theta_in = -(M_PI/180) * (double)args.get_float("theta", 0.0f);
double phi_in = (M_PI/180) * (double)args.get_float("phi", 0.0f);
vec cart(6);
cart[0] = cos(phi_in)*sin(theta_in);
cart[1] = sin(phi_in)*sin(theta_in);
cart[2] = cos(theta_in);
const int N = 1000;
for(int i=0; i<N; ++i) {
const double theta_out = M_PI * (i / (double)(N-1) - 0.5);
const double phi_out = 0.0;
cart[3] = cos(phi_out)*sin(theta_out);
cart[4] = sin(phi_out)*sin(theta_out);
cart[5] = cos(theta_out);
params::convert(&cart[0], params::CARTESIAN, d->parametrization(), &x[0]);
vec v = d->value(x) ;
file << theta_out << "\t";
for(int u=0; u<d->dimY(); ++u) {
file << v[u] << "\t" ;
file << std::endl ;

The arguments object allow to parse the command line and read options. The plugins_manager allows to create plugin objects from shared object files. In this example, when data objects are not defined in the same parametrization than the data point we want to evaluate, the convert function from the params class can be used. We advise to use it all the time.