1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0025039: Improvement of code structure of general and supporting tools implemented in BRepMesh

Removed CDL declarations; Data collections are replaced by NCollections; Small code refactoring.
Remove definition of BRepMesh class. Code refactoring of BRepMesh_IncrementalMesh.
Function BRepMesh_Write storing BRepMesh_DataStructureOfDelaun to BRep file is added for debug needs.
Static method BRepMesh_GeomTool::IntLinLin has been added to eliminate code duplications in BRepMesh_Dealun and BRepMesh_CircleTool.
BRepMesh_CircleTool simplified method to find circumcircle.

Fix merging conflicts
Remove redundant function
Fix compilation warning on MacOS
Revert changes occurred during rebase
Resolved merging conflicts
Use parallel flag with BRepMesh_FastDiscret

Test cases for issue CR25039_2
This commit is contained in:
oan
2014-07-10 14:51:15 +04:00
committed by apn
parent b6c0b841ec
commit fc9b36d630
109 changed files with 5266 additions and 6602 deletions

View File

@@ -1,3 +1,5 @@
StdPrs_ToolShadedShape.hxx
StdPrs_ToolShadedShape.cxx
StdPrs_HLRShape.hxx
StdPrs_HLRShape.cxx
StdPrs_Point.hxx

View File

@@ -53,7 +53,7 @@ is
class ToolVertex;
class ToolRFace;
class HLRToolShape;
class ToolShadedShape;
imported ToolShadedShape from StdPrs;
class ShadedShape;
class PoleCurve;

View File

@@ -66,7 +66,7 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
const Standard_Boolean rel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
Standard_Real def = rel? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
BRepMesh_IncrementalMesh mesh(aShape, def, rel, aDrawer->HLRAngle());
BRepMesh_IncrementalMesh mesh(aShape, def, aDrawer->HLRAngle(), rel);
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);

View File

@@ -41,6 +41,8 @@
#include <StdPrs_ToolShadedShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
@@ -132,11 +134,11 @@ namespace
// Precision for compare square distances
const Standard_Real aPreci = Precision::SquareConfusion();
StdPrs_ToolShadedShape aShapeTool;
for (aShapeTool.Init (theShape); aShapeTool.MoreFace(); aShapeTool.NextFace())
TopExp_Explorer aFaceIt(theShape, TopAbs_FACE);
for (; aFaceIt.More(); aFaceIt.Next())
{
const TopoDS_Face& aFace = aShapeTool.CurrentFace();
aT = aShapeTool.Triangulation (aFace, aLoc);
const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
aT = StdPrs_ToolShadedShape::Triangulation (aFace, aLoc);
if (!aT.IsNull())
{
aNbTriangles += aT->NbTriangles();
@@ -151,10 +153,10 @@ namespace
Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aNbVertices, 3 * aNbTriangles,
Standard_True, Standard_False, theHasTexels);
Standard_Real aUmin (0.0), aUmax (0.0), aVmin (0.0), aVmax (0.0), dUmax (0.0), dVmax (0.0);
for (aShapeTool.Init (theShape); aShapeTool.MoreFace(); aShapeTool.NextFace())
for (aFaceIt.Init (theShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
{
const TopoDS_Face& aFace = aShapeTool.CurrentFace();
aT = aShapeTool.Triangulation (aFace, aLoc);
const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
aT = StdPrs_ToolShadedShape::Triangulation (aFace, aLoc);
if (aT.IsNull())
{
continue;
@@ -165,7 +167,7 @@ namespace
const TColgp_Array1OfPnt& aNodes = aT->Nodes();
const TColgp_Array1OfPnt2d& aUVNodes = aT->UVNodes();
TColgp_Array1OfDir aNormals (aNodes.Lower(), aNodes.Upper());
aShapeTool.Normal (aFace, aPolyConnect, aNormals);
StdPrs_ToolShadedShape::Normal (aFace, aPolyConnect, aNormals);
if (theHasTexels)
{
@@ -201,7 +203,7 @@ namespace
Standard_Integer anIndex[3];
for (Standard_Integer aTriIter = 1; aTriIter <= aT->NbTriangles(); ++aTriIter)
{
if (aShapeTool.Orientation (aFace) == TopAbs_REVERSED)
if (aFace.Orientation() == TopAbs_REVERSED)
{
aTriangles (aTriIter).Get (anIndex[0], anIndex[2], anIndex[1]);
}

View File

@@ -1,40 +0,0 @@
-- Created on: 1993-10-27
-- Created by: Jean-Louis FRENKEL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 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.
class ToolShadedShape from StdPrs inherits ShapeTool from BRepMesh
uses
Shape from TopoDS,
Face from TopoDS,
Array1OfDir from TColgp,
Connect from Poly,
Triangulation from Poly,
Location from TopLoc
is
IsClosed (myclass; theShape : Shape from TopoDS) returns Boolean from Standard;
---Purpose: Checks back faces visibility for specified shape (to activate back-face culling).
-- @return true if shape is closed Solid or compound of closed Solids.
Triangulation(myclass; aFace: Face from TopoDS;
loc : out Location from TopLoc)
returns Triangulation from Poly;
Normal(myclass; aFace: Face from TopoDS;
PC : in out Connect from Poly;
Nor : out Array1OfDir from TColgp);
end ToolShadedShape from StdPrs;

View File

@@ -14,7 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPrs_ToolShadedShape.ixx>
#include <StdPrs_ToolShadedShape.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
@@ -31,6 +31,9 @@
#include <TopLoc_Location.hxx>
#include <TShort_HArray1OfShortReal.hxx>
#include <TShort_Array1OfShortReal.hxx>
#include <TColgp_Array1OfDir.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
namespace
{

View File

@@ -0,0 +1,47 @@
// Copyright (c) 2013 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 _StdPrs_ToolShadedShape_HeaderFile
#define _StdPrs_ToolShadedShape_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Handle_Poly_Triangulation.hxx>
class TopoDS_Shape;
class Poly_Triangulation;
class TopoDS_Face;
class TopLoc_Location;
class Poly_Connect;
class TColgp_Array1OfDir;
class StdPrs_ToolShadedShape
{
public:
DEFINE_STANDARD_ALLOC
//! Checks back faces visibility for specified shape (to activate back-face culling). <br>
//! @return true if shape is closed Solid or compound of closed Solids. <br>
static Standard_Boolean IsClosed(const TopoDS_Shape& theShape);
static Handle_Poly_Triangulation Triangulation(const TopoDS_Face& aFace,
TopLoc_Location& loc);
static void Normal(const TopoDS_Face& aFace,
Poly_Connect& PC,
TColgp_Array1OfDir& Nor);
};
#endif