Hello,
a surface has a parametrization
x = x(u,v)
y = y(u,v)
z = z(u,v)
The position of P on the surface S is
(P-O) = x e_i + y e_y + k e_z
in which e_i, e_j, e_k are the direction vectors in (O,x,y,z).
The first fundamental form describing the metric of S is the square maxtrix
E F
F G
in which
E = d(P-O)/du × d(P-O)/du
F = d(P-O)/du × d(P-O)/dv
G = d(P-O)/dv × d(P-O)/dv
Nothing new.
For a sphere of radius R
x = R cos u cos v
y = R cos u sin v
z = R sin v
so the first fundamental form is
E = R^2
F = 0
G = R^2 sin^2 u
if R = 100, the first fundamental form is
10000 0
0 10000 sin^2 (u)
and depends on u. Again nothing new.
The following simple functions should return the matrix as result, as a function of the input point (u,v) in the parametric space of the input surface
void metricTensor(double u, double v, occHandle(Geom_Surface) surf, double* mt)
{
gp_Pnt P3d;
gp_Vec d1u, d1v;
surf->D1(u,v,P3d,d1u,d1v);
mt[0] = d1u.Dot(d1u);
mt[1] = d1u.Dot(d1v);
mt[2] = d1v.Dot(d1u);
mt[3] = d1v.Dot(d1v);
std::cout<<"******* metric tensor ***********"<<std::endl;
std::cout<<" | "<<mt[0]<<"\t "<<mt[1]<<" |"<<std::endl;
std::cout<<" | "<<mt[2]<<"\t "<<mt[3]<<" |"<<std::endl;
std::cout<<"*********************************"<<std::endl;
}
If I use as input a spherical surface of radius R = 100 (see the attached picture), for a bunch of points P_j, with a certain (u_P_j, v_P_j) the function prints:
******* metric tensor ***********
| 380.602 0 |
| 0 10000 |
*********************************
******* metric tensor ***********
| 842.652 0 |
| 0 10000 |
*********************************
******* metric tensor ***********
| 693.059 0 |
| 0 10000 |
*********************************
******* metric tensor ***********
| 8535.53 1.00974e-28 |
| 1.00974e-28 10000 |
*********************************
The output matrix is transposed. What's wrong?
Thank you very much
Author