Skip to content
Snippets Groups Projects
Commit dda491ef authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent 0e49772a
No related branches found
No related tags found
No related merge requests found
// $Id: GEdge.cpp,v 1.33 2008-01-20 10:10:41 geuzaine Exp $ // $Id: GEdge.cpp,v 1.34 2008-01-21 22:16:04 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -73,7 +73,7 @@ SBoundingBox3d GEdge::bounds() const ...@@ -73,7 +73,7 @@ SBoundingBox3d GEdge::bounds() const
if(geomType() != DiscreteCurve && geomType() != BoundaryLayerCurve){ if(geomType() != DiscreteCurve && geomType() != BoundaryLayerCurve){
const int N = 10; const int N = 10;
for(int i = 0; i < N; i++){ for(int i = 0; i < N; i++){
double t = tr.low() + (double)i/(double)(N - 1) * (tr.high() - tr.low()); double t = tr.low() + (double)i / (double)(N - 1) * (tr.high() - tr.low());
GPoint p = point(t); GPoint p = point(t);
bbox += SPoint3(p.x(), p.y(), p.z()); bbox += SPoint3(p.x(), p.y(), p.z());
} }
...@@ -139,8 +139,8 @@ double GEdge::curvature(double par) const ...@@ -139,8 +139,8 @@ double GEdge::curvature(double par) const
double eps2 = 1.e-5; double eps2 = 1.e-5;
Range<double> r = parBounds(0); Range<double> r = parBounds(0);
if (r.low() == par) eps2 = 0; if(r.low() == par) eps2 = 0;
if (r.high() == par) eps1 = 0; if(r.high() == par) eps1 = 0;
SVector3 n1 = firstDer(par - eps1); SVector3 n1 = firstDer(par - eps1);
SVector3 n2 = firstDer(par + eps2); SVector3 n2 = firstDer(par + eps2);
...@@ -158,4 +158,3 @@ double GEdge::curvature(double par) const ...@@ -158,4 +158,3 @@ double GEdge::curvature(double par) const
SVector3 d = one_over_D * (n2 - n1); SVector3 d = one_over_D * (n2 - n1);
return norm(d); return norm(d);
} }
// $Id: GFace.cpp,v 1.40 2008-01-19 22:06:01 geuzaine Exp $ // $Id: GFace.cpp,v 1.41 2008-01-21 22:16:04 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -276,7 +276,7 @@ void GFace::computeMeanPlane(const std::vector<SPoint3> &points) ...@@ -276,7 +276,7 @@ void GFace::computeMeanPlane(const std::vector<SPoint3> &points)
double ex[3], t1[3], t2[3]; double ex[3], t1[3], t2[3];
// check coherence of results for non-plane surfaces // check coherence of results for non-plane surfaces
if(geomType() != GEntity::Plane && geomType() != GEntity::DiscreteSurface) { if(geomType() != Plane && geomType() != DiscreteSurface) {
double res2[3], c[3], cosc, sinc, angplan; double res2[3], c[3], cosc, sinc, angplan;
double eps = 1.e-3; double eps = 1.e-3;
...@@ -362,7 +362,7 @@ end: ...@@ -362,7 +362,7 @@ end:
meanPlane.x, meanPlane.y, meanPlane.z); meanPlane.x, meanPlane.y, meanPlane.z);
//check coherence for plane surfaces //check coherence for plane surfaces
if(geomType() == GEntity::Plane) { if(geomType() == Plane) {
SBoundingBox3d bb = bounds(); SBoundingBox3d bb = bounds();
double lc = norm(SVector3(bb.max(), bb.min())); double lc = norm(SVector3(bb.max(), bb.min()));
std::list<GVertex*> verts = vertices(); std::list<GVertex*> verts = vertices();
...@@ -405,7 +405,7 @@ void GFace::getMeanPlaneData(double plan[3][3]) const ...@@ -405,7 +405,7 @@ void GFace::getMeanPlaneData(double plan[3][3]) const
double GFace::curvature (const SPoint2 &param) const double GFace::curvature (const SPoint2 &param) const
{ {
if (geomType() == Plane)return 0; if (geomType() == Plane) return 0;
// X=X(u,v) Y=Y(u,v) Z=Z(u,v) // X=X(u,v) Y=Y(u,v) Z=Z(u,v)
// curv = div n = dnx/dx + dny/dy + dnz/dz // curv = div n = dnx/dx + dny/dy + dnz/dz
...@@ -413,30 +413,30 @@ double GFace::curvature (const SPoint2 &param) const ...@@ -413,30 +413,30 @@ double GFace::curvature (const SPoint2 &param) const
const double eps = 1.e-3; const double eps = 1.e-3;
Pair<SVector3,SVector3> der = firstDer(param) ; Pair<SVector3,SVector3> der = firstDer(param);
SVector3 du = der.first(); SVector3 du = der.first();
SVector3 dv = der.second(); SVector3 dv = der.second();
SVector3 nml = crossprod(du,dv); SVector3 nml = crossprod(du, dv);
double detJ = norm ( nml ); double detJ = norm(nml);
du.normalize(); du.normalize();
dv.normalize(); dv.normalize();
SVector3 n1 = normal(SPoint2(param.x() - eps , param.y() )) ; SVector3 n1 = normal(SPoint2(param.x() - eps, param.y()));
SVector3 n2 = normal(SPoint2(param.x() + eps , param.y() )) ; SVector3 n2 = normal(SPoint2(param.x() + eps, param.y()));
SVector3 n3 = normal(SPoint2(param.x() , param.y() - eps )) ; SVector3 n3 = normal(SPoint2(param.x(), param.y() - eps));
SVector3 n4 = normal(SPoint2(param.x() , param.y() + eps )) ; SVector3 n4 = normal(SPoint2(param.x(), param.y() + eps));
SVector3 dndu = 500 * ( n2-n1 ); SVector3 dndu = 500 * (n2 - n1);
SVector3 dndv = 500 * ( n4-n3 ); SVector3 dndv = 500 * (n4 - n3);
double c = fabs(dot(dndu,du) + dot(dndv,dv)) / detJ; double c = fabs(dot(dndu, du) + dot(dndv, dv)) / detJ;
// Msg (INFO,"c = %g detJ %g",c,detJ); // Msg(INFO, "c = %g detJ %g", c, detJ);
return c; return c;
} }
void GFace::XYZtoUV(const double X, const double Y, const double Z, void GFace::XYZtoUV(const double X, const double Y, const double Z,
...@@ -483,12 +483,6 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z, ...@@ -483,12 +483,6 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
mat[1][0] = der.right().x(); mat[1][0] = der.right().x();
mat[1][1] = der.right().y(); mat[1][1] = der.right().y();
mat[1][2] = der.right().z(); mat[1][2] = der.right().z();
// printf("X = %g Y = %g Z = %g U %g V %g deru = %g %g %g derv = %g %g %g\n",P.x(),P.y(),P.z(),U,V
// ,der.left().x(),der.left().y(),der.left().z()
// ,der.right().x(),der.right().y(),der.right().z());
// getchar();
mat[2][0] = 0.; mat[2][0] = 0.;
mat[2][1] = 0.; mat[2][1] = 0.;
mat[2][2] = 0.; mat[2][2] = 0.;
...@@ -527,13 +521,10 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z, ...@@ -527,13 +521,10 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
} }
} }
SPoint2 GFace::parFromPoint(const SPoint3 &p) const SPoint2 GFace::parFromPoint(const SPoint3 &p) const
{ {
double U,V; double U,V;
XYZtoUV(p.x(),p.y(),p.z(),U,V,1.0); XYZtoUV(p.x(),p.y(),p.z(),U,V,1.0);
return SPoint2(U,V); return SPoint2(U,V);
} }
...@@ -563,5 +554,4 @@ void GFace::computeGraphicsRep(int nu, int nv) ...@@ -563,5 +554,4 @@ void GFace::computeGraphicsRep(int nu, int nv)
_graphicsRep[i][j] = gp; _graphicsRep[i][j] = gp;
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment