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

*** empty log message ***

parent 72842947
No related branches found
No related tags found
No related merge requests found
# $Id: Makefile,v 1.118 2006-11-27 22:22:14 geuzaine Exp $
# $Id: Makefile,v 1.119 2006-11-29 20:31:29 jacob Exp $
#
# Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
#
......@@ -44,6 +44,7 @@ SRC = GEntity.cpp\
MVertex.cpp \
MElement.cpp \
SVector3.cpp\
projectionFace.cpp\
SBoundingBox3d.cpp
OBJ = ${SRC:.cpp=.o}
......
#include "projectionFace.h"
SVector3 scalePoint(SVector3 p, SVector3 s)
{
double x = p[0]*s[0];
double y = p[1]*s[1];
double z = p[2]*s[2];
SVector3 result(x,y,z);
return result;
}
SVector3 rotatePoint(SVector3 p, SVector3 r)
{
double rot[16];
double x = r[0] * Pi / 180.;
double y = r[1] * Pi / 180.;
double z = r[2] * Pi / 180.;
double A = cos(x);
double B = sin(x);
double C = cos(y);
double D = sin(y);
double E = cos(z);
double F = sin(z);
double AD = A * D;
double BD = B * D;
rot[0] = C*E; rot[1] = BD*E+A*F; rot[2] =-AD*E+B*F; rot[3] = 0.;
rot[4] =-C*F; rot[5] =-BD*F+A*E; rot[6] = AD*F+B*E; rot[7] = 0.;
rot[8] = D; rot[9] =-B*C; rot[10] = A*C; rot[11] = 0.;
rot[12] = 0.; rot[13] = 0.; rot[14] = 0.; rot[15] = 1.;
x = p[0]*rot[0] + p[1]*rot[1] + p[2]*rot[2];
y = p[0]*rot[4] + p[1]*rot[5] + p[2]*rot[6];
z = p[0]*rot[8] + p[1]*rot[9] + p[2]*rot[10];
SVector3 result(x,y,z);
return result;
}
void projectionFace::rotate(SVector3 rot)
{
rotation = rot + rotation;
}
void projectionFace::translate(SVector3 trans)
{
translation = trans + translation;
}
void projectionFace::scale(SVector3 sc)
{
scaleFactor[0] *= sc[0];
scaleFactor[1] *= sc[1];
scaleFactor[2] *= sc[2];
}
/*
parabolicCylinder::parabolicCylinder(GModel *m, Surface *face) : projectionFace(m, face->Num), s(face)
{
}
*/
GPoint parabolicCylinder::point(double par1, double par2) const
{
//first let's find the vertex
//SPoint3 k = focalPoint - directrixPoint;
//k.setPosition(k.x/2,k.y/2,k.z/2);
//double f = sqrt(k.x^2 + k.y^2 + k.z^2);
//SPoint3 vertex = directrixPoint + k;
par1 -= .5; //I need these to make sure the 'vertex' occurs at the parameter point (.5,.5)
par2 -= .5;
SVector3 p(par1, (1/(4*focalPoint))*pow(par1,2.0), par2);
//now we have to do the necessary transformations
p = scalePoint(p,scaleFactor); //LOCAL SCALING
p = rotatePoint(p,rotation);
p = translation + p;
//ok...how so you convert an SVector3 to a GPoint...?
GPoint gp;
return gp;
}
GPoint parabolicCylinder::point(const SPoint2 &pt) const
{
double par1 = pt[0];
double par2 = pt[1];
return point(par1,par2);
}
/*
It is my understanding that this method assumes the point is actually on the surface...
also...what does the syntax in the argument mean?
*/
SPoint2 parabolicCylinder::parFromPoint(const SPoint3 &p) const
{
//ok...first we need to untranslate, unrotate and unscale it
SVector3 trans(-translation[0], -translation[1], -translation[2]);
SVector3 rot(-rotation[0],-rotation[1],-rotation[2]);
SVector3 scalar(1/scaleFactor[0],1/scaleFactor[1],1/scaleFactor[2]); //LOCAL SCALING?
SVector3 pos(p[0],p[1],p[2]);
pos = trans + pos;
pos = rotatePoint(pos,rot);
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?
SPoint2 q(pos[0],pos[1]);
return q;
}
/*
du/dx, du/dy, du/dz; dv/dx, dv/dy, dv/dz
v - (1/4f)*u^2 = 0
*/
Pair<SVector3,SVector3> parabolicCylinder::firstDer(const SPoint2 &param) const
{
SVector3 du;
SVector3 dv;
du[0] = 1;
du[1] = -(1/(2*focalPoint))*param[0];
du[2] = 0;
dv[0] = 0;
dv[1] = 0;
dv[2] = 1;
//ok, now we need to scale and rotate...hmm
du = scalePoint(du, scaleFactor);
dv = scalePoint(dv, scaleFactor);
du = rotatePoint(du, rotation);
dv = rotatePoint(dv, rotation);
//yeah...that "might" work
Pair<SVector3,SVector3> result(du,dv);
return result;
}
/*
By convention, we're going to return the normal facing the interior of the parabola
*/
SVector3 parabolicCylinder::normal(const SPoint2 &param) const
{
SVector3 n;
Pair<SVector3,SVector3> result = firstDer(param);
const SVector3 left = result.left();
const SVector3 right = result.right();
n = crossprod( left, right);
//I forget...do we want to normalize this?
n.normalize();
return n;
}
#include "GFace.h"
/*
What functions we need for this class and all derived classes:
1. given point in xyz space, compute xyz point on surface
2. given point in xyz on surface, compute uv co-ordinate
3. given point in uv, compute xyz co-ordinate on surface
functions 2 and 3 are already virtual functions associated with GFace so let's make sure we implement them correctly.
Specific to the derived classes, we're going to also need functions which can be used to easily adjust the parameters of the functions.
plus, we're going to have to implement all that stuff in GFace eventually.
*/
SVector3 scalePoint(SVector3 p, SVector3 s);
SVector3 rotatePoint(SVector3 p, SVector3 r);
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 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( );
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;
virtual double * nthDerivative(const SPoint2 &param, int n,
double *array) const {throw;}
virtual GEntity::GeomType geomType() const;
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; }
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
};
class parabolicCylinder : protected projectionFace
{
protected:
double focalPoint; //the length from the vertex to the focal point
//SPoint3 directrixPoint; //the point on the directrix opposite wrt the vertex of the focal point
//SVector3 directrixLine; //the direction in which the directrix extends
// 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();
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
// GEntity::GeomType geomType() const; //I have no idea what this is.
SPoint2 parFromPoint(const SPoint3 &p) const; //what is that syntax?
};
// $Id: BackgroundMesh.cpp,v 1.4 2006-11-29 16:57:01 remacle Exp $
// $Id: BackgroundMesh.cpp,v 1.5 2006-11-29 20:31:29 jacob Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -133,8 +133,10 @@ double LC_MVertex_PNTS ( GEntity *ge, double U, double V )
switch (ge->dim ())
{
case 0:
{
GVertex *gv = (GVertex *)ge;
return gv->prescribedMeshSizeAtVertex();
}
case 1:
{
GEdge *ged = (GEdge *)ge;
......
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