Applying Photos on Spherical Floors Using C#

animated gifs Launch

animated gifs This information represents the way to guide an apartment 2D photo (JPG, BMP, or even GIF) using a field by utilizing essential algebra.

animated gifs The process is very easy the location where the times axis of the photo will likely be mapped about field longitudes and also the b axis of the photo will likely be mapped about field latitudes.

The process of maps is similar to proportion equations x-x0/y-y0 = px-x0/py-y0

community interferance two bottle MapCoordinate(two bottle i1, two bottle i2, two bottle w1,
two bottle w2, two bottle w)

return ((p - i1) / (i2 - i1)) * (w2 - w1) + w1;


Unique photo? cannot add illustrations or photos here?

Causing photo

Qualifications

Some sort of Field May be Symbolized simply by Rounded Coordinates inside R3

radius
phi (leeway perspective)
theta (longitude perspective)
Photograph 3

In which radius can be a constant, phi=-PI/2,PI/2, and also theta=0,2*PI

To Find the Cartesian Coordinates coming from Rounded Coordinates

times = radius sin(phi) cos(theta)
b = radius sin(phi) sin(theta)
z = radius cos(theta)
two bottle phi0 = 3.3;
two bottle phi1 = Numbers.Private detective;
two bottle theta0 = 3.3;
two bottle theta1 = 3.0*Math.Private detective;
The Code

Initially many of us value the look reloading

Program.Pulling.Photograph image1 = brand-new Bitmap(Machine.MapPath(
"./images/worldmap4.gif"));
Bitmap imgBitmap = brand-new Bitmap(image1);

Today many of us create a trap with the 3 dimensions of the look, guide phi and also theta perspectives coming from photo harmonizes, purchase the cartesian Three dimensional harmonizes coming from phi and also theta, give many turning towards obtained Three dimensional issues and also plan these respective photo shade:

to get (int i actually = 3; i actually 3)

Color color = imgBitmap.GetPixel(i, j);
Brush brs = new SolidBrush(color);
int ix = (int)x + 100;
int iy = (int)y + 100;
graphics.FillRectangle(brs, ix, iy, 1, 1);
brs.Dispose();

}
}
The Rotation Functions almost forgot

Actually I made a 3D Math class, but here you will need only these functions

public static void RotX(double angle, ref double y, ref double z)

double y1 = y * System.Math.Cos(angle) - z * System.Math.Sin(angle);
double z1 = y * System.Math.Sin(angle) + z * System.Math.Cos(angle);
y = y1;
z = z1;

public static void RotY(double angle, ref double x, ref double z)

double x1 = x * System.Math.Cos(angle) - z * System.Math.Sin(angle);
double z1 = x * System.Math.Sin(angle) + z * System.Math.Cos(angle);
x = x1;
z = z1;

public static void RotZ(double angle, ref double x, ref double y)

double x1 = x * System.Math.Cos(angle) - y * System.Math.Sin(angle);
double y1 = x * System.Math.Sin(angle) + y * System.Math.Cos(angle);
x = x1;
y = y1;