-
Notifications
You must be signed in to change notification settings - Fork 0
/
lines.cpp
36 lines (31 loc) · 799 Bytes
/
lines.cpp
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
#include<cmath>
#include"lines.h"
#include<iostream>
#include"VPoint.h"
line::line(VPoint begin){
start = begin;
std::cout<<"enter the angle at which the line is inclined"<<std::endl;
std::cin>>direction;
}
line::line(VPoint begin, double angle){
start = begin;
direction = angle;
//std::cout<<"start point of line is ("<<start.x<<", "<<start.y<<")"<<std::endl;
//std::cout<<"direction of the line is "<<direction<<std::endl;
}
polar_point line::MirrorPoint(polar_point p){
double angle_diff = p.theta - direction;
polar_point q;
q.theta = direction - angle_diff;
q.r = p.r;
q.angle_correction();
return q;
}
VPoint line::MirrorPoint(VPoint p){
polar_point q = p.ConvertToPolar();
q = MirrorPoint(q);
return q.ConvertToCoordinate();
}
double line::angle(){
return direction;
}