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

Fix (?) intrpolation of LC for splines et al.

parent 684f661d
No related branches found
No related tags found
No related merge requests found
// $Id: Interpolation.cpp,v 1.11 2001-08-12 20:45:02 geuzaine Exp $ // $Id: Interpolation.cpp,v 1.12 2001-08-17 07:41:58 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Numeric.h" #include "Numeric.h"
...@@ -50,7 +50,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){ ...@@ -50,7 +50,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
List_Read (Curve->Control_Points, i, &v[1]); List_Read (Curve->Control_Points, i, &v[1]);
List_Read (Curve->Control_Points, i + 1, &v[2]); List_Read (Curve->Control_Points, i + 1, &v[2]);
V.lc = t * v[2]->lc + (1. - t) * v[1]->lc; V.lc = t * v[2]->lc + (1. - t) * v[1]->lc; // ?????
V.Pos.X = v[1]->Pos.X + t * (v[2]->Pos.X - v[1]->Pos.X); V.Pos.X = v[1]->Pos.X + t * (v[2]->Pos.X - v[1]->Pos.X);
V.Pos.Y = v[1]->Pos.Y + t * (v[2]->Pos.Y - v[1]->Pos.Y); V.Pos.Y = v[1]->Pos.Y + t * (v[2]->Pos.Y - v[1]->Pos.Y);
V.Pos.Z = v[1]->Pos.Z + t * (v[2]->Pos.Z - v[1]->Pos.Z); V.Pos.Z = v[1]->Pos.Z + t * (v[2]->Pos.Z - v[1]->Pos.Z);
...@@ -61,7 +61,8 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){ ...@@ -61,7 +61,8 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
V.Pos.X = evaluate_scalarfunction ("t", u, Curve->functu); V.Pos.X = evaluate_scalarfunction ("t", u, Curve->functu);
V.Pos.Y = evaluate_scalarfunction ("t", u, Curve->functv); V.Pos.Y = evaluate_scalarfunction ("t", u, Curve->functv);
V.Pos.Z = evaluate_scalarfunction ("t", u, Curve->functw); V.Pos.Z = evaluate_scalarfunction ("t", u, Curve->functw);
V.lc = (u * Curve->beg->lc + (1. - u) * Curve->end->lc);
V.lc = (u * Curve->end->lc + (1. - u) * Curve->beg->lc);// ?????
V.w = (u * Curve->beg->w + (1. - u) * Curve->end->w); V.w = (u * Curve->beg->w + (1. - u) * Curve->end->w);
return V; return V;
...@@ -90,22 +91,17 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){ ...@@ -90,22 +91,17 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
V.Pos.Y += Curve->Circle.v[2]->Pos.Y; V.Pos.Y += Curve->Circle.v[2]->Pos.Y;
V.Pos.Z += Curve->Circle.v[2]->Pos.Z; V.Pos.Z += Curve->Circle.v[2]->Pos.Z;
V.w = (u * Curve->beg->w + (1. - u) * Curve->end->w); V.w = (u * Curve->beg->w + (1. - u) * Curve->end->w);
V.lc = (u * Curve->end->lc + (1. - u) * Curve->beg->lc);// ?????
// ?????
V.lc = (u * Curve->end->lc + (1. - u) * Curve->beg->lc);
return V; return V;
case MSH_SEGM_BSPLN: case MSH_SEGM_BSPLN:
case MSH_SEGM_BEZIER: case MSH_SEGM_BEZIER:
V.lc = (u * Curve->beg->lc + (1. - u) * Curve->end->lc);
return InterpolateUBS (Curve, u, derivee); return InterpolateUBS (Curve, u, derivee);
case MSH_SEGM_NURBS: case MSH_SEGM_NURBS:
V.lc = (u * Curve->beg->lc + (1. - u) * Curve->end->lc);
return InterpolateNurbs (Curve, u, derivee); return InterpolateNurbs (Curve, u, derivee);
case MSH_SEGM_SPLN: case MSH_SEGM_SPLN:
V.lc = (u * Curve->beg->lc + (1. - u) * Curve->end->lc);
N = List_Nbr (Curve->Control_Points); N = List_Nbr (Curve->Control_Points);
/* /*
...@@ -138,7 +134,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){ ...@@ -138,7 +134,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
List_Read (Curve->Control_Points, i, &v[1]); List_Read (Curve->Control_Points, i, &v[1]);
List_Read (Curve->Control_Points, i + 1, &v[2]); List_Read (Curve->Control_Points, i + 1, &v[2]);
V.lc = t * v[1]->lc + (1. - t) * v[2]->lc; V.lc = t * v[2]->lc + (1. - t) * v[1]->lc; //?????
if (!i){ if (!i){
v[0] = &temp1; v[0] = &temp1;
......
// $Id: Nurbs.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $ // $Id: Nurbs.cpp,v 1.6 2001-08-17 07:41:58 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Mesh.h" #include "Mesh.h"
...@@ -10,7 +10,8 @@ Vertex InterpolateCubicSpline (Vertex * v[4], double t, double mat[4][4], ...@@ -10,7 +10,8 @@ Vertex InterpolateCubicSpline (Vertex * v[4], double t, double mat[4][4],
double vec[4], T[4]; double vec[4], T[4];
V.Pos.X = V.Pos.Y = V.Pos.Z = 0.0; V.Pos.X = V.Pos.Y = V.Pos.Z = 0.0;
V.lc = t * v[1]->lc + (1. - t) * v[2]->lc; //V.lc = t * v[1]->lc + (1. - t) * v[2]->lc;
V.lc = (1-t) * v[1]->lc + t * v[2]->lc; // ???????
if (derivee){ if (derivee){
T[3] = 0.; T[3] = 0.;
......
lc = 1e-1 ;
xx = 0;
// Lines
p = newp;
Point(p) = {xx, 0, 0, 0.3*lc} ;
Point(p+1) = {xx+.5, 0, 0, lc} ;
Point(p+2) = {xx+.5, 1, 0, 0.1*lc} ;
Point(p+3) = {xx, 1, 0, lc} ;
l = newreg;
Line(l) = {p+3,p+2};
Line(l+1) = {p+2,p+1};
Line(l+2) = {p+1,p};
Line(l+3) = {p,p+3};
s = newreg;
Line Loop(s) = {-l,-(l+1),-(l+2),-(l+3)};
Plane Surface(s+1) = {s};
xx += 1;
// B-Splines
p = newp;
Point(p) = {xx, 0, 0, 0.3*lc} ;
Point(p+1) = {xx+.5, 0, 0, lc} ;
Point(p+2) = {xx+.5, 1, 0, 0.1*lc} ;
Point(p+3) = {xx, 1, 0, lc} ;
l = newreg;
BSpline(l) = {p+3,p+3,p+3,p+2,p+1,p+1,p,p,p};
BSpline(l+1) = {p,p,p,p+3,p+3,p+3};
s = newreg;
Line Loop(s) = {-l,-(l+1)};
Plane Surface(s+1) = s;
xx += 1;
// Splines (CatmullRom)
p = newp;
Point(p) = {xx, 0, 0, 0.3*lc} ;
Point(p+1) = {xx+.5, 0, 0, lc} ;
Point(p+2) = {xx+.5, 1, 0, 0.1*lc} ;
Point(p+3) = {xx, 1, 0, lc} ;
l = newreg;
Spline(l) = {p+3,p+2,p+1,p};
Spline(l+1) = {p,p+3};
s = newreg;
Line Loop(s) = {-l,-(l+1)};
Plane Surface(s+1) = s;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment