%module graphics
%{
#include "swig_vector.hpp"
%}
class Vector {
public:
%immutable;
    double x, y, z;
%mutable;
    Vector( double x = 0, double y = 0, double z = 0 );
    Vector operator+( const Vector & );
    Vector operator-( const Vector & );
    Vector operator*( const Vector & );
};

%extend Vector {
    VALUE to_a(){
        VALUE arr = rb_ary_new();
        rb_ary_store( arr, 0, rb_float_new(self->x));
        rb_ary_store( arr, 1, rb_float_new(self->y));
        rb_ary_store( arr, 2, rb_float_new(self->z));
        return( arr );
    }
};
