2009-01-13 23:32:10 +05:00
|
|
|
#ifdef OCCGEOMETRY
|
|
|
|
|
|
|
|
#ifndef FILE_OCCMESHSURF
|
|
|
|
#define FILE_OCCMESHSURF
|
|
|
|
|
|
|
|
#include "occgeom.hpp"
|
2018-01-23 13:01:58 +05:00
|
|
|
#include "mydefs.hpp"
|
2009-01-13 23:32:10 +05:00
|
|
|
|
|
|
|
#define PARAMETERSPACE -1
|
|
|
|
#define PLANESPACE 1
|
|
|
|
|
|
|
|
class OCCGeometry;
|
|
|
|
|
|
|
|
class SingularMatrixException
|
|
|
|
{};
|
|
|
|
|
|
|
|
class UVBoundsException
|
|
|
|
{};
|
|
|
|
|
|
|
|
class OCCSurface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TopoDS_Face topods_face;
|
|
|
|
Handle(Geom_Surface) occface;
|
|
|
|
TopAbs_Orientation orient;
|
|
|
|
int projecttype;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Point<3> p1;
|
|
|
|
Point<3> p2;
|
|
|
|
|
|
|
|
/// in plane, directed p1->p2
|
|
|
|
Vec<3> ex;
|
|
|
|
/// in plane
|
|
|
|
Vec<3> ey;
|
|
|
|
/// outer normal direction
|
|
|
|
Vec<3> ez;
|
|
|
|
|
|
|
|
/// normal vector in p2
|
|
|
|
Vec<3> n2;
|
|
|
|
|
|
|
|
/// average normal vector
|
|
|
|
Vec<3> nmid;
|
|
|
|
|
|
|
|
// for transformation to parameter space
|
|
|
|
Point<2> psp1;
|
|
|
|
Point<2> psp2;
|
|
|
|
Vec<2> psex;
|
|
|
|
Vec<2> psey;
|
|
|
|
Mat<2,2> Amat, Amatinv;
|
|
|
|
|
|
|
|
// UV Bounds
|
|
|
|
double umin, umax, vmin, vmax;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OCCSurface (const TopoDS_Face & aface, int aprojecttype)
|
|
|
|
{
|
2019-07-28 23:22:48 +05:00
|
|
|
static Timer t("occurface ctor"); RegionTimer r(t);
|
2009-01-13 23:32:10 +05:00
|
|
|
topods_face = aface;
|
|
|
|
occface = BRep_Tool::Surface(topods_face);
|
|
|
|
orient = topods_face.Orientation();
|
|
|
|
projecttype = aprojecttype;
|
|
|
|
ShapeAnalysis::GetFaceUVBounds (topods_face, umin, umax, vmin, vmax);
|
|
|
|
umin -= fabs(umax-umin)/100.0;
|
|
|
|
vmin -= fabs(vmax-vmin)/100.0;
|
|
|
|
umax += fabs(umax-umin)/100.0;
|
|
|
|
vmax += fabs(vmax-vmin)/100.0;
|
|
|
|
// projecttype = PLANESPACE;
|
|
|
|
/*
|
|
|
|
TopExp_Explorer exp1;
|
|
|
|
exp1.Init (topods_face, TopAbs_WIRE);
|
|
|
|
orient = TopAbs::Compose (orient, exp1.Current().Orientation());
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
~OCCSurface()
|
|
|
|
{};
|
|
|
|
|
|
|
|
void Project (Point<3> & p, PointGeomInfo & gi);
|
|
|
|
|
|
|
|
void GetNormalVector (const Point<3> & p,
|
|
|
|
const PointGeomInfo & geominfo,
|
|
|
|
Vec<3> & n) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Defines tangential plane in ap1.
|
|
|
|
The local x-coordinate axis point to the direction of ap2 */
|
|
|
|
void DefineTangentialPlane (const Point<3> & ap1,
|
|
|
|
const PointGeomInfo & geominfo1,
|
|
|
|
const Point<3> & ap2,
|
|
|
|
const PointGeomInfo & geominfo2);
|
|
|
|
|
|
|
|
|
|
|
|
/// Transforms 3d point p3d to local coordinates pplane
|
|
|
|
void ToPlane (const Point<3> & p3d, const PointGeomInfo & geominfo,
|
|
|
|
Point<2> & pplane, double h, int & zone) const;
|
|
|
|
|
|
|
|
/// Transforms point pplane in local coordinates to 3d point
|
|
|
|
void FromPlane (const Point<2> & pplane,
|
|
|
|
Point<3> & p3d,
|
|
|
|
PointGeomInfo & gi,
|
|
|
|
double h);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
class Meshing2OCCSurfaces : public Meshing2
|
|
|
|
{
|
|
|
|
///
|
|
|
|
OCCSurface surface;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
///
|
2019-10-28 17:44:51 +05:00
|
|
|
Meshing2OCCSurfaces (const NetgenGeometry& geo,
|
|
|
|
const TopoDS_Shape & asurf, const Box<3> & aboundingbox,
|
2019-07-27 22:05:43 +05:00
|
|
|
int aprojecttype, const MeshingParameters & mparam);
|
2009-01-13 23:32:10 +05:00
|
|
|
|
|
|
|
///
|
|
|
|
int GetProjectionType ()
|
|
|
|
{ return surface.projecttype; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
///
|
2019-09-29 17:54:24 +05:00
|
|
|
void DefineTransformation (const Point<3> & p1, const Point<3> & p2,
|
|
|
|
const PointGeomInfo * geominfo1,
|
|
|
|
const PointGeomInfo * geominfo2) override;
|
2009-01-13 23:32:10 +05:00
|
|
|
///
|
2019-09-29 17:54:24 +05:00
|
|
|
void TransformToPlain (const Point<3> & locpoint,
|
|
|
|
const MultiPointGeomInfo & geominfo,
|
|
|
|
Point<2> & plainpoint,
|
|
|
|
double h, int & zone) override;
|
2009-01-13 23:32:10 +05:00
|
|
|
///
|
|
|
|
|
2019-09-29 17:54:24 +05:00
|
|
|
int TransformFromPlain (const Point<2> & plainpoint,
|
|
|
|
Point<3> & locpoint,
|
|
|
|
PointGeomInfo & gi,
|
|
|
|
double h) override;
|
2009-01-13 23:32:10 +05:00
|
|
|
///
|
2019-10-01 14:59:17 +05:00
|
|
|
double CalcLocalH (const Point<3> & p, double gh) const override;
|
2009-01-13 23:32:10 +05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class OCCGeometry;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|