mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
1 Commits
CR0_CADVie
...
CR30095
Author | SHA1 | Date | |
---|---|---|---|
|
0156fa8914 |
@@ -7360,26 +7360,15 @@ Analysis of shapes includes commands to compute length, area, volumes and inerti
|
||||
|
||||
Syntax:
|
||||
~~~~~
|
||||
lprops shape [x y z] [-skip] [-full] [-tri]
|
||||
sprops shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri]
|
||||
vprops shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri]
|
||||
lprops shape
|
||||
sprops shape
|
||||
vprops shape
|
||||
~~~~~
|
||||
|
||||
* **lprops** computes the mass properties of all edges in the shape with a linear density of 1;
|
||||
* **sprops** of all faces with a surface density of 1;
|
||||
* **vprops** of all solids with a density of 1.
|
||||
|
||||
For computation of properties of the shape, exact geomery (curves, surfaces) or
|
||||
some discrete data (polygons, triangulations) can be used for calculations.
|
||||
The epsilon, if given, defines relative precision of computation.
|
||||
The **closed** flag, if present, forces computation only closed shells of the shape.
|
||||
The centroid coordinates will be put to DRAW variables x y z (if given).
|
||||
Shared entities will be taken in account only one time in the **skip** mode.
|
||||
All values are output with the full precision in the **full** mode.
|
||||
Preferable source of geometry data are triangulations in case if it exists,
|
||||
if the **-tri** key is used, otherwise preferable data is exact geometry.
|
||||
If epsilon is given, exact geometry (curves, surfaces) are used for calculations independently of using key **-tri**.
|
||||
|
||||
All three commands print the mass, the coordinates of the center of gravity, the matrix of inertia and the moments. Mass is either the length, the area or the volume. The center and the main axis of inertia are displayed.
|
||||
|
||||
**Example:**
|
||||
|
BIN
dox/user_guides/inspector/images/build_cmake_tools.png
Normal file
BIN
dox/user_guides/inspector/images/build_cmake_tools.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
@@ -557,6 +557,22 @@ When this option is switched ON, MS Visual Studio project has an additional tree
|
||||
@figure{VStudio_projects.png,"Inspector packages in MS Visual Studio",160}
|
||||
|
||||
|
||||
@subsection occt_inspector_5_1 Building tools with CMake outside of OCCT
|
||||
|
||||
To compile OCCT tools, run CMake and set the source directory into the "tools" folder of OCCT.
|
||||
@figure{build_cmake_tools.png,"OCCT tools",160}
|
||||
|
||||
"OpenCASCADE_Dir" should be defined and point into <b>cmake</b> directory of installed OCCT. (Please be sure that sources
|
||||
of OCCT for compiled tools are the same as sources of installed OCCT, otherwise interface might be different and
|
||||
you have compilation errors)
|
||||
|
||||
After, define 3RDPARTY_QT_DIR
|
||||
|
||||
Checked variables BUILD_PLUGIN_* define which plugins should be compiled.
|
||||
If only BUILD_PLUGIN_TreeModel is checked, no plugins are compiled, only TreeModel library that might be used as an interface
|
||||
of communication to Qt tree model by items implementation.
|
||||
|
||||
|
||||
@section occt_inspector_6 Sources and packaging
|
||||
|
||||
OCCT sources are extended by the /tools directory.
|
||||
|
@@ -90,8 +90,7 @@ AIS_Shape::AIS_Shape(const TopoDS_Shape& theShape)
|
||||
myUVRepeat(1.0, 1.0),
|
||||
myUVScale (1.0, 1.0),
|
||||
myInitAng (0.0),
|
||||
myCompBB (Standard_True),
|
||||
myMostEdgeClass(GeomAbs_CN)
|
||||
myCompBB (Standard_True)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -165,8 +164,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
|
||||
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
|
||||
myUVOrigin, myUVRepeat, myUVScale, StdPrs_Volume_Autodetection,
|
||||
myMostEdgeClass);
|
||||
myUVOrigin, myUVRepeat, myUVScale);
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
@@ -1194,23 +1192,3 @@ Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle,
|
||||
aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
|
||||
return myDrawer->HasOwnHLRDeviationAngle();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMostContinuityClass
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Shape::SetMostContinuityClass(const GeomAbs_Shape theMostAllowedEdgeClass)
|
||||
{
|
||||
myMostEdgeClass = theMostAllowedEdgeClass;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MostContinuityClass
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_Shape AIS_Shape::MostContinuityClass() const
|
||||
{
|
||||
return myMostEdgeClass;
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_TypeOfHLR.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
//! A framework to manage presentation and selection of shapes.
|
||||
//! AIS_Shape is the interactive object which is used the
|
||||
@@ -215,14 +214,6 @@ public:
|
||||
//! the current facing model;
|
||||
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
|
||||
|
||||
//! Set the most edge continuity class
|
||||
//! @param theMostAllowedEdgeClass the most edge continuity class to be included to presentation
|
||||
//! (edges with more continuity should be ignored)
|
||||
Standard_EXPORT void SetMostContinuityClass(const GeomAbs_Shape theMostAllowedEdgeClass);
|
||||
|
||||
//! Get the most edge continuity class
|
||||
Standard_EXPORT GeomAbs_Shape MostContinuityClass() const;
|
||||
|
||||
//! Return shape type for specified selection mode.
|
||||
static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
|
||||
{
|
||||
@@ -339,7 +330,7 @@ protected:
|
||||
gp_Pnt2d myUVScale; //!< UV scale vector for generating texture coordinates
|
||||
Standard_Real myInitAng;
|
||||
Standard_Boolean myCompBB; //!< if TRUE, then bounding box should be recomputed
|
||||
GeomAbs_Shape myMostEdgeClass; //!< the most edge continuity class to be included to the presentation
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject)
|
||||
|
@@ -32,8 +32,7 @@ Aspect_IS_HOLLOW,
|
||||
Aspect_IS_HATCH,
|
||||
Aspect_IS_SOLID,
|
||||
Aspect_IS_HIDDENLINE,
|
||||
Aspect_IS_POINT,
|
||||
Aspect_IS_OUTLINE
|
||||
Aspect_IS_POINT
|
||||
};
|
||||
|
||||
#endif // _Aspect_InteriorStyle_HeaderFile
|
||||
|
@@ -16,8 +16,6 @@
|
||||
#include <BRepGProp_Cinert.hxx>
|
||||
#include <BRepGProp_Sinert.hxx>
|
||||
#include <BRepGProp_Vinert.hxx>
|
||||
#include <BRepGProp_MeshProps.hxx>
|
||||
#include <BRepGProp_MeshCinert.hxx>
|
||||
#include <BRepGProp_VinertGK.hxx>
|
||||
#include <GProp_PGProps.hxx>
|
||||
#include <BRepGProp_Face.hxx>
|
||||
@@ -31,7 +29,6 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <BRepCheck_Shell.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
static Standard_Integer AffichEps = 0;
|
||||
#endif
|
||||
@@ -41,45 +38,18 @@ static gp_Pnt roughBaryCenter(const TopoDS_Shape& S){
|
||||
gp_XYZ xyz(0,0,0);
|
||||
for (ex.Init(S,TopAbs_VERTEX), i = 0; ex.More(); ex.Next(), i++)
|
||||
xyz += BRep_Tool::Pnt(TopoDS::Vertex(ex.Current())).XYZ();
|
||||
if (i > 0)
|
||||
{
|
||||
xyz /= i;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Try using triangulation
|
||||
ex.Init(S, TopAbs_FACE);
|
||||
for (; ex.More(); ex.Next())
|
||||
{
|
||||
const TopoDS_Shape& aF = ex.Current();
|
||||
TopLoc_Location aLocDummy;
|
||||
const Handle(Poly_Triangulation)& aTri =
|
||||
BRep_Tool::Triangulation(TopoDS::Face(aF), aLocDummy);
|
||||
if (!aTri.IsNull())
|
||||
{
|
||||
xyz = aTri->Node(1).XYZ();
|
||||
if (!aLocDummy.IsIdentity())
|
||||
{
|
||||
aLocDummy.Transformation().Transforms(xyz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( i > 0 ) xyz /= i;
|
||||
return gp_Pnt(xyz);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BRepGProp::LinearProperties(const TopoDS_Shape& S, GProp_GProps& SProps, const Standard_Boolean SkipShared,
|
||||
const Standard_Boolean UseTriangulation)
|
||||
{
|
||||
void BRepGProp::LinearProperties(const TopoDS_Shape& S, GProp_GProps& SProps, const Standard_Boolean SkipShared){
|
||||
// find the origin
|
||||
gp_Pnt P(0,0,0);
|
||||
P.Transform(S.Location());
|
||||
SProps = GProp_GProps(P);
|
||||
|
||||
BRepAdaptor_Curve BAC;
|
||||
Standard_Real eps = Epsilon(1.);
|
||||
TopTools_MapOfShape anEMap;
|
||||
TopExp_Explorer ex;
|
||||
for (ex.Init(S,TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||
@@ -88,35 +58,27 @@ void BRepGProp::LinearProperties(const TopoDS_Shape& S, GProp_GProps& SProps, c
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(TColgp_HArray1OfPnt) theNodes;
|
||||
Standard_Boolean IsGeom = BRep_Tool::IsGeometric(aE);
|
||||
if (UseTriangulation || !IsGeom)
|
||||
if(!BRep_Tool::IsGeometric(aE))
|
||||
{
|
||||
BRepGProp_MeshCinert::PreparePolygon(aE, theNodes);
|
||||
}
|
||||
if(!theNodes.IsNull())
|
||||
GProp_PGProps aPProps;
|
||||
TopoDS_Iterator anIter(aE);
|
||||
for(; anIter.More(); anIter.Next())
|
||||
{
|
||||
BRepGProp_MeshCinert MG;
|
||||
MG.SetLocation(P);
|
||||
MG.Perform(theNodes->Array1());
|
||||
SProps.Add(MG);
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(anIter.Value());
|
||||
aPProps.AddPoint(BRep_Tool::Pnt(aV), eps);
|
||||
}
|
||||
SProps.Add(aPProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsGeom)
|
||||
{
|
||||
BAC.Initialize(aE);
|
||||
BRepGProp_Cinert CG(BAC,P);
|
||||
SProps.Add(CG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Real Eps, const Standard_Boolean SkipShared,
|
||||
const Standard_Boolean UseTriangulation)
|
||||
{
|
||||
static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Real Eps, const Standard_Boolean SkipShared){
|
||||
Standard_Integer i;
|
||||
#ifdef OCCT_DEBUG
|
||||
Standard_Integer iErrorMax = 0;
|
||||
@@ -125,8 +87,6 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
|
||||
TopExp_Explorer ex;
|
||||
gp_Pnt P(roughBaryCenter(S));
|
||||
BRepGProp_Sinert G; G.SetLocation(P);
|
||||
BRepGProp_MeshProps MG(BRepGProp_MeshProps::Sinert);
|
||||
MG.SetLocation(P);
|
||||
|
||||
BRepGProp_Face BF;
|
||||
BRepGProp_Domain BD;
|
||||
@@ -140,33 +100,15 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Boolean NoSurf = Standard_False, NoTri = Standard_False;
|
||||
{
|
||||
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface (F, aLocDummy);
|
||||
if (aSurf.IsNull())
|
||||
{
|
||||
NoSurf = Standard_True;
|
||||
}
|
||||
const Handle(Poly_Triangulation)& aTri = BRep_Tool::Triangulation(F, aLocDummy);
|
||||
if (aTri.IsNull())
|
||||
{
|
||||
NoTri = Standard_True;
|
||||
}
|
||||
if (NoTri && NoSurf)
|
||||
{
|
||||
// skip faces without geometry
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((UseTriangulation && !NoTri) || (NoSurf && !NoTri))
|
||||
{
|
||||
TopAbs_Orientation anOri = F.Orientation();
|
||||
const Handle(Poly_Triangulation)& aTri = BRep_Tool::Triangulation(F, aLocDummy);
|
||||
MG.Perform(aTri, aLocDummy, anOri);
|
||||
Props.Add(MG);
|
||||
}
|
||||
else
|
||||
{
|
||||
BF.Load(F);
|
||||
TopoDS_Iterator aWIter(F);
|
||||
Standard_Boolean IsNatRestr = !aWIter.More();
|
||||
@@ -180,8 +122,7 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
|
||||
iErrorMax = i;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if(IsNatRestr) G.Perform(BF);
|
||||
else G.Perform(BF, BD);
|
||||
}
|
||||
@@ -190,26 +131,23 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
|
||||
if(AffichEps) cout<<"\n"<<i<<":\tEpsArea = "<< G.GetEpsilon();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
if(AffichEps) cout<<"\n-----------------\n"<<iErrorMax<<":\tMaxError = "<<ErrorMax<<"\n";
|
||||
#endif
|
||||
return ErrorMax;
|
||||
}
|
||||
void BRepGProp::SurfaceProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Boolean SkipShared,
|
||||
const Standard_Boolean UseTriangulation)
|
||||
{
|
||||
void BRepGProp::SurfaceProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Boolean SkipShared){
|
||||
// find the origin
|
||||
gp_Pnt P(0,0,0);
|
||||
P.Transform(S.Location());
|
||||
Props = GProp_GProps(P);
|
||||
surfaceProperties(S,Props,1.0, SkipShared, UseTriangulation);
|
||||
surfaceProperties(S,Props,1.0, SkipShared);
|
||||
}
|
||||
Standard_Real BRepGProp::SurfaceProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Real Eps, const Standard_Boolean SkipShared){
|
||||
// find the origin
|
||||
gp_Pnt P(0,0,0); P.Transform(S.Location());
|
||||
Props = GProp_GProps(P);
|
||||
Standard_Real ErrorMax = surfaceProperties(S,Props,Eps,SkipShared, Standard_False);
|
||||
Standard_Real ErrorMax = surfaceProperties(S,Props,Eps,SkipShared);
|
||||
return ErrorMax;
|
||||
}
|
||||
|
||||
@@ -218,9 +156,7 @@ Standard_Real BRepGProp::SurfaceProperties(const TopoDS_Shape& S, GProp_GProps&
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Real volumeProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Real Eps, const Standard_Boolean SkipShared,
|
||||
const Standard_Boolean UseTriangulation)
|
||||
{
|
||||
static Standard_Real volumeProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Real Eps, const Standard_Boolean SkipShared){
|
||||
Standard_Integer i;
|
||||
#ifdef OCCT_DEBUG
|
||||
Standard_Integer iErrorMax = 0;
|
||||
@@ -229,8 +165,6 @@ static Standard_Real volumeProperties(const TopoDS_Shape& S, GProp_GProps& Props
|
||||
TopExp_Explorer ex;
|
||||
gp_Pnt P(roughBaryCenter(S));
|
||||
BRepGProp_Vinert G; G.SetLocation(P);
|
||||
BRepGProp_MeshProps MG(BRepGProp_MeshProps::Vinert);
|
||||
MG.SetLocation(P);
|
||||
|
||||
BRepGProp_Face BF;
|
||||
BRepGProp_Domain BD;
|
||||
@@ -254,34 +188,16 @@ static Standard_Real volumeProperties(const TopoDS_Shape& S, GProp_GProps& Props
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Standard_Boolean NoSurf = Standard_False, NoTri = Standard_False;
|
||||
{
|
||||
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface (F, aLocDummy);
|
||||
if (aSurf.IsNull())
|
||||
{
|
||||
NoSurf = Standard_True;
|
||||
}
|
||||
const Handle(Poly_Triangulation)& aTri = BRep_Tool::Triangulation(F, aLocDummy);
|
||||
if (aTri.IsNull())
|
||||
{
|
||||
NoTri = Standard_True;
|
||||
}
|
||||
if (NoTri && NoSurf)
|
||||
{
|
||||
// skip faces without geometry
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFwd || isRvs)
|
||||
{
|
||||
if ((UseTriangulation && !NoTri) || (NoSurf && !NoTri))
|
||||
{
|
||||
const Handle(Poly_Triangulation)& aTri = BRep_Tool::Triangulation(F, aLocDummy);
|
||||
MG.Perform(aTri, aLocDummy, anOri);
|
||||
Props.Add(MG);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFwd || isRvs){
|
||||
BF.Load(F);
|
||||
TopoDS_Iterator aWIter(F);
|
||||
Standard_Boolean IsNatRestr = !aWIter.More();
|
||||
@@ -306,15 +222,12 @@ static Standard_Real volumeProperties(const TopoDS_Shape& S, GProp_GProps& Props
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
if(AffichEps) cout<<"\n-----------------\n"<<iErrorMax<<":\tMaxError = "<<ErrorMax<<"\n";
|
||||
#endif
|
||||
return ErrorMax;
|
||||
}
|
||||
void BRepGProp::VolumeProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Boolean OnlyClosed, const Standard_Boolean SkipShared,
|
||||
const Standard_Boolean UseTriangulation)
|
||||
{
|
||||
void BRepGProp::VolumeProperties(const TopoDS_Shape& S, GProp_GProps& Props, const Standard_Boolean OnlyClosed, const Standard_Boolean SkipShared){
|
||||
// find the origin
|
||||
gp_Pnt P(0,0,0); P.Transform(S.Location());
|
||||
Props = GProp_GProps(P);
|
||||
@@ -327,9 +240,9 @@ void BRepGProp::VolumeProperties(const TopoDS_Shape& S, GProp_GProps& Props, co
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(BRep_Tool::IsClosed(Sh)) volumeProperties(Sh,Props,1.0,SkipShared, UseTriangulation);
|
||||
if(BRep_Tool::IsClosed(Sh)) volumeProperties(Sh,Props,1.0,SkipShared);
|
||||
}
|
||||
} else volumeProperties(S,Props,1.0,SkipShared, UseTriangulation);
|
||||
} else volumeProperties(S,Props,1.0,SkipShared);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -358,7 +271,7 @@ Standard_Real BRepGProp::VolumeProperties(const TopoDS_Shape& S, GProp_GProps& P
|
||||
continue;
|
||||
}
|
||||
if(BRep_Tool::IsClosed(Sh)) {
|
||||
Error = volumeProperties(Sh,Props,Eps,SkipShared, Standard_False);
|
||||
Error = volumeProperties(Sh,Props,Eps,SkipShared);
|
||||
if(ErrorMax < Error) {
|
||||
ErrorMax = Error;
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -367,7 +280,7 @@ Standard_Real BRepGProp::VolumeProperties(const TopoDS_Shape& S, GProp_GProps& P
|
||||
}
|
||||
}
|
||||
}
|
||||
} else ErrorMax = volumeProperties(S,Props,Eps,SkipShared, Standard_False);
|
||||
} else ErrorMax = volumeProperties(S,Props,Eps,SkipShared);
|
||||
#ifdef OCCT_DEBUG
|
||||
if(AffichEps) cout<<"\n\n==================="<<iErrorMax<<":\tMaxEpsVolume = "<<ErrorMax<<"\n";
|
||||
#endif
|
||||
|
@@ -23,8 +23,6 @@
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColgp_Array1OfXYZ.hxx>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class GProp_GProps;
|
||||
class gp_Pln;
|
||||
@@ -37,7 +35,6 @@ class BRepGProp_Vinert;
|
||||
class BRepGProp_VinertGK;
|
||||
class BRepGProp_UFunction;
|
||||
class BRepGProp_TFunction;
|
||||
class gp_XYZ;
|
||||
|
||||
|
||||
//! Provides global functions to compute a shape's global
|
||||
@@ -88,19 +85,10 @@ public:
|
||||
//! No check is performed to verify that the shape S
|
||||
//! retains truly linear properties. If S is simply a vertex, it
|
||||
//! is not considered to present any additional global properties.
|
||||
//! SkipShared is a special flag, which allows taking in calculation
|
||||
//! shared topological entities or not.
|
||||
//! For ex., if SkipShared = True, edges, shared by two or more faces,
|
||||
//! are taken into calculation only once.
|
||||
//! If we have cube with sizes 1, 1, 1, its linear properties = 12
|
||||
//! for SkipEdges = true and 24 for SkipEdges = false.
|
||||
//! UseTriangulation is a special flag, which defines preferable
|
||||
//! source of geometry data. If UseTriangulation = Standard_False,
|
||||
//! exact geometry objects (curves) are used, otherwise polygons of
|
||||
//! triangulation are used first.
|
||||
Standard_EXPORT static void LinearProperties(const TopoDS_Shape& S, GProp_GProps& LProps,
|
||||
const Standard_Boolean SkipShared = Standard_False,
|
||||
const Standard_Boolean UseTriangulation = Standard_False);
|
||||
//! SkipShared is special flag, which allows to take in calculation shared topological entities or not
|
||||
//! For ex., if SkipShared = True, edges, shared by two or more faces, are taken into calculation only once.
|
||||
//! If we have cube with sizes 1, 1, 1, its linear properties = 12 for SkipEdges = true and 24 for SkipEdges = false.
|
||||
Standard_EXPORT static void LinearProperties (const TopoDS_Shape& S, GProp_GProps& LProps, const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
//! Computes the surface global properties of the
|
||||
//! shape S, i.e. the global properties induced by each
|
||||
@@ -134,17 +122,9 @@ public:
|
||||
//! retains truly surface properties. If S is simply a
|
||||
//! vertex, an edge or a wire, it is not considered to
|
||||
//! present any additional global properties.
|
||||
//! SkipShared is a special flag, which allows taking in calculation
|
||||
//! shared topological entities or not.
|
||||
//! For ex., if SkipShared = True, faces, shared by two or more shells,
|
||||
//! are taken into calculation only once.
|
||||
//! UseTriangulation is a special flag, which defines preferable
|
||||
//! source of geometry data. If UseTriangulation = Standard_False,
|
||||
//! exact geometry objects (surfaces) are used,
|
||||
//! otherwise face triangulations are used first.
|
||||
Standard_EXPORT static void SurfaceProperties(const TopoDS_Shape& S, GProp_GProps& SProps,
|
||||
const Standard_Boolean SkipShared = Standard_False,
|
||||
const Standard_Boolean UseTriangulation = Standard_False);
|
||||
//! SkipShared is special flag, which allows to take in calculation shared topological entities or not
|
||||
//! For ex., if SkipShared = True, faces, shared by two or more shells, are taken into calculation only once.
|
||||
Standard_EXPORT static void SurfaceProperties (const TopoDS_Shape& S, GProp_GProps& SProps, const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
//! Updates <SProps> with the shape <S>, that contains its pricipal properties.
|
||||
//! The surface properties of all the faces in <S> are computed.
|
||||
@@ -154,12 +134,9 @@ public:
|
||||
//! for two successive steps of adaptive integration.
|
||||
//! Method returns estimation of relative error reached for whole shape.
|
||||
//! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
|
||||
//! SkipShared is a special flag, which allows taking in calculation
|
||||
//! shared topological entities or not
|
||||
//! For ex., if SkipShared = True, faces, shared by two or more shells,
|
||||
//! are taken into calculation only once.
|
||||
Standard_EXPORT static Standard_Real SurfaceProperties (const TopoDS_Shape& S, GProp_GProps& SProps,
|
||||
const Standard_Real Eps, const Standard_Boolean SkipShared = Standard_False);
|
||||
//! SkipShared is special flag, which allows to take in calculation shared topological entities or not
|
||||
//! For ex., if SkipShared = True, faces, shared by two or more shells, are taken into calculation only once.
|
||||
Standard_EXPORT static Standard_Real SurfaceProperties (const TopoDS_Shape& S, GProp_GProps& SProps, const Standard_Real Eps, const Standard_Boolean SkipShared = Standard_False);
|
||||
//!
|
||||
//! Computes the global volume properties of the solid
|
||||
//! S, and brings them together with the global
|
||||
@@ -193,19 +170,9 @@ public:
|
||||
//! exempt of any free boundary. Note that these
|
||||
//! conditions of coherence are not checked by this
|
||||
//! algorithm, and results will be false if they are not respected.
|
||||
//! SkipShared a is special flag, which allows taking in calculation
|
||||
//! shared topological entities or not.
|
||||
//! For ex., if SkipShared = True, the volumes formed by the equal
|
||||
//! (the same TShape, location and orientation) faces are taken
|
||||
//! into calculation only once.
|
||||
//! UseTriangulation is a special flag, which defines preferable
|
||||
//! source of geometry data. If UseTriangulation = Standard_False,
|
||||
//! exact geometry objects (surfaces) are used,
|
||||
//! otherwise face triangulations are used first.
|
||||
Standard_EXPORT static void VolumeProperties(const TopoDS_Shape& S, GProp_GProps& VProps,
|
||||
const Standard_Boolean OnlyClosed = Standard_False,
|
||||
const Standard_Boolean SkipShared = Standard_False,
|
||||
const Standard_Boolean UseTriangulation = Standard_False);
|
||||
//! SkipShared is special flag, which allows to take in calculation shared topological entities or not
|
||||
//! For ex., if SkipShared = True, the volumes formed by the equal (the same TShape, location and orientation) faces are taken into calculation only once.
|
||||
Standard_EXPORT static void VolumeProperties (const TopoDS_Shape& S, GProp_GProps& VProps, const Standard_Boolean OnlyClosed = Standard_False, const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
//! Updates <VProps> with the shape <S>, that contains its pricipal properties.
|
||||
//! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
|
||||
@@ -216,14 +183,9 @@ public:
|
||||
//! for two successive steps of adaptive integration.
|
||||
//! Method returns estimation of relative error reached for whole shape.
|
||||
//! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
|
||||
//! SkipShared is a special flag, which allows taking in calculation shared
|
||||
//! topological entities or not.
|
||||
//! For ex., if SkipShared = True, the volumes formed by the equal
|
||||
//! (the same TShape, location and orientation)
|
||||
//! faces are taken into calculation only once.
|
||||
Standard_EXPORT static Standard_Real VolumeProperties (const TopoDS_Shape& S, GProp_GProps& VProps,
|
||||
const Standard_Real Eps, const Standard_Boolean OnlyClosed = Standard_False,
|
||||
const Standard_Boolean SkipShared = Standard_False);
|
||||
//! SkipShared is special flag, which allows to take in calculation shared topological entities or not
|
||||
//! For ex., if SkipShared = True, the volumes formed by the equal (the same TShape, location and orientation) faces are taken into calculation only once.
|
||||
Standard_EXPORT static Standard_Real VolumeProperties (const TopoDS_Shape& S, GProp_GProps& VProps, const Standard_Real Eps, const Standard_Boolean OnlyClosed = Standard_False, const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
//! Updates <VProps> with the shape <S>, that contains its pricipal properties.
|
||||
//! The volume properties of all the FORWARD and REVERSED faces in <S> are computed.
|
||||
@@ -236,27 +198,13 @@ public:
|
||||
//! that is used for properties computation.
|
||||
//! Method returns estimation of relative error reached for whole shape.
|
||||
//! Returns negative value if the computation is failed.
|
||||
//! SkipShared is a special flag, which allows taking in calculation
|
||||
//! shared topological entities or not.
|
||||
//! For ex., if SkipShared = True, the volumes formed by the equal
|
||||
//! (the same TShape, location and orientation) faces are taken into calculation only once.
|
||||
Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S,
|
||||
GProp_GProps& VProps,
|
||||
const Standard_Real Eps = 0.001,
|
||||
const Standard_Boolean OnlyClosed = Standard_False,
|
||||
const Standard_Boolean IsUseSpan = Standard_False,
|
||||
const Standard_Boolean CGFlag = Standard_False,
|
||||
const Standard_Boolean IFlag = Standard_False,
|
||||
const Standard_Boolean SkipShared = Standard_False);
|
||||
//! SkipShared is special flag, which allows to take in calculation shared topological entities or not
|
||||
//! For ex., if SkipShared = True, the volumes formed by the equal (the same TShape, location and orientation) faces are taken into calculation only once.
|
||||
Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S, GProp_GProps& VProps, const Standard_Real Eps = 0.001, const Standard_Boolean OnlyClosed = Standard_False, const Standard_Boolean IsUseSpan = Standard_False, const Standard_Boolean CGFlag = Standard_False, const Standard_Boolean IFlag = Standard_False, const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S,
|
||||
GProp_GProps& VProps,
|
||||
const gp_Pln& thePln, const Standard_Real Eps = 0.001,
|
||||
const Standard_Boolean OnlyClosed = Standard_False,
|
||||
const Standard_Boolean IsUseSpan = Standard_False,
|
||||
const Standard_Boolean CGFlag = Standard_False,
|
||||
const Standard_Boolean IFlag = Standard_False,
|
||||
const Standard_Boolean SkipShared = Standard_False);
|
||||
Standard_EXPORT static Standard_Real VolumePropertiesGK (const TopoDS_Shape& S, GProp_GProps& VProps, const gp_Pln& thePln, const Standard_Real Eps = 0.001, const Standard_Boolean OnlyClosed = Standard_False, const Standard_Boolean IsUseSpan = Standard_False, const Standard_Boolean CGFlag = Standard_False, const Standard_Boolean IFlag = Standard_False, const Standard_Boolean SkipShared = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -1,236 +0,0 @@
|
||||
// Copyright (c) 2018 OPEN CASCADE SAS
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRepGProp_MeshCinert.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <math.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepGProp_MeshCinert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepGProp_MeshCinert::BRepGProp_MeshCinert()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepGProp_MeshCinert::SetLocation(const gp_Pnt& CLocation)
|
||||
{
|
||||
loc = CLocation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepGProp_MeshCinert::Perform(const TColgp_Array1OfPnt& theNodes)
|
||||
{
|
||||
|
||||
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
|
||||
dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
|
||||
|
||||
Standard_Integer Order = 2;
|
||||
|
||||
Standard_Real ds;
|
||||
Standard_Real ur, um, u;
|
||||
Standard_Real x, y, z;
|
||||
Standard_Real xloc, yloc, zloc;
|
||||
Standard_Real Upper;
|
||||
gp_XYZ P, D;
|
||||
|
||||
math_Vector GaussP (1, Order);
|
||||
math_Vector GaussW (1, Order);
|
||||
|
||||
math::GaussPoints (Order,GaussP);
|
||||
math::GaussWeights (Order,GaussW);
|
||||
|
||||
Standard_Integer nIndex = 0;
|
||||
|
||||
for(nIndex = 1; nIndex < theNodes.Length(); nIndex++)
|
||||
{
|
||||
const gp_XYZ& aP1 = theNodes(nIndex).XYZ();
|
||||
const gp_XYZ& aP2 = theNodes(nIndex + 1).XYZ();
|
||||
Standard_Real dimLocal, IxLocal, IyLocal, IzLocal, IxxLocal, IyyLocal, IzzLocal, IxyLocal, IxzLocal, IyzLocal;
|
||||
dimLocal = IxLocal = IyLocal = IzLocal = IxxLocal = IyyLocal = IzzLocal = IxyLocal = IxzLocal = IyzLocal = 0.0;
|
||||
|
||||
loc.Coord (xloc, yloc, zloc);
|
||||
|
||||
Standard_Integer i;
|
||||
|
||||
Upper = (aP2 - aP1).Modulus();
|
||||
if (Upper < gp::Resolution())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
um = 0.5 * Upper;
|
||||
ur =um;
|
||||
D = (aP2 - aP1) / Upper;
|
||||
|
||||
for (i = 1; i <= Order; i++) {
|
||||
u = um + ur * GaussP (i);
|
||||
P = aP1 + u * D;
|
||||
P.Coord (x, y, z);
|
||||
x -= xloc;
|
||||
y -= yloc;
|
||||
z -= zloc;
|
||||
ds = GaussW (i);
|
||||
dimLocal += ds;
|
||||
IxLocal += x * ds;
|
||||
IyLocal += y * ds;
|
||||
IzLocal += z * ds;
|
||||
IxyLocal += x * y * ds;
|
||||
IyzLocal += y * z * ds;
|
||||
IxzLocal += x * z * ds;
|
||||
x *= x;
|
||||
y *= y;
|
||||
z *= z;
|
||||
IxxLocal += (y + z) * ds;
|
||||
IyyLocal += (x + z) * ds;
|
||||
IzzLocal += (x + y) * ds;
|
||||
}
|
||||
|
||||
dimLocal *= ur;
|
||||
IxLocal *= ur;
|
||||
IyLocal *= ur;
|
||||
IzLocal *= ur;
|
||||
IxxLocal *= ur;
|
||||
IyyLocal *= ur;
|
||||
IzzLocal *= ur;
|
||||
IxyLocal *= ur;
|
||||
IxzLocal *= ur;
|
||||
IyzLocal *= ur;
|
||||
|
||||
dim += dimLocal;
|
||||
Ix += IxLocal;
|
||||
Iy += IyLocal;
|
||||
Iz += IzLocal;
|
||||
Ixx += IxxLocal;
|
||||
Iyy += IyyLocal;
|
||||
Izz += IzzLocal;
|
||||
Ixy += IxyLocal;
|
||||
Ixz += IxzLocal;
|
||||
Iyz += IyzLocal;
|
||||
}
|
||||
|
||||
inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz),
|
||||
gp_XYZ (-Ixy, Iyy, -Iyz),
|
||||
gp_XYZ (-Ixz, -Iyz, Izz));
|
||||
|
||||
if (Abs(dim) < gp::Resolution())
|
||||
g = P;
|
||||
else
|
||||
g.SetCoord (Ix/dim, Iy/dim, Iz/dim);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PreparePolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepGProp_MeshCinert::PreparePolygon(const TopoDS_Edge& theE,
|
||||
Handle(TColgp_HArray1OfPnt)& thePolyg)
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
const Handle(Poly_Polygon3D)& aPolyg = BRep_Tool::Polygon3D(theE, aLoc);
|
||||
if (!aPolyg.IsNull())
|
||||
{
|
||||
const TColgp_Array1OfPnt& aNodes = aPolyg->Nodes();
|
||||
thePolyg = new TColgp_HArray1OfPnt(1, aNodes.Length());
|
||||
Standard_Integer i;
|
||||
if (aLoc.IsIdentity())
|
||||
{
|
||||
for (i = 1; i <= aNodes.Length(); ++i)
|
||||
{
|
||||
thePolyg->SetValue(i, aNodes(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const gp_Trsf& aTr = aLoc.Transformation();
|
||||
for (i = 1; i <= aNodes.Length(); ++i)
|
||||
{
|
||||
thePolyg->SetValue(i, aNodes.Value(i).Transformed(aTr));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Try to get PolygonOnTriangulation
|
||||
Handle(Poly_Triangulation) aTri;
|
||||
Handle(Poly_PolygonOnTriangulation) aPOnTri;
|
||||
BRep_Tool::PolygonOnTriangulation(theE, aPOnTri, aTri, aLoc);
|
||||
if (!aPOnTri.IsNull())
|
||||
{
|
||||
Standard_Integer aNbNodes = aPOnTri->NbNodes();
|
||||
thePolyg = new TColgp_HArray1OfPnt(1, aNbNodes);
|
||||
const TColStd_Array1OfInteger& aNodeInds = aPOnTri->Nodes();
|
||||
const TColgp_Array1OfPnt& aNodes = aTri->Nodes();
|
||||
Standard_Integer i;
|
||||
if (aLoc.IsIdentity())
|
||||
{
|
||||
for (i = 1; i <= aNbNodes; ++i)
|
||||
{
|
||||
thePolyg->SetValue(i, aNodes(aNodeInds(i)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const gp_Trsf& aTr = aLoc.Transformation();
|
||||
for (i = 1; i <= aNbNodes; ++i)
|
||||
{
|
||||
thePolyg->SetValue(i, aNodes.Value(aNodeInds(i)).Transformed(aTr));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
//
|
||||
//Try to get Polygon2D on Surface
|
||||
Handle(Poly_Polygon2D) aPolyg2D;
|
||||
Handle(Geom_Surface) aS;
|
||||
BRep_Tool::PolygonOnSurface(theE, aPolyg2D, aS, aLoc);
|
||||
if (!aPolyg2D.IsNull())
|
||||
{
|
||||
Standard_Integer aNbNodes = aPolyg2D->NbNodes();
|
||||
thePolyg = new TColgp_HArray1OfPnt(1, aNbNodes);
|
||||
const TColgp_Array1OfPnt2d& aNodes2D = aPolyg2D->Nodes();
|
||||
Standard_Integer i;
|
||||
if (aLoc.IsIdentity())
|
||||
{
|
||||
for (i = 1; i <= aNbNodes; ++i)
|
||||
{
|
||||
const gp_Pnt2d& aP2d = aNodes2D(i);
|
||||
gp_Pnt aP = aS->Value(aP2d.X(), aP2d.Y());
|
||||
thePolyg->SetValue(i, aP);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const gp_Trsf& aTr = aLoc.Transformation();
|
||||
for (i = 1; i <= aNbNodes; ++i)
|
||||
{
|
||||
const gp_Pnt2d& aP2d = aNodes2D(i);
|
||||
gp_Pnt aP = aS->Value(aP2d.X(), aP2d.Y());
|
||||
aP.Transform(aTr);
|
||||
thePolyg->SetValue(i, aP);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
@@ -1,67 +0,0 @@
|
||||
// Copyright (c) 2018 OPEN CASCADE SAS
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepGProp_MeshCinert_HeaderFile
|
||||
#define _BRepGProp_MeshCinert_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
class gp_Pnt;
|
||||
class TopoDS_Edge;
|
||||
|
||||
|
||||
|
||||
//! Computes the global properties of
|
||||
//! of polylines represented by set of points.
|
||||
//! This class is used for computation of global
|
||||
//! properties of edge, which has no exact geometry
|
||||
//! (3d or 2d curve), but has any of allowed
|
||||
//! polygons.
|
||||
//!
|
||||
class BRepGProp_MeshCinert : public GProp_GProps
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BRepGProp_MeshCinert();
|
||||
|
||||
Standard_EXPORT void SetLocation (const gp_Pnt& CLocation);
|
||||
|
||||
//! Computes the global properties of
|
||||
//! of polylines represented by set of points.
|
||||
Standard_EXPORT void Perform(const TColgp_Array1OfPnt& theNodes);
|
||||
|
||||
//! Prepare set of 3d points on base of any available edge polygons:
|
||||
//! 3D polygon, polygon on triangulation, 2d polygon on surface
|
||||
//! If edge has no polygons, array thePolyg is left unchanged
|
||||
Standard_EXPORT static void PreparePolygon(const TopoDS_Edge& theE, Handle(TColgp_HArray1OfPnt)& thePolyg);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepGProp_MeshCinert_HeaderFile
|
@@ -1,291 +0,0 @@
|
||||
// Copyright (c) 2018 OPEN CASCADE SAS
|
||||
// This file is part of commercial software by OPEN CASCADE SAS,
|
||||
// furnished in accordance with the terms and conditions of the contract
|
||||
// and with the inclusion of this copyright notice.
|
||||
// This file or any part thereof may not be provided or otherwise
|
||||
// made available to any third party.
|
||||
//
|
||||
// No ownership title to the software is transferred hereby.
|
||||
//
|
||||
// OPEN CASCADE SAS makes no representation or warranties with respect to the
|
||||
// performance of this software, and specifically disclaims any responsibility
|
||||
// for any damages, special or consequential, connected with its use.
|
||||
|
||||
#include <BRepGProp_MeshProps.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Poly_Triangle.hxx>
|
||||
#include<ElSLib.hxx>
|
||||
#include<gp_Ax3.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <GProp.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : CalculateElSProps
|
||||
//purpose : Calculate one Gauss point for surface properties
|
||||
// of triangle p1, p2, p3
|
||||
// relatively point Apex
|
||||
//=======================================================================
|
||||
static void CalculateElSProps(const Standard_Real x,
|
||||
const Standard_Real y,
|
||||
const Standard_Real z, const Standard_Real ds, Standard_Real* GProps)
|
||||
{
|
||||
//GProps[0] = Volume
|
||||
// Static moments of inertia.
|
||||
//GProps[1] = Ix, GProps[2] = Iy, GProps[3] = Iz
|
||||
//Matrix of moments of inertia.
|
||||
//GProps[4] = Ixx, GProps[5] = Iyy, GProps[6] = Izz,
|
||||
//GProps[7] = Ixy, aGProps[8] = Ixz, GProps[9] = Iyz,
|
||||
//
|
||||
Standard_Real x2, y2, z2;
|
||||
x2 = x * x;
|
||||
y2 = y * y;
|
||||
z2 = z * z;
|
||||
|
||||
GProps[0] += ds; //Area
|
||||
GProps[1] += x * ds; //Ix
|
||||
GProps[2] += y * ds; //Iy
|
||||
GProps[3] += z * ds; //Iz
|
||||
//
|
||||
GProps[7] += x * y * ds; //Ixy
|
||||
GProps[8] += x * z * ds; //Ixz
|
||||
GProps[9] += y * z * ds; //Iyz
|
||||
GProps[4] += (y2 + z2) * ds; //Ixx
|
||||
GProps[5] += (x2 + z2) * ds; //Iyy
|
||||
GProps[6] += (x2 + y2) * ds; //Izz
|
||||
}
|
||||
//=======================================================================
|
||||
//function : CalculateElVProps
|
||||
//purpose : Calculate one Gauss point for volume properties of pyramid,
|
||||
// based on triangle p1, p2, p3 with apex Apex
|
||||
//=======================================================================
|
||||
static void CalculateElVProps(const Standard_Real x,
|
||||
const Standard_Real y,
|
||||
const Standard_Real z, const Standard_Real dv, Standard_Real* GProps)
|
||||
{
|
||||
Standard_Real x2, y2, z2;
|
||||
x2 = x * x;
|
||||
y2 = y * y;
|
||||
z2 = z * z;
|
||||
GProps[0] += dv / 3.0; //Volume
|
||||
GProps[1] += 0.25 * x * dv; //Ix
|
||||
GProps[2] += 0.25 * y * dv; //Iy
|
||||
GProps[3] += 0.25 * z * dv; //Iz
|
||||
Standard_Real dv1 = 0.2 * dv;
|
||||
GProps[7] += x * y * dv1; //Ixy
|
||||
GProps[8] += x * z * dv1; //Ixz
|
||||
GProps[9] += y * z * dv1; //Iyz
|
||||
GProps[4] += (y2 + z2) * dv1; //Ixx
|
||||
GProps[5] += (x2 + z2) * dv1; //Iyy
|
||||
GProps[6] += (x2 + y2) * dv1; //Izz
|
||||
}
|
||||
//=======================================================================
|
||||
//function : CalculateProps
|
||||
//purpose : Calculate global surface properties of triangle
|
||||
// or volume properties of pyramid, based on triangle
|
||||
// p1, p2, p3 with apex Apex by Gauss integration over triangle area.
|
||||
//=======================================================================
|
||||
void BRepGProp_MeshProps::CalculateProps(const gp_Pnt& p1, const gp_Pnt& p2,
|
||||
const gp_Pnt& p3,
|
||||
const gp_Pnt& Apex,
|
||||
const Standard_Boolean isVolume,
|
||||
Standard_Real GProps[10],
|
||||
const Standard_Integer NbGaussPoints,
|
||||
const Standard_Real* GaussPnts)
|
||||
{
|
||||
//GProps[0] = Volume
|
||||
// Static moments of inertia.
|
||||
//GProps[1] = Ix, GProps[2] = Iy, GProps[3] = Iz
|
||||
//Matrix of moments of inertia.
|
||||
//GProps[4] = Ixx, GProps[5] = Iyy, GProps[6] = Izz,
|
||||
//GProps[7] = Ixy, aGProps[8] = Ixz, GProps[9] = Iyz,
|
||||
//
|
||||
|
||||
//Define plane and coordinates of triangle nodes on plane
|
||||
gp_Vec aV12(p2, p1);
|
||||
gp_Vec aV23(p3, p2);
|
||||
gp_Vec aNorm = aV12 ^ aV23;
|
||||
Standard_Real aDet = aNorm.Magnitude();
|
||||
if (aDet <= gp::Resolution())
|
||||
{
|
||||
return;
|
||||
}
|
||||
gp_XYZ aCenter = (p1.XYZ() + p2.XYZ() + p3.XYZ()) / 3.;
|
||||
gp_Pnt aPC(aCenter);
|
||||
gp_Dir aDN(aNorm);
|
||||
gp_Ax3 aPosPln(aPC, aDN);
|
||||
//Coordinates of nodes on plane
|
||||
Standard_Real x1, y1, x2, y2, x3, y3;
|
||||
ElSLib::PlaneParameters(aPosPln, p1, x1, y1);
|
||||
ElSLib::PlaneParameters(aPosPln, p2, x2, y2);
|
||||
ElSLib::PlaneParameters(aPosPln, p3, x3, y3);
|
||||
//
|
||||
Standard_Real l1, l2; //barycentriche coordinates
|
||||
Standard_Real x, y, z;
|
||||
Standard_Real w; //weight
|
||||
Standard_Integer i;
|
||||
for (i = 0; i < NbGaussPoints; ++i)
|
||||
{
|
||||
Standard_Integer ind = 3 * i;
|
||||
l1 = GaussPnts[ind];
|
||||
l2 = GaussPnts[ind + 1];
|
||||
w = GaussPnts[ind + 2];
|
||||
w *= aDet;
|
||||
x = l1*(x1 - x3) + l2*(x2 - x3) + x3;
|
||||
y = l1*(y1 - y3) + l2*(y2 - y3) + y3;
|
||||
gp_Pnt aP = ElSLib::PlaneValue(x, y, aPosPln);
|
||||
x = aP.X() - Apex.X();
|
||||
y = aP.Y() - Apex.Y();
|
||||
z = aP.Z() - Apex.Z();
|
||||
//
|
||||
if (isVolume)
|
||||
{
|
||||
Standard_Real xn = aDN.X() * w;
|
||||
Standard_Real yn = aDN.Y() * w;
|
||||
Standard_Real zn = aDN.Z() * w;
|
||||
Standard_Real dv = x * xn + y * yn + z * zn;
|
||||
CalculateElVProps(x, y, z, dv, GProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real ds = w;
|
||||
CalculateElSProps(x, y, z, ds, GProps);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepGProp_MeshProps::Perform(const Handle(Poly_Triangulation)& theMesh,
|
||||
const TopLoc_Location& theLoc,
|
||||
const TopAbs_Orientation theOri)
|
||||
{
|
||||
if (theLoc.IsIdentity())
|
||||
{
|
||||
Perform(theMesh->Nodes(), theMesh->Triangles(), theOri);
|
||||
}
|
||||
else
|
||||
{
|
||||
const gp_Trsf& aTr = theLoc.Transformation();
|
||||
//
|
||||
Standard_Boolean isToCopy = aTr.ScaleFactor()*aTr.HVectorialPart().Determinant() < 0. ||
|
||||
Abs(Abs(aTr.ScaleFactor()) - 1.) > gp::Resolution();
|
||||
if (isToCopy)
|
||||
{
|
||||
TColgp_Array1OfPnt aNodes(1, theMesh->NbNodes());
|
||||
const TColgp_Array1OfPnt& aMeshNodes = theMesh->Nodes();
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= aMeshNodes.Length(); ++i)
|
||||
{
|
||||
aNodes(i) = aMeshNodes.Value(i).Transformed(aTr);
|
||||
}
|
||||
Perform(aNodes, theMesh->Triangles(), theOri);
|
||||
return;
|
||||
}
|
||||
//
|
||||
gp_Trsf aTrInv = aTr.Inverted();
|
||||
gp_Pnt loc_save = loc;
|
||||
loc.Transform(aTrInv);
|
||||
Perform(theMesh->Nodes(), theMesh->Triangles(), theOri);
|
||||
//Computes the inertia tensor at mesh gravity center
|
||||
gp_Mat HMat, inertia0;
|
||||
gp_Pnt g0 = g;
|
||||
g.SetXYZ(g.XYZ() + loc.XYZ());
|
||||
if (g0.XYZ().Modulus() > gp::Resolution())
|
||||
{
|
||||
GProp::HOperator(g, loc, dim, HMat);
|
||||
inertia0 = inertia - HMat;
|
||||
}
|
||||
else
|
||||
{
|
||||
inertia0 = inertia;
|
||||
}
|
||||
//Transform inertia tensor for rotation
|
||||
gp_Mat HVec = aTrInv.HVectorialPart();
|
||||
gp_Mat HVecT = HVec.Transposed();
|
||||
HVecT.Multiply(inertia0);
|
||||
inertia0 = HVecT.Multiplied(HVec);
|
||||
//Put gravity center in true position of mesh
|
||||
g.Transform(aTr);
|
||||
g0 = g;
|
||||
g.SetXYZ(g.XYZ() - loc_save.XYZ());
|
||||
loc = loc_save;
|
||||
//
|
||||
//Computes the inertia tensor for loc
|
||||
GProp::HOperator(g0, loc, dim, HMat);
|
||||
inertia = inertia0 + HMat;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepGProp_MeshProps::Perform(const TColgp_Array1OfPnt& theNodes,
|
||||
const Poly_Array1OfTriangle& theTriangles,
|
||||
const TopAbs_Orientation theOri)
|
||||
{
|
||||
//
|
||||
// Gauss points for barycentriche coordinates
|
||||
static const Standard_Real GPtsWg[] =
|
||||
{ 1. / 6., 1. / 6., 1. / 6., /*3 points*/
|
||||
2. / 3., 1. / 6., 1. / 6.,
|
||||
1. / 6., 2. / 3., 1. / 6. };
|
||||
//
|
||||
Standard_Integer aNbGaussPoints = 3;
|
||||
|
||||
// Array to store global properties
|
||||
Standard_Real aGProps[10] = { 0., 0., 0., 0., 0., 0., 0., 0., 0., 0 };
|
||||
//aGProps[0] = Volume
|
||||
// Static moments of inertia.
|
||||
//aGProps[1] = Ix, aGProps[2] = Iy, aGProps[3] = Iz
|
||||
//Matrix of moments of inertia.
|
||||
//aGProps[4] = Ixx, aGProps[5] = Iyy, aGProps[6] = Izz,
|
||||
//aGProps[7] = Ixy, aGProps[8] = Ixz, aGProps[9] = Iyz,
|
||||
|
||||
Standard_Boolean isVolume = myType == Vinert;
|
||||
Standard_Integer i;
|
||||
Standard_Integer n1, n2, n3; //node indeces
|
||||
for (i = theTriangles.Lower(); i <= theTriangles.Upper(); ++i)
|
||||
{
|
||||
const Poly_Triangle& aTri = theTriangles(i);
|
||||
aTri.Get(n1, n2, n3);
|
||||
if (theOri == TopAbs_REVERSED)
|
||||
{
|
||||
Standard_Integer nn = n2;
|
||||
n2 = n3;
|
||||
n3 = nn;
|
||||
}
|
||||
// Calculate properties of a pyramid built on face and apex
|
||||
const gp_Pnt& p1 = theNodes(n1);
|
||||
const gp_Pnt& p2 = theNodes(n2);
|
||||
const gp_Pnt& p3 = theNodes(n3);
|
||||
CalculateProps(p1, p2, p3, loc, isVolume, aGProps, aNbGaussPoints, GPtsWg);
|
||||
}
|
||||
|
||||
dim = aGProps[0];
|
||||
if (Abs(dim) >= 1.e-20) //To be consistent with GProp_GProps
|
||||
{
|
||||
g.SetX(aGProps[1] / dim);
|
||||
g.SetY(aGProps[2] / dim);
|
||||
g.SetZ(aGProps[3] / dim);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.SetX(aGProps[1]);
|
||||
g.SetY(aGProps[2]);
|
||||
g.SetZ(aGProps[3]);
|
||||
}
|
||||
inertia(1, 1) = aGProps[4];
|
||||
inertia(1, 2) = -aGProps[7];
|
||||
inertia(1, 3) = -aGProps[8];
|
||||
inertia(2, 1) = -aGProps[7];
|
||||
inertia(2, 2) = aGProps[5];
|
||||
inertia(2, 3) = -aGProps[9];
|
||||
inertia(3, 1) = -aGProps[8];
|
||||
inertia(3, 2) = -aGProps[9];
|
||||
inertia(3, 3) = aGProps[6];
|
||||
}
|
@@ -1,90 +0,0 @@
|
||||
// Copyright (c) 2018 OPEN CASCADE SAS
|
||||
// This file is part of commercial software by OPEN CASCADE SAS,
|
||||
// furnished in accordance with the terms and conditions of the contract
|
||||
// and with the inclusion of this copyright notice.
|
||||
// This file or any part thereof may not be provided or otherwise
|
||||
// made available to any third party.
|
||||
//
|
||||
// No ownership title to the software is transferred hereby.
|
||||
//
|
||||
// OPEN CASCADE SAS makes no representation or warranties with respect to the
|
||||
// performance of this software, and specifically disclaims any responsibility
|
||||
// for any damages, special or consequential, connected with its use.
|
||||
|
||||
#ifndef _BRepGProp_MeshProps_HeaderFile
|
||||
#define _BRepGProp_MeshProps_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <Poly_Array1OfTriangle.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
class Poly_Triangulation;
|
||||
class TopLoc_Location;
|
||||
class gp_Pnt;
|
||||
|
||||
|
||||
//! Computes the global properties of a surface mesh. The mesh can be
|
||||
//! interpreted as just a surface or as a piece of volume limited by this surface.
|
||||
class BRepGProp_MeshProps : public GProp_GProps
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Describes types of geometric objects.
|
||||
//! - Vinert is 3D closed region of space delimited with
|
||||
//! Point and surface mesh;
|
||||
//! - Sinert is surface mesh in 3D space.
|
||||
typedef enum { Vinert = 0, Sinert } BRepGProp_MeshObjType;
|
||||
|
||||
//! Constructor takes the type of object.
|
||||
BRepGProp_MeshProps(const BRepGProp_MeshObjType theType) :
|
||||
myType(theType)
|
||||
{}
|
||||
|
||||
//! Sets the point relative which the calculation is to be done
|
||||
void SetLocation(const gp_Pnt& theLocation) { loc = theLocation; }
|
||||
|
||||
//! Computes the global properties of a surface mesh of 3D space.
|
||||
//! Calculation of surface properties is performed by numerical integration
|
||||
//! over triangle surfaces using Gauss cubature formulas.
|
||||
//! Depending on the mesh object type used in constructor this method can
|
||||
//! calculate the surface or volume properties of the mesh.
|
||||
Standard_EXPORT void Perform(const Handle(Poly_Triangulation)& theMesh,
|
||||
const TopLoc_Location& theLoc,
|
||||
const TopAbs_Orientation theOri);
|
||||
|
||||
Standard_EXPORT void Perform(const TColgp_Array1OfPnt& theNodes,
|
||||
const Poly_Array1OfTriangle& theTriangles,
|
||||
const TopAbs_Orientation theOri);
|
||||
|
||||
//! Computes the global properties of triangle {p1, p2, p3} relatively
|
||||
//! point Apex
|
||||
//! If isVolume = true, volume properties are calculated
|
||||
//! otherwise - surface ones
|
||||
Standard_EXPORT static void CalculateProps(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3,
|
||||
const gp_Pnt& Apex,
|
||||
const Standard_Boolean isVolume,
|
||||
Standard_Real GProps[10],
|
||||
const Standard_Integer NbGaussPoints,
|
||||
const Standard_Real* GaussPnts);
|
||||
|
||||
//! Get type of mesh object
|
||||
BRepGProp_MeshObjType GetMeshObjType() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
|
||||
private: //! @name private fields
|
||||
|
||||
|
||||
BRepGProp_MeshObjType myType; //!< Type of geometric object
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepGProp_MeshProps_HeaderFile
|
@@ -24,7 +24,3 @@ BRepGProp_Vinert.cxx
|
||||
BRepGProp_Vinert.hxx
|
||||
BRepGProp_VinertGK.cxx
|
||||
BRepGProp_VinertGK.hxx
|
||||
BRepGProp_MeshCinert.hxx
|
||||
BRepGProp_MeshCinert.cxx
|
||||
BRepGProp_MeshProps.hxx
|
||||
BRepGProp_MeshProps.cxx
|
||||
|
@@ -41,25 +41,16 @@ Standard_IMPORT Draw_Viewer dout;
|
||||
Standard_Integer props(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 2) {
|
||||
di << "Use: " << a[0] << " shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri]\n";
|
||||
di << "Compute properties of the shape, exact geometry (curves, surfaces) or\n";
|
||||
di << "some discrete data (polygons, triangulations) can be used for calculations\n";
|
||||
di << "Use: " << a[0] << " shape [epsilon] [c[losed]] [x y z] [-skip] [-full]\n";
|
||||
di << "Compute properties of the shape\n";
|
||||
di << "The epsilon, if given, defines relative precision of computation\n";
|
||||
di << "The \"closed\" flag, if present, do computation only closed shells of the shape\n";
|
||||
di << "The centroid coordinates will be put to DRAW variables x y z (if given)\n";
|
||||
di << "Shared entities will be take in account only one time in the skip mode\n";
|
||||
di << "All values are outputted with the full precision in the full mode.\n";
|
||||
di << "Preferable source of geometry data are triangulations in case if it exists, if the -tri key is used.\n";
|
||||
di << "If epsilon is given, exact geometry (curves, surfaces) are used for calculations independently of using key -tri\n\n";
|
||||
di << "All values are outputted with the full precision in the full mode.\n\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Boolean UseTriangulation = Standard_False;
|
||||
if (n >= 2 && strcmp(a[n - 1], "-tri") == 0)
|
||||
{
|
||||
UseTriangulation = Standard_True;
|
||||
--n;
|
||||
}
|
||||
Standard_Boolean isFullMode = Standard_False;
|
||||
if (n >= 2 && strcmp(a[n-1], "-full") == 0)
|
||||
{
|
||||
@@ -95,11 +86,11 @@ Standard_Integer props(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
}
|
||||
else {
|
||||
if (*a[0] == 'l')
|
||||
BRepGProp::LinearProperties(S, G, SkipShared, UseTriangulation);
|
||||
BRepGProp::LinearProperties(S,G,SkipShared);
|
||||
else if (*a[0] == 's')
|
||||
BRepGProp::SurfaceProperties(S, G, SkipShared, UseTriangulation);
|
||||
BRepGProp::SurfaceProperties(S,G,SkipShared);
|
||||
else
|
||||
BRepGProp::VolumeProperties(S,G,onlyClosed,SkipShared, UseTriangulation);
|
||||
BRepGProp::VolumeProperties(S,G,onlyClosed,SkipShared);
|
||||
}
|
||||
|
||||
gp_Pnt P = G.CentreOfMass();
|
||||
@@ -322,7 +313,6 @@ Standard_Integer vpropsgk(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GPropCommands
|
||||
//purpose :
|
||||
@@ -338,11 +328,11 @@ void BRepTest::GPropCommands(Draw_Interpretor& theCommands)
|
||||
|
||||
const char* g = "Global properties";
|
||||
theCommands.Add("lprops",
|
||||
"lprops name [x y z] [-skip] [-full] [-tri]: compute linear properties",
|
||||
"lprops name [x y z] [-skip] [-full] : compute linear properties",
|
||||
__FILE__, props, g);
|
||||
theCommands.Add("sprops", "sprops name [epsilon] [x y z] [-skip] [-full] [-tri]:\n"
|
||||
theCommands.Add("sprops", "sprops name [epsilon] [x y z] [-skip] [-full] :\n"
|
||||
" compute surfacic properties", __FILE__, props, g);
|
||||
theCommands.Add("vprops", "vprops name [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri]:\n"
|
||||
theCommands.Add("vprops", "vprops name [epsilon] [c[losed]] [x y z] [-skip] [-full] :\n"
|
||||
" compute volumic properties", __FILE__, props, g);
|
||||
|
||||
theCommands.Add("vpropsgk",
|
||||
|
@@ -827,43 +827,6 @@ void BRepTools::Clean(const TopoDS_Shape& theShape)
|
||||
aBuilder.UpdateEdge (aEdge, aNullPoly3d);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : CleanGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTools::CleanGeometry(const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
return;
|
||||
|
||||
BRep_Builder aBuilder;
|
||||
|
||||
for (TopExp_Explorer aFaceIt(theShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
|
||||
const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface(aFace, aLocation);
|
||||
|
||||
for (TopExp_Explorer aEdgeIt(aFace, TopAbs_EDGE); aEdgeIt.More(); aEdgeIt.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt.Current());
|
||||
aBuilder.UpdateEdge(anEdge, Handle(Geom2d_Curve)(), aSurface,
|
||||
aLocation, BRep_Tool::Tolerance(anEdge));
|
||||
}
|
||||
|
||||
aBuilder.UpdateFace(aFace, Handle(Geom_Surface)(), aFace.Location(), BRep_Tool::Tolerance(aFace));
|
||||
}
|
||||
|
||||
for (TopExp_Explorer aEdgeIt2(theShape, TopAbs_EDGE); aEdgeIt2.More(); aEdgeIt2.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt2.Current());
|
||||
|
||||
aBuilder.UpdateEdge(anEdge, Handle(Geom_Curve)(),
|
||||
TopLoc_Location(), BRep_Tool::Tolerance(anEdge));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveUnusedPCurves
|
||||
|
@@ -155,9 +155,6 @@ public:
|
||||
//! edges.
|
||||
Standard_EXPORT static void Clean (const TopoDS_Shape& S);
|
||||
|
||||
//! Removes geometry (curves and surfaces) from all edges and faces of the shape
|
||||
Standard_EXPORT static void CleanGeometry(const TopoDS_Shape& theShape);
|
||||
|
||||
//! Removes all the pcurves of the edges of <S> that
|
||||
//! refer to surfaces not belonging to any face of <S>
|
||||
Standard_EXPORT static void RemoveUnusedPCurves (const TopoDS_Shape& S);
|
||||
|
@@ -370,22 +370,11 @@ static Standard_Integer triangles(Draw_Interpretor& ,
|
||||
static Standard_Integer tclean(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n == 1) return 1;
|
||||
|
||||
Standard_Integer aStart = 1;
|
||||
Standard_Boolean toRemoveGeometry = Standard_False;
|
||||
if (strcmp(a[1], "-geom") == 0)
|
||||
{
|
||||
aStart++;
|
||||
toRemoveGeometry = Standard_True;
|
||||
}
|
||||
|
||||
for (Standard_Integer i = aStart; i < n; i++) {
|
||||
if (n < 1) return 1;
|
||||
|
||||
for (Standard_Integer i = 1; i < n; i++) {
|
||||
TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
if (toRemoveGeometry)
|
||||
BRepTools::CleanGeometry(S);
|
||||
else
|
||||
BRepTools::Clean(S);
|
||||
BRepTools::Clean(S);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1423,10 +1412,7 @@ void DBRep::BasicCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("hlr" ,"[no]hlr, rg1, rgn, hid, ang",__FILE__,hlr ,g);
|
||||
theCommands.Add("vori","vori [name1 ...], edges are colored by orientation (see vconn)",__FILE__,dispor,g);
|
||||
theCommands.Add("triangles", "triangles [name1]..., display triangles of shapes if exists",__FILE__, triangles, g);
|
||||
theCommands.Add("tclean", "tclean [-geom] [name1]..., depending on using or not key -geom, \n"
|
||||
"\t erase geometry objects from shapes - key is used or \n"
|
||||
"\t erase triangulations and polygons on triangulations from shapes - key is omitted \n",
|
||||
__FILE__, tclean, g);
|
||||
theCommands.Add("tclean", "tclean [name1]..., erase triangulations and polygons on triangulations from shapes",__FILE__, tclean, g);
|
||||
theCommands.Add("polygons", "polygons [name1]..., display polygons of shapes if exists",__FILE__, polygons, g);
|
||||
theCommands.Add("vconn","vconn [name1 ...] , edges are colored by number of faces (see vori)",__FILE__,dispor,g);
|
||||
theCommands.Add("discretisation","discretisation [nbpoints]",__FILE__,discretisation,g);
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <Graphic3d_TransformUtils.hxx>
|
||||
#include <Graphic3d_RenderingParams.hxx>
|
||||
|
||||
@@ -3448,82 +3447,6 @@ void OpenGl_Context::SetPointSize (const Standard_ShortReal theSize)
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PushOrthoScale
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::PushOrthoScale (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
{
|
||||
if (!myActiveProgram.IsNull() && !theWorkspace.IsNull())
|
||||
{
|
||||
Handle(Graphic3d_Camera) aCamera = theWorkspace->View()->Camera();
|
||||
Standard_ShortReal aScale = 0.0;
|
||||
if( aCamera->IsOrthographic() )
|
||||
aScale = (Standard_ShortReal)aCamera->Scale();
|
||||
myActiveProgram->SetUniform(this, myActiveProgram->GetStateLocation(OpenGl_OCCT_ORTHO_SCALE), aScale);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetIsSilhouettePass
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetIsSilhouettePass (Standard_Boolean isSilhouettePass)
|
||||
{
|
||||
if (!myActiveProgram.IsNull() )
|
||||
{
|
||||
myActiveProgram->SetUniform(this,
|
||||
myActiveProgram->GetStateLocation(OpenGl_OCCT_IS_SILHOUETTE_PASS),
|
||||
isSilhouettePass ? 1.0f : 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PushBackgroundColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::PushBackgroundColor (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
{
|
||||
if (!myActiveProgram.IsNull() && !theWorkspace.IsNull())
|
||||
{
|
||||
const Quantity_Color& aBackground = theWorkspace->View()->BackgroundColor().GetRGB();
|
||||
myActiveProgram->SetUniform(this,
|
||||
myActiveProgram->GetStateLocation(OpenGl_OCCT_BACKGROUND_COLOR),
|
||||
OpenGl_Vec3((Standard_ShortReal)aBackground.Red(),
|
||||
(Standard_ShortReal)aBackground.Green(),
|
||||
(Standard_ShortReal)aBackground.Blue()));
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetSilhouetteColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetSilhouetteColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (!myActiveProgram.IsNull())
|
||||
{
|
||||
myActiveProgram->SetUniform(this,
|
||||
myActiveProgram->GetStateLocation(OpenGl_OCCT_SILHOUETTE_COLOR),
|
||||
OpenGl_Vec3((Standard_ShortReal)theColor.Red(),
|
||||
(Standard_ShortReal)theColor.Green(),
|
||||
(Standard_ShortReal)theColor.Blue()));
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetSilhouetteThickness
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetSilhouetteThickness (Standard_ShortReal theThickness)
|
||||
{
|
||||
if (!myActiveProgram.IsNull())
|
||||
{
|
||||
myActiveProgram->SetUniform(this,
|
||||
myActiveProgram->GetStateLocation(OpenGl_OCCT_SILHOUETTE_THICKNESS), theThickness);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetPointSpriteOrigin
|
||||
// purpose :
|
||||
|
@@ -45,8 +45,6 @@
|
||||
|
||||
#include <NCollection_Shared.hxx>
|
||||
|
||||
class OpenGl_Workspace;
|
||||
|
||||
//! Forward declarations
|
||||
#if defined(__APPLE__)
|
||||
#import <TargetConditionals.h>
|
||||
@@ -724,12 +722,6 @@ public: //! @name methods to alter or retrieve current state
|
||||
//! Setup texture matrix to active GLSL program or to FFP global state using glMatrixMode (GL_TEXTURE).
|
||||
Standard_EXPORT void SetTextureMatrix (const Handle(Graphic3d_TextureParams)& theParams);
|
||||
|
||||
Standard_EXPORT void PushOrthoScale (const Handle(OpenGl_Workspace)& theWorkspace);
|
||||
Standard_EXPORT void SetIsSilhouettePass (Standard_Boolean);
|
||||
Standard_EXPORT void PushBackgroundColor (const Handle(OpenGl_Workspace)& theWorkspace);
|
||||
Standard_EXPORT void SetSilhouetteColor (const Quantity_Color&);
|
||||
Standard_EXPORT void SetSilhouetteThickness (Standard_ShortReal);
|
||||
|
||||
//! Bind default Vertex Array Object
|
||||
Standard_EXPORT void BindDefaultVao();
|
||||
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include <OpenGl_ShaderProgram.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_VertexBufferCompat.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <NCollection_AlignedAllocator.hxx>
|
||||
@@ -811,39 +810,7 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
||||
anAspectFace->Aspect()->AlphaMode(),
|
||||
hasVertColor,
|
||||
toEnableEnvMap,
|
||||
anAspectFace->ShaderProgramRes (aCtx),
|
||||
anAspectFace->Aspect()->InteriorStyle());
|
||||
|
||||
if (anAspectFace->Aspect()->InteriorStyle() == Aspect_IS_OUTLINE)
|
||||
{
|
||||
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
|
||||
? myBounds->Colors
|
||||
: NULL;
|
||||
|
||||
aCtx->PushOrthoScale(theWorkspace);
|
||||
aCtx->PushBackgroundColor(theWorkspace);
|
||||
aCtx->SetSilhouetteColor(anAspectFace->Aspect()->EdgeColor());
|
||||
|
||||
Standard_Integer aViewWidth, aViewHeight;
|
||||
theWorkspace->View()->Window()->Size(aViewWidth, aViewHeight);
|
||||
Standard_Integer aMin = aViewWidth < aViewHeight ? aViewWidth : aViewHeight;
|
||||
|
||||
Standard_ShortReal anEdgeWidth = (Standard_ShortReal)anAspectFace->Aspect()->EdgeWidth() / (Standard_ShortReal)aMin;
|
||||
aCtx->SetSilhouetteThickness(anEdgeWidth);
|
||||
|
||||
aCtx->SetIsSilhouettePass(Standard_True);
|
||||
GLboolean isCull = glIsEnabled(GL_CULL_FACE);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_FRONT);
|
||||
drawArray(theWorkspace, aFaceColors, hasColorAttrib);
|
||||
|
||||
aCtx->SetIsSilhouettePass(Standard_False);
|
||||
glCullFace(GL_BACK);
|
||||
drawArray(theWorkspace, aFaceColors, hasColorAttrib);
|
||||
|
||||
if (!isCull)
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
anAspectFace->ShaderProgramRes (aCtx));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -901,9 +868,8 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((anAspectFace->Aspect()->ToDrawEdges()
|
||||
|| anAspectFace->Aspect()->InteriorStyle() == Aspect_IS_HIDDENLINE)
|
||||
&& anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_OUTLINE)
|
||||
if (anAspectFace->Aspect()->ToDrawEdges()
|
||||
|| anAspectFace->Aspect()->InteriorStyle() == Aspect_IS_HIDDENLINE)
|
||||
{
|
||||
const OpenGl_Vec4& anEdgeColor = theWorkspace->EdgeColor();
|
||||
drawEdges (anEdgeColor, theWorkspace);
|
||||
@@ -1060,4 +1026,3 @@ void OpenGl_PrimitiveArray::InitBuffers (const Handle(OpenGl_Context)& th
|
||||
|
||||
setDrawMode (theType);
|
||||
}
|
||||
|
||||
|
@@ -34,8 +34,7 @@ enum OpenGl_ProgramOptions
|
||||
OpenGl_PO_ClipPlanesN = 0x100, //!< handle N clipping planes
|
||||
OpenGl_PO_AlphaTest = 0x200, //!< discard fragment by alpha test (defined by cutoff value)
|
||||
OpenGl_PO_WriteOit = 0x400, //!< write coverage buffer for Blended Order-Independent Transparency
|
||||
OpenGl_PO_OUTLINE = 0x800, //!< HLR presentation (outline shader)
|
||||
OpenGl_PO_NB = 0x1000 //!< overall number of combinations
|
||||
OpenGl_PO_NB = 0x800 //!< overall number of combinations
|
||||
};
|
||||
|
||||
//! Alias to programs array of predefined length
|
||||
|
@@ -1603,72 +1603,13 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramUnlit (Handle(OpenGl_Sha
|
||||
}
|
||||
}
|
||||
|
||||
if ((theBits & OpenGl_PO_OUTLINE) != 0)
|
||||
{
|
||||
aSrcVertExtraOut +=
|
||||
EOL"uniform float occOrthoScale;"
|
||||
EOL"uniform float occIsSilhouettePass;"
|
||||
EOL"uniform float occSilhouetteThickness;"
|
||||
;
|
||||
|
||||
aSrcVertExtraMain +=
|
||||
EOL" vec3 delta = vec3(0.0, 0.0, 0.0);"
|
||||
EOL" vec3 pdelta = vec3(0.0, 0.0, 0.0);"
|
||||
EOL" vec4 proj_normal = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * vec4(occNormal, 0.0);"
|
||||
EOL""
|
||||
EOL" float aShift = occSilhouetteThickness;"
|
||||
EOL" if (occOrthoScale > 0.0)"
|
||||
EOL" {"
|
||||
EOL" if (abs(proj_normal[2]) < 0.25)"
|
||||
EOL" {"
|
||||
EOL" float k = 1.0;"
|
||||
EOL" if (occIsSilhouettePass < 0.1)"
|
||||
EOL" k = -1.0;"
|
||||
EOL" "
|
||||
EOL" vec3 pn = normalize(vec3(proj_normal.xy, 0.0));"
|
||||
EOL" pdelta = k * pn * aShift / 2.0;"
|
||||
EOL" }"
|
||||
EOL" }"
|
||||
EOL" else"
|
||||
EOL" {"
|
||||
EOL" if (occIsSilhouettePass > 0.1)"
|
||||
EOL" {"
|
||||
EOL" vec4 proj_vertex = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * vertex;"
|
||||
EOL" delta = occNormal.xyz * aShift / 2.0 * proj_vertex.w;"
|
||||
EOL" }"
|
||||
EOL" }"
|
||||
EOL" "
|
||||
EOL" vertex += vec4(delta, 0.0);"
|
||||
EOL" vertex[3] = 1.0;"
|
||||
;
|
||||
|
||||
aSrcVertEndMain +=
|
||||
EOL"gl_Position += vec4(pdelta.xy, 0.0, 0.0);"
|
||||
;
|
||||
|
||||
aSrcFragExtraOut +=
|
||||
EOL"uniform float occIsSilhouettePass;"
|
||||
EOL"uniform vec3 occBackgroundColor;"
|
||||
EOL"uniform vec3 occSilhouetteColor;"
|
||||
;
|
||||
|
||||
aSrcFragExtraMain +=
|
||||
EOL" vec3 aColor = occBackgroundColor;"
|
||||
EOL" if (occIsSilhouettePass > 0.1)"
|
||||
EOL" aColor = occSilhouetteColor;"
|
||||
;
|
||||
|
||||
aSrcFragWriteOit = EOL" occSetFragColor(vec4(aColor, 1.0));";
|
||||
}
|
||||
|
||||
aSrcVert =
|
||||
aSrcVertExtraFunc
|
||||
+ aSrcVertExtraOut
|
||||
+ EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" vec4 vertex = occVertex;"
|
||||
+ aSrcVertExtraMain
|
||||
+ EOL" gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * vertex;"
|
||||
+ EOL" gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * occVertex;"
|
||||
+ aSrcVertEndMain
|
||||
+ EOL"}";
|
||||
|
||||
|
@@ -87,8 +87,7 @@ public:
|
||||
const Graphic3d_AlphaMode theAlphaMode,
|
||||
const Standard_Boolean theHasVertColor,
|
||||
const Standard_Boolean theEnableEnvMap,
|
||||
const Handle(OpenGl_ShaderProgram)& theCustomProgram,
|
||||
const Aspect_InteriorStyle theStyle)
|
||||
const Handle(OpenGl_ShaderProgram)& theCustomProgram)
|
||||
{
|
||||
if (!theCustomProgram.IsNull()
|
||||
|| myContext->caps->ffpEnable)
|
||||
@@ -100,7 +99,7 @@ public:
|
||||
&& (theTextures.IsNull() || theTextures->IsModulate())
|
||||
? theShadingModel
|
||||
: Graphic3d_TOSM_UNLIT;
|
||||
const Standard_Integer aBits = getProgramBits (theTextures, theAlphaMode, theHasVertColor, theEnableEnvMap, theStyle);
|
||||
const Standard_Integer aBits = getProgramBits (theTextures, theAlphaMode, theHasVertColor, theEnableEnvMap);
|
||||
Handle(OpenGl_ShaderProgram)& aProgram = getStdProgram (aShadeModelOnFace, aBits);
|
||||
return bindProgramWithState (aProgram);
|
||||
}
|
||||
@@ -402,8 +401,7 @@ protected:
|
||||
Standard_Integer getProgramBits (const Handle(OpenGl_TextureSet)& theTextures,
|
||||
Graphic3d_AlphaMode theAlphaMode,
|
||||
Standard_Boolean theHasVertColor,
|
||||
Standard_Boolean theEnableEnvMap,
|
||||
Aspect_InteriorStyle theStyle=Aspect_IS_EMPTY)
|
||||
Standard_Boolean theEnableEnvMap)
|
||||
|
||||
{
|
||||
Standard_Integer aBits = 0;
|
||||
@@ -446,11 +444,6 @@ protected:
|
||||
{
|
||||
aBits |= OpenGl_PO_WriteOit;
|
||||
}
|
||||
|
||||
if (theStyle == Aspect_IS_OUTLINE)
|
||||
{
|
||||
aBits |= OpenGl_PO_OUTLINE;
|
||||
}
|
||||
return aBits;
|
||||
}
|
||||
|
||||
@@ -459,8 +452,7 @@ protected:
|
||||
Standard_Integer theBits)
|
||||
{
|
||||
if (theShadingModel == Graphic3d_TOSM_UNLIT
|
||||
|| (theBits & OpenGl_PO_TextureEnv) != 0
|
||||
|| (theBits & OpenGl_PO_OUTLINE) != 0)
|
||||
|| (theBits & OpenGl_PO_TextureEnv) != 0)
|
||||
{
|
||||
// If environment map is enabled lighting calculations are
|
||||
// not needed (in accordance with default OCCT behavior)
|
||||
|
@@ -74,13 +74,7 @@ Standard_CString OpenGl_ShaderProgram::PredefinedKeywords[] =
|
||||
"occOitDepthFactor", // OpenGl_OCCT_OIT_DEPTH_FACTOR
|
||||
|
||||
"occTexTrsf2d", // OpenGl_OCCT_TEXTURE_TRSF2D
|
||||
"occPointSize", // OpenGl_OCCT_POINT_SIZE
|
||||
|
||||
"occOrthoScale", // OpenGl_OCCT_ORTHO_SCALE
|
||||
"occIsSilhouettePass", // OpenGl_OCCT_IS_SILHOUETTE_PASS
|
||||
"occBackgroundColor", // OpenGl_OCCT_BACKGROUND_COLOR
|
||||
"occSilhouetteColor", // OpenGl_OCCT_SILHOUETTE_COLOR
|
||||
"occSilhouetteThickness" // OpenGl_OCCT_SILHOUETTE_THICKNESS
|
||||
"occPointSize" // OpenGl_OCCT_POINT_SIZE
|
||||
};
|
||||
|
||||
namespace
|
||||
|
@@ -74,13 +74,6 @@ enum OpenGl_StateVariable
|
||||
OpenGl_OCCT_TEXTURE_TRSF2D,
|
||||
OpenGl_OCCT_POINT_SIZE,
|
||||
|
||||
// Parameters of outline (silhouette) shader
|
||||
OpenGl_OCCT_ORTHO_SCALE,
|
||||
OpenGl_OCCT_IS_SILHOUETTE_PASS,
|
||||
OpenGl_OCCT_BACKGROUND_COLOR,
|
||||
OpenGl_OCCT_SILHOUETTE_COLOR,
|
||||
OpenGl_OCCT_SILHOUETTE_THICKNESS,
|
||||
|
||||
// DON'T MODIFY THIS ITEM (insert new items before it)
|
||||
OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES
|
||||
};
|
||||
|
@@ -761,7 +761,7 @@ void OpenGl_Text::drawRect (const Handle(OpenGl_Context)& theCtx,
|
||||
// bind unlit program
|
||||
theCtx->ShaderManager()->BindFaceProgram (Handle(OpenGl_TextureSet)(), Graphic3d_TOSM_UNLIT,
|
||||
Graphic3d_AlphaMode_Opaque, Standard_False, Standard_False,
|
||||
Handle(OpenGl_ShaderProgram)(), Aspect_IS_SOLID);
|
||||
Handle(OpenGl_ShaderProgram)());
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (theCtx->core11 != NULL
|
||||
|
@@ -42,7 +42,7 @@
|
||||
//! - "dev" for official (certified) version (master branch) between releases
|
||||
//! - "beta..." or "rc..." for beta releases or release candidates
|
||||
//! - "project..." for version containing project-specific fixes
|
||||
#define OCC_VERSION_DEVELOPMENT "fuji"
|
||||
//#define OCC_VERSION_DEVELOPMENT "beta"
|
||||
|
||||
// Derived (manually): version as real and string (major.minor)
|
||||
#define OCC_VERSION 7.3
|
||||
|
@@ -301,8 +301,7 @@ namespace
|
||||
}
|
||||
|
||||
//! Compute boundary presentation for faces of the shape.
|
||||
static Handle(Graphic3d_ArrayOfSegments) fillFaceBoundaries
|
||||
(const TopoDS_Shape& theShape, const GeomAbs_Shape theMostAllowedEdgeClass)
|
||||
static Handle(Graphic3d_ArrayOfSegments) fillFaceBoundaries (const TopoDS_Shape& theShape)
|
||||
{
|
||||
// collection of all triangulation nodes on edges
|
||||
// for computing boundaries presentation
|
||||
@@ -342,16 +341,6 @@ namespace
|
||||
}
|
||||
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
|
||||
if (anEdgeIter.Value().Extent() > 1)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape anIter2(anEdgeIter.Value());
|
||||
anIter2.Next();
|
||||
const TopoDS_Face& aFace2 = TopoDS::Face(anIter2.Value());
|
||||
GeomAbs_Shape aShape = BRep_Tool::Continuity(anEdge, aFace, aFace2);
|
||||
if (aShape > theMostAllowedEdgeClass)
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
|
||||
if (!anEdgePoly.IsNull()
|
||||
&& anEdgePoly->Nodes().Length() >= 2)
|
||||
@@ -395,16 +384,6 @@ namespace
|
||||
}
|
||||
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
|
||||
if (anEdgeIter.Value().Extent() > 1)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape anIter2(anEdgeIter.Value());
|
||||
anIter2.Next();
|
||||
const TopoDS_Face& aFace2 = TopoDS::Face(anIter2.Value());
|
||||
GeomAbs_Shape aShape = BRep_Tool::Continuity(anEdge, aFace, aFace2);
|
||||
if (aShape > theMostAllowedEdgeClass)
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
|
||||
if (anEdgePoly.IsNull()
|
||||
|| anEdgePoly->Nodes().Length () < 2)
|
||||
@@ -522,12 +501,11 @@ void StdPrs_ShadedShape::ExploreSolids (const TopoDS_Shape& theShape,
|
||||
void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const StdPrs_Volume theVolume,
|
||||
const GeomAbs_Shape theMostAllowedEdgeClass)
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
gp_Pnt2d aDummy;
|
||||
StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer,
|
||||
Standard_False, aDummy, aDummy, aDummy, theVolume, theMostAllowedEdgeClass);
|
||||
Standard_False, aDummy, aDummy, aDummy, theVolume);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -541,8 +519,7 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const StdPrs_Volume theVolume,
|
||||
const GeomAbs_Shape theMostAllowedEdgeClass)
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
@@ -601,7 +578,7 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
|
||||
if (theDrawer->FaceBoundaryDraw())
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape, theMostAllowedEdgeClass);
|
||||
Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape);
|
||||
if (!aBndSegments.IsNull())
|
||||
{
|
||||
Handle(Graphic3d_AspectLine3d) aBoundaryAspect = theDrawer->FaceBoundaryAspect()->Aspect();
|
||||
@@ -629,10 +606,9 @@ Handle(Graphic3d_ArrayOfTriangles) StdPrs_ShadedShape::FillTriangles (const Topo
|
||||
// function : FillFaceBoundaries
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_ArrayOfSegments) StdPrs_ShadedShape::FillFaceBoundaries (const TopoDS_Shape& theShape,
|
||||
const GeomAbs_Shape theMostAllowedEdgeClass)
|
||||
Handle(Graphic3d_ArrayOfSegments) StdPrs_ShadedShape::FillFaceBoundaries (const TopoDS_Shape& theShape)
|
||||
{
|
||||
return fillFaceBoundaries (theShape, theMostAllowedEdgeClass);
|
||||
return fillFaceBoundaries (theShape);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <StdPrs_Volume.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
class Graphic3d_ArrayOfSegments;
|
||||
class Graphic3d_ArrayOfTriangles;
|
||||
@@ -44,27 +43,13 @@ public:
|
||||
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face
|
||||
//! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
|
||||
//! or to perform Autodetection (would split input shape into two groups)
|
||||
//! @param theMostAllowedEdgeClass the most edge continuity class to be included to result (edges with more continuity should be ignored)
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection,
|
||||
const GeomAbs_Shape theMostAllowedEdgeClass = GeomAbs_CN);
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
|
||||
|
||||
//! Shades <theShape> with texture coordinates.
|
||||
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face
|
||||
//! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
|
||||
//! or to perform Autodetection (would split input shape into two groups)
|
||||
//! @param theMostAllowedEdgeClass the most edge continuity class to be included to result (edges with more continuity should be ignored)
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection,
|
||||
const GeomAbs_Shape theMostAllowedEdgeClass = GeomAbs_CN);
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const Standard_Boolean theHasTexels, const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
|
||||
|
||||
//! Searches closed and unclosed subshapes in shape structure and puts them
|
||||
//! into two compounds for separate processing of closed and unclosed sub-shapes
|
||||
@@ -105,9 +90,8 @@ public:
|
||||
|
||||
//! Define primitive array of boundary segments for specified shape.
|
||||
//! @param theShape segments array or NULL if specified face does not have computed triangulation
|
||||
//! @param theMostAllowedEdgeClass the most edge continuity class to be included to result (edges with more continuity should be ignored)
|
||||
Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) FillFaceBoundaries
|
||||
(const TopoDS_Shape& theShape, const GeomAbs_Shape theMostAllowedEdgeClass = GeomAbs_CN);
|
||||
Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) FillFaceBoundaries (const TopoDS_Shape& theShape);
|
||||
|
||||
};
|
||||
|
||||
#endif // _StdPrs_ShadedShape_HeaderFile
|
||||
|
@@ -1575,18 +1575,14 @@ static int VSetInteriorStyle (Draw_Interpretor& theDI,
|
||||
{
|
||||
anInterStyle = Aspect_IS_POINT;
|
||||
}
|
||||
else if (aStyleArg == "outline")
|
||||
{
|
||||
anInterStyle = Aspect_IS_OUTLINE;
|
||||
}
|
||||
else
|
||||
{
|
||||
const Standard_Integer anIntStyle = aStyleArg.IntegerValue();
|
||||
if (anIntStyle < Aspect_IS_EMPTY
|
||||
|| anIntStyle > Aspect_IS_OUTLINE)
|
||||
|| anIntStyle > Aspect_IS_POINT)
|
||||
{
|
||||
std::cout << "Error: style must be within a range [0 (Aspect_IS_EMPTY), "
|
||||
<< Aspect_IS_OUTLINE << " (Aspect_IS_OUTLINE)]\n";
|
||||
<< Aspect_IS_POINT << " (Aspect_IS_POINT)]\n";
|
||||
return 1;
|
||||
}
|
||||
anInterStyle = (Aspect_InteriorStyle )anIntStyle;
|
||||
@@ -1619,72 +1615,6 @@ static int VSetInteriorStyle (Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : VSetMostCont
|
||||
//purpose : sets the most continuity class of edges in presentation
|
||||
//==============================================================================
|
||||
static int VSetMostCont(Draw_Interpretor& theDI,
|
||||
Standard_Integer theArgNb,
|
||||
const char** theArgVec)
|
||||
{
|
||||
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||
ViewerTest_AutoUpdater anUpdateTool(aCtx, ViewerTest::CurrentView());
|
||||
if (aCtx.IsNull())
|
||||
{
|
||||
std::cerr << "Error: no active view!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (theArgNb != 3)
|
||||
{
|
||||
std::cout << "Error: wrong number of arguments! See usage:\n";
|
||||
theDI.PrintHelp(theArgVec[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aName = theArgVec[1];
|
||||
TCollection_AsciiString aClassArg = theArgVec[2];
|
||||
aClassArg.LowerCase();
|
||||
|
||||
GeomAbs_Shape aClass = GeomAbs_CN;
|
||||
if (aClassArg == "c0")
|
||||
aClass = GeomAbs_C0;
|
||||
else if (aClassArg == "c1")
|
||||
aClass = GeomAbs_C1;
|
||||
else if (aClassArg == "c2")
|
||||
aClass = GeomAbs_C2;
|
||||
else if (aClassArg == "c3")
|
||||
aClass = GeomAbs_C3;
|
||||
else if (aClassArg == "cn")
|
||||
aClass = GeomAbs_CN;
|
||||
else
|
||||
{
|
||||
std::cout << "Error: incorrect class! See usage:\n";
|
||||
theDI.PrintHelp(theArgVec[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!aName.IsEmpty()
|
||||
&& !GetMapOfAIS().IsBound2(aName))
|
||||
{
|
||||
std::cout << "Error: object " << aName << " is not displayed!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (ViewTest_PrsIter anIter(aName); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_Shape)& aShape = Handle(AIS_Shape)::DownCast(anIter.Current());
|
||||
if (!aShape.IsNull())
|
||||
{
|
||||
aShape->SetMostContinuityClass(aClass);
|
||||
aCtx->RecomputePrsOnly(aShape, Standard_False, Standard_True);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Auxiliary structure for VAspects
|
||||
struct ViewerTest_AspectsChangeSet
|
||||
{
|
||||
@@ -6140,12 +6070,6 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
||||
"\n\t\t: Where style is: 0 = EMPTY, 1 = HOLLOW, 2 = HATCH, 3 = SOLID, 4 = HIDDENLINE.",
|
||||
__FILE__,VSetInteriorStyle,group);
|
||||
|
||||
theCommands.Add("vsetmostcont",
|
||||
"vsetmostcont : ObjectName class"
|
||||
"- sets the most continuity class of edges in presentation",
|
||||
"\n\t\t: Where class is c0, c1, c2, c3, cn"
|
||||
__FILE__, VSetMostCont, group);
|
||||
|
||||
theCommands.Add("vsensdis",
|
||||
"vsensdis : Display active entities (sensitive entities of one of the standard types corresponding to active selection modes)."
|
||||
"\n\t\t: Standard entity types are those defined in Select3D package:"
|
||||
|
@@ -321,14 +321,6 @@ inline gp_Mat gp_Mat::Subtracted (const gp_Mat& Other) const
|
||||
return NewMat;
|
||||
}
|
||||
|
||||
// On macOS 10.13.6 with XCode 9.4.1 the compiler has a bug leading to
|
||||
// generation of invalid code when method gp_Mat::Transpose() is called
|
||||
// for a matrix which is when applied to vector; it looks like vector
|
||||
// is transformed before the matrix is actually transposed; see #29978.
|
||||
// To avoid this, we disable compiler optimization here.
|
||||
#if defined(__APPLE__) && (__apple_build_version__ > 9020000)
|
||||
__attribute__((optnone))
|
||||
#endif
|
||||
inline void gp_Mat::Transpose ()
|
||||
{
|
||||
Standard_Real Temp;
|
||||
|
@@ -157,10 +157,11 @@ void gp_Trsf::SetTransformation (const gp_Ax3& FromA1,
|
||||
shape = gp_CompoundTrsf;
|
||||
scale = 1.0;
|
||||
// matrix from XOY ToA2 :
|
||||
matrix.SetRows (ToA2.XDirection().XYZ(),
|
||||
ToA2.YDirection().XYZ(),
|
||||
ToA2. Direction().XYZ());
|
||||
matrix.SetCol (1, ToA2.XDirection().XYZ());
|
||||
matrix.SetCol (2, ToA2.YDirection().XYZ());
|
||||
matrix.SetCol (3, ToA2.Direction().XYZ());
|
||||
loc = ToA2.Location().XYZ();
|
||||
matrix.Transpose();
|
||||
loc.Multiply (matrix);
|
||||
loc.Reverse ();
|
||||
|
||||
@@ -182,10 +183,11 @@ void gp_Trsf::SetTransformation (const gp_Ax3& A3)
|
||||
{
|
||||
shape = gp_CompoundTrsf;
|
||||
scale = 1.0;
|
||||
matrix.SetRows (A3.XDirection().XYZ(),
|
||||
loc = A3.Location().XYZ();
|
||||
matrix.SetCols (A3.XDirection().XYZ(),
|
||||
A3.YDirection().XYZ(),
|
||||
A3. Direction().XYZ());
|
||||
loc = A3.Location().XYZ();
|
||||
matrix.Transpose();
|
||||
loc.Multiply (matrix);
|
||||
loc.Reverse ();
|
||||
}
|
||||
@@ -401,12 +403,16 @@ void gp_Trsf::Invert()
|
||||
if (shape == gp_Identity) { }
|
||||
else if (shape == gp_Translation || shape == gp_PntMirror) loc.Reverse();
|
||||
else if (shape == gp_Scale) {
|
||||
Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
Standard_Real As = scale;
|
||||
if (As < 0) As = - As;
|
||||
Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
scale = 1.0 / scale;
|
||||
loc.Multiply (-scale);
|
||||
}
|
||||
else {
|
||||
Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
Standard_Real As = scale;
|
||||
if (As < 0) As = - As;
|
||||
Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
scale = 1.0 / scale;
|
||||
matrix.Transpose ();
|
||||
loc.Multiply (matrix);
|
||||
|
@@ -1,19 +0,0 @@
|
||||
|
||||
puts "0029731: Modeling Algorithms - calculation of surface/volume of tessellated geometry"
|
||||
puts ""
|
||||
|
||||
#############################################################
|
||||
# Surface and volume calculation on the triangulation built on a sphere
|
||||
#############################################################
|
||||
|
||||
psphere sp1 10
|
||||
checkprops sp1 -v 4188.79
|
||||
checkprops sp1 -s 1256.64
|
||||
checkprops sp1 -l 62.8319
|
||||
|
||||
incmesh sp1 0.01
|
||||
tclean -geom sp1
|
||||
|
||||
checkprops sp1 -v 4183.13
|
||||
checkprops sp1 -s 1255.75
|
||||
checkprops sp1 -l 62.8215
|
@@ -1,64 +0,0 @@
|
||||
puts "========"
|
||||
puts "OCC29734"
|
||||
puts "========"
|
||||
puts ""
|
||||
#######################
|
||||
# Compute global properties of tessellated shape
|
||||
#######################
|
||||
proc compmass { mass props1 props2 } {
|
||||
regexp {Mass +: +([-0-9.+eE]+)} ${props1} full m1
|
||||
regexp {Mass +: +([-0-9.+eE]+)} ${props2} full m2
|
||||
if { abs ($m1 - $m2) > 1.e-7 } {
|
||||
puts "Error : The $mass by geometry is $m1, by triangulation is $m2"
|
||||
} else {
|
||||
puts "The $mass are equal $m1"
|
||||
}
|
||||
}
|
||||
#
|
||||
proc compmoms { props1 props2 } {
|
||||
set moments {"IX" "IY" "IZ"}
|
||||
foreach moment $moments {
|
||||
set exp_string "${moment} = +(\[-0-9.+eE\]+)"
|
||||
regexp "${exp_string}" ${props1} full m1
|
||||
regexp "${exp_string}" ${props2} full m2
|
||||
if { abs ($m1 - $m2) > 1.e-7 } {
|
||||
puts "Error : The ${moment} by geometry is $m1, by triangulation is $m2"
|
||||
} else {
|
||||
puts "The moments ${moment} are equal $m1"
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
proc compprops { shape } {
|
||||
upvar ${shape} ${shape}
|
||||
set commands {"lprops" "sprops" "vprops"}
|
||||
foreach command ${commands} {
|
||||
switch $command {
|
||||
"lprops" { set mass "length" }
|
||||
"sprops" { set mass "area" }
|
||||
"vprops" { set mass "volume" }
|
||||
}
|
||||
puts ""
|
||||
set props1 [eval $command ${shape} -full]
|
||||
set props2 [eval $command ${shape} -full -tri]
|
||||
compmass $mass $props1 $props2
|
||||
compmoms $props1 $props2
|
||||
}
|
||||
}
|
||||
|
||||
#For shapes consisted from planar polygonal faces
|
||||
#results of computation of global properties using exact geometry
|
||||
#and using triangulations must be the same
|
||||
#It is checked by this test
|
||||
box b1 1 2 3
|
||||
box b2 3 2 1
|
||||
ttranslate b2 .5 .5 .5
|
||||
trotate b2 0 0 0 1 1 1 30
|
||||
bfuse ff b1 b2
|
||||
incmesh ff .01
|
||||
set tri_info [eval trinfo ff]
|
||||
puts $tri_info
|
||||
|
||||
# check of equality calculations by triangulation and exact geometry
|
||||
#set shape "ff"
|
||||
compprops ff
|
@@ -11,8 +11,8 @@ puts ""
|
||||
restore [locate_data_file OCC173.brep] result
|
||||
checkshape result
|
||||
|
||||
vinit
|
||||
tclean result
|
||||
vinit result
|
||||
tclean
|
||||
vdisplay result
|
||||
vfit
|
||||
vsetdispmode result 1
|
||||
|
@@ -1,36 +0,0 @@
|
||||
puts "========"
|
||||
puts "0024437: Efficient HLR visualization based on OpenGL and GLSL"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
vclear
|
||||
vinit View1
|
||||
vsetcolorbg 220 220 220
|
||||
|
||||
psphere sph 1.0
|
||||
|
||||
box b 1 2 3
|
||||
ttranslate b 2 -2 -2
|
||||
|
||||
pcylinder cyl 1.0 1.0
|
||||
ttranslate cyl 4.2 0 0
|
||||
|
||||
vdisplay -dispMode 1 b
|
||||
vsetinteriorstyle b outline
|
||||
vshowfaceboundary b 1 255 0 0 1
|
||||
vsetedgetype b -color 255 0 0
|
||||
vfit
|
||||
|
||||
vdisplay -dispMode 1 sph
|
||||
vsetinteriorstyle sph outline
|
||||
vshowfaceboundary sph 1 255 0 0 1
|
||||
vsetedgetype sph -color 255 0 0
|
||||
vfit
|
||||
|
||||
vdisplay -dispMode 1 cyl
|
||||
vsetinteriorstyle cyl outline
|
||||
vshowfaceboundary cyl 1 255 0 0 1
|
||||
vsetedgetype cyl -color 255 0 0
|
||||
vfit
|
@@ -1,25 +0,0 @@
|
||||
puts "========"
|
||||
puts "0029787: Avoid in presentation edges of certain continuity class"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
vclear
|
||||
vinit View1
|
||||
vsetcolorbg 255 255 255
|
||||
|
||||
psphere sph1 1.0
|
||||
psphere sph2 1.0
|
||||
psphere sph3 1.0
|
||||
|
||||
ttranslate sph2 4.0 0.0 0.0
|
||||
ttranslate sph3 8.0 0.0 0.0
|
||||
|
||||
vdisplay -dispMode 0 sph1
|
||||
vdisplay -dispMode 1 sph2
|
||||
vshowfaceboundary sph2 1 255 0 0
|
||||
vdisplay -dispMode 1 sph3
|
||||
vshowfaceboundary sph3 1 255 0 0
|
||||
vsetmostcont sph3 c2
|
||||
vfit
|
@@ -26,6 +26,23 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
|
||||
|
||||
# build variables
|
||||
macro (BUILD_TOOL_MESSAGE BUILD_TOOL_TARGET_VARIABLE BUILD_TOOL_TARGET_STRING)
|
||||
set (${BUILD_TOOL_TARGET_VARIABLE}_DESCR
|
||||
"Indicates whether ${BUILD_TOOL_TARGET_STRING} tool should be built or not.
|
||||
It should be noted that some toolkits of the module can be built even if this module
|
||||
is not checked (this happens if some other modules depend on these toolkits)")
|
||||
set (${BUILD_TOOL_TARGET_VARIABLE} ON CACHE BOOL "${${BUILD_TOOL_TARGET_VARIABLE}_DESCR}")
|
||||
endmacro()
|
||||
|
||||
BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKTreeModel "TKTreeModel")
|
||||
BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKDFBrowser "TKDFBrowser")
|
||||
BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKVInspector "TKVInspector")
|
||||
BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKShapeView "TKShapeView")
|
||||
if (NOT BUILD_PLUGIN_TKDFBrowser AND NOT BUILD_PLUGIN_TKVInspector AND NOT BUILD_PLUGIN_TKShapeView)
|
||||
set (BUILD_TREE_MODEL_ONLY ON)
|
||||
endif()
|
||||
|
||||
# macro: include patched file if it exists
|
||||
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
|
||||
@@ -333,9 +350,16 @@ endif()
|
||||
# list <OCCT_TOOLS> will contain all tools
|
||||
#if (BUILD_Inspector)
|
||||
OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
|
||||
foreach (OCCT_TOOL ${OCCT_TOOLS})
|
||||
list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
|
||||
endforeach()
|
||||
|
||||
if (DEFINED BUILD_TREE_MODEL_ONLY AND BUILD_TREE_MODEL_ONLY)
|
||||
list (APPEND BUILD_TOOL_TOOLKITS "TKTreeModel")
|
||||
else()
|
||||
foreach (OCCT_TOOL ${OCCT_TOOLS})
|
||||
list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
message("Build: ${BUILD_TOOL_TOOLKITS}")
|
||||
|
||||
# collect all the headers to <binary dir>/inc/inspector folder
|
||||
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
||||
@@ -363,9 +387,15 @@ if (3RDPARTY_LIBRARY_DIRS)
|
||||
endif()
|
||||
|
||||
# include patched toolkit projects or original ones
|
||||
if (BUILD_TOOL_TOOLKITS)
|
||||
if (BUILD_TREE_MODEL_ONLY)
|
||||
OCCT_ADD_SUBDIRECTORY ("tools/TKTreeModel")
|
||||
message (STATUS "Info: TKTreeModel OCCT toolkits processed")
|
||||
else()
|
||||
foreach (BUILD_TOOL_TOOLKIT ${BUILD_TOOL_TOOLKITS})
|
||||
OCCT_ADD_SUBDIRECTORY ("tools/${BUILD_TOOL_TOOLKIT}")
|
||||
if (NOT DEFINED BUILD_PLUGIN_${BUILD_TOOL_TOOLKIT} OR BUILD_PLUGIN_${BUILD_TOOL_TOOLKIT})
|
||||
OCCT_ADD_SUBDIRECTORY ("tools/${BUILD_TOOL_TOOLKIT}")
|
||||
message (STATUS "Info: ${BUILD_TOOL_TOOLKIT} toolkits processed")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
@@ -98,12 +98,12 @@ QModelIndex DFBrowser_TreeModel::FindIndex (const TDF_Label& theLabel) const
|
||||
}
|
||||
}
|
||||
bool aDocumentItemFound = false;
|
||||
QModelIndex aParentIndex = index (0, 0);
|
||||
TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // application item
|
||||
QModelIndex aParentIndex;
|
||||
TreeModel_ItemBasePtr aParentItem;
|
||||
// find document, where label of document item is equal to Root label
|
||||
for (int aChildId = 0, aCount = aParentItem->rowCount(); aChildId < aCount; aChildId++)
|
||||
for (int aChildId = 0, aCount = rowCount(); aChildId < aCount; aChildId++)
|
||||
{
|
||||
QModelIndex anIndex = index (aChildId, 0, aParentIndex);
|
||||
QModelIndex anIndex = index (aChildId, 0);
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
DFBrowser_ItemDocumentPtr anItem = itemDynamicCast<DFBrowser_ItemDocument> (anItemBase);
|
||||
if (anItem->GetLabel() == aRoot)
|
||||
|
@@ -107,11 +107,9 @@ void ShapeView_TreeModel::RemoveAllShapes()
|
||||
// =======================================================================
|
||||
QModelIndex ShapeView_TreeModel::FindIndex (const TopoDS_Shape& theShape) const
|
||||
{
|
||||
QModelIndex aParentIndex = index (0, 0);
|
||||
TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // application item
|
||||
for (int aChildId = 0, aCount = aParentItem->rowCount(); aChildId < aCount; aChildId++)
|
||||
for (int aChildId = 0, aCount = rowCount(); aChildId < aCount; aChildId++)
|
||||
{
|
||||
QModelIndex anIndex = index (aChildId, 0, aParentIndex);
|
||||
QModelIndex anIndex = index (aChildId, 0);
|
||||
ShapeView_ItemShapePtr anItem = itemDynamicCast<ShapeView_ItemShape> (TreeModel_ModelBase::GetItemByIndex (anIndex));
|
||||
if (anItem && anItem->GetItemShape() == theShape)
|
||||
return anIndex;
|
||||
|
@@ -66,10 +66,6 @@ QModelIndex TreeModel_ModelBase::index (int theRow, int theColumn, const QModelI
|
||||
if (!hasIndex (theRow, theColumn, theParent))
|
||||
return QModelIndex();
|
||||
|
||||
// to create index on the root item
|
||||
if (!theParent.isValid())
|
||||
return createIndex (theRow, theColumn, getIndexValue (RootItem (theColumn)));
|
||||
|
||||
TreeModel_ItemBasePtr aParentItem;
|
||||
if (!theParent.isValid())
|
||||
aParentItem = RootItem (theColumn);
|
||||
@@ -164,10 +160,6 @@ QVariant TreeModel_ModelBase::headerData (int theSection, Qt::Orientation theOri
|
||||
// =======================================================================
|
||||
int TreeModel_ModelBase::rowCount (const QModelIndex& theParent) const
|
||||
{
|
||||
// to create index on the root item
|
||||
if (!theParent.isValid())
|
||||
return 1;
|
||||
|
||||
TreeModel_ItemBasePtr aParentItem;
|
||||
if (!theParent.isValid())
|
||||
aParentItem = RootItem (0);
|
||||
|
@@ -105,11 +105,9 @@ void VInspector_ViewModel::SetContext (const Handle(AIS_InteractiveContext)& the
|
||||
QModelIndexList VInspector_ViewModel::FindPointers (const QStringList& thePointers)
|
||||
{
|
||||
QModelIndexList anIndices;
|
||||
QModelIndex aParentIndex = index (0, 0);
|
||||
TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // context item
|
||||
for (int aRowId = 0, aCount = aParentItem->rowCount(); aRowId < aCount; aRowId++)
|
||||
for (int aRowId = 0, aCount = rowCount(); aRowId < aCount; aRowId++)
|
||||
{
|
||||
QModelIndex anIndex = index (aRowId, 0, aParentIndex);
|
||||
QModelIndex anIndex = index (aRowId, 0);
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
VInspector_ItemPresentableObjectPtr anItemPrs = itemDynamicCast<VInspector_ItemPresentableObject>(anItemBase);
|
||||
if (!anItemPrs)
|
||||
|
Reference in New Issue
Block a user