For some damn reason, this is making me thing of the following simple
setup. Very quick, and I must be missing something important, anyway:
My Test Code
________________________
namespace ct_project_test // just for fun
{
void
limit_line(
ct::plot::cairo::plot_2d& plot,
glm::vec2 p0_xy_plane,
glm::vec2 p1_xy_plane,
glm::vec2 p0_x_plane,
glm::vec2 p1_x_plane,
unsigned long n
) {
glm::vec2 dif_xy_plane = p1_xy_plane - p0_xy_plane;
glm::vec2 dif_x_plane = p1_x_plane - p0_x_plane;
float normal_base = 1.f / (n - 1);
plot.line(p0_xy_plane, p1_xy_plane, CT_RGBF(1, 1, 0));
plot.line(p0_x_plane, p1_x_plane, CT_RGBF(1, 0, 0));
for (unsigned long i = 0; i < n; ++i)
{
float normal = normal_base * i;
glm::vec2 p0_xy = p0_xy_plane + dif_xy_plane * normal;
glm::vec2 p0_x = p0_x_plane + dif_x_plane * normal;
plot.circle_filled(p0_xy, .03f, CT_RGBF(1, 0, 0));
plot.circle_filled(p0_x, .03f, CT_RGBF(1, 1, 0));
plot.line(p0_xy, p0_x, CT_RGBF(1, 0, 1));
std::cout << "p0_xy = (" << p0_xy.x << ", " << p0_xy.y <<
") projected to ";
std::cout << "p0_x = (" << p0_x.x << ", " << p0_x.y << ")\n";
}
}
void manifest(ct::plot::cairo::plot_2d& plot)
{
std::cout << "ct_project_test::manifest\n\n";
{
glm::vec2 l0_p0 = { -1, 0 };
glm::vec2 l0_p1 = { -1, 1 };
glm::vec2 l1_p0 = { -1, 0 };
glm::vec2 l1_p1 = { 1, 0 };
unsigned long n = 10;
limit_line(plot, l0_p0, l0_p1, l1_p0, l1_p1, n);
}
}
}
________________________
Its output:
________________________
p0_xy = (-1, 0) projected to p0_x = (-1, 0)
p0_xy = (-1, 0.111111) projected to p0_x = (-0.777778, 0)
p0_xy = (-1, 0.222222) projected to p0_x = (-0.555556, 0)
p0_xy = (-1, 0.333333) projected to p0_x = (-0.333333, 0)
p0_xy = (-1, 0.444444) projected to p0_x = (-0.111111, 0)
p0_xy = (-1, 0.555556) projected to p0_x = (0.111111, 0)
p0_xy = (-1, 0.666667) projected to p0_x = (0.333333, 0)
p0_xy = (-1, 0.777778) projected to p0_x = (0.555556, 0)
p0_xy = (-1, 0.888889) projected to p0_x = (0.777778, 0)
p0_xy = (-1, 1) projected to p0_x = (1, 0)
________________________
A graphic:
https://i.ibb.co/3y5GzRq/ct-test-line.png
The radically simple sequence goes to 1, and is projected onto the unit
real line. Now, I can map more complex sequences using the same
technique. Btw, the circle in white is the unit circle, centered on {0,
0}, radius one.
What am I missing? Thanks.