mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 13:30:34 +05:00
clipping plane
This commit is contained in:
parent
ff3e491863
commit
eaf9ec57ac
@ -831,28 +831,20 @@ namespace netgen
|
||||
for (int i = 0; i < nsurf; i++)
|
||||
isidenticto[i] = i;
|
||||
|
||||
//(*testout) << "jetzt!" << endl;
|
||||
for (int i = 0; i < nsurf; i++)
|
||||
for (int j = i+1; j < nsurf; j++)
|
||||
{
|
||||
//(*testout) << "surf" << i << " surf" << j << endl;
|
||||
if (GetSurface(j) -> IsIdentic (*GetSurface(i), inv, eps))
|
||||
{
|
||||
INDEX_2 i2(i, j);
|
||||
identicsurfaces.Set (i2, inv);
|
||||
isidenticto[j] = isidenticto[i];
|
||||
//(*testout) << "surfaces " << i2 << " are identic" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
(*testout) << "identicmap:" << endl;
|
||||
for (int i = 0; i < isidenticto.Size(); i++)
|
||||
(*testout) << i << " -> " << isidenticto[i] << endl;
|
||||
|
||||
/*
|
||||
for (int i = 0; i < nsurf; i++)
|
||||
GetSurface(i)->Print (*testout);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -865,9 +857,9 @@ namespace netgen
|
||||
ReducePrimitiveIterator rpi(box);
|
||||
UnReducePrimitiveIterator urpi;
|
||||
|
||||
((Solid*)sol) -> IterateSolid (rpi);
|
||||
const_cast<Solid*> (sol) -> IterateSolid (rpi);
|
||||
sol -> GetSurfaceIndices (locsurf);
|
||||
((Solid*)sol) -> IterateSolid (urpi);
|
||||
const_cast<Solid*> (sol) -> IterateSolid (urpi);
|
||||
|
||||
for (int i = locsurf.Size()-1; i >= 0; i--)
|
||||
{
|
||||
@ -944,7 +936,7 @@ namespace netgen
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void CSGeometry ::
|
||||
GetIndependentSurfaceIndices (const Solid * sol,
|
||||
const Point<3> & p, Vec<3> & v,
|
||||
@ -957,7 +949,7 @@ namespace netgen
|
||||
box.CalcDiamCenter();
|
||||
GetIndependentSurfaceIndices (sol, box, locsurf);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void CSGeometry ::
|
||||
GetIndependentSurfaceIndices (Array<int> & locsurf) const
|
||||
|
@ -253,9 +253,11 @@ namespace netgen
|
||||
const BoxSphere<3> & box,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
/*
|
||||
void GetIndependentSurfaceIndices (const Solid * sol,
|
||||
const Point<3> & p, Vec<3> & v,
|
||||
Array<int> & locsurf) const;
|
||||
*/
|
||||
///
|
||||
void GetIndependentSurfaceIndices (Array<int> & locsurf) const;
|
||||
|
||||
|
@ -666,7 +666,7 @@ namespace netgen
|
||||
|
||||
// Philippose - 30/01/2009
|
||||
// Enable clipping planes for Selection mode in OCC Geometry
|
||||
if (vispar.clipenable)
|
||||
if (vispar.clipping.enable)
|
||||
{
|
||||
Vec<3> n(clipplane[0], clipplane[1], clipplane[2]);
|
||||
double len = Abs(n);
|
||||
|
@ -357,14 +357,14 @@ namespace netgen
|
||||
|
||||
void VisualScene :: SetClippingPlane ()
|
||||
{
|
||||
if (vispar.clipenable)
|
||||
if (vispar.clipping.enable)
|
||||
{
|
||||
Vec3d n = vispar.clipnormal;
|
||||
Vec3d n = vispar.clipping.normal;
|
||||
n /= (n.Length()+1e-10);
|
||||
clipplane[0] = n.X();
|
||||
clipplane[1] = n.Y();
|
||||
clipplane[2] = n.Z();
|
||||
clipplane[3] = -(Vec3d(center) * n) + rad * vispar.clipdist;
|
||||
clipplane[3] = -(Vec3d(center) * n) + rad * vispar.clipping.dist;
|
||||
|
||||
glClipPlane(GL_CLIP_PLANE0, clipplane);
|
||||
glEnable(GL_CLIP_PLANE0);
|
||||
|
@ -16,10 +16,27 @@ public:
|
||||
char selectvisual[20];
|
||||
int showstltrias;
|
||||
|
||||
/*
|
||||
Vec3d clipnormal;
|
||||
double clipdist;
|
||||
int clipenable;
|
||||
int clipplanetimestamp;
|
||||
*/
|
||||
class Clipping
|
||||
{
|
||||
public:
|
||||
Vec3d normal;
|
||||
double dist;
|
||||
int enable;
|
||||
int timestamp;
|
||||
bool operator== (Clipping & clip2)
|
||||
{
|
||||
return
|
||||
(normal == clip2.normal) && (dist == clip2.dist)
|
||||
&& (enable == clip2.enable);
|
||||
}
|
||||
};
|
||||
Clipping clipping;
|
||||
|
||||
int colormeshsize;
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ namespace netgen
|
||||
{
|
||||
|
||||
if (tettimestamp > mesh->GetTimeStamp () &&
|
||||
tettimestamp > vispar.clipplanetimestamp )
|
||||
tettimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
|
||||
if (!lock)
|
||||
@ -1775,7 +1775,7 @@ namespace netgen
|
||||
Array<Element2d> faces;
|
||||
|
||||
BitArray shownode(mesh->GetNP());
|
||||
if (vispar.clipenable)
|
||||
if (vispar.clipping.enable)
|
||||
{
|
||||
shownode.Clear();
|
||||
for (int i = 1; i <= shownode.Size(); i++)
|
||||
@ -2082,7 +2082,7 @@ namespace netgen
|
||||
void VisualSceneMesh :: BuildPrismList()
|
||||
{
|
||||
if (prismtimestamp > mesh->GetTimeStamp () &&
|
||||
prismtimestamp > vispar.clipplanetimestamp )
|
||||
prismtimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
|
||||
if (!lock)
|
||||
@ -2410,7 +2410,7 @@ namespace netgen
|
||||
void VisualSceneMesh :: BuildHexList()
|
||||
{
|
||||
if (hextimestamp > mesh->GetTimeStamp () &&
|
||||
hextimestamp > vispar.clipplanetimestamp )
|
||||
hextimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
|
||||
if (!lock)
|
||||
@ -2618,7 +2618,7 @@ namespace netgen
|
||||
void VisualSceneMesh :: BuildPyramidList()
|
||||
{
|
||||
if (pyramidtimestamp > mesh->GetTimeStamp () &&
|
||||
pyramidtimestamp > vispar.clipplanetimestamp )
|
||||
pyramidtimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
|
||||
if (!lock)
|
||||
@ -3330,7 +3330,7 @@ namespace netgen
|
||||
|
||||
glDisable(GL_CLIP_PLANE0);
|
||||
|
||||
if (vispar.clipenable)
|
||||
if (vispar.clipping.enable)
|
||||
{
|
||||
Vec<3> n(clipplane[0], clipplane[1], clipplane[2]);
|
||||
double len = Abs(n);
|
||||
|
@ -603,7 +603,7 @@ namespace netgen
|
||||
else
|
||||
{
|
||||
if (mesh->GetTimeStamp () > surfeltimestamp ||
|
||||
vispar.clipplanetimestamp > clipplanetimestamp ||
|
||||
vispar.clipping.timestamp > clipplanetimestamp ||
|
||||
solutiontimestamp > surfeltimestamp)
|
||||
{
|
||||
GetMinMax (scalfunction, scalcomp, minval, maxval);
|
||||
@ -672,12 +672,12 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
if (clipplanetimestamp < vispar.clipplanetimestamp ||
|
||||
if (clipplanetimestamp < vispar.clipping.timestamp ||
|
||||
clipplanetimestamp < solutiontimestamp)
|
||||
{
|
||||
|
||||
// cout << "clipsolution = " << clipsolution << endl;
|
||||
if (vispar.clipenable && clipsolution == 2)
|
||||
if (vispar.clipping.enable && clipsolution == 2)
|
||||
{
|
||||
// lock->UnLock();
|
||||
NgLock mlock (mesh->Mutex(), 0);
|
||||
@ -689,7 +689,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
if (vispar.clipenable && clipsolution == 1 && sol)
|
||||
if (vispar.clipping.enable && clipsolution == 1 && sol)
|
||||
DrawClipPlaneTrigs ();
|
||||
|
||||
if (clipplanelist_vec)
|
||||
@ -698,7 +698,7 @@ namespace netgen
|
||||
clipplanelist_vec = glGenLists (1);
|
||||
glNewList (clipplanelist_vec, GL_COMPILE);
|
||||
|
||||
if (vispar.clipenable && clipsolution == 2 && vsol)
|
||||
if (vispar.clipping.enable && clipsolution == 2 && vsol)
|
||||
{
|
||||
SetTextureMode (usetexture);
|
||||
|
||||
@ -794,7 +794,7 @@ namespace netgen
|
||||
|
||||
if (
|
||||
numisolines &&
|
||||
(clipplanetimestamp < vispar.clipplanetimestamp ||
|
||||
(clipplanetimestamp < vispar.clipping.timestamp ||
|
||||
clipplanetimestamp < solutiontimestamp)
|
||||
)
|
||||
{
|
||||
@ -925,7 +925,7 @@ namespace netgen
|
||||
|
||||
if (clipplane_isolinelist) glDeleteLists (clipplane_isolinelist, 1);
|
||||
|
||||
if (vispar.clipenable && clipsolution == 1 && sol)
|
||||
if (vispar.clipping.enable && clipsolution == 1 && sol)
|
||||
{
|
||||
clipplane_isolinelist = glGenLists (1);
|
||||
glNewList (clipplane_isolinelist, GL_COMPILE);
|
||||
@ -961,7 +961,7 @@ namespace netgen
|
||||
glEnd();
|
||||
}
|
||||
|
||||
clipplanetimestamp = max2 (vispar.clipplanetimestamp, solutiontimestamp);
|
||||
clipplanetimestamp = max2 (vispar.clipping.timestamp, solutiontimestamp);
|
||||
}
|
||||
|
||||
|
||||
@ -1115,6 +1115,7 @@ namespace netgen
|
||||
|
||||
|
||||
bool drawelem = false;
|
||||
/*
|
||||
if (sol && sol->draw_surface)
|
||||
{
|
||||
if (usetexture == 2)
|
||||
@ -1124,6 +1125,22 @@ namespace netgen
|
||||
for (int ii = 0; ii < npt; ii++)
|
||||
drawelem = GetSurfValue (sol, sei, -1, pref[ii](0), pref[ii](1), scalcomp, values[ii]);
|
||||
}
|
||||
*/
|
||||
if (sol && sol->draw_surface)
|
||||
{
|
||||
drawelem = GetMultiSurfValues (sol, sei, -1, npt,
|
||||
&pref[0](0), &pref[1](0)-&pref[0](0),
|
||||
&points[0](0), &points[1](0)-&points[0](0),
|
||||
&dxdxis[0](0), &dxdxis[1](0)-&dxdxis[0](0),
|
||||
&mvalues[0], sol->components);
|
||||
if (usetexture == 2)
|
||||
for (int ii = 0; ii < npt; ii++)
|
||||
valuesc[ii] = ExtractValueComplex(sol, scalcomp, &mvalues[ii*sol->components]);
|
||||
else
|
||||
for (int ii = 0; ii < npt; ii++)
|
||||
values[ii] = ExtractValue(sol, scalcomp, &mvalues[ii*sol->components]);
|
||||
}
|
||||
|
||||
|
||||
if (deform)
|
||||
for (int ii = 0; ii < npt; ii++)
|
||||
@ -3824,7 +3841,8 @@ namespace netgen
|
||||
sol = soldata[scalfunction];
|
||||
|
||||
|
||||
|
||||
if (sol -> draw_volume)
|
||||
{
|
||||
glBegin (GL_TRIANGLES);
|
||||
|
||||
int maxlpnr = 0;
|
||||
@ -3851,7 +3869,7 @@ namespace netgen
|
||||
|
||||
for (int i = 0; i < trigs.Size(); i++)
|
||||
{
|
||||
bool ok = true;
|
||||
bool ok; // = true;
|
||||
const ClipPlaneTrig & trig = trigs[i];
|
||||
if (trig.elnr != lastelnr)
|
||||
{
|
||||
@ -3887,7 +3905,8 @@ namespace netgen
|
||||
|
||||
// cout << "have multivalues, comps = " << sol->components << endl;
|
||||
|
||||
if (!drawelem) ok = false;
|
||||
// if (!drawelem) ok = false;
|
||||
ok = drawelem;
|
||||
if (usetexture != 2 || !sol->iscomplex)
|
||||
for (int ii = 0; ii < nlp; ii++)
|
||||
vals[ii] = ExtractValue(sol, scalcomp, &mvalues[ii*sol->components]);
|
||||
@ -3919,7 +3938,7 @@ namespace netgen
|
||||
|
||||
}
|
||||
glEnd();
|
||||
|
||||
}
|
||||
glEndList ();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user