Commit 09c102a7 by Luis Penaranda

added perspective visualization

1 parent d2c03e50
......@@ -425,7 +425,7 @@ void OpenGLCanvas::vertex_transformation(float *positions, int m, int n, float c
lambda=atan2f(x,-z)/CONST_PI_F;
phi=asinf(y)/CONST_PI_2_F;
if (visualization=="Moebius"){
if (visualization=="Moebius" || visualization=="Perspective"){
u = x/(-z);
v = y/(-z);
positions[3*(j+i*n)] = u/extent;
......@@ -535,7 +535,7 @@ float OpenGLCanvas::calculate_extent(float fov_rads){
x=(4.f*u)/(u*u+v*v+4.f);
y=(4.f*v)/(u*u+v*v+4.f);
z=(u*u+v*v-4.f)/(u*u+v*v+4.f);
if (visualization=="Moebius"){
if (visualization=="Moebius" || visualization=="Perspective"){
u=x/(-z);
v=y/(-z);
}
......@@ -774,7 +774,7 @@ void OpenGLCanvas::paintGL(){
// defining transformation parameters (that will be passed to the vertex shader)
float extent=calculate_extent(fov_rads);
float vis_mode=.0f;
if (visualization=="Moebius") vis_mode=1.f;
if (visualization=="Moebius" || visualization=="Perspective") vis_mode=1.f;
else if (visualization=="3D Sphere") vis_mode=2.f;
else if (visualization=="Equi-Rectangular") vis_mode=3.f;
else if (visualization=="Stereographic") vis_mode=4.f;
......
......@@ -194,22 +194,27 @@
</item>
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
<item>
<property name="text">
<string>Stereographic</string>
</property>
</item>
<item>
<property name="text">
<string>Mercator</string>
<string>Orthographic</string>
</property>
</item>
<item>
<property name="text">
<string>Zorin-Barr</string>
<string>Mercator</string>
</property>
</item>
<item>
<property name="text">
<string>Orthographic</string>
<string>Zorin-Barr</string>
</property>
</item>
</widget>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!