The above seems to work. I am able to project the test pattern used in
the attached image onto the sphere and I believe it's correct, but it
may not be.
I suppose a calculation of surface area on each
projected quad onto the sphere.
What's the formula for computing the
area of a general 4-point polygon on a sphere?
void iUnprojectVert(SVert* v,
double rho, double theta, double radius)
{
double t1, t2, x, y, z;
// Compute thetas
t1 = atan2(v->z, v->y);
t2 = atan2(v->x, v->y);
// Un-project
v->x = radius * t2 * cos(t1);
v->y = radius;
v->z = radius * t1 * cos(t2);
}
x = t1 * radius;
z = t2 * radius;
Am 12.11.2020 um 02:20 schrieb Rick C. Hodgin:
void iUnprojectVert(SVert* v,
double rho, double theta, double radius)
{
double t1, t2, x, y, z;
// Compute thetas
t1 = atan2(v->z, v->y);
t2 = atan2(v->x, v->y);
// Un-project
v->x = radius * t2 * cos(t1);
v->y = radius;
v->z = radius * t1 * cos(t2);
}
If you want to revert your original projection, why don't you do just
that, step by step?
t3 = atan2(v->x, v->z); // recover t3 from rotation around Y
rho = sqrt(v->x*v->x + v->z*v->z); // projected radius
t2 = atan2(rho,v->y) // recover t3 from rotation around z
t1 = t3 * cos(t2);
v->x = t1 * radius;
v->z = t2 * radius;
Am 12.11.2020 um 02:20 schrieb Rick C. Hodgin:
The above seems to work. I am able to project the test pattern used
in the attached image onto the sphere and I believe it's correct,
but it may not be.
To be able to tell, you would have to have a separate way of
expressing what it is you're trying to achieve. "It should look look
like ..." doesn't exactly qualify for that.
I suppose a calculation of surface area on each projected quad onto
the sphere.
That might qualify as a criterion if the unstated goal you set out to
achieve was an area-preserving projection. But be warned that goal is impossible for non-infinitesimal quadrangles. That's one way of
saying that wall-papering a sphere is simply not possible if you want
to avoid all wrinkles and tears.
What's the formula for computing the area of a general 4-point
polygon on a sphere?
I suspect there isn't one. There is one for triangles, but IIRC that
only works if they don't include either pole. Quadrangles have to be
split into triangles, but the decision how to do that correctly in the general case is ... complicated.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 292 |
Nodes: | 16 (2 / 14) |
Uptime: | 203:09:47 |
Calls: | 6,617 |
Calls today: | 1 |
Files: | 12,168 |
Messages: | 5,316,452 |