- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C++ Program to Show the Duality Transformation of Line and Point

This is a C++ Program to show the Duality Transformation of Line and Point. So it can have two cases −

**Case-1:** A point (a, b) is transformed to the line (y = ax − b).

**Case-2:** A line D(y = cx + d) is transformed to the point D’(c, −d).

## Functions and pseudocodes

### Function LineTransformation(double c, double d)

Print C: (d / c) D: (d * -1)

### Function PointTransformation(double x, double y)

Print a = (-1 * y / x) b = (-1 * y)

## Example

#include <iostream> #include <time.h> #include <stdlib.h> using namespace std; void LineTransformation(double c, double d) { cout << "C: " << (d / c) << ", D: " << (d * -1); } void PointTransformation(double x, double y) { cout << "y=" << (-1 * y / x) << "x +" << (-1 * y); } int main(int argc, char **argv) { cout << "\n1. Line Transformation\n2. Point Transformation"; int c; cin >> c; switch (c) { case 1: cout << "Enter the coefficients of line y=ax-b:"; double a, b; cin >> a >> b; LineTransformation(a, b); break; case 2: cout << "Enter the coordinate of point <a, b>"; double x, y; cin >> x >> y; PointTransformation(x, y); break; default: break; } }

## Output

1. Line Transformation 2. Point Transformation 1 Enter the coefficients of line y=ax-b: 1 2 C: 2, D: -2 1. Line Transformation 2. Point Transformation 2 Enter the coordinate of point <a, b> 1 2 y=-2x +-2

- Related Articles
- Program to find the mid-point of a line in C++
- Swift Program to Find the Mid-point of a Line
- Show that the mid-point of the line segment joining the points $(5, 7)$ and $(3, 9)$ is also the mid-point of the line segment joining the points $(8, 6)$ and $(0, 10)$.
- Show that of all line segments drawn from a given point not on it, the perpendicular line segment is the shortest.
- C++ Program to Apply Above-Below-on Test to Find the Position of a Point with respect to a Line
- Signals & Systems – Duality Property of Fourier Transform
- Fill in the blanks so as to make the following statements true:Given a line and a point, not on the line, there is one and only _____ line which passes through the given point and is _____ to the given line.
- In Question 4, point ( mathrm{C} ) is called a mid-point of line segment ( mathrm{AB} ). Prove that every line segment has one and only one mid-point.
- Mid-Point Line Generation Algorithm in C++
- C++ program to find the number of triangles amongst horizontal and vertical line segments
- Draw line $l$. Take any point $P$ on the line. Using a set square, draw a line perpendicular to line $l$ at the point $P$.
- Find the other end point of a line with given one end and mid using C++
- Array Transformation in C++
- Program to find the Break Even Point in C++
- Matplotlib – How to show the coordinates of a point upon mouse click?

Advertisements