Blame c++/vector/activepoint.h
|
|
2fb9fd |
#ifndef ACTIVEPOINT_H
|
|
|
2fb9fd |
#define ACTIVEPOINT_H
|
|
|
2fb9fd |
|
|
|
2fb9fd |
|
|
|
2fb9fd |
#include "vector.h"
|
|
|
2fb9fd |
#include "color.h"
|
|
|
2fb9fd |
#include "handle.h"
|
|
|
2fb9fd |
|
|
|
2fb9fd |
|
|
|
2fb9fd |
class ActivePoint: public Shared {
|
|
|
2fb9fd |
public:
|
|
|
2fb9fd |
typedef HandleT<activepoint> Handle;</activepoint>
|
|
|
2fb9fd |
|
|
|
2fb9fd |
Vector position;
|
|
|
2fb9fd |
Color color;
|
|
|
2fb9fd |
Real radius;
|
|
|
2fb9fd |
bool enabled;
|
|
|
2fb9fd |
bool visible;
|
|
|
2fb9fd |
|
|
|
2fb9fd |
bool active;
|
|
|
2fb9fd |
|
|
|
2fb9fd |
private:
|
|
|
2fb9fd |
ActivePoint(const ActivePoint&): ActivePoint() { }
|
|
|
2fb9fd |
ActivePoint& operator= (const ActivePoint&) { return *this; }
|
|
|
2fb9fd |
|
|
|
2fb9fd |
public:
|
|
|
2fb9fd |
ActivePoint(
|
|
|
2fb9fd |
const Vector &position,
|
|
|
2fb9fd |
const Color &color,
|
|
|
2fb9fd |
const Real &radius = 5,
|
|
|
2fb9fd |
bool enabled = true,
|
|
|
2fb9fd |
bool visible = true
|
|
|
2fb9fd |
):
|
|
|
2fb9fd |
position(position),
|
|
|
2fb9fd |
color(color),
|
|
|
2fb9fd |
radius(radius),
|
|
|
2fb9fd |
enabled(enabled),
|
|
|
2fb9fd |
visible(visible),
|
|
|
2fb9fd |
active()
|
|
|
2fb9fd |
{ }
|
|
|
2fb9fd |
|
|
|
2fb9fd |
explicit ActivePoint(
|
|
|
2fb9fd |
const Vector &position = Vector()
|
|
|
2fb9fd |
): ActivePoint(position, Color::white()) { }
|
|
|
2fb9fd |
|
|
|
2fb9fd |
bool is_inside(const Vector &p) const
|
|
|
2fb9fd |
{ return lesseq((position - p).lensqr(), radius*radius); }
|
|
|
2fb9fd |
};
|
|
|
2fb9fd |
|
|
|
2fb9fd |
|
|
|
2fb9fd |
#endif
|