Merge remote-tracking branch 'kkremitzki/master'

This commit is contained in:
Matthias Hochsteger 2018-05-18 09:26:48 +02:00
commit d6b7439788
2 changed files with 0 additions and 138 deletions

View File

@ -1,92 +0,0 @@
#include <csg.hpp>
#include <mystdlib.h>
#include "splinesurface.hpp"
namespace netgen
{
SplineSurface :: SplineSurface() : OneSurfacePrimitive()
{ ; }
SplineSurface :: ~SplineSurface() { ; }
void SplineSurface :: AppendPoint(const Point<3> & p, const double reffac, const bool hpref)
{
geompoints.Append(GeomPoint<3>(p,reffac));
geompoints.Last().hpref = hpref;
}
double SplineSurface :: CalcFunctionValue (const Point<3> & point) const
{
auto v1 = splines[0]->GetTangent(0);
auto v2 = splines.Last()->GetTangent(1);
auto p1 = splines[0]->GetPoint(0);
auto n = Cross(v1,v2);
n.Normalize();
return n * (point-p1);
}
void SplineSurface :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
{
auto v1 = splines[0]->GetTangent(0);
auto v2 = splines.Last()->GetTangent(1);
auto p1 = splines[0]->GetPoint(0);
grad = Cross(v1,v2);
grad.Normalize();
}
double SplineSurface :: HesseNorm() const
{
return 0;
}
Point<3> SplineSurface :: GetSurfacePoint() const
{
return splines[0]->GetPoint(0);
}
void SplineSurface :: Print(ostream & str) const
{
str << "SplineSurface " << endl;
}
INSOLID_TYPE SplineSurface :: BoxInSolid(const BoxSphere<3> & box) const
{
int i;
double val;
val = CalcFunctionValue (box.Center());
if (val > box.Diam() / 2) return IS_OUTSIDE;
if (val < -box.Diam() / 2) return IS_INSIDE;
Vec<3> n = GetNormalVector(box.Center());
double cx = n[0];
double cy = n[1];
double cz = n[2];
if (val > 0)
{
Vec<3> vdiag = box.PMax() - box.PMin();
double modify = (vdiag(0) * fabs (cx) +
vdiag(1) * fabs (cy) +
vdiag(2) * fabs (cz) ) / 2;
if (val - modify < 0)
return DOES_INTERSECT;
return IS_OUTSIDE;
}
else
{
Vec<3> vdiag = box.PMax() - box.PMin();
double modify = (vdiag(0) * fabs (cx) +
vdiag(1) * fabs (cy) +
vdiag(2) * fabs (cz) ) / 2;
if (val + modify > 0)
return DOES_INTERSECT;
return IS_INSIDE;
}
}
}

View File

@ -1,46 +0,0 @@
#ifndef FILE_SPLINESURFACE
#define FILE_SPLINESURFACE
namespace netgen
{
class SplineSurface : public OneSurfacePrimitive
{
protected:
Array<GeomPoint<3>> geompoints;
Array<SplineSeg<3>*> splines;
Array<string*> bcnames;
public:
SplineSurface();
virtual ~SplineSurface();
const Array<SplineSeg<3>*> & GetSplines() const { return splines; }
int GetNSplines() const { return splines.Size(); }
string GetSplineType(const int i) const { return splines[i]->GetType(); }
SplineSeg<3> & GetSpline(const int i) { return *splines[i]; }
const SplineSeg<3> & GetSpline(const int i) const { return *splines[i]; }
int GetNP() const { return geompoints.Size(); }
const GeomPoint<3> & GetPoint(int i) const { return geompoints[i]; }
DLL_HEADER void AppendPoint(const Point<3> & p, const double reffac = 1., const bool hpref=false);
void AppendSegment(SplineSeg<3>* spline, string* bcname);
Array<Plane*>* CreatePlanes() const;
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual double HesseNorm () const;
virtual Point<3> GetSurfacePoint () const;
virtual void CalcSpecialPoints(Array<Point<3>> & pts) const;
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const;
virtual void Print (ostream & str) const;
};
}
#endif