A
AJ
AJ
Hey I need help calling a constructor of a class twice, giving it
different parameters on the second call. The reason is because I want
to rotate a line and my convertpoint class find the new point to
rotate it to. With a circle i only need to call it once, but with a
line i need to call it twice for each endpoint. The problem is that i
keep getting this error:
csci135p6spinline.cpp:49: error: redeclaration of `ConvertPoint
convertpoint'
csci135p6spinline.cpp:48: error: `ConvertPoint convertpoint'
previously declared here
here is the csci135p6spinline.cpp file
#############################################################################################
#include "csci135canvas.h"
#include "csci135p6spinline.h"
#include "csci135p6spinconvertpoint.h"
#include <string>
#include <sstream>
#include <fstream>
#include <vector>
using std::vector;
using std::ifstream;
using std::string;
using std::stringstream;
Line::Line()
{
ifstream image2;
string specs;
image2.open("image.canvas.txt");
while(image2.good())
{
string type;
getline(image2,specs);
stringstream paint(specs);
paint>>type;
if(type == "line")
{
stringstream art(specs);
paint>>Xposition_1>>Yposition_1>>Xposition_2>>Yposition_2;
linex1.push_back(Xposition_1);
liney1.push_back(Yposition_1);
linex2.push_back(Xposition_2);
liney2.push_back(Yposition_2);
}
}
}
void Line::draw(Canvas &canvas, double angle)
{
double theta = angle;
for(unsigned int i = 0; i < linex1.size(); i++)
{
double x_one = linex1;
double y_one = liney1;
double x_two = linex2;
double y_two = liney2;
ConvertPoint convertpoint(x_one,y_one,theta);
ConvertPoint convertpoint(x_two,y_two,theta);
canvas.DrawLine(x_one,y_one,x_two,y_two);
}
}
#############################################################################################
Thank You in advance for your help and time.
AJ,
Hey I need help calling a constructor of a class twice, giving it
different parameters on the second call. The reason is because I want
to rotate a line and my convertpoint class find the new point to
rotate it to. With a circle i only need to call it once, but with a
line i need to call it twice for each endpoint. The problem is that i
keep getting this error:
csci135p6spinline.cpp:49: error: redeclaration of `ConvertPoint
convertpoint'
csci135p6spinline.cpp:48: error: `ConvertPoint convertpoint'
previously declared here
here is the csci135p6spinline.cpp file
#############################################################################################
#include "csci135canvas.h"
#include "csci135p6spinline.h"
#include "csci135p6spinconvertpoint.h"
#include <string>
#include <sstream>
#include <fstream>
#include <vector>
using std::vector;
using std::ifstream;
using std::string;
using std::stringstream;
Line::Line()
{
ifstream image2;
string specs;
image2.open("image.canvas.txt");
while(image2.good())
{
string type;
getline(image2,specs);
stringstream paint(specs);
paint>>type;
if(type == "line")
{
stringstream art(specs);
paint>>Xposition_1>>Yposition_1>>Xposition_2>>Yposition_2;
linex1.push_back(Xposition_1);
liney1.push_back(Yposition_1);
linex2.push_back(Xposition_2);
liney2.push_back(Yposition_2);
}
}
}
void Line::draw(Canvas &canvas, double angle)
{
double theta = angle;
for(unsigned int i = 0; i < linex1.size(); i++)
{
double x_one = linex1;
double y_one = liney1;
double x_two = linex2;
double y_two = liney2;
ConvertPoint convertpoint(x_one,y_one,theta);
ConvertPoint convertpoint(x_two,y_two,theta);
canvas.DrawLine(x_one,y_one,x_two,y_two);
}
}
#############################################################################################
Thank You in advance for your help and time.
AJ,