Commit a93df634 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

bug in curved surfaces of ug_lens fixed, now resembles a sphere. next step is...

bug in curved surfaces of ug_lens fixed, now resembles a sphere. next step is fixing the inner transfomrations.
parent 6728d5a6
......@@ -58,6 +58,7 @@ D3vector transform_right_lens_diag_NW_quad ( double t1, double t2, double* point
double r_global_data = pointer_global_data[1];
double curvatureLeft_global_data = pointer_global_data[2];
double curvatureRight_global_data = pointer_global_data[3];
double thickness_global_data = pointer_global_data[4];
double offsetZ_global_data = pointer_global_data[5];
double z_left_inner_global_data = pointer_global_data[6];
double z_left_outer_global_data = pointer_global_data[7];
......@@ -68,37 +69,30 @@ D3vector transform_right_lens_diag_NW_quad ( double t1, double t2, double* point
t2 = temp;
double t = t2;
// t2 = (1-t2);
double x = -( sin ( t1*0.5*M_PI )-t1);
double x = -R_global_data*( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = R_global_data*(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
//double z = 0;
//x = y = 0;
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
actualX = -actualX;
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double z = offsetZ_global_data+
sign*(-1*( sqrt(pow(curvatureRight_global_data,2)-
((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY)) ) // pow(r_global_data * (1-t) + R_global_data * t,2)) //now direct with x²+y²
+sign *(-curvatureRight_global_data
+( (1-t)*z_left_inner_global_data //z_inner doesn't work anymore
+ t * z_left_outer_global_data))));
sign*( ( sqrt(pow(curvatureRight_global_data,2)-
radiusSquared)
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
z = -z;
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
if (std::isnan(z))
{
if ( fabs(x) > 1e-10 || fabs(y) > 1e-10 || fabs(z) > 1e-10)
{
cout << "stop "<<endl;
}
z = 0;
}
return D3vector(R_global_data*x, R_global_data*y, z);
return R_global_data*D3vector ( x,y,z);
return D3vector ( x,y,z);
}
......@@ -268,13 +262,10 @@ D3vector transform_right_lens_diag_SW_quad ( double t1, double t2, double* point
t1 = t2;
t2 = temp;
double t = t2;
// t2 = (1-t2);
double x = -( sin ( t1*0.5*M_PI )-t1);
double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = -(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
//double z = 0;
//x = y = 0;
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
actualY = -actualY;
......@@ -286,17 +277,10 @@ D3vector transform_right_lens_diag_SW_quad ( double t1, double t2, double* point
((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY)))
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
if ( fabs(x) > 1e-10 || fabs(y) > 1e-10 || fabs(z) > 1e-10)
{
cout << "stop "<<endl;
}
}
return D3vector(R_global_data*x, R_global_data*y, z);
return R_global_data*D3vector ( x,y,z);
if (std::isnan(z))
{ z = 0; }
return D3vector ( x,y,z);
}
......@@ -346,13 +330,10 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point
t1 = t2;
t2 = temp;
double t = t2;
// t2 = (1-t2);
double x = ( sin ( t1*0.5*M_PI )-t1);
double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = -(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
//double z = 0;
//x = y = 0;
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
......@@ -365,17 +346,10 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
if (std::isnan(z))
{
if ( fabs(x) > 1e-10 || fabs(y) > 1e-10 || fabs(z) > 1e-10)
{
cout << "stop "<<endl;
}
}
return D3vector(R_global_data*x, R_global_data*y, z);
return R_global_data*D3vector ( x,y,z);
z = 0;}
return D3vector ( x,y,z);
}
......@@ -416,17 +390,23 @@ D3vector transform_diag_inner_faces_NE_quad( double t1, double t2, double* point
double t = t2;
//HERE
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double radiusSquared = r_global_data + (R_global_data-r_global_data)* (t1);
double radiusSquared = r_global_data + (R_global_data-r_global_data)* (t2);
radiusSquared = radiusSquared * radiusSquared;
//WORKONLYHERE
double z = offsetZ_global_data+
sign*( ( sqrt(pow(curvatureRight_global_data,2)-
( radiusSquared))
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
z = 0;
z=0;
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
if ( fabs(z) > 1e-10)
......@@ -463,13 +443,18 @@ D3vector transform_inner_faces_NE_quad( double t1, double t2, double* pointer_gl
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double radiusSquared = r_global_data* (t1-1)*r_global_data* (t1-1)+r_global_data* (t1)*r_global_data* (t1);
double x = r_global_data* (t1-1);
double y = r_global_data* (t1);
double radiusSquared = x*x+y*y;
double z = offsetZ_global_data
+sign*(( sqrt(pow(curvatureRight_global_data,2)- radiusSquared) //pow(r_global_data,2) * (t*t + (1-t)*(1-t)))
+sign*(- curvatureRight_global_data + (thickness_global_data-z_right_inner_global_data)) ));
// z = 0;
//works for one side only:
z = z * (t2);
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
if ( fabs(z) > 1e-10)
......@@ -497,35 +482,27 @@ D3vector transform_right_lens_diag_NE_quad ( double t1, double t2, double* point
t2 = temp;
double t = t2;
double x = ( sin ( t1*0.5*M_PI )-t1);
double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = R_global_data * (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
double z = offsetZ_global_data+
sign*( ( sqrt(pow(curvatureRight_global_data,2)-
((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY)))
radiusSquared)
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
if ( fabs(z) > 1e-10)
{
cout << "stop "<<endl;
}
}
return D3vector ( R_global_data*x ,
R_global_data*y ,
z);
return R_global_data*D3vector ( x,y,z);
if (std::isnan(x) || std::isnan(y) || std::isnan(z))
{ z = 0;}
return D3vector ( x,y,z);
}
......@@ -1011,7 +988,7 @@ LensQuadrangle::LensQuadrangle(double Radius, double radius, double thickness, d
//inner block: corner ids: 0 2 4 6 8 10 12 14
Set_transformation_face(0,2,4,6,transform_left_lens_inner_quad); // z=0 plane
Set_transformation_face(0,2,4,6,transform_quadrangle_NULL); // z=0 plane transform_left_lens_inner_quad
Set_transformation_face(0,2,8,10,transform_inner_faces_NE_quad); //transform_inner_quad_NE transform_inner_quad_NW transform_inner_quad_SW transform_inner_quad_SE
Set_transformation_face(2,4,10,12,transform_inner_faces_NE_quad); //??
Set_transformation_face(4,6,12,14,transform_inner_faces_NE_quad); //??
......@@ -1022,24 +999,24 @@ LensQuadrangle::LensQuadrangle(double Radius, double radius, double thickness, d
Set_transformation_face(0,1,2,3,transform_left_lens_diag_NE_quad);
Set_transformation_face(0,1,8,9,transform_diag_inner_faces_NE_quad);
Set_transformation_face(0,2,8,10,transform_inner_faces_NE_quad);
Set_transformation_face(2,3,10,11,transform_quadrangle_NULL);
Set_transformation_face(2,3,10,11,transform_diag_inner_faces_NE_quad);
Set_transformation_face(1,3,9,11,transform_outer_boundary_NE); // transform_boundary_NE
Set_transformation_face(8,9,10,11,transform_right_lens_diag_NE_quad);
//north-west block: corner ids: 2 3 4 5 10 11 12 13
Set_transformation_face(2,3,4,5,transform_left_lens_diag_NW_quad);//
Set_transformation_face(2,3,10,11,transform_quadrangle_NULL);
Set_transformation_face(2,3,10,11,transform_diag_inner_faces_NE_quad);
Set_transformation_face(2,4,10,12,transform_inner_faces_NE_quad);
Set_transformation_face(4,5,12,13,transform_quadrangle_NULL);
Set_transformation_face(4,5,12,13,transform_diag_inner_faces_NE_quad);
Set_transformation_face(3,5,11,13,transform_outer_boundary_NW); // transform_boundary_NW
Set_transformation_face(10,11,12,13,transform_right_lens_diag_NW_quad); //
//bottom-west block: corner ids: 4 5 6 7 12 13 14 15
//eher: S-W-BLOCK
Set_transformation_face(4,5,6,7,transform_left_lens_diag_SW_quad);
Set_transformation_face(4,5,12,13,transform_quadrangle_NULL);
Set_transformation_face(4,5,12,13,transform_diag_inner_faces_NE_quad);
Set_transformation_face(4,6,12,14,transform_inner_faces_NE_quad);
Set_transformation_face(6,7,14,15,transform_quadrangle_NULL);
Set_transformation_face(6,7,14,15,transform_diag_inner_faces_NE_quad);
Set_transformation_face(5,7,13,15,transform_outer_boundary_SW); //
Set_transformation_face(12,13,14,15,transform_right_lens_diag_SW_quad);
......@@ -1048,7 +1025,7 @@ LensQuadrangle::LensQuadrangle(double Radius, double radius, double thickness, d
Set_transformation_face(0,1,6,7,transform_left_lens_diag_SE_quad);
Set_transformation_face(0,1,8,9,transform_diag_inner_faces_NE_quad);
Set_transformation_face(0,6,8,14,transform_inner_faces_NE_quad);
Set_transformation_face(6,7,14,15,transform_quadrangle_NULL);
Set_transformation_face(6,7,14,15,transform_diag_inner_faces_NE_quad);
Set_transformation_face(1,7,9,15,transform_outer_boundary_SE);
Set_transformation_face(8,9,14,15,transform_right_lens_diag_SE_quad);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment