diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index a7919490d4e965e7c346f83991c5f1501f0be78f..a3d30ce7a88fd4261119b20ea05ba9ad184aadac 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -7,7 +7,10 @@ extern GModel *GMODEL; void mesh_parameterize_cb(Fl_Widget* w, void* data) { + parabolicCylinder *p = new parabolicCylinder(GMODEL,10000); - Msg(GERROR, "Reparameterize not implemented yet: %d faces", GMODEL->numFace()); + GMODEL->add( p ); + Msg(GERROR, "Model added: %d faces", GMODEL->numFace()); + } diff --git a/Geo/projectionFace.cpp b/Geo/projectionFace.cpp index 851b61936892a54d58381b897a9322e335e9311b..5701d1840500cb4271a183d37bc7fcbac7876d6a 100644 --- a/Geo/projectionFace.cpp +++ b/Geo/projectionFace.cpp @@ -53,15 +53,36 @@ void projectionFace::scale(SVector3 sc) scaleFactor[2] *= sc[2]; } +projectionFace::projectionFace(GModel *m,int num) : GFace(m,num) +{ + for(int j = 0; j<3; j++) + { + translation[j] = 0; + rotation[j] = 0; + } +} +projectionFace::~projectionFace() +{ +} - -/* -parabolicCylinder::parabolicCylinder(GModel *m, Surface *face) : projectionFace(m, face->Num), s(face) +parabolicCylinder::parabolicCylinder(GModel *m, int num) : projectionFace(m,num) { + focalPoint = 1; + + scaleFactor[0] = 1; + scaleFactor[1] = 1; + scaleFactor[2] = 1; +// translation +// scaleFactor = new SVector3(1,1,1); +// rotation = new SVector3(0,0,0); } -*/ + + +parabolicCylinder::~parabolicCylinder() +{ +} GPoint parabolicCylinder::point(double par1, double par2) const { @@ -80,10 +101,10 @@ GPoint parabolicCylinder::point(double par1, double par2) const p = rotatePoint(p,rotation); p = translation + p; - //ok...how so you convert an SVector3 to a GPoint...? - GPoint gp; + GPoint gp(p[0],p[1],p[2]); return gp; } + GPoint parabolicCylinder::point(const SPoint2 &pt) const { double par1 = pt[0]; @@ -108,6 +129,10 @@ SPoint2 parabolicCylinder::parFromPoint(const SPoint3 &p) const pos = scalePoint(pos, scalar); //since the y co-ordinate is completely dependent on u, I actually don't need it to compute the u-v point? + double u = pos[0] + .5; + double v = pos[1] + .5; + + SPoint2 q(pos[0],pos[1]); return q; } @@ -121,7 +146,7 @@ Pair<SVector3,SVector3> parabolicCylinder::firstDer(const SPoint2 ¶m) const SVector3 dv; du[0] = 1; - du[1] = -(1/(2*focalPoint))*param[0]; + du[1] = -(1/(2*focalPoint))*(param[0]-.5); du[2] = 0; dv[0] = 0; @@ -153,3 +178,34 @@ SVector3 parabolicCylinder::normal(const SPoint2 ¶m) const n.normalize(); return n; } + +/* + COPIED DIRECTLY FROM GMODELIO_FOURIER.CPP +*/ + + +Range<double> parabolicCylinder::parBounds(int i) const +{ + return Range<double>(0, 1); +} + +/* +GPoint parabolicCylinder::closestPoint(const SPoint3 & queryPoint) const +{ + throw; +} +int parabolicCylinder::containsPoint(const SPoint3 &pt) const +{ + throw; +} +int parabolicCylinder::containsParam(const SPoint2 &pt) const +{ + return 1; +} +GEntity::GeomType parabolicCylinder::geomType() const +{ + return GEntity::DiscreteSurface; +} +*/ + + diff --git a/Geo/projectionFace.h b/Geo/projectionFace.h index b4384829492e1a37aeec0675095549d8fed9e4ce..77b4c69d057477a781a40ec417a5bbbe34f3078e 100644 --- a/Geo/projectionFace.h +++ b/Geo/projectionFace.h @@ -1,3 +1,6 @@ +#ifndef _PROJECTION_FACE_H_ +#define _PROJECTION_FACE_H_ + #include "GFace.h" /* @@ -18,61 +21,51 @@ class projectionFace : public GFace protected: //Surface *s; //what is this? - SVector3 rotation; //this vector holds the euler angles at which the surface is rotated + SVector3 rotation; //this vector holds the euler angles at which the surface is rotated SVector3 translation; //this vector holds the location of the reference point in xyz space SVector3 scaleFactor; //this vector holds the scaling factors w.r.t x,y,z public: -/*fourierFace::fourierFace(GModel *m, int num) - : GFace(m, num) -{ - for(int i = 0; i < 4; i++){ _v[i] = 0; _e[i] = 0; } - _discrete = 1; -}*/ - projectionFace(GModel *m,int num) : GFace(m,num) - { - } - ~projectionFace( ); + projectionFace(GModel *m, int num); + + ~projectionFace(); void rotate(SVector3 rot); //rotates the surface by the euler angles rot void translate(SVector3 trans); //translates the surface by trans void scale(SVector3 sc); //scales the surface along the (local?) x,y,z axes by sc -/* -This is all from gmshFace.h...I'm not sure whether or not I should be subclassing gmshFace or GFace right now. let's not screw around until I figure that out... -*/ - virtual GPoint point(double par1, double par2) const = 0; - virtual GPoint point(const SPoint2 &pt) const = 0; - - virtual SVector3 normal(const SPoint2 ¶m) const; - virtual Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; + + Range<double> parBounds(int i) const {throw;} + virtual int paramDegeneracies(int dir, double *par) { return 0; } + + virtual GPoint point(double par1, double par2) const {throw;} + virtual GPoint point(const SPoint2 &pt) const {throw;} + virtual GPoint closestPoint(const SPoint3 & queryPoint) const {throw;} + + virtual int containsPoint(const SPoint3 &pt) const {throw;} + virtual int containsParam(const SPoint2 &pt) const {throw;} + + virtual SVector3 normal(const SPoint2 ¶m) const {throw;} + virtual Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const {throw;} virtual double * nthDerivative(const SPoint2 ¶m, int n, - double *array) const {throw;} - - virtual GEntity::GeomType geomType() const; - + double *array) const {throw;} + + virtual GEntity::GeomType geomType() const {throw;} virtual int geomDirection() const { return 1; } virtual bool continuous(int dim) const { return true; } virtual bool periodic(int dim) const { return false; } virtual bool degenerate(int dim) const { return false; } virtual double period(int dir) const {throw;} - - void * getNativePtr() const { return 0; } - + ModelType getNativeType() const { return UnknownModel; } + void * getNativePtr() const {throw;} virtual bool surfPeriodic(int dim) const {throw;} - - virtual SPoint2 parFromPoint(const SPoint3 &) const; - - int dim() const {return 2;} - -// virtual void setVisibility(char val, bool recursive=false); //i think we need this - + virtual SPoint2 parFromPoint(const SPoint3 &) const {throw;} }; -class parabolicCylinder : protected projectionFace +class parabolicCylinder : public projectionFace { protected: double focalPoint; //the length from the vertex to the focal point @@ -81,22 +74,34 @@ class parabolicCylinder : protected projectionFace // double length; //the length of the parabola - just scaling factors // double height; //the height of the cylinder - just scaling factors public: - parabolicCylinder(GModel *m, int num) : projectionFace(m,num) - { - } - - ~parabolicCylinder(); + parabolicCylinder(GModel *m, int num); - GPoint point(double par1, double par2) const; //partially implemented - GPoint point(const SPoint2 &pt) const; //partially implemented - - SVector3 normal(const SPoint2 ¶m) const; //implemented (contingent on gradient) - Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; //partially implemented contingent on function requirements - + ~parabolicCylinder(); -// GEntity::GeomType geomType() const; //I have no idea what this is. + Range<double> parBounds(int i) const; + + GPoint point(double par1, double par2) const; + GPoint point(const SPoint2 &pt) const; +// virtual GPoint closestPoint(const SPoint3 & queryPoint) const; + + SVector3 normal(const SPoint2 ¶m) const; + Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; + //virtual double * nthDerivative(const SPoint2 ¶m, int n, + // double *array) const {throw;} + - SPoint2 parFromPoint(const SPoint3 &p) const; //what is that syntax? +// virtual int geomDirection() const { return 1; } + +// virtual bool continuous(int dim) const { return true; } +// virtual bool periodic(int dim) const { return false; } +// virtual bool degenerate(int dim) const { return false; } +// virtual double period(int dir) const {throw;} +// ModelType getNativeType() const { return UnknownModel; } +// void * getNativePtr() const {throw;} +// virtual bool surfPeriodic(int dim) const {throw;} + + SPoint2 parFromPoint(const SPoint3 &) const; }; +#endif