-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.cpp
More file actions
46 lines (37 loc) · 894 Bytes
/
Point.cpp
File metadata and controls
46 lines (37 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "Point.h"
#include "Text.h"
using CSC2110::String;
#include <iostream>
using namespace std;
Point::Point(double xp, double yp)
{
x = xp;
y = yp;
}
Point::~Point()
{}
double Point::getX()
{
return x;
}
double Point::getY()
{
return y;
}
void Point::draw(wxDC& dc, Color* color, int radius, int width, int height, double x_max, double y_max)
{
double w = (double) width;
double h = (double) height;
//compute the transformation
double x_t = w*x/x_max;
double y_t = (-h*y/y_max) + h;
int x_t_r = (int) (x_t + 0.5);
int y_t_r = (int) (y_t + 0.5);
//draw the point on the provided canvas
Color* copy_color = new Color(color->getRed(), color->getGreen(), color->getBlue());
String* circle_text = new String("");
Circle* c = new Circle(copy_color, radius, circle_text);
c->draw(dc, x_t_r, y_t_r);
delete circle_text;
delete c;
}