यह रेखा और बिंदु के डुअलिटी ट्रांसफॉर्मेशन को दिखाने के लिए एक C++ प्रोग्राम है। इसके दो मामले हो सकते हैं:
केस-1: एक बिंदु (a, b) को रेखा (y = ax - b) में ट्रांसफॉर्म किया जाता है।
केस-2: एक रेखा D(y = cx + d) को बिंदु D'(c, -d) में ट्रांसफॉर्म किया जाता है।
फंक्शन्स और स्यूडोकोड
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)
उदाहरण
#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 : ";
double x, y;
cin >> x >> y;
PointTransformation(x, y);
break;
default:
break;
}
return 0;
}
आउटपुट
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 1 2 y=-2x +-2
कम्प्यूटेशनल ज्योमेट्री में डुअलिटी ट्रांसफॉर्मेशन बिंदुओं को रेखाओं में और रेखाओं को बिंदुओं में मैप करता है। यह व्यवस्था समस्याओं, वोरोनोई डायग्राम्स और कन्वेक्स हल एल्गोरिदम में उपयोगी है। मानक डुअलिटी: बिंदु (a,b) → रेखा y = ax - b; रेखा y = cx + d → बिंदु (c, -d)। यह घटनाओं और ऊपर/नीचे संबंधों को संरक्षित करता है।