Skip to content
Snippets Groups Projects
Commit d4b12dbc authored by Jacob Bedrossian's avatar Jacob Bedrossian
Browse files

projectionFace and GUI_Projection files

parent 57eccb26
No related branches found
No related tags found
No related merge requests found
......@@ -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());
}
......@@ -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 &param) 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 &param) 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;
}
*/
#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 &param) const;
virtual Pair<SVector3,SVector3> firstDer(const SPoint2 &param) 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 &param) const {throw;}
virtual Pair<SVector3,SVector3> firstDer(const SPoint2 &param) const {throw;}
virtual double * nthDerivative(const SPoint2 &param, 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 &param) const; //implemented (contingent on gradient)
Pair<SVector3,SVector3> firstDer(const SPoint2 &param) 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 &param) const;
Pair<SVector3,SVector3> firstDer(const SPoint2 &param) const;
//virtual double * nthDerivative(const SPoint2 &param, 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment