Skip to content
Snippets Groups Projects
Commit dc5e1db7 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent 5002dd66
Branches
Tags
No related merge requests found
// $Id: gmshEdge.cpp,v 1.33 2007-03-13 16:11:43 remacle Exp $ // $Id: gmshEdge.cpp,v 1.34 2007-05-14 10:34:55 remacle Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -144,6 +144,7 @@ SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const ...@@ -144,6 +144,7 @@ SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const
{ {
Surface *s = (Surface*) face->getNativePtr(); Surface *s = (Surface*) face->getNativePtr();
bool periodic = (c->end == c->beg);
if(s->geometry){ if(s->geometry){
switch (c->Typ) { switch (c->Typ) {
case MSH_SEGM_LINE: case MSH_SEGM_LINE:
...@@ -161,28 +162,21 @@ SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const ...@@ -161,28 +162,21 @@ SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const
int NbControlPoints, NbCurves, iCurve; int NbControlPoints, NbCurves, iCurve;
double t, t1, t2; double t, t1, t2;
Vertex *v[4]; Vertex *v[4];
NbControlPoints = List_Nbr(c->Control_Points); NbControlPoints = List_Nbr(c->Control_Points);
NbCurves = NbControlPoints - (c->beg==c->end ? 1 : 3); NbCurves = NbControlPoints + (periodic ? -1 : 1);
iCurve = (int)floor(epar * (double)NbCurves);
iCurve = (int)(epar * (double)NbCurves) + 1; if(iCurve >= NbCurves)
iCurve = NbCurves-1;
if(iCurve > NbCurves) else if (iCurve < 0) // ? does it happen ?
iCurve = NbCurves; iCurve = 0;
else if (iCurve < 1)
iCurve = 1;
t1 = (double)(iCurve - 1) / (double)(NbCurves);
t2 = (double)(iCurve) / (double)(NbCurves);
t1 = (double)(iCurve) / (double)(NbCurves);
t2 = (double)(iCurve+1) / (double)(NbCurves);
t = (epar - t1) / (t2 - t1); t = (epar - t1) / (t2 - t1);
for(int j = 0; j < 4; j ++ ){ for(int j = 0; j < 4; j ++ ){
int k=iCurve - (c->beg==c->end ? 2 : 1) + j; int k=iCurve - (periodic ? 1 : 2) + j;
if(k<0) if(k < 0) k = periodic ? k + NbControlPoints - 1 : 0;
k += NbControlPoints - 1; if(k >= NbControlPoints) k = periodic ? k - NbControlPoints + 1: NbControlPoints - 1;
if(k>=NbControlPoints)
k -= NbControlPoints - 1;
List_Read(c->Control_Points,k, &v[j]); List_Read(c->Control_Points,k, &v[j]);
} }
return InterpolateCubicSpline(v, t, c->mat, 0, t1, t2,c->geometry); return InterpolateCubicSpline(v, t, c->mat, 0, t1, t2,c->geometry);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment