My old project for strange attractors, new approach
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 

37 lines
731 B

//
// Canvas.hpp
// AwesomeAttractorND
//
// Created by Joshua Moerman on 10/28/11.
// Copyright 2011 Vadovas. All rights reserved.
//
#ifndef AwesomeAttractorND_Canvas_hpp
#define AwesomeAttractorND_Canvas_hpp
#include "nd_array.hpp"
class Canvas2D : public nd_array<unsigned int, 2>{
typedef Canvas2D self;
typedef nd_array<unsigned int, 2> super;
public:
Canvas2D(size_t width, size_t height)
: super(width, height)
{}
void plot(double const * const position){
const size_t width = get_size(0);
const size_t height = get_size(1);
const size_t x = position[0]*width + width*.5;
const size_t y = position[1]*width + height*.5;
if(x < width && y < height) {
(*this)[x][y]++;
}
}
};
#endif