This is a C++ program to show the duality transformation of line and point. The transformation corresponds from line to point and point to line.
Here is source code of the C++ Program to Show the Duality Transformation of Line and Point. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
using namespace std;
void performLineTransformation(double a, double b)
cout << "X: " << (b / a) << ", Y: " << (b * -1);
void performPointTransformation(double x, double y)
cout << "y=" << (-1 * y / x) << "x +" << (-1 * y);
int main(int argc, char **argv)
<< "Perform what transformation.\n1. Line Transformation\n2. Point Transformation";
cin >> option;
cout << "Enter the coefficients of line <y=ax-b>";
double a, b;
cin >> a >> b;
cout << "Enter the coordinate of point <x, y>";
double x, y;
cin >> x >> y;
$ g++ DualityTransformation.cpp $ a.out Perform what transformation. 1. Line Transformation 2. Point Transformation 1 Enter the coefficients of line <y=ax-b> 1 2 X: 2.0, Y: -2.0 Perform what transformation. 1. Line Transformation 2. Point Transformation 2 Enter the coordinate of point <x, y> 2 -2 y=1.0x +2.0 ------------------ (program exited with code: 0) Press return to continue
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.
Here’s the list of Best Books in C++ Programming, Data Structures and Algorithms.
- Get Free Certificate of Merit in C++ Programming
- Participate in C++ Programming Certification Contest
- Become a Top Ranker in C++ Programming
- Take C++ Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Practice Computer Science MCQs
- Apply for Information Technology Internship
- Buy C++ Books
- Apply for C++ Internship
- Buy Programming Books