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.
38 lines
731 B
38 lines
731 B
13 years ago
|
//
|
||
|
// 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
|