mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a28be1eb2a | ||
|
835f8451ac |
@@ -1,96 +1,4 @@
|
|||||||
# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
|
# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
|
||||||
# https://github.com/google/draco
|
# https://github.com/google/draco
|
||||||
|
|
||||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
THIRDPARTY_PRODUCT("DRACO" "draco/compression/decode.h" "CSF_Draco" "")
|
||||||
|
|
||||||
if (NOT DEFINED INSTALL_DRACO)
|
|
||||||
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
|
|
||||||
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
|
|
||||||
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
|
||||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
|
|
||||||
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
|
||||||
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
|
|
||||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
|
|
||||||
if (DRACO_DIR_NAME)
|
|
||||||
set (3RDPARTY_DRACO_DIR "${3RDPARTY_DIR}/${DRACO_DIR_NAME}" CACHE PATH "The directory containing Draco" FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
|
||||||
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
|
|
||||||
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
|
|
||||||
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
|
|
||||||
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
|
|
||||||
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
|
|
||||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (3RDPARTY_DRACO_INCLUDE_DIR AND EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
|
||||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
|
||||||
else()
|
|
||||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DRACO_INCLUDE_DIR)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
|
||||||
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
|
||||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
|
||||||
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
|
|
||||||
|
|
||||||
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
|
|
||||||
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
CMAKE_FIND_ROOT_PATH_BOTH
|
|
||||||
NO_DEFAULT_PATH)
|
|
||||||
if (3RDPARTY_DRACO_LIBRARY AND EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
|
||||||
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY}" PATH)
|
|
||||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
|
||||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
|
||||||
else()
|
|
||||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (INSTALL_DRACO)
|
|
||||||
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
|
|
||||||
if (SINGLE_GENERATOR)
|
|
||||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
|
||||||
else()
|
|
||||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
|
||||||
CONFIGURATIONS Release
|
|
||||||
DESTINATION "${INSTALL_DIR_LIB}")
|
|
||||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
|
||||||
CONFIGURATIONS RelWithDebInfo
|
|
||||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
|
||||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
|
||||||
CONFIGURATIONS Debug
|
|
||||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
@@ -339,7 +339,6 @@ The <i>GeomConvert</i> package also provides the following:
|
|||||||
* global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation,
|
* global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation,
|
||||||
* an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces,
|
* an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces,
|
||||||
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
|
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
|
||||||
* algorithms that converts NURBS, Bezier and other general parametrized curves and surface into anaytical curves and surfaces.
|
|
||||||
|
|
||||||
@subsection occt_modat_1_4 Points on Curves
|
@subsection occt_modat_1_4 Points on Curves
|
||||||
|
|
||||||
|
@@ -1007,25 +1007,6 @@ Standard_Integer aNbOffsetSurfaces = aCheckContents.NbOffsetSurf();
|
|||||||
Handle(TopTools_HSequenceOfShape) aSeqFaces = aCheckContents.OffsetSurfaceSec();
|
Handle(TopTools_HSequenceOfShape) aSeqFaces = aCheckContents.OffsetSurfaceSec();
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
@subsubsection occt_shg_3_2_4 Analysis of shape underlined geometry
|
|
||||||
|
|
||||||
Class *ShapeAnalysis_CanonicalRecognition* provides tools that analyze geometry of shape and explore the possibility of converting geometry into a canonical form.
|
|
||||||
Canonical forms for curves are lines, circles and ellipses.
|
|
||||||
Canonical forms for surfaces are planar, cylindrical, conical and spherical surfaces.
|
|
||||||
|
|
||||||
Recognition and converting into canonical form is performed according to maximal deviation criterium: maximal distance between initial and canonical geometrical objects must be less, than given value.
|
|
||||||
|
|
||||||
Analysis of curves is allowed for following shapes:
|
|
||||||
* edge - algorithm checks 3d curve of edge
|
|
||||||
* wire - algorithm checks 3d curves of all edges in order to convert them in the same analytical curve
|
|
||||||
|
|
||||||
Analysis of surfaces is allowed for following shapes:
|
|
||||||
* face - algorithm checks surface of face
|
|
||||||
* shell - algorithm checks surfaces of all faces in order to convert them in the same analytical surface
|
|
||||||
* edge - algorithm checks all surfaces that are shared by given edge in order convert one of them in analytical surface, which most close to the input sample surface.
|
|
||||||
* wire - the same as for edge, but algorithm checks all edges of wire in order to find analytical surface, which most close to the input sample surface.
|
|
||||||
|
|
||||||
|
|
||||||
@section occt_shg_4 Upgrading
|
@section occt_shg_4 Upgrading
|
||||||
|
|
||||||
Upgrading tools are intended for adaptation of shapes for better use by Open CASCADE Technology or for customization to particular needs, i.e. for export to another system.
|
Upgrading tools are intended for adaptation of shapes for better use by Open CASCADE Technology or for customization to particular needs, i.e. for export to another system.
|
||||||
|
@@ -1948,7 +1948,7 @@ int mcrcomm_(integer *kop,
|
|||||||
/* Local variables */
|
/* Local variables */
|
||||||
intptr_t ideb;
|
intptr_t ideb;
|
||||||
doublereal dtab[32000];
|
doublereal dtab[32000];
|
||||||
intptr_t itab[160] /* was [4][40] */;
|
intptr_t itab[160] = {0} /* was [4][40] */;
|
||||||
intptr_t ipre;
|
intptr_t ipre;
|
||||||
integer i__, j, k;
|
integer i__, j, k;
|
||||||
|
|
||||||
@@ -2522,7 +2522,7 @@ int AdvApp2Var_SysBase::mcrlist_(integer *ier) const
|
|||||||
|
|
||||||
/* Local variables */
|
/* Local variables */
|
||||||
char cfmt[1];
|
char cfmt[1];
|
||||||
doublereal dfmt;
|
doublereal dfmt = 0.0; // unused
|
||||||
integer ifmt, i__, nufmt, ntotal;
|
integer ifmt, i__, nufmt, ntotal;
|
||||||
char subrou[7];
|
char subrou[7];
|
||||||
|
|
||||||
@@ -2667,7 +2667,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
|
|||||||
integer i__1, i__2;
|
integer i__1, i__2;
|
||||||
|
|
||||||
/* Local variables */
|
/* Local variables */
|
||||||
doublereal dfmt;
|
doublereal dfmt = 0.0; // unused
|
||||||
integer ifmt, iver;
|
integer ifmt, iver;
|
||||||
char subr[7];
|
char subr[7];
|
||||||
integer ksys , ibyte, irest, ier;
|
integer ksys , ibyte, irest, ier;
|
||||||
|
@@ -77,7 +77,8 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
|
|||||||
for(Standard_Integer i=1; i<=aNbPnts; i++)
|
for(Standard_Integer i=1; i<=aNbPnts; i++)
|
||||||
{
|
{
|
||||||
const IntSurf_PntOn2S POn2S = theline->Point(i);
|
const IntSurf_PntOn2S POn2S = theline->Point(i);
|
||||||
Standard_Real U,V;
|
Standard_Real U = 0.0;
|
||||||
|
Standard_Real V = 0.0;
|
||||||
(POn2S.*pfunc)(U,V);
|
(POn2S.*pfunc)(U,V);
|
||||||
aUmin = Min(U, aUmin);
|
aUmin = Min(U, aUmin);
|
||||||
aVmin = Min(V, aVmin);
|
aVmin = Min(V, aVmin);
|
||||||
|
@@ -15,8 +15,186 @@
|
|||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepBuilderAPI_Copy.hxx>
|
#include <BRepBuilderAPI_Copy.hxx>
|
||||||
#include <BRepTools_CopyModification.hxx>
|
#include <BRepTools_Modification.hxx>
|
||||||
|
#include <Geom2d_Curve.hxx>
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
#include <Geom_Surface.hxx>
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <Poly_Triangulation.hxx>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
//! Tool class implementing necessary functionality for copying geometry
|
||||||
|
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
|
||||||
|
const Standard_Boolean copyMesh)
|
||||||
|
: myCopyGeom(copyGeom),
|
||||||
|
myCopyMesh(copyMesh)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy face;
|
||||||
|
//! copies surface if requested
|
||||||
|
Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S,
|
||||||
|
TopLoc_Location& L, Standard_Real& Tol,
|
||||||
|
Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
S = BRep_Tool::Surface(F,L);
|
||||||
|
Tol = BRep_Tool::Tolerance(F);
|
||||||
|
RevWires = RevFace = Standard_False;
|
||||||
|
|
||||||
|
if ( ! S.IsNull() && myCopyGeom )
|
||||||
|
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
||||||
|
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy triangulation;
|
||||||
|
//! copies it if required
|
||||||
|
Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
if (!myCopyMesh
|
||||||
|
&& BRep_Tool::IsGeometric (F))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
TopLoc_Location L;
|
||||||
|
T = BRep_Tool::Triangulation(F, L);
|
||||||
|
|
||||||
|
if (T.IsNull())
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
// mesh is copied if and only if the geometry need to be copied too
|
||||||
|
if (myCopyGeom)
|
||||||
|
T = T->Copy();
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy edge;
|
||||||
|
//! copies curves if requested
|
||||||
|
Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C,
|
||||||
|
TopLoc_Location& L, Standard_Real& Tol) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
Standard_Real f,l;
|
||||||
|
C = BRep_Tool::Curve (E, L, f, l);
|
||||||
|
Tol = BRep_Tool::Tolerance(E);
|
||||||
|
|
||||||
|
if ( ! C.IsNull() && myCopyGeom )
|
||||||
|
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||||
|
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy polygon;
|
||||||
|
//! copies it if required
|
||||||
|
Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
if (!myCopyMesh
|
||||||
|
&& BRep_Tool::IsGeometric (E))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
TopLoc_Location aLoc;
|
||||||
|
P = BRep_Tool::Polygon3D(E, aLoc);
|
||||||
|
|
||||||
|
if (P.IsNull())
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
// polygon is copied if and only if the geometry need to be copied too
|
||||||
|
if (myCopyGeom)
|
||||||
|
P = P->Copy();
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy polygon;
|
||||||
|
//! copies it if required
|
||||||
|
Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F,
|
||||||
|
Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
if (!myCopyMesh
|
||||||
|
&& BRep_Tool::IsGeometric (E))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
TopLoc_Location aLoc;
|
||||||
|
Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(F, aLoc);
|
||||||
|
P = BRep_Tool::PolygonOnTriangulation(E, aTria, aLoc);
|
||||||
|
|
||||||
|
if (P.IsNull())
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
// polygon is copied if and only if the geometry need to be copied too
|
||||||
|
if (myCopyGeom)
|
||||||
|
P = P->Copy();
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy vertex
|
||||||
|
Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P,
|
||||||
|
Standard_Real& Tol) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
P = BRep_Tool::Pnt(V);
|
||||||
|
Tol = BRep_Tool::Tolerance(V);
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy edge;
|
||||||
|
//! copies pcurve if requested
|
||||||
|
Standard_Boolean NewCurve2d (const TopoDS_Edge& E,
|
||||||
|
const TopoDS_Face& F,
|
||||||
|
const TopoDS_Edge& /*NewE*/,
|
||||||
|
const TopoDS_Face& /*NewF*/,
|
||||||
|
Handle(Geom2d_Curve)& C,
|
||||||
|
Standard_Real& Tol) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
Tol = BRep_Tool::Tolerance(E);
|
||||||
|
Standard_Real f, l;
|
||||||
|
C = BRep_Tool::CurveOnSurface (E, F, f, l);
|
||||||
|
|
||||||
|
if ( ! C.IsNull() && myCopyGeom )
|
||||||
|
C = Handle(Geom2d_Curve)::DownCast (C->Copy());
|
||||||
|
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns true to indicate the need to copy vertex
|
||||||
|
Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E,
|
||||||
|
Standard_Real& P, Standard_Real& Tol) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
if (V.IsNull()) return Standard_False; // infinite edge may have Null vertex
|
||||||
|
|
||||||
|
Tol = BRep_Tool::Tolerance(V);
|
||||||
|
P = BRep_Tool::Parameter (V, E);
|
||||||
|
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the continuity of E between F1 and F2
|
||||||
|
GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1,
|
||||||
|
const TopoDS_Face& F2, const TopoDS_Edge&,
|
||||||
|
const TopoDS_Face&, const TopoDS_Face&) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
return BRep_Tool::Continuity (E, F1, F2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
DEFINE_STANDARD_RTTI_INLINE(BRepBuilderAPI_Copy_Modification,BRepTools_Modification)
|
||||||
|
|
||||||
|
private:
|
||||||
|
Standard_Boolean myCopyGeom;
|
||||||
|
Standard_Boolean myCopyMesh;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepBuilderAPI_Copy
|
//function : BRepBuilderAPI_Copy
|
||||||
@@ -25,7 +203,7 @@
|
|||||||
|
|
||||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||||
{
|
{
|
||||||
myModification = new BRepTools_CopyModification(Standard_True, Standard_False);
|
myModification = new BRepBuilderAPI_Copy_Modification(Standard_True, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -36,7 +214,7 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
|||||||
|
|
||||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||||
{
|
{
|
||||||
myModification = new BRepTools_CopyModification(copyGeom, copyMesh);
|
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||||
DoModif(S);
|
DoModif(S);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +226,7 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_B
|
|||||||
|
|
||||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||||
{
|
{
|
||||||
myModification = new BRepTools_CopyModification(copyGeom, copyMesh);
|
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||||
NotDone(); // on force la copie si on vient deja d`en faire une
|
NotDone(); // on force la copie si on vient deja d`en faire une
|
||||||
DoModif(S);
|
DoModif(S);
|
||||||
}
|
}
|
||||||
|
@@ -1,247 +0,0 @@
|
|||||||
// Created on: 2022-06-30
|
|
||||||
// Created by: Alexander MALYSHEV
|
|
||||||
// Copyright (c) 2022-2022 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 <BRepBuilderAPI_MakeShapeOnMesh.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
|
||||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
|
||||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
|
||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
|
||||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
|
||||||
#include <NCollection_IndexedDataMap.hxx>
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
//! Structure representing mesh edge.
|
|
||||||
struct Edge
|
|
||||||
{
|
|
||||||
//! Constructor. Sets edge nodes.
|
|
||||||
Edge(const Standard_Integer TheIdx1,
|
|
||||||
const Standard_Integer TheIdx2)
|
|
||||||
: Idx1(Min(TheIdx1, TheIdx2)),
|
|
||||||
Idx2(Max(TheIdx1, TheIdx2))
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! Comparison operator.
|
|
||||||
Standard_Boolean operator<(const Edge& other) const
|
|
||||||
{
|
|
||||||
if (Idx1 < other.Idx1 ||
|
|
||||||
(Idx1 == other.Idx1 && Idx2 < other.Idx2))
|
|
||||||
{
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! First index. It is lower or equal than the second.
|
|
||||||
Standard_Integer Idx1;
|
|
||||||
|
|
||||||
//! Second index.
|
|
||||||
Standard_Integer Idx2;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Hasher of Edge structure.
|
|
||||||
struct EdgeHasher
|
|
||||||
{
|
|
||||||
|
|
||||||
//! Returns hash code for the given edge.
|
|
||||||
static Standard_Integer HashCode(const Edge& theEdge,
|
|
||||||
const Standard_Integer theUpperBound)
|
|
||||||
{
|
|
||||||
// Circle-based collisions.
|
|
||||||
return ::HashCode(theEdge.Idx1 * theEdge.Idx1 + theEdge.Idx2 * theEdge.Idx2, theUpperBound);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns true if two edges are equal.
|
|
||||||
static Standard_Boolean IsEqual(const Edge& theEdge1,
|
|
||||||
const Edge& theEdge2)
|
|
||||||
{
|
|
||||||
return theEdge1.Idx1 == theEdge2.Idx1 && theEdge1.Idx2 == theEdge2.Idx2;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Build
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BRepBuilderAPI_MakeShapeOnMesh::Build(const Message_ProgressRange& theRange)
|
|
||||||
{
|
|
||||||
// Generally, this method guarantees topology sharing by mapping mesh primitives
|
|
||||||
// into topological counterparts.
|
|
||||||
// mesh points -> topological vertices
|
|
||||||
// mesh edges -> topological edges
|
|
||||||
|
|
||||||
// Cannot reconstruct anything from null or empty mesh.
|
|
||||||
if (myMesh.IsNull() || myMesh->NbNodes() == 0 || myMesh->NbTriangles() == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const Standard_Integer aNbNodes = myMesh->NbNodes();
|
|
||||||
const Standard_Integer aNbTriangles = myMesh->NbTriangles();
|
|
||||||
|
|
||||||
// We are going to have three loops: iterate once over nodes and iterate twice
|
|
||||||
// over triangles of input mesh.
|
|
||||||
Message_ProgressScope aPS(theRange,
|
|
||||||
"Per-facet shape construction",
|
|
||||||
Standard_Real(aNbNodes + 2 * aNbTriangles));
|
|
||||||
|
|
||||||
// Build shared vertices.
|
|
||||||
NCollection_IndexedDataMap<Standard_Integer, TopoDS_Vertex> aPnt2VertexMap;
|
|
||||||
|
|
||||||
for (Standard_Integer i = 1; i <= aNbNodes; ++i)
|
|
||||||
{
|
|
||||||
aPS.Next();
|
|
||||||
if (aPS.UserBreak())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const gp_Pnt aP = myMesh->Node(i);
|
|
||||||
const TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex(aP);
|
|
||||||
aPnt2VertexMap.Add(i, aV);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build shared edges.
|
|
||||||
NCollection_IndexedDataMap<Edge, TopoDS_Edge, EdgeHasher> anEdgeToTEgeMap;
|
|
||||||
for (Standard_Integer i = 1; i <= aNbTriangles; ++i)
|
|
||||||
{
|
|
||||||
aPS.Next();
|
|
||||||
if (aPS.UserBreak())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Standard_Integer anIdx[3];
|
|
||||||
const Poly_Triangle& aTriangle = myMesh->Triangle(i);
|
|
||||||
aTriangle.Get(anIdx[0], anIdx[1], anIdx[2]);
|
|
||||||
|
|
||||||
// Skip degenerated triangles.
|
|
||||||
if (anIdx[0] == anIdx[1] || anIdx[0] == anIdx[2] || anIdx[1] == anIdx[2])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const gp_Pnt aP1 = myMesh->Node(anIdx[0]);
|
|
||||||
const gp_Pnt aP2 = myMesh->Node(anIdx[1]);
|
|
||||||
const gp_Pnt aP3 = myMesh->Node(anIdx[2]);
|
|
||||||
const Standard_Real aD1 = aP1.SquareDistance(aP2);
|
|
||||||
const Standard_Real aD2 = aP1.SquareDistance(aP3);
|
|
||||||
const Standard_Real aD3 = aP2.SquareDistance(aP3);
|
|
||||||
if (aD1 < gp::Resolution() ||
|
|
||||||
aD2 < gp::Resolution() ||
|
|
||||||
aD3 < gp::Resolution())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edges are constructed in forward order for the existing normals orientation.
|
|
||||||
// In Poly_Triangulation, positive direction is defined as cross product:
|
|
||||||
// (aV1, aV2) x (aV1, aV3).
|
|
||||||
const TopoDS_Vertex& aV1 = aPnt2VertexMap.FindFromKey(anIdx[0]);
|
|
||||||
const TopoDS_Vertex& aV2 = aPnt2VertexMap.FindFromKey(anIdx[1]);
|
|
||||||
const TopoDS_Vertex& aV3 = aPnt2VertexMap.FindFromKey(anIdx[2]);
|
|
||||||
|
|
||||||
const Edge aMeshEdge1(anIdx[0], anIdx[1]);
|
|
||||||
const Edge aMeshEdge2(anIdx[1], anIdx[2]);
|
|
||||||
const Edge aMeshEdge3(anIdx[2], anIdx[0]);
|
|
||||||
|
|
||||||
BRepBuilderAPI_MakeEdge aMaker1(aV1, aV2);
|
|
||||||
BRepBuilderAPI_MakeEdge aMaker2(aV2, aV3);
|
|
||||||
BRepBuilderAPI_MakeEdge aMaker3(aV3, aV1);
|
|
||||||
|
|
||||||
TopoDS_Edge aTE1 = aMaker1.Edge();
|
|
||||||
if (anIdx[1] < anIdx[0])
|
|
||||||
aTE1.Reverse();
|
|
||||||
|
|
||||||
TopoDS_Edge aTE2 = aMaker2.Edge();
|
|
||||||
if (anIdx[2] < anIdx[1])
|
|
||||||
aTE2.Reverse();
|
|
||||||
|
|
||||||
TopoDS_Edge aTE3 = aMaker3.Edge();
|
|
||||||
if (anIdx[0] < anIdx[2])
|
|
||||||
aTE3.Reverse();
|
|
||||||
|
|
||||||
anEdgeToTEgeMap.Add(aMeshEdge1, aTE1);
|
|
||||||
anEdgeToTEgeMap.Add(aMeshEdge2, aTE2);
|
|
||||||
anEdgeToTEgeMap.Add(aMeshEdge3, aTE3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct planar faces using shared topology.
|
|
||||||
TopoDS_Compound aResult;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
aBB.MakeCompound(aResult);
|
|
||||||
for (Standard_Integer i = 1; i <= aNbTriangles; ++i)
|
|
||||||
{
|
|
||||||
aPS.Next();
|
|
||||||
if (aPS.UserBreak())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Standard_Integer anIdx[3];
|
|
||||||
const Poly_Triangle& aTriangle = myMesh->Triangle(i);
|
|
||||||
aTriangle.Get(anIdx[0], anIdx[1], anIdx[2]);
|
|
||||||
|
|
||||||
const Edge aMeshEdge1(anIdx[0], anIdx[1]);
|
|
||||||
const Edge aMeshEdge2(anIdx[1], anIdx[2]);
|
|
||||||
const Edge aMeshEdge3(anIdx[2], anIdx[0]);
|
|
||||||
const Standard_Boolean isReversed1 = anIdx[1] < anIdx[0];
|
|
||||||
const Standard_Boolean isReversed2 = anIdx[2] < anIdx[1];
|
|
||||||
const Standard_Boolean isReversed3 = anIdx[0] < anIdx[2];
|
|
||||||
|
|
||||||
// Edges can be skipped in case of mesh defects - topologically or geometrically
|
|
||||||
// degenerated triangles.
|
|
||||||
const Standard_Boolean aHasAllEdges = anEdgeToTEgeMap.Contains(aMeshEdge1) &&
|
|
||||||
anEdgeToTEgeMap.Contains(aMeshEdge2) &&
|
|
||||||
anEdgeToTEgeMap.Contains(aMeshEdge3) ;
|
|
||||||
if (!aHasAllEdges)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TopoDS_Edge aTEdge1 = anEdgeToTEgeMap.FindFromKey(aMeshEdge1);
|
|
||||||
if (isReversed1)
|
|
||||||
aTEdge1.Reverse();
|
|
||||||
TopoDS_Edge aTEdge2 = anEdgeToTEgeMap.FindFromKey(aMeshEdge2);
|
|
||||||
if (isReversed2)
|
|
||||||
aTEdge2.Reverse();
|
|
||||||
TopoDS_Edge aTEdge3 = anEdgeToTEgeMap.FindFromKey(aMeshEdge3);
|
|
||||||
if (isReversed3)
|
|
||||||
aTEdge3.Reverse();
|
|
||||||
|
|
||||||
BRepBuilderAPI_MakeWire aWireMaker;
|
|
||||||
aWireMaker.Add(aTEdge1);
|
|
||||||
aWireMaker.Add(aTEdge2);
|
|
||||||
aWireMaker.Add(aTEdge3);
|
|
||||||
const TopoDS_Wire aWire = aWireMaker.Wire();
|
|
||||||
|
|
||||||
// Construct plane explicitly since it is faster than automatic construction
|
|
||||||
// within BRepBuilderAPI_MakeFace.
|
|
||||||
BRepAdaptor_Curve aC1(aTEdge1);
|
|
||||||
BRepAdaptor_Curve aC2(aTEdge2);
|
|
||||||
const gp_Dir aD1 = aC1.Line().Direction();
|
|
||||||
const gp_Dir aD2 = aC2.Line().Direction();
|
|
||||||
gp_XYZ aN = aD1.XYZ().Crossed(aD2.XYZ());
|
|
||||||
if (aN.SquareModulus() < Precision::SquareConfusion())
|
|
||||||
continue;
|
|
||||||
if (aTEdge1.Orientation() == TopAbs_REVERSED)
|
|
||||||
aN.Reverse();
|
|
||||||
if (aTEdge2.Orientation() == TopAbs_REVERSED)
|
|
||||||
aN.Reverse();
|
|
||||||
const gp_Dir aNorm(aN);
|
|
||||||
gp_Pln aPln(myMesh->Node(anIdx[0]), aNorm);
|
|
||||||
|
|
||||||
BRepBuilderAPI_MakeFace aFaceMaker(aPln, aWire);
|
|
||||||
const TopoDS_Face aFace = aFaceMaker.Face();
|
|
||||||
|
|
||||||
aBB.Add(aResult, aFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Done();
|
|
||||||
myShape = aResult;
|
|
||||||
}
|
|
@@ -1,46 +0,0 @@
|
|||||||
// Created on: 2022-06-30
|
|
||||||
// Created by: Alexander MALYSHEV
|
|
||||||
// Copyright (c) 2022-2022 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 _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
|
||||||
#define _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
|
||||||
|
|
||||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
|
||||||
#include <Poly_Triangulation.hxx>
|
|
||||||
|
|
||||||
//! Builds shape on per-facet basis on the input mesh. Resulting shape has shared
|
|
||||||
//! edges by construction, but no maximization (unify same domain) is applied.
|
|
||||||
//! No generation history is provided.
|
|
||||||
class BRepBuilderAPI_MakeShapeOnMesh : public BRepBuilderAPI_MakeShape
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
//! Ctor. Sets mesh to process.
|
|
||||||
//! @param theMesh [in] - Mesh to construct shape for.
|
|
||||||
BRepBuilderAPI_MakeShapeOnMesh(const Handle(Poly_Triangulation)& theMesh)
|
|
||||||
: myMesh(theMesh)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! Builds shape on mesh.
|
|
||||||
Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(Poly_Triangulation) myMesh;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
|
@@ -36,14 +36,13 @@ BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const gp_Trsf& T) :
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& theShape,
|
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& S,
|
||||||
const gp_Trsf& theTrsf,
|
const gp_Trsf& T,
|
||||||
const Standard_Boolean theCopyGeom,
|
const Standard_Boolean Copy) :
|
||||||
const Standard_Boolean theCopyMesh)
|
myTrsf(T)
|
||||||
: myTrsf(theTrsf)
|
|
||||||
{
|
{
|
||||||
myModification = new BRepTools_TrsfModification(theTrsf);
|
myModification = new BRepTools_TrsfModification(T);
|
||||||
Perform(theShape, theCopyGeom, theCopyMesh);
|
Perform(S,Copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -53,21 +52,19 @@ BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& theSh
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& theShape,
|
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& S,
|
||||||
const Standard_Boolean theCopyGeom,
|
const Standard_Boolean Copy)
|
||||||
const Standard_Boolean theCopyMesh)
|
|
||||||
{
|
{
|
||||||
myUseModif = theCopyGeom || myTrsf.IsNegative() || (Abs(Abs(myTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec());
|
myUseModif = Copy || myTrsf.IsNegative() || (Abs(Abs(myTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec());
|
||||||
if (myUseModif) {
|
if (myUseModif) {
|
||||||
Handle(BRepTools_TrsfModification) theModif =
|
Handle(BRepTools_TrsfModification) theModif =
|
||||||
Handle(BRepTools_TrsfModification)::DownCast(myModification);
|
Handle(BRepTools_TrsfModification)::DownCast(myModification);
|
||||||
theModif->Trsf() = myTrsf;
|
theModif->Trsf() = myTrsf;
|
||||||
theModif->IsCopyMesh() = theCopyMesh;
|
DoModif(S,myModification);
|
||||||
DoModif(theShape, myModification);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myLocation = myTrsf;
|
myLocation = myTrsf;
|
||||||
myShape = theShape.Moved(myLocation);
|
myShape = S.Moved(myLocation);
|
||||||
Done();
|
Done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,37 +50,28 @@ public:
|
|||||||
//! to define the shape to transform.
|
//! to define the shape to transform.
|
||||||
Standard_EXPORT BRepBuilderAPI_Transform(const gp_Trsf& T);
|
Standard_EXPORT BRepBuilderAPI_Transform(const gp_Trsf& T);
|
||||||
|
|
||||||
//! Creates a transformation from the gp_Trsf <theTrsf>, and
|
//! Creates a transformation from the gp_Trsf <T>, and
|
||||||
//! applies it to the shape <theShape>. If the transformation
|
//! applies it to the shape <S>. If the transformation
|
||||||
//! is direct and isometric (determinant = 1) and
|
//! is direct and isometric (determinant = 1) and
|
||||||
//! <theCopyGeom> = Standard_False, the resulting shape is
|
//! <Copy> = Standard_False, the resulting shape is
|
||||||
//! <theShape> on which a new location has been set.
|
//! <S> on which a new location has been set.
|
||||||
//! Otherwise, the transformation is applied on a
|
//! Otherwise, the transformation is applied on a
|
||||||
//! duplication of <theShape>.
|
//! duplication of <S>.
|
||||||
//! If <theCopyMesh> is true, the triangulation will be copied,
|
Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& S, const gp_Trsf& T, const Standard_Boolean Copy = Standard_False);
|
||||||
//! and the copy will be assigned to the result shape.
|
|
||||||
Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& theShape,
|
|
||||||
const gp_Trsf& theTrsf,
|
|
||||||
const Standard_Boolean theCopyGeom = Standard_False,
|
|
||||||
const Standard_Boolean theCopyMesh = Standard_False);
|
|
||||||
|
|
||||||
//! Applies the geometric transformation defined at the
|
//! pplies the geometric transformation defined at the
|
||||||
//! time of construction of this framework to the shape S.
|
//! time of construction of this framework to the shape S.
|
||||||
//! - If the transformation T is direct and isometric, in
|
//! - If the transformation T is direct and isometric, in
|
||||||
//! other words, if the determinant of the vectorial part
|
//! other words, if the determinant of the vectorial part
|
||||||
//! of T is equal to 1., and if theCopyGeom equals false (the
|
//! of T is equal to 1., and if Copy equals false (the
|
||||||
//! default value), the resulting shape is the same as
|
//! default value), the resulting shape is the same as
|
||||||
//! the original but with a new location assigned to it.
|
//! the original but with a new location assigned to it.
|
||||||
//! - In all other cases, the transformation is applied to a duplicate of theShape.
|
//! - In all other cases, the transformation is applied to a duplicate of S.
|
||||||
//! - If theCopyMesh is true, the triangulation will be copied,
|
|
||||||
//! and the copy will be assigned to the result shape.
|
|
||||||
//! Use the function Shape to access the result.
|
//! Use the function Shape to access the result.
|
||||||
//! Note: this framework can be reused to apply the same
|
//! Note: this framework can be reused to apply the same
|
||||||
//! geometric transformation to other shapes. You only
|
//! geometric transformation to other shapes. You only
|
||||||
//! need to specify them by calling the function Perform again.
|
//! need to specify them by calling the function Perform again.
|
||||||
Standard_EXPORT void Perform (const TopoDS_Shape& theShape,
|
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_False);
|
||||||
const Standard_Boolean theCopyGeom = Standard_False,
|
|
||||||
const Standard_Boolean theCopyMesh = Standard_False);
|
|
||||||
|
|
||||||
//! Returns the modified shape corresponding to <S>.
|
//! Returns the modified shape corresponding to <S>.
|
||||||
Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
|
Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
|
||||||
|
@@ -26,8 +26,6 @@ BRepBuilderAPI_MakePolygon.cxx
|
|||||||
BRepBuilderAPI_MakePolygon.hxx
|
BRepBuilderAPI_MakePolygon.hxx
|
||||||
BRepBuilderAPI_MakeShape.cxx
|
BRepBuilderAPI_MakeShape.cxx
|
||||||
BRepBuilderAPI_MakeShape.hxx
|
BRepBuilderAPI_MakeShape.hxx
|
||||||
BRepBuilderAPI_MakeShapeOnMesh.cxx
|
|
||||||
BRepBuilderAPI_MakeShapeOnMesh.hxx
|
|
||||||
BRepBuilderAPI_MakeShell.cxx
|
BRepBuilderAPI_MakeShell.cxx
|
||||||
BRepBuilderAPI_MakeShell.hxx
|
BRepBuilderAPI_MakeShell.hxx
|
||||||
BRepBuilderAPI_MakeSolid.cxx
|
BRepBuilderAPI_MakeSolid.cxx
|
||||||
|
@@ -1585,7 +1585,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
|||||||
NbSamples = 4;
|
NbSamples = 4;
|
||||||
gp_Pln FirstPlane;
|
gp_Pln FirstPlane;
|
||||||
PlaneOfWire(TopoDS::Wire(myWork(ideb)), FirstPlane);
|
PlaneOfWire(TopoDS::Wire(myWork(ideb)), FirstPlane);
|
||||||
gp_Pnt PrevBary = FirstPlane.Location();
|
gp_Pnt FirstBary = FirstPlane.Location();
|
||||||
gp_Vec NormalOfFirstPlane = FirstPlane.Axis().Direction();
|
gp_Vec NormalOfFirstPlane = FirstPlane.Axis().Direction();
|
||||||
for (i = ideb+1; i <= ifin; i++)
|
for (i = ideb+1; i <= ifin; i++)
|
||||||
{
|
{
|
||||||
@@ -1596,10 +1596,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
|||||||
gp_Pln CurPlane;
|
gp_Pln CurPlane;
|
||||||
PlaneOfWire(aWire, CurPlane);
|
PlaneOfWire(aWire, CurPlane);
|
||||||
gp_Pnt CurBary = CurPlane.Location();
|
gp_Pnt CurBary = CurPlane.Location();
|
||||||
gp_Vec aVec(PrevBary, CurBary);
|
gp_Vec aVec(FirstBary, CurBary);
|
||||||
gp_Vec anOffsetProj = (aVec * NormalOfFirstPlane) * NormalOfFirstPlane;
|
gp_Vec anOffsetProj = (aVec * NormalOfFirstPlane) * NormalOfFirstPlane;
|
||||||
CurBary.Translate(-anOffsetProj); //projected current bary center
|
CurBary.Translate(-anOffsetProj); //projected current bary center
|
||||||
gp_Vec Offset(CurBary, PrevBary);
|
gp_Vec Offset(CurBary, FirstBary);
|
||||||
|
|
||||||
TopoDS_Wire newwire;
|
TopoDS_Wire newwire;
|
||||||
BRep_Builder BB;
|
BRep_Builder BB;
|
||||||
@@ -1804,8 +1804,6 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
|||||||
newwire.Closed( Standard_True );
|
newwire.Closed( Standard_True );
|
||||||
newwire.Orientation( TopAbs_FORWARD );
|
newwire.Orientation( TopAbs_FORWARD );
|
||||||
myWork(i) = newwire;
|
myWork(i) = newwire;
|
||||||
|
|
||||||
PrevBary = CurBary;
|
|
||||||
}
|
}
|
||||||
#ifdef OCCT_DEBUG_EFV
|
#ifdef OCCT_DEBUG_EFV
|
||||||
|
|
||||||
|
@@ -124,12 +124,10 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
|
|||||||
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
||||||
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
||||||
|
|
||||||
// Slightly increase exact resolution so to cover links with approximate
|
|
||||||
// length equal to resolution itself on sub-resolution differences.
|
|
||||||
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
||||||
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
||||||
const Standard_Real aResU = aSurface.UResolution (aTolerance) * 1.1;
|
const Standard_Real aResU = aSurface.UResolution (aTolerance);
|
||||||
const Standard_Real aResV = aSurface.VResolution (aTolerance) * 1.1;
|
const Standard_Real aResV = aSurface.VResolution (aTolerance);
|
||||||
|
|
||||||
const Standard_Real aDeflectionUV = 1.e-05;
|
const Standard_Real aDeflectionUV = 1.e-05;
|
||||||
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
||||||
|
@@ -46,8 +46,7 @@ namespace
|
|||||||
void operator()(const Standard_Integer theFaceIndex) const
|
void operator()(const Standard_Integer theFaceIndex) const
|
||||||
{
|
{
|
||||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||||
if (aDFace->IsSet(IMeshData_Outdated) ||
|
if (aDFace->IsSet(IMeshData_Outdated))
|
||||||
aDFace->GetFace().IsNull())
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -120,7 +119,7 @@ namespace
|
|||||||
void operator()(const Standard_Integer theFaceIndex) const
|
void operator()(const Standard_Integer theFaceIndex) const
|
||||||
{
|
{
|
||||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone || aDFace->IsSet(IMeshData_Failure))
|
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -124,14 +124,7 @@ static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const cha
|
|||||||
Standard_Boolean isBasic = Standard_False;
|
Standard_Boolean isBasic = Standard_False;
|
||||||
Standard_Boolean isForced = Standard_False;
|
Standard_Boolean isForced = Standard_False;
|
||||||
Standard_Boolean isCopy = Standard_False;
|
Standard_Boolean isCopy = Standard_False;
|
||||||
Standard_Boolean isCopyMesh = Standard_False;
|
|
||||||
|
|
||||||
// Check "copymesh" flag.
|
|
||||||
if (!strcmp(a[n - 1], "-copymesh"))
|
|
||||||
{
|
|
||||||
isCopyMesh = Standard_True;
|
|
||||||
last = --n;
|
|
||||||
}
|
|
||||||
// Check "copy" flag.
|
// Check "copy" flag.
|
||||||
if (!strcmp(a[n-1], "-copy")) {
|
if (!strcmp(a[n-1], "-copy")) {
|
||||||
isCopy = Standard_True;
|
isCopy = Standard_True;
|
||||||
@@ -225,7 +218,7 @@ static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const cha
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
trf.Perform(S, isCopy, isCopyMesh);
|
trf.Perform(S, isCopy);
|
||||||
if (!trf.IsDone())
|
if (!trf.IsDone())
|
||||||
return 1;
|
return 1;
|
||||||
DBRep::Set(a[i],trf.Shape());
|
DBRep::Set(a[i],trf.Shape());
|
||||||
@@ -1494,27 +1487,27 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
|||||||
transform,g);
|
transform,g);
|
||||||
|
|
||||||
theCommands.Add("tmove",
|
theCommands.Add("tmove",
|
||||||
"tmove name1 name2 ... name, set location from name [-copy] [-copymesh]",
|
"tmove name1 name2 ... name, set location from name [-copy]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
transform,g);
|
transform,g);
|
||||||
|
|
||||||
theCommands.Add("ttranslate",
|
theCommands.Add("ttranslate",
|
||||||
"ttranslate name1 name2 ... dx dy dz [-copy [-copymesh]]",
|
"ttranslate name1 name2 ... dx dy dz [-copy]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
transform,g);
|
transform,g);
|
||||||
|
|
||||||
theCommands.Add("trotate",
|
theCommands.Add("trotate",
|
||||||
"trotate name1 name2 ... x y z dx dy dz angle [-copy [-copymesh]]",
|
"trotate name1 name2 ... x y z dx dy dz angle [-copy]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
transform,g);
|
transform,g);
|
||||||
|
|
||||||
theCommands.Add("tmirror",
|
theCommands.Add("tmirror",
|
||||||
"tmirror name x y z dx dy dz [-copy] [-copymesh]",
|
"tmirror name x y z dx dy dz [-copy]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
transform,g);
|
transform,g);
|
||||||
|
|
||||||
theCommands.Add("tscale",
|
theCommands.Add("tscale",
|
||||||
"tscale name x y z scale [-copy] [-copymesh]",
|
"tscale name x y z scale [-copy]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
transform,g);
|
transform,g);
|
||||||
|
|
||||||
|
@@ -893,8 +893,6 @@ void BRepTools::CleanGeometry(const TopoDS_Shape& theShape)
|
|||||||
aBuilder.UpdateEdge(anEdge, Handle(Geom_Curve)(),
|
aBuilder.UpdateEdge(anEdge, Handle(Geom_Curve)(),
|
||||||
TopLoc_Location(), BRep_Tool::Tolerance(anEdge));
|
TopLoc_Location(), BRep_Tool::Tolerance(anEdge));
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveUnusedPCurves(theShape);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,215 +0,0 @@
|
|||||||
// Copyright (c) 1999-2022 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 <BRepTools_CopyModification.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <TopLoc_Location.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_CopyModification, BRepTools_Modification)
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BRepTools_CopyModification
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BRepTools_CopyModification::BRepTools_CopyModification(const Standard_Boolean copyGeom,
|
|
||||||
const Standard_Boolean copyMesh)
|
|
||||||
: myCopyGeom(copyGeom),
|
|
||||||
myCopyMesh(copyMesh)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewSurface
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewSurface(const TopoDS_Face& theFace,
|
|
||||||
Handle(Geom_Surface)& theSurf,
|
|
||||||
TopLoc_Location& theLoc,
|
|
||||||
Standard_Real& theTol,
|
|
||||||
Standard_Boolean& theRevWires,
|
|
||||||
Standard_Boolean& theRevFace)
|
|
||||||
{
|
|
||||||
theSurf = BRep_Tool::Surface(theFace, theLoc);
|
|
||||||
theTol = BRep_Tool::Tolerance(theFace);
|
|
||||||
theRevWires = theRevFace = Standard_False;
|
|
||||||
|
|
||||||
if (!theSurf.IsNull() && myCopyGeom)
|
|
||||||
theSurf = Handle(Geom_Surface)::DownCast(theSurf->Copy());
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewTriangulation(const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_Triangulation)& theTri)
|
|
||||||
{
|
|
||||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theFace))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
theTri = BRep_Tool::Triangulation(theFace, aLoc);
|
|
||||||
|
|
||||||
if (theTri.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
// mesh is copied if and only if the geometry need to be copied too
|
|
||||||
if (myCopyGeom)
|
|
||||||
theTri = theTri->Copy();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewCurve
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewCurve(const TopoDS_Edge& theEdge,
|
|
||||||
Handle(Geom_Curve)& theCurve,
|
|
||||||
TopLoc_Location& theLoc,
|
|
||||||
Standard_Real& theTol)
|
|
||||||
{
|
|
||||||
Standard_Real aFirst, aLast;
|
|
||||||
theCurve = BRep_Tool::Curve(theEdge, theLoc, aFirst, aLast);
|
|
||||||
theTol = BRep_Tool::Tolerance(theEdge);
|
|
||||||
|
|
||||||
if (!theCurve.IsNull() && myCopyGeom)
|
|
||||||
theCurve = Handle(Geom_Curve)::DownCast(theCurve->Copy());
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygon
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewPolygon(const TopoDS_Edge& theEdge,
|
|
||||||
Handle(Poly_Polygon3D)& thePoly)
|
|
||||||
{
|
|
||||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theEdge))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
thePoly = BRep_Tool::Polygon3D(theEdge, aLoc);
|
|
||||||
|
|
||||||
if (thePoly.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
// polygon is copied if and only if the geometry need to be copied too
|
|
||||||
if (myCopyGeom)
|
|
||||||
thePoly = thePoly->Copy();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygonOnTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewPolygonOnTriangulation(
|
|
||||||
const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
|
||||||
{
|
|
||||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theEdge))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(theFace, aLoc);
|
|
||||||
thePoly = BRep_Tool::PolygonOnTriangulation(theEdge, aTria, aLoc);
|
|
||||||
|
|
||||||
if (thePoly.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
// polygon is copied if and only if the geometry need to be copied too
|
|
||||||
if (myCopyGeom)
|
|
||||||
thePoly = thePoly->Copy();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPoint
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewPoint(const TopoDS_Vertex& theVertex,
|
|
||||||
gp_Pnt& thePnt,
|
|
||||||
Standard_Real& theTol)
|
|
||||||
{
|
|
||||||
thePnt = BRep_Tool::Pnt(theVertex);
|
|
||||||
theTol = BRep_Tool::Tolerance(theVertex);
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewCurve2d
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewCurve2d(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
const TopoDS_Edge&,
|
|
||||||
const TopoDS_Face&,
|
|
||||||
Handle(Geom2d_Curve)& theCurve,
|
|
||||||
Standard_Real& theTol)
|
|
||||||
{
|
|
||||||
theTol = BRep_Tool::Tolerance(theEdge);
|
|
||||||
Standard_Real aFirst, aLast;
|
|
||||||
theCurve = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
|
|
||||||
|
|
||||||
if (!theCurve.IsNull() && myCopyGeom)
|
|
||||||
theCurve = Handle(Geom2d_Curve)::DownCast(theCurve->Copy());
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_CopyModification::NewParameter(const TopoDS_Vertex& theVertex,
|
|
||||||
const TopoDS_Edge& theEdge,
|
|
||||||
Standard_Real& thePnt,
|
|
||||||
Standard_Real& theTol)
|
|
||||||
{
|
|
||||||
if (theVertex.IsNull())
|
|
||||||
return Standard_False; // infinite edge may have Null vertex
|
|
||||||
|
|
||||||
theTol = BRep_Tool::Tolerance(theVertex);
|
|
||||||
thePnt = BRep_Tool::Parameter(theVertex, theEdge);
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Continuity
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GeomAbs_Shape BRepTools_CopyModification::Continuity(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace1,
|
|
||||||
const TopoDS_Face& theFace2,
|
|
||||||
const TopoDS_Edge&,
|
|
||||||
const TopoDS_Face&,
|
|
||||||
const TopoDS_Face&)
|
|
||||||
{
|
|
||||||
return BRep_Tool::Continuity(theEdge, theFace1, theFace2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@@ -1,124 +0,0 @@
|
|||||||
// Copyright (c) 1999-2022 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 _BRepTools_CopyModification_HeaderFile
|
|
||||||
#define _BRepTools_CopyModification_HeaderFile
|
|
||||||
|
|
||||||
#include <BRepTools_Modification.hxx>
|
|
||||||
|
|
||||||
class BRepTools_CopyModification;
|
|
||||||
DEFINE_STANDARD_HANDLE(BRepTools_CopyModification, BRepTools_Modification)
|
|
||||||
|
|
||||||
//! Tool class implementing necessary functionality for copying geometry and triangulation.
|
|
||||||
class BRepTools_CopyModification : public BRepTools_Modification
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! Constructor.
|
|
||||||
//! \param[in] theCopyGeom indicates that the geomtery (surfaces and curves) should be copied
|
|
||||||
//! \param[in] theCopyMesh indicates that the triangulation should be copied
|
|
||||||
Standard_EXPORT explicit BRepTools_CopyModification(const Standard_Boolean theCopyGeom = Standard_True,
|
|
||||||
const Standard_Boolean theCopyMesh = Standard_True);
|
|
||||||
|
|
||||||
//! Returns true if theFace has been modified.
|
|
||||||
//! If the face has been modified:
|
|
||||||
//! - theSurf is the new geometry of the face,
|
|
||||||
//! - theLoc is its new location, and
|
|
||||||
//! - theTol is the new tolerance.
|
|
||||||
//! theRevWires, theRevFace are always set to false, because the orientaion is not changed.
|
|
||||||
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& theFace,
|
|
||||||
Handle(Geom_Surface)& theSurf,
|
|
||||||
TopLoc_Location& theLoc,
|
|
||||||
Standard_Real& theTol,
|
|
||||||
Standard_Boolean& theRevWires,
|
|
||||||
Standard_Boolean& theRevFace) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if theEdge has been modified.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - theCurve is the new geometric support of the edge,
|
|
||||||
//! - theLoc is the new location, and
|
|
||||||
//! - theTol is the new tolerance.
|
|
||||||
//! If the edge has not been modified, this function
|
|
||||||
//! returns false, and the values of theCurve, theLoc and theTol are not significant.
|
|
||||||
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& theEdge,
|
|
||||||
Handle(Geom_Curve)& theCurve,
|
|
||||||
TopLoc_Location& theLoc,
|
|
||||||
Standard_Real& theTol) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if theVertex has been modified.
|
|
||||||
//! If the vertex has been modified:
|
|
||||||
//! - thePnt is the new geometry of the vertex, and
|
|
||||||
//! - theTol is the new tolerance.
|
|
||||||
//! If the vertex has not been modified this function
|
|
||||||
//! returns false, and the values of thePnt and theTol are not significant.
|
|
||||||
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& theVertex, gp_Pnt& thePnt, Standard_Real& theTol) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if theEdge has a new curve on surface on theFace.
|
|
||||||
//! If a new curve exists:
|
|
||||||
//! - theCurve is the new geometric support of the edge,
|
|
||||||
//! - theTol the new tolerance.
|
|
||||||
//! If no new curve exists, this function returns false, and
|
|
||||||
//! the values of theCurve and theTol are not significant.
|
|
||||||
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
const TopoDS_Edge& theNewEdge,
|
|
||||||
const TopoDS_Face& theNewFace,
|
|
||||||
Handle(Geom2d_Curve)& theCurve,
|
|
||||||
Standard_Real& theTol) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if theVertex has a new parameter on theEdge.
|
|
||||||
//! If a new parameter exists:
|
|
||||||
//! - thePnt is the parameter, and
|
|
||||||
//! - theTol is the new tolerance.
|
|
||||||
//! If no new parameter exists, this function returns false,
|
|
||||||
//! and the values of thePnt and theTol are not significant.
|
|
||||||
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& theVertex,
|
|
||||||
const TopoDS_Edge& theEdge,
|
|
||||||
Standard_Real& thePnt,
|
|
||||||
Standard_Real& theTol) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns the continuity of theNewEdge between theNewFace1 and theNewFace2.
|
|
||||||
//!
|
|
||||||
//! theNewEdge is the new edge created from theEdge. theNewFace1
|
|
||||||
//! (resp. theNewFace2) is the new face created from theFace1 (resp. theFace2).
|
|
||||||
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace1,
|
|
||||||
const TopoDS_Face& theFace2,
|
|
||||||
const TopoDS_Edge& theNewEdge,
|
|
||||||
const TopoDS_Face& theNewFace1,
|
|
||||||
const TopoDS_Face& theNewFace2) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the face has been modified according to changed triangulation.
|
|
||||||
//! If the face has been modified:
|
|
||||||
//! - theTri is a new triangulation on the face
|
|
||||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace, Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - thePoly is a new polygon
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge, Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - thePoly is a new polygon on triangulation
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(BRepTools_CopyModification, BRepTools_Modification)
|
|
||||||
|
|
||||||
private:
|
|
||||||
Standard_Boolean myCopyGeom;
|
|
||||||
Standard_Boolean myCopyMesh;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _BRepTools_CopyModification_HeaderFile
|
|
@@ -29,7 +29,6 @@
|
|||||||
#include <GeomLib.hxx>
|
#include <GeomLib.hxx>
|
||||||
#include <gp_GTrsf.hxx>
|
#include <gp_GTrsf.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Quaternion.hxx>
|
|
||||||
#include <gp_XYZ.hxx>
|
#include <gp_XYZ.hxx>
|
||||||
#include <Standard_NoSuchObject.hxx>
|
#include <Standard_NoSuchObject.hxx>
|
||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
@@ -89,13 +88,7 @@ Standard_Boolean BRepTools_GTrsfModification::NewSurface
|
|||||||
gp_GTrsf gtrsf;
|
gp_GTrsf gtrsf;
|
||||||
gtrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
gtrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
||||||
gtrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
gtrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
||||||
S = BRep_Tool::Surface(F, L);
|
S = Handle(Geom_Surface)::DownCast(BRep_Tool::Surface(F,L)->Copy());
|
||||||
if (S.IsNull())
|
|
||||||
{
|
|
||||||
//processing the case when there is no geometry
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
|
||||||
|
|
||||||
Tol = BRep_Tool::Tolerance(F);
|
Tol = BRep_Tool::Tolerance(F);
|
||||||
Tol *= myGScale;
|
Tol *= myGScale;
|
||||||
@@ -180,7 +173,7 @@ Standard_Boolean BRepTools_GTrsfModification::NewCurve
|
|||||||
C = new Geom_TrimmedCurve(C, f, l);
|
C = new Geom_TrimmedCurve(C, f, l);
|
||||||
}
|
}
|
||||||
L.Identity() ;
|
L.Identity() ;
|
||||||
return !C.IsNull();
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -221,11 +214,6 @@ Standard_Boolean BRepTools_GTrsfModification::NewCurve2d
|
|||||||
Tol *= myGScale;
|
Tol *= myGScale;
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
C = BRep_Tool::CurveOnSurface(E,F,f,l);
|
C = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||||
if (C.IsNull())
|
|
||||||
{
|
|
||||||
//processing the case when there is no geometry
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
C = new Geom2d_TrimmedCurve(C, f, l);
|
C = new Geom2d_TrimmedCurve(C, f, l);
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@@ -263,113 +251,4 @@ GeomAbs_Shape BRepTools_GTrsfModification::Continuity
|
|||||||
return BRep_Tool::Continuity(E,F1,F2);
|
return BRep_Tool::Continuity(E,F1,F2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_Triangulation)& theTriangulation)
|
|
||||||
{
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
theTriangulation = BRep_Tool::Triangulation(theFace, aLoc);
|
|
||||||
if (theTriangulation.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_GTrsf aGTrsf;
|
|
||||||
aGTrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
|
||||||
aGTrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
|
||||||
aGTrsf.Multiply(aLoc.Transformation());
|
|
||||||
|
|
||||||
theTriangulation = theTriangulation->Copy();
|
|
||||||
theTriangulation->SetCachedMinMax(Bnd_Box()); // clear bounding box
|
|
||||||
theTriangulation->Deflection(theTriangulation->Deflection() * Abs(myGScale));
|
|
||||||
// apply transformation to 3D nodes
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
|
||||||
{
|
|
||||||
gp_Pnt aP = theTriangulation->Node(anInd);
|
|
||||||
aGTrsf.Transforms(aP.ChangeCoord());
|
|
||||||
theTriangulation->SetNode(anInd, aP);
|
|
||||||
}
|
|
||||||
// modify triangles orientation in case of mirror transformation
|
|
||||||
if (myGScale < 0.0)
|
|
||||||
{
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
|
||||||
{
|
|
||||||
Poly_Triangle aTria = theTriangulation->Triangle(anInd);
|
|
||||||
Standard_Integer aN1, aN2, aN3;
|
|
||||||
aTria.Get(aN1, aN2, aN3);
|
|
||||||
aTria.Set(aN1, aN3, aN2);
|
|
||||||
theTriangulation->SetTriangle(anInd, aTria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// modify normals
|
|
||||||
if (theTriangulation->HasNormals())
|
|
||||||
{
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
|
||||||
{
|
|
||||||
gp_Dir aNormal = theTriangulation->Normal(anInd);
|
|
||||||
aNormal.Transform(aGTrsf.Trsf());
|
|
||||||
theTriangulation->SetNormal(anInd, aNormal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygon
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_GTrsfModification::NewPolygon(const TopoDS_Edge& theEdge,
|
|
||||||
Handle(Poly_Polygon3D)& thePoly)
|
|
||||||
{
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
thePoly = BRep_Tool::Polygon3D(theEdge, aLoc);
|
|
||||||
if (thePoly.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_GTrsf aGTrsf;
|
|
||||||
aGTrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
|
||||||
aGTrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
|
||||||
aGTrsf.Multiply(aLoc.Transformation());
|
|
||||||
|
|
||||||
thePoly = thePoly->Copy();
|
|
||||||
thePoly->Deflection(thePoly->Deflection() * Abs(myGScale));
|
|
||||||
// transform nodes
|
|
||||||
TColgp_Array1OfPnt& aNodesArray = thePoly->ChangeNodes();
|
|
||||||
for (Standard_Integer anId = aNodesArray.Lower(); anId <= aNodesArray.Upper(); ++anId)
|
|
||||||
{
|
|
||||||
gp_Pnt& aP = aNodesArray.ChangeValue(anId);
|
|
||||||
aGTrsf.Transforms(aP.ChangeCoord());
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygonOnTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_GTrsfModification::NewPolygonOnTriangulation
|
|
||||||
(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
|
||||||
{
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(theFace, aLoc);
|
|
||||||
if (aT.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
thePoly = BRep_Tool::PolygonOnTriangulation(theEdge, aT, aLoc);
|
|
||||||
if (!thePoly.IsNull())
|
|
||||||
thePoly = thePoly->Copy();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
@@ -101,25 +101,6 @@ public:
|
|||||||
//! (resp. <F2>).
|
//! (resp. <F2>).
|
||||||
Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
|
Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if the face has been modified according to changed triangulation.
|
|
||||||
//! If the face has been modified:
|
|
||||||
//! - theTri is a new triangulation on the face
|
|
||||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - thePoly is a new polygon
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge,
|
|
||||||
Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - thePoly is a new polygon on triangulation
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,10 +20,7 @@
|
|||||||
#include <BRep_TEdge.hxx>
|
#include <BRep_TEdge.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
#include <ElSLib.hxx>
|
#include <ElSLib.hxx>
|
||||||
#include <Extrema_ExtPC2d.hxx>
|
|
||||||
#include <Extrema_GenLocateExtPS.hxx>
|
|
||||||
#include <Extrema_LocateExtPC.hxx>
|
#include <Extrema_LocateExtPC.hxx>
|
||||||
#include <Extrema_LocateExtPC2d.hxx>
|
|
||||||
#include <Geom2d_BezierCurve.hxx>
|
#include <Geom2d_BezierCurve.hxx>
|
||||||
#include <Geom2d_Curve.hxx>
|
#include <Geom2d_Curve.hxx>
|
||||||
#include <Geom2d_TrimmedCurve.hxx>
|
#include <Geom2d_TrimmedCurve.hxx>
|
||||||
@@ -50,163 +47,30 @@
|
|||||||
#include <TopLoc_Location.hxx>
|
#include <TopLoc_Location.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_Modification)
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_CopyModification)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
namespace
|
static void GeomLib_ChangeUBounds(Handle(Geom_BSplineSurface)& aSurface,
|
||||||
{
|
|
||||||
static void GeomLib_ChangeUBounds(Handle(Geom_BSplineSurface)& aSurface,
|
|
||||||
const Standard_Real newU1,
|
const Standard_Real newU1,
|
||||||
const Standard_Real newU2)
|
const Standard_Real newU2)
|
||||||
{
|
{
|
||||||
TColStd_Array1OfReal knots(1, aSurface->NbUKnots());
|
TColStd_Array1OfReal knots(1,aSurface->NbUKnots()) ;
|
||||||
aSurface->UKnots(knots);
|
aSurface->UKnots(knots) ;
|
||||||
BSplCLib::Reparametrize(newU1, newU2, knots);
|
BSplCLib::Reparametrize(newU1,
|
||||||
aSurface->SetUKnots(knots);
|
newU2,
|
||||||
}
|
knots) ;
|
||||||
|
aSurface->SetUKnots(knots) ;
|
||||||
static void GeomLib_ChangeVBounds(Handle(Geom_BSplineSurface)& aSurface,
|
}
|
||||||
|
static void GeomLib_ChangeVBounds(Handle(Geom_BSplineSurface)& aSurface,
|
||||||
const Standard_Real newV1,
|
const Standard_Real newV1,
|
||||||
const Standard_Real newV2)
|
const Standard_Real newV2)
|
||||||
{
|
{
|
||||||
TColStd_Array1OfReal knots(1, aSurface->NbVKnots());
|
TColStd_Array1OfReal knots(1,aSurface->NbVKnots()) ;
|
||||||
aSurface->VKnots(knots);
|
aSurface->VKnots(knots) ;
|
||||||
BSplCLib::Reparametrize(newV1, newV2, knots);
|
BSplCLib::Reparametrize(newV1,
|
||||||
aSurface->SetVKnots(knots);
|
newV2,
|
||||||
}
|
knots) ;
|
||||||
|
aSurface->SetVKnots(knots) ;
|
||||||
// find 3D curve from theEdge in theMap, and return the transformed curve or NULL
|
|
||||||
static Handle(Geom_Curve) newCurve(const TColStd_IndexedDataMapOfTransientTransient& theMap,
|
|
||||||
const TopoDS_Edge& theEdge,
|
|
||||||
Standard_Real& theFirst,
|
|
||||||
Standard_Real& theLast)
|
|
||||||
{
|
|
||||||
Handle(Geom_Curve) aNewCurve;
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aLoc, theFirst, theLast);
|
|
||||||
if (!aCurve.IsNull() && theMap.Contains(aCurve))
|
|
||||||
{
|
|
||||||
aNewCurve = Handle(Geom_Curve)::DownCast(theMap.FindFromKey(aCurve));
|
|
||||||
aNewCurve = Handle(Geom_Curve)::DownCast(aNewCurve->Transformed(aLoc.Transformation()));
|
|
||||||
}
|
|
||||||
return aNewCurve;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find 2D curve from theEdge on theFace in theMap, and return the transformed curve or NULL
|
|
||||||
static Handle(Geom2d_Curve) newCurve(const TColStd_IndexedDataMapOfTransientTransient& theMap,
|
|
||||||
const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Standard_Real& theFirst,
|
|
||||||
Standard_Real& theLast)
|
|
||||||
{
|
|
||||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, theFirst, theLast);
|
|
||||||
return (!aC2d.IsNull() && theMap.Contains(aC2d)) ? Handle(Geom2d_Curve)::DownCast(theMap.FindFromKey(aC2d))
|
|
||||||
: Handle(Geom2d_Curve)();
|
|
||||||
}
|
|
||||||
|
|
||||||
// find surface from theFace in theMap, and return the transformed surface or NULL
|
|
||||||
static Handle(Geom_Surface) newSurface(const TColStd_IndexedDataMapOfTransientTransient& theMap,
|
|
||||||
const TopoDS_Face& theFace)
|
|
||||||
{
|
|
||||||
Handle(Geom_Surface) aNewSurf;
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
|
||||||
if (!aSurf.IsNull() && theMap.Contains(aSurf))
|
|
||||||
{
|
|
||||||
aNewSurf = Handle(Geom_Surface)::DownCast(theMap.FindFromKey(aSurf));
|
|
||||||
aNewSurf = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(aLoc.Transformation()));
|
|
||||||
}
|
|
||||||
return aNewSurf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Standard_Boolean newParameter(const gp_Pnt& thePoint,
|
|
||||||
const Handle(Geom_Curve)& theCurve,
|
|
||||||
const Standard_Real theFirst,
|
|
||||||
const Standard_Real theLast,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
Standard_Real& theParam)
|
|
||||||
{
|
|
||||||
GeomAdaptor_Curve anAdaptor(theCurve);
|
|
||||||
Extrema_LocateExtPC proj(thePoint, anAdaptor, theParam, theFirst, theLast, Precision::PConfusion());
|
|
||||||
if (proj.IsDone())
|
|
||||||
{
|
|
||||||
Standard_Real aDist2Min = proj.SquareDistance();
|
|
||||||
if (aDist2Min < theTol * theTol)
|
|
||||||
{
|
|
||||||
theParam = proj.Point().Parameter();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Standard_Boolean newParameter(const gp_Pnt2d& theUV,
|
|
||||||
const Handle(Geom2d_Curve)& theCurve2d,
|
|
||||||
const Standard_Real theFirst,
|
|
||||||
const Standard_Real theLast,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
Standard_Real& theParam)
|
|
||||||
{
|
|
||||||
Geom2dAdaptor_Curve anAdaptor(theCurve2d);
|
|
||||||
Extrema_LocateExtPC2d aProj(theUV, anAdaptor, theParam, Precision::PConfusion());
|
|
||||||
if (aProj.IsDone())
|
|
||||||
{
|
|
||||||
Standard_Real aDist2Min = aProj.SquareDistance();
|
|
||||||
if (aDist2Min < theTol * theTol)
|
|
||||||
{
|
|
||||||
theParam = aProj.Point().Parameter();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Try to use general extrema to find the parameter, because Extrema_LocateExtPC2d
|
|
||||||
// sometimes could not find a solution if the parameter's first approach is several
|
|
||||||
// spans away from the expected solution (test bugs/modalg_7/bug28722).
|
|
||||||
Extrema_ExtPC2d anExt(theUV, anAdaptor, theFirst, theLast);
|
|
||||||
if (anExt.IsDone())
|
|
||||||
{
|
|
||||||
Standard_Integer aMinInd = 0;
|
|
||||||
Standard_Real aMinSqDist = Precision::Infinite();
|
|
||||||
for (Standard_Integer anIndex = 1; anIndex <= anExt.NbExt(); ++anIndex)
|
|
||||||
if (anExt.SquareDistance(anIndex) < aMinSqDist)
|
|
||||||
{
|
|
||||||
aMinSqDist = anExt.SquareDistance(anIndex);
|
|
||||||
aMinInd = anIndex;
|
|
||||||
}
|
|
||||||
if (aMinSqDist < theTol * theTol)
|
|
||||||
{
|
|
||||||
theParam = anExt.Point(aMinInd).Parameter();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Standard_Boolean newUV(const gp_Pnt& thePoint,
|
|
||||||
const Handle(Geom_Surface)& theSurf,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
gp_Pnt2d& theUV)
|
|
||||||
{
|
|
||||||
GeomAdaptor_Surface anAdaptor(theSurf);
|
|
||||||
Extrema_GenLocateExtPS aProj(anAdaptor);
|
|
||||||
aProj.Perform(thePoint, theUV.X(), theUV.Y());
|
|
||||||
if (aProj.IsDone())
|
|
||||||
{
|
|
||||||
Standard_Real aDist2Min = aProj.SquareDistance();
|
|
||||||
if (aDist2Min < theTol * theTol)
|
|
||||||
{
|
|
||||||
gp_XY& aUV = theUV.ChangeCoord();
|
|
||||||
aProj.Point().Parameter(aUV.ChangeCoord(1), aUV.ChangeCoord(2));
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -238,12 +102,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
|||||||
RevWires = Standard_False;
|
RevWires = Standard_False;
|
||||||
RevFace = Standard_False;
|
RevFace = Standard_False;
|
||||||
Handle(Geom_Surface) SS = BRep_Tool::Surface(F,L);
|
Handle(Geom_Surface) SS = BRep_Tool::Surface(F,L);
|
||||||
if (SS.IsNull())
|
|
||||||
{
|
|
||||||
//processing the case when there is no geometry
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Standard_Type) TheTypeSS = SS->DynamicType();
|
Handle(Standard_Type) TheTypeSS = SS->DynamicType();
|
||||||
if ((TheTypeSS == STANDARD_TYPE(Geom_BSplineSurface)) ||
|
if ((TheTypeSS == STANDARD_TYPE(Geom_BSplineSurface)) ||
|
||||||
(TheTypeSS == STANDARD_TYPE(Geom_BezierSurface))) {
|
(TheTypeSS == STANDARD_TYPE(Geom_BezierSurface))) {
|
||||||
@@ -257,7 +115,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
|||||||
//OCC466(apo)->
|
//OCC466(apo)->
|
||||||
U1 = curvU1; U2 = curvU2;
|
U1 = curvU1; U2 = curvU2;
|
||||||
V1 = curvV1; V2 = curvV2;
|
V1 = curvV1; V2 = curvV2;
|
||||||
S->Bounds(surfU1,surfU2,surfV1,surfV2);
|
SS->Bounds(surfU1,surfU2,surfV1,surfV2);
|
||||||
|
|
||||||
if (Abs(U1 - surfU1) <= TolPar)
|
if (Abs(U1 - surfU1) <= TolPar)
|
||||||
U1 = surfU1;
|
U1 = surfU1;
|
||||||
@@ -334,10 +192,10 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
|||||||
|
|
||||||
if (Abs(surfU1-U1) > Tol || Abs(surfU2-U2) > Tol ||
|
if (Abs(surfU1-U1) > Tol || Abs(surfU2-U2) > Tol ||
|
||||||
Abs(surfV1-V1) > Tol || Abs(surfV2-V2) > Tol)
|
Abs(surfV1-V1) > Tol || Abs(surfV2-V2) > Tol)
|
||||||
S = new Geom_RectangularTrimmedSurface(S, U1, U2, V1, V2);
|
SS = new Geom_RectangularTrimmedSurface(S, U1, U2, V1, V2);
|
||||||
S->Bounds(surfU1,surfU2,surfV1,surfV2);
|
SS->Bounds(surfU1,surfU2,surfV1,surfV2);
|
||||||
|
|
||||||
S = GeomConvert::SurfaceToBSplineSurface(S);
|
S = GeomConvert::SurfaceToBSplineSurface(SS);
|
||||||
Handle(Geom_BSplineSurface) BS = Handle(Geom_BSplineSurface)::DownCast(S) ;
|
Handle(Geom_BSplineSurface) BS = Handle(Geom_BSplineSurface)::DownCast(S) ;
|
||||||
BS->Resolution(Tol, UTol, VTol) ;
|
BS->Resolution(Tol, UTol, VTol) ;
|
||||||
|
|
||||||
@@ -352,9 +210,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
|||||||
GeomLib_ChangeVBounds(BS, V1, V2) ;
|
GeomLib_ChangeVBounds(BS, V1, V2) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myMap.Contains(SS)) {
|
|
||||||
myMap.Add(SS, S);
|
|
||||||
}
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,41 +234,6 @@ static Standard_Boolean IsConvert(const TopoDS_Edge& E)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_NurbsConvertModification::NewTriangulation(const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_Triangulation)& theTri)
|
|
||||||
{
|
|
||||||
if (!BRepTools_CopyModification::NewTriangulation(theFace, theTri))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert UV nodes of the mesh
|
|
||||||
if (theTri->HasUVNodes())
|
|
||||||
{
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
|
||||||
Handle(Geom_Surface) aNewSurf = newSurface(myMap, theFace);
|
|
||||||
if (!aSurf.IsNull() && !aNewSurf.IsNull())
|
|
||||||
{
|
|
||||||
Standard_Real aTol = BRep_Tool::Tolerance(theFace);
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTri->NbNodes(); ++anInd)
|
|
||||||
{
|
|
||||||
gp_Pnt2d aUV = theTri->UVNode(anInd);
|
|
||||||
gp_Pnt aPoint = aSurf->Value(aUV.X(), aUV.Y());
|
|
||||||
if (newUV(aPoint, aNewSurf, aTol, aUV))
|
|
||||||
theTri->SetUVNode(anInd, aUV);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NewCurve
|
//function : NewCurve
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -492,40 +312,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve
|
|||||||
return Standard_True ;
|
return Standard_True ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygon
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_NurbsConvertModification::NewPolygon(const TopoDS_Edge& theEdge,
|
|
||||||
Handle(Poly_Polygon3D)& thePoly)
|
|
||||||
{
|
|
||||||
if (!BRepTools_CopyModification::NewPolygon(theEdge, thePoly))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update parameters of polygon
|
|
||||||
if (thePoly->HasParameters())
|
|
||||||
{
|
|
||||||
Standard_Real aTol = BRep_Tool::Tolerance(theEdge);
|
|
||||||
Standard_Real aFirst, aLast;
|
|
||||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
|
|
||||||
Handle(Geom_Curve) aNewCurve = newCurve(myMap, theEdge, aFirst, aLast);
|
|
||||||
if (!aCurve.IsNull() && !aNewCurve.IsNull()) // skip processing degenerated edges
|
|
||||||
{
|
|
||||||
TColStd_Array1OfReal& aParams = thePoly->ChangeParameters();
|
|
||||||
for (Standard_Integer anInd = aParams.Lower(); anInd <= aParams.Upper(); ++anInd)
|
|
||||||
{
|
|
||||||
Standard_Real& aParam = aParams(anInd);
|
|
||||||
gp_Pnt aPoint = aCurve->Value(aParam);
|
|
||||||
newParameter(aPoint, aNewCurve, aFirst, aLast, aTol, aParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NewPoint
|
//function : NewPoint
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -554,7 +340,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
|
|
||||||
Tol = BRep_Tool::Tolerance(E);
|
Tol = BRep_Tool::Tolerance(E);
|
||||||
Standard_Real f2d,l2d;
|
Standard_Real f2d,l2d;
|
||||||
Handle(Geom2d_Curve) aBaseC2d = BRep_Tool::CurveOnSurface(E,F,f2d,l2d);
|
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f2d,l2d);
|
||||||
Standard_Real f3d,l3d;
|
Standard_Real f3d,l3d;
|
||||||
TopLoc_Location Loc;
|
TopLoc_Location Loc;
|
||||||
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, Loc, f3d,l3d);
|
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, Loc, f3d,l3d);
|
||||||
@@ -562,7 +348,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
!C3d->IsKind(STANDARD_TYPE(Geom_BezierCurve))) ||
|
!C3d->IsKind(STANDARD_TYPE(Geom_BezierCurve))) ||
|
||||||
IsConvert(E));
|
IsConvert(E));
|
||||||
|
|
||||||
Handle(Geom2d_Curve) C2d = aBaseC2d;
|
|
||||||
if(BRep_Tool::Degenerated(E)) {
|
if(BRep_Tool::Degenerated(E)) {
|
||||||
//Curve2d = C2d;
|
//Curve2d = C2d;
|
||||||
if(!C2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
if(!C2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||||
@@ -571,7 +356,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
C2d = aTrimC;
|
C2d = aTrimC;
|
||||||
}
|
}
|
||||||
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
|
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
if(!BRepTools::IsReallyClosed(E,F)) {
|
if(!BRepTools::IsReallyClosed(E,F)) {
|
||||||
@@ -597,11 +381,9 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
if(!newE.IsNull()) {
|
if(!newE.IsNull()) {
|
||||||
C3d = BRep_Tool::Curve(newE, f3d, l3d);
|
C3d = BRep_Tool::Curve(newE, f3d, l3d);
|
||||||
}
|
}
|
||||||
if (C3d.IsNull()) {
|
else {
|
||||||
C3d = BRep_Tool::Curve(E,f3d,l3d);
|
C3d = BRep_Tool::Curve(E,f3d,l3d);
|
||||||
}
|
}
|
||||||
if (C3d.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
GeomAdaptor_Curve G3dAC(C3d, f3d, l3d);
|
GeomAdaptor_Curve G3dAC(C3d, f3d, l3d);
|
||||||
Handle(GeomAdaptor_Curve) G3dAHC = new GeomAdaptor_Curve(G3dAC);
|
Handle(GeomAdaptor_Curve) G3dAHC = new GeomAdaptor_Curve(G3dAC);
|
||||||
|
|
||||||
@@ -621,16 +403,13 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Handle(Geom_Surface) aNewS = BRep_Tool::Surface(newF);
|
S = BRep_Tool::Surface(newF);
|
||||||
if (!aNewS.IsNull())
|
|
||||||
S = aNewS;
|
|
||||||
}
|
}
|
||||||
S->Bounds(Uinf, Usup, Vinf, Vsup);
|
S->Bounds(Uinf, Usup, Vinf, Vsup);
|
||||||
//Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9;
|
//Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9;
|
||||||
@@ -672,7 +451,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
Curve2d = ProjOnCurve.BSpline();
|
Curve2d = ProjOnCurve.BSpline();
|
||||||
@@ -682,7 +460,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,7 +502,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -736,7 +512,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -782,7 +557,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -808,7 +582,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -856,7 +629,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
Tol = newTol;
|
Tol = newTol;
|
||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -868,7 +640,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
myUpdatedEdges.Append(newE);
|
myUpdatedEdges.Append(newE);
|
||||||
}
|
}
|
||||||
mylcu.Append(C2dBis);
|
mylcu.Append(C2dBis);
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -880,58 +651,11 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
|
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
|
||||||
myMap.Add(aBaseC2d, Curve2d);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygonOnTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BRepTools_NurbsConvertModification::NewPolygonOnTriangulation(
|
|
||||||
const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
|
||||||
{
|
|
||||||
if (!BRepTools_CopyModification::NewPolygonOnTriangulation(theEdge, theFace, thePoly))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update parameters of 2D polygon
|
|
||||||
if (thePoly->HasParameters())
|
|
||||||
{
|
|
||||||
Standard_Real aTol = Max(BRep_Tool::Tolerance(theEdge), thePoly->Deflection());
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
|
||||||
Handle(Geom_Surface) aNewSurf = newSurface(myMap, theFace);
|
|
||||||
Standard_Real aFirst, aLast;
|
|
||||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
|
|
||||||
Handle(Geom2d_Curve) aNewC2d = newCurve(myMap, theEdge, theFace, aFirst, aLast);
|
|
||||||
if (!aSurf.IsNull() && !aC2d.IsNull() && !aNewSurf.IsNull() && !aNewC2d.IsNull())
|
|
||||||
{
|
|
||||||
// compute 2D tolerance
|
|
||||||
GeomAdaptor_Surface aSurfAdapt(aSurf);
|
|
||||||
Standard_Real aTol2D = Max(aSurfAdapt.UResolution(aTol), aSurfAdapt.VResolution(aTol));
|
|
||||||
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= thePoly->NbNodes(); ++anInd)
|
|
||||||
{
|
|
||||||
Standard_Real aParam = thePoly->Parameter(anInd);
|
|
||||||
gp_Pnt2d aUV = aC2d->Value(aParam);
|
|
||||||
gp_Pnt aPoint = aSurf->Value(aUV.X(), aUV.Y());
|
|
||||||
if (newUV(aPoint, aNewSurf, aTol, aUV) &&
|
|
||||||
newParameter(aUV, aNewC2d, aFirst, aLast, aTol2D, aParam))
|
|
||||||
{
|
|
||||||
thePoly->SetParameter(anInd, aParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NewParameter
|
//function : NewParameter
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -946,12 +670,30 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewParameter
|
|||||||
Tol = BRep_Tool::Tolerance(V);
|
Tol = BRep_Tool::Tolerance(V);
|
||||||
if(BRep_Tool::Degenerated(E))
|
if(BRep_Tool::Degenerated(E))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
Standard_Real f, l, param = BRep_Tool::Parameter(V,E);
|
||||||
|
TopLoc_Location L;
|
||||||
|
|
||||||
|
Handle(Geom_Curve) gc = BRep_Tool::Curve(E, L, f, l);
|
||||||
|
if(!myMap.Contains(gc))
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
Handle(Geom_BSplineCurve) gcc =
|
||||||
|
Handle(Geom_BSplineCurve)::DownCast(myMap.FindFromKey(gc));
|
||||||
|
|
||||||
|
gcc = Handle(Geom_BSplineCurve)::DownCast(gcc->Transformed(L.Transformation()));
|
||||||
|
|
||||||
|
GeomAdaptor_Curve ac(gcc);
|
||||||
gp_Pnt pnt = BRep_Tool::Pnt(V);
|
gp_Pnt pnt = BRep_Tool::Pnt(V);
|
||||||
P = BRep_Tool::Parameter(V,E);
|
|
||||||
Standard_Real aFirst, aLast;
|
Extrema_LocateExtPC proj(pnt, ac, param, f, l, Tol);
|
||||||
Handle(Geom_Curve) aNewCurve = newCurve(myMap, E, aFirst, aLast);
|
if(proj.IsDone()) {
|
||||||
return !aNewCurve.IsNull() && newParameter(pnt, aNewCurve, aFirst, aLast, Tol, P);
|
Standard_Real Dist2Min = proj.SquareDistance();
|
||||||
|
if (Dist2Min < Tol*Tol) {
|
||||||
|
P = proj.Point().Parameter();
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <TColStd_ListOfTransient.hxx>
|
#include <TColStd_ListOfTransient.hxx>
|
||||||
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
|
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
|
||||||
#include <BRepTools_CopyModification.hxx>
|
#include <BRepTools_Modification.hxx>
|
||||||
#include <Standard_Real.hxx>
|
#include <Standard_Real.hxx>
|
||||||
#include <GeomAbs_Shape.hxx>
|
#include <GeomAbs_Shape.hxx>
|
||||||
class TopoDS_Face;
|
class TopoDS_Face;
|
||||||
@@ -36,12 +36,12 @@ class Geom2d_Curve;
|
|||||||
|
|
||||||
|
|
||||||
class BRepTools_NurbsConvertModification;
|
class BRepTools_NurbsConvertModification;
|
||||||
DEFINE_STANDARD_HANDLE(BRepTools_NurbsConvertModification, BRepTools_CopyModification)
|
DEFINE_STANDARD_HANDLE(BRepTools_NurbsConvertModification, BRepTools_Modification)
|
||||||
|
|
||||||
//! Defines a modification of the geometry by a Trsf
|
//! Defines a modification of the geometry by a Trsf
|
||||||
//! from gp. All methods return True and transform the
|
//! from gp. All methods return True and transform the
|
||||||
//! geometry.
|
//! geometry.
|
||||||
class BRepTools_NurbsConvertModification : public BRepTools_CopyModification
|
class BRepTools_NurbsConvertModification : public BRepTools_Modification
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -100,27 +100,11 @@ public:
|
|||||||
//! (resp. <F2>).
|
//! (resp. <F2>).
|
||||||
Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
|
Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if the face has been modified according to changed triangulation.
|
|
||||||
//! If the face has been modified:
|
|
||||||
//! - theTri is a new triangulation on the face
|
|
||||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace, Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - thePoly is a new polygon
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge, Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - thePoly is a new polygon on triangulation
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
|
||||||
const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
Standard_EXPORT const TopTools_ListOfShape& GetUpdatedEdges() const;
|
Standard_EXPORT const TopTools_ListOfShape& GetUpdatedEdges() const;
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_CopyModification)
|
|
||||||
|
DEFINE_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_Modification)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -23,7 +23,6 @@
|
|||||||
#include <Geom_Surface.hxx>
|
#include <Geom_Surface.hxx>
|
||||||
#include <GeomAdaptor_Surface.hxx>
|
#include <GeomAdaptor_Surface.hxx>
|
||||||
#include <GeomLib.hxx>
|
#include <GeomLib.hxx>
|
||||||
#include <GeomLib_Tool.hxx>
|
|
||||||
#include <gp_GTrsf2d.hxx>
|
#include <gp_GTrsf2d.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Trsf.hxx>
|
#include <gp_Trsf.hxx>
|
||||||
@@ -44,8 +43,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepTools_TrsfModification,BRepTools_Modification)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BRepTools_TrsfModification::BRepTools_TrsfModification(const gp_Trsf& T) :
|
BRepTools_TrsfModification::BRepTools_TrsfModification(const gp_Trsf& T) :
|
||||||
myTrsf(T),
|
myTrsf(T)
|
||||||
myCopyMesh(Standard_False)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,16 +58,6 @@ gp_Trsf& BRepTools_TrsfModification::Trsf ()
|
|||||||
return myTrsf;
|
return myTrsf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsCopyMesh
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean& BRepTools_TrsfModification::IsCopyMesh()
|
|
||||||
{
|
|
||||||
return myCopyMesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NewSurface
|
//function : NewSurface
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -84,12 +72,6 @@ Standard_Boolean BRepTools_TrsfModification::NewSurface
|
|||||||
Standard_Boolean& RevFace)
|
Standard_Boolean& RevFace)
|
||||||
{
|
{
|
||||||
S = BRep_Tool::Surface(F,L);
|
S = BRep_Tool::Surface(F,L);
|
||||||
if (S.IsNull())
|
|
||||||
{
|
|
||||||
//processing cases when there is no geometry
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tol = BRep_Tool::Tolerance(F);
|
Tol = BRep_Tool::Tolerance(F);
|
||||||
Tol *= Abs(myTrsf.ScaleFactor());
|
Tol *= Abs(myTrsf.ScaleFactor());
|
||||||
RevWires = Standard_False;
|
RevWires = Standard_False;
|
||||||
@@ -105,194 +87,6 @@ Standard_Boolean BRepTools_TrsfModification::NewSurface
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_TrsfModification::NewTriangulation
|
|
||||||
(const TopoDS_Face& theFace,
|
|
||||||
Handle(Poly_Triangulation)& theTriangulation)
|
|
||||||
{
|
|
||||||
if (!myCopyMesh)
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
theTriangulation = BRep_Tool::Triangulation(theFace, aLoc);
|
|
||||||
|
|
||||||
if (theTriangulation.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Trsf aTrsf = myTrsf;
|
|
||||||
if (!aLoc.IsIdentity())
|
|
||||||
{
|
|
||||||
aTrsf = aLoc.Transformation().Inverted() * aTrsf * aLoc.Transformation();
|
|
||||||
}
|
|
||||||
|
|
||||||
theTriangulation = theTriangulation->Copy();
|
|
||||||
theTriangulation->SetCachedMinMax(Bnd_Box()); // clear bounding box
|
|
||||||
theTriangulation->Deflection(theTriangulation->Deflection() * Abs(myTrsf.ScaleFactor()));
|
|
||||||
// apply transformation to 3D nodes
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
|
||||||
{
|
|
||||||
gp_Pnt aP = theTriangulation->Node(anInd);
|
|
||||||
aP.Transform(aTrsf);
|
|
||||||
theTriangulation->SetNode(anInd, aP);
|
|
||||||
}
|
|
||||||
// modify 2D nodes
|
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
|
||||||
if (theTriangulation->HasUVNodes() && !aSurf.IsNull())
|
|
||||||
{
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
|
||||||
{
|
|
||||||
gp_Pnt2d aP2d = theTriangulation->UVNode(anInd);
|
|
||||||
aSurf->TransformParameters(aP2d.ChangeCoord().ChangeCoord(1),
|
|
||||||
aP2d.ChangeCoord().ChangeCoord(2),
|
|
||||||
myTrsf);
|
|
||||||
theTriangulation->SetUVNode(anInd, aP2d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// modify triangles orientation in case of mirror transformation
|
|
||||||
if (myTrsf.ScaleFactor() < 0.0)
|
|
||||||
{
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
|
||||||
{
|
|
||||||
Poly_Triangle aTria = theTriangulation->Triangle(anInd);
|
|
||||||
Standard_Integer aN1, aN2, aN3;
|
|
||||||
aTria.Get(aN1, aN2, aN3);
|
|
||||||
aTria.Set(aN1, aN3, aN2);
|
|
||||||
theTriangulation->SetTriangle(anInd, aTria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// modify normals
|
|
||||||
if (theTriangulation->HasNormals())
|
|
||||||
{
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
|
||||||
{
|
|
||||||
gp_Dir aNormal = theTriangulation->Normal(anInd);
|
|
||||||
aNormal.Transform(aTrsf);
|
|
||||||
theTriangulation->SetNormal(anInd, aNormal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygon
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_TrsfModification::NewPolygon
|
|
||||||
(const TopoDS_Edge& theE,
|
|
||||||
Handle(Poly_Polygon3D)& theP)
|
|
||||||
{
|
|
||||||
if (!myCopyMesh)
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
theP = BRep_Tool::Polygon3D(theE, aLoc);
|
|
||||||
if (theP.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Trsf aTrsf = myTrsf;
|
|
||||||
if (!aLoc.IsIdentity())
|
|
||||||
{
|
|
||||||
aTrsf = aLoc.Transformation().Inverted() * aTrsf * aLoc.Transformation();
|
|
||||||
}
|
|
||||||
|
|
||||||
theP = theP->Copy();
|
|
||||||
theP->Deflection(theP->Deflection() * Abs(myTrsf.ScaleFactor()));
|
|
||||||
TColgp_Array1OfPnt& aNodesArray = theP->ChangeNodes();
|
|
||||||
for (Standard_Integer anId = aNodesArray.Lower(); anId <= aNodesArray.Upper(); ++anId)
|
|
||||||
{
|
|
||||||
//Applying the transformation to each node of polygon
|
|
||||||
aNodesArray.ChangeValue(anId).Transform(aTrsf);
|
|
||||||
}
|
|
||||||
// transform the parametrization
|
|
||||||
if (theP->HasParameters())
|
|
||||||
{
|
|
||||||
TopLoc_Location aCurveLoc;
|
|
||||||
Standard_Real aFirst, aLast;
|
|
||||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theE, aCurveLoc, aFirst, aLast);
|
|
||||||
if (!aCurve.IsNull())
|
|
||||||
{
|
|
||||||
Standard_Real aReparametrization = aCurve->ParametricTransformation(aTrsf);
|
|
||||||
if (Abs(aReparametrization - 1.0) > Precision::PConfusion())
|
|
||||||
{
|
|
||||||
TColStd_Array1OfReal& aParams = theP->ChangeParameters();
|
|
||||||
for (Standard_Integer anInd = aParams.Lower(); anInd <= aParams.Upper(); ++anInd)
|
|
||||||
{
|
|
||||||
aParams(anInd) *= aReparametrization;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPolygonOnTriangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean BRepTools_TrsfModification::NewPolygonOnTriangulation
|
|
||||||
(const TopoDS_Edge& theE,
|
|
||||||
const TopoDS_Face& theF,
|
|
||||||
Handle(Poly_PolygonOnTriangulation)& theP)
|
|
||||||
{
|
|
||||||
if (!myCopyMesh)
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(theF, aLoc);
|
|
||||||
if (aT.IsNull())
|
|
||||||
{
|
|
||||||
theP = Handle(Poly_PolygonOnTriangulation) ();
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
theP = BRep_Tool::PolygonOnTriangulation(theE, aT, aLoc);
|
|
||||||
if (theP.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
theP = theP->Copy();
|
|
||||||
theP->Deflection(theP->Deflection() * Abs(myTrsf.ScaleFactor()));
|
|
||||||
|
|
||||||
// transform the parametrization
|
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theF, aLoc);
|
|
||||||
Standard_Real aFirst, aLast;
|
|
||||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theE, theF, aFirst, aLast);
|
|
||||||
if (!aSurf.IsNull() && !aC2d.IsNull() && Abs(Abs(myTrsf.ScaleFactor()) - 1.0) > TopLoc_Location::ScalePrec())
|
|
||||||
{
|
|
||||||
gp_GTrsf2d aGTrsf = aSurf->ParametricTransformation(myTrsf);
|
|
||||||
if (aGTrsf.Form() != gp_Identity)
|
|
||||||
{
|
|
||||||
Handle(Geom2d_Curve) aNewC2d = GeomLib::GTransform(aC2d, aGTrsf);
|
|
||||||
for (Standard_Integer anInd = 1; anInd <= theP->NbNodes(); ++anInd)
|
|
||||||
{
|
|
||||||
Standard_Real aParam = theP->Parameter(anInd);
|
|
||||||
gp_Pnt2d aP2d = aC2d->Value(aParam);
|
|
||||||
aGTrsf.Transforms(aP2d.ChangeCoord());
|
|
||||||
GeomLib_Tool::Parameter(aNewC2d, aP2d, theP->Deflection(), aParam);
|
|
||||||
theP->SetParameter(anInd, aParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NewCurve
|
//function : NewCurve
|
||||||
@@ -307,10 +101,6 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve
|
|||||||
{
|
{
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
C = BRep_Tool::Curve(E,L,f,l);
|
C = BRep_Tool::Curve(E,L,f,l);
|
||||||
if (C.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tol = BRep_Tool::Tolerance(E);
|
Tol = BRep_Tool::Tolerance(E);
|
||||||
Tol *= Abs(myTrsf.ScaleFactor());
|
Tol *= Abs(myTrsf.ScaleFactor());
|
||||||
@@ -363,12 +153,6 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve2d
|
|||||||
Standard_Real scale = myTrsf.ScaleFactor();
|
Standard_Real scale = myTrsf.ScaleFactor();
|
||||||
Tol *= Abs(scale);
|
Tol *= Abs(scale);
|
||||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,loc);
|
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,loc);
|
||||||
|
|
||||||
if (S.IsNull())
|
|
||||||
{
|
|
||||||
// processing the case when the surface (geometry) is deleted
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
GeomAdaptor_Surface GAsurf(S);
|
GeomAdaptor_Surface GAsurf(S);
|
||||||
if (GAsurf.GetType() == GeomAbs_Plane)
|
if (GAsurf.GetType() == GeomAbs_Plane)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@@ -51,9 +51,6 @@ public:
|
|||||||
//! modification. The transformation can be changed.
|
//! modification. The transformation can be changed.
|
||||||
Standard_EXPORT gp_Trsf& Trsf();
|
Standard_EXPORT gp_Trsf& Trsf();
|
||||||
|
|
||||||
//! Sets a flag to indicate the need to copy mesh.
|
|
||||||
Standard_EXPORT Standard_Boolean& IsCopyMesh();
|
|
||||||
|
|
||||||
//! Returns true if the face F has been modified.
|
//! Returns true if the face F has been modified.
|
||||||
//! If the face has been modified:
|
//! If the face has been modified:
|
||||||
//! - S is the new geometry of the face,
|
//! - S is the new geometry of the face,
|
||||||
@@ -67,21 +64,6 @@ public:
|
|||||||
//! associated with this modification is negative.
|
//! associated with this modification is negative.
|
||||||
Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE;
|
Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if the face has been modified according to changed triangulation.
|
|
||||||
//! If the face has been modified:
|
|
||||||
//! - T is a new triangulation on the face
|
|
||||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - P is a new polygon
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
|
||||||
//! If the edge has been modified:
|
|
||||||
//! - P is a new polygon on triangulation
|
|
||||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F, Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if the edge E has been modified.
|
//! Returns true if the edge E has been modified.
|
||||||
//! If the edge has been modified:
|
//! If the edge has been modified:
|
||||||
//! - C is the new geometric support of the edge,
|
//! - C is the new geometric support of the edge,
|
||||||
@@ -138,7 +120,6 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
gp_Trsf myTrsf;
|
gp_Trsf myTrsf;
|
||||||
Standard_Boolean myCopyMesh;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
BRepTools.cxx
|
BRepTools.cxx
|
||||||
BRepTools.hxx
|
BRepTools.hxx
|
||||||
BRepTools_CopyModification.cxx
|
|
||||||
BRepTools_CopyModification.hxx
|
|
||||||
BRepTools_DataMapIteratorOfMapOfVertexPnt2d.hxx
|
BRepTools_DataMapIteratorOfMapOfVertexPnt2d.hxx
|
||||||
BRepTools_Debug.cxx
|
BRepTools_Debug.cxx
|
||||||
BRepTools_GTrsfModification.cxx
|
BRepTools_GTrsfModification.cxx
|
||||||
|
@@ -51,7 +51,7 @@ Standard_Boolean BinMDF_TagSourceDriver::Paste
|
|||||||
BinObjMgt_RRelocationTable& ) const
|
BinObjMgt_RRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDF_TagSource) aTag = Handle(TDF_TagSource)::DownCast(theTarget);
|
Handle(TDF_TagSource) aTag = Handle(TDF_TagSource)::DownCast(theTarget);
|
||||||
Standard_Integer aValue;
|
const Standard_Integer aValue = -1;
|
||||||
Standard_Boolean ok = theSource >> aValue;
|
Standard_Boolean ok = theSource >> aValue;
|
||||||
if (ok)
|
if (ok)
|
||||||
aTag->Set(aValue);
|
aTag->Set(aValue);
|
||||||
|
@@ -73,7 +73,7 @@ Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
|
|||||||
}
|
}
|
||||||
if(aSize) {
|
if(aSize) {
|
||||||
Handle(TColStd_HPackedMapOfInteger) aHMap = new TColStd_HPackedMapOfInteger ();
|
Handle(TColStd_HPackedMapOfInteger) aHMap = new TColStd_HPackedMapOfInteger ();
|
||||||
Standard_Integer aKey;
|
const Standard_Integer aKey = -1;
|
||||||
for(Standard_Integer i = 0; i< aSize; i++) {
|
for(Standard_Integer i = 0; i< aSize; i++) {
|
||||||
Standard_Boolean ok = Source >> aKey;
|
Standard_Boolean ok = Source >> aKey;
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
@@ -54,7 +54,7 @@ Standard_Boolean BinMDataStd_IntegerDriver::Paste
|
|||||||
BinObjMgt_RRelocationTable& theRT) const
|
BinObjMgt_RRelocationTable& theRT) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
|
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
|
||||||
Standard_Integer aValue;
|
const Standard_Integer aValue = -1;
|
||||||
Standard_Boolean ok = theSource >> aValue;
|
Standard_Boolean ok = theSource >> aValue;
|
||||||
if (ok)
|
if (ok)
|
||||||
anAtt->Set(aValue);
|
anAtt->Set(aValue);
|
||||||
|
@@ -54,7 +54,7 @@ Standard_Boolean BinMDataStd_RealDriver::Paste
|
|||||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
|
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
|
||||||
Standard_Real aValue;
|
Standard_Real aValue = -1.0;
|
||||||
Standard_Boolean ok = theSource >> aValue;
|
Standard_Boolean ok = theSource >> aValue;
|
||||||
if (ok)
|
if (ok)
|
||||||
anAtt->Set(aValue);
|
anAtt->Set(aValue);
|
||||||
|
@@ -54,7 +54,7 @@ Standard_Boolean BinMDataXtd_GeometryDriver::Paste
|
|||||||
Handle(TDataXtd_Geometry) aT =
|
Handle(TDataXtd_Geometry) aT =
|
||||||
Handle(TDataXtd_Geometry)::DownCast (theTarget);
|
Handle(TDataXtd_Geometry)::DownCast (theTarget);
|
||||||
|
|
||||||
Standard_Integer aType;
|
const Standard_Integer aType = -1;
|
||||||
Standard_Boolean ok = theSource >> aType;
|
Standard_Boolean ok = theSource >> aType;
|
||||||
if (ok)
|
if (ok)
|
||||||
aT->SetType ((TDataXtd_GeometryEnum) aType);
|
aT->SetType ((TDataXtd_GeometryEnum) aType);
|
||||||
|
@@ -55,7 +55,7 @@ Standard_Boolean BinMDataXtd_PositionDriver::Paste
|
|||||||
BinObjMgt_RRelocationTable& ) const
|
BinObjMgt_RRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
|
Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
|
||||||
Standard_Real aValue;
|
Standard_Real aValue = 0.0;
|
||||||
Standard_Boolean ok = theSource >> aValue;
|
Standard_Boolean ok = theSource >> aValue;
|
||||||
if (!ok) return ok;
|
if (!ok) return ok;
|
||||||
gp_Pnt aPosition(0., 0., 0.);
|
gp_Pnt aPosition(0., 0., 0.);
|
||||||
|
@@ -56,7 +56,7 @@ Standard_Boolean BinMDataXtd_PresentationDriver::Paste
|
|||||||
Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theTarget);
|
Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theTarget);
|
||||||
|
|
||||||
// Display status
|
// Display status
|
||||||
Standard_Integer aValue;
|
const Standard_Integer aValue = -1;
|
||||||
ok = theSource >> aValue;
|
ok = theSource >> aValue;
|
||||||
if (!ok) return ok;
|
if (!ok) return ok;
|
||||||
anAttribute->SetDisplayed (aValue != 0);
|
anAttribute->SetDisplayed (aValue != 0);
|
||||||
@@ -92,7 +92,7 @@ Standard_Boolean BinMDataXtd_PresentationDriver::Paste
|
|||||||
anAttribute->UnsetMaterial();
|
anAttribute->UnsetMaterial();
|
||||||
|
|
||||||
// Transparency
|
// Transparency
|
||||||
Standard_Real aRValue;
|
Standard_Real aRValue = -1.0;
|
||||||
ok = theSource >> aRValue;
|
ok = theSource >> aRValue;
|
||||||
if ( !ok ) return ok;
|
if ( !ok ) return ok;
|
||||||
if ( aRValue != -1. )
|
if ( aRValue != -1. )
|
||||||
|
@@ -62,7 +62,7 @@ Standard_Boolean BinMFunction_FunctionDriver::Paste
|
|||||||
Standard_Boolean ok = theSource >> aGUID;
|
Standard_Boolean ok = theSource >> aGUID;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
anAtt->SetDriverGUID(aGUID);
|
anAtt->SetDriverGUID(aGUID);
|
||||||
Standard_Integer aValue;
|
const Standard_Integer aValue = -1;
|
||||||
ok = theSource >> aValue;
|
ok = theSource >> aValue;
|
||||||
if(ok)
|
if(ok)
|
||||||
anAtt->SetFailure(aValue);
|
anAtt->SetFailure(aValue);
|
||||||
|
@@ -117,8 +117,9 @@ static int TranslateFrom (const BinObjMgt_Persistent& theSource,
|
|||||||
TopoDS_Shape& theResult,
|
TopoDS_Shape& theResult,
|
||||||
BinTools_ShapeSet* theShapeSet)
|
BinTools_ShapeSet* theShapeSet)
|
||||||
{
|
{
|
||||||
Standard_Integer aShapeID, aLocID;
|
const Standard_Integer aShapeID = -1;
|
||||||
Standard_Character aCharOrient;
|
const Standard_Integer aLocID = -1;
|
||||||
|
const Standard_Character aCharOrient = '0';
|
||||||
Standard_Boolean Ok = theSource >> aShapeID; //TShapeID;
|
Standard_Boolean Ok = theSource >> aShapeID; //TShapeID;
|
||||||
if(!Ok) return 1;
|
if(!Ok) return 1;
|
||||||
// Read TShape and Orientation
|
// Read TShape and Orientation
|
||||||
@@ -176,11 +177,11 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
|
|||||||
theSource >> aNbShapes;
|
theSource >> aNbShapes;
|
||||||
TDF_Label aLabel = theTarget->Label ();
|
TDF_Label aLabel = theTarget->Label ();
|
||||||
TNaming_Builder aBuilder (aLabel);
|
TNaming_Builder aBuilder (aLabel);
|
||||||
Standard_Integer aVer;
|
const Standard_Integer aVer = -1;
|
||||||
Standard_Boolean ok = theSource >> aVer;
|
Standard_Boolean ok = theSource >> aVer;
|
||||||
if(!ok) return Standard_False;
|
if(!ok) return Standard_False;
|
||||||
aTAtt->SetVersion(aVer); //Version
|
aTAtt->SetVersion(aVer); //Version
|
||||||
Standard_Character aCharEvol;
|
const Standard_Character aCharEvol = '0';
|
||||||
ok = theSource >> aCharEvol;
|
ok = theSource >> aCharEvol;
|
||||||
if(!ok) return Standard_False;
|
if(!ok) return Standard_False;
|
||||||
TNaming_Evolution anEvol = EvolutionToEnum (aCharEvol); //Evolution
|
TNaming_Evolution anEvol = EvolutionToEnum (aCharEvol); //Evolution
|
||||||
|
@@ -152,7 +152,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
|
|||||||
TNaming_Name& aName = anAtt->ChangeName();
|
TNaming_Name& aName = anAtt->ChangeName();
|
||||||
TCollection_ExtendedString aMsg;
|
TCollection_ExtendedString aMsg;
|
||||||
//1. NameType
|
//1. NameType
|
||||||
Standard_Character aValue;
|
const Standard_Character aValue = '0';
|
||||||
Standard_Boolean ok = theSource >> aValue;
|
Standard_Boolean ok = theSource >> aValue;
|
||||||
Standard_Boolean aNewF = Standard_False;
|
Standard_Boolean aNewF = Standard_False;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
@@ -171,7 +171,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
|
|||||||
|
|
||||||
//3. Args
|
//3. Args
|
||||||
Standard_Integer aNbArgs=0;
|
Standard_Integer aNbArgs=0;
|
||||||
Standard_Integer anIndx;
|
const Standard_Integer anIndx = -1;
|
||||||
Handle(TNaming_NamedShape) aNS;
|
Handle(TNaming_NamedShape) aNS;
|
||||||
ok = theSource >> aNbArgs;
|
ok = theSource >> aNbArgs;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
@@ -48,7 +48,9 @@ Standard_Boolean BinMXCAFDoc_CentroidDriver::Paste(const BinObjMgt_Persistent& t
|
|||||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(XCAFDoc_Centroid) anAtt = Handle(XCAFDoc_Centroid)::DownCast(theTarget);
|
Handle(XCAFDoc_Centroid) anAtt = Handle(XCAFDoc_Centroid)::DownCast(theTarget);
|
||||||
Standard_Real x, y, z;
|
Standard_Real x = 0.0;
|
||||||
|
Standard_Real y = 0.0;
|
||||||
|
Standard_Real z = 0.0;
|
||||||
Standard_Boolean isOk = theSource >> x >> y >> z;
|
Standard_Boolean isOk = theSource >> x >> y >> z;
|
||||||
if(isOk) {
|
if(isOk) {
|
||||||
gp_Pnt aPnt(x, y, z);
|
gp_Pnt aPnt(x, y, z);
|
||||||
|
@@ -48,8 +48,10 @@ Standard_Boolean BinMXCAFDoc_ColorDriver::Paste(const BinObjMgt_Persistent& theS
|
|||||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(XCAFDoc_Color) anAtt = Handle(XCAFDoc_Color)::DownCast(theTarget);
|
Handle(XCAFDoc_Color) anAtt = Handle(XCAFDoc_Color)::DownCast(theTarget);
|
||||||
Standard_Real R, G, B;
|
Standard_Real R = 0.0;
|
||||||
Standard_ShortReal alpha;
|
Standard_Real G = 0.0;
|
||||||
|
Standard_Real B = 0.0;
|
||||||
|
Standard_ShortReal alpha = 1.0;
|
||||||
Standard_Boolean isOk = theSource >> R >> G >> B;
|
Standard_Boolean isOk = theSource >> R >> G >> B;
|
||||||
if(isOk) {
|
if(isOk) {
|
||||||
Standard_Boolean isRGBA = theSource >> alpha;
|
Standard_Boolean isRGBA = theSource >> alpha;
|
||||||
|
@@ -54,7 +54,6 @@ static Standard_Byte faceCullToChar (Graphic3d_TypeOfBackfacingModel theMode)
|
|||||||
{
|
{
|
||||||
case Graphic3d_TypeOfBackfacingModel_Auto: return '0';
|
case Graphic3d_TypeOfBackfacingModel_Auto: return '0';
|
||||||
case Graphic3d_TypeOfBackfacingModel_BackCulled: return 'B';
|
case Graphic3d_TypeOfBackfacingModel_BackCulled: return 'B';
|
||||||
case Graphic3d_TypeOfBackfacingModel_FrontCulled: return 'F';
|
|
||||||
case Graphic3d_TypeOfBackfacingModel_DoubleSided: return '1';
|
case Graphic3d_TypeOfBackfacingModel_DoubleSided: return '1';
|
||||||
}
|
}
|
||||||
return '0';
|
return '0';
|
||||||
@@ -67,7 +66,6 @@ static Graphic3d_TypeOfBackfacingModel faceCullFromChar (Standard_Byte theMode)
|
|||||||
{
|
{
|
||||||
case '0': return Graphic3d_TypeOfBackfacingModel_Auto;
|
case '0': return Graphic3d_TypeOfBackfacingModel_Auto;
|
||||||
case 'B': return Graphic3d_TypeOfBackfacingModel_BackCulled;
|
case 'B': return Graphic3d_TypeOfBackfacingModel_BackCulled;
|
||||||
case 'F': return Graphic3d_TypeOfBackfacingModel_FrontCulled;
|
|
||||||
case '1': return Graphic3d_TypeOfBackfacingModel_DoubleSided;
|
case '1': return Graphic3d_TypeOfBackfacingModel_DoubleSided;
|
||||||
}
|
}
|
||||||
return Graphic3d_TypeOfBackfacingModel_Auto;
|
return Graphic3d_TypeOfBackfacingModel_Auto;
|
||||||
|
@@ -198,7 +198,7 @@ public:
|
|||||||
Standard_Real LowerValue()
|
Standard_Real LowerValue()
|
||||||
{
|
{
|
||||||
Standard_Integer a, aResultIndex = 0;
|
Standard_Integer a, aResultIndex = 0;
|
||||||
Standard_Real aValue;
|
Standard_Real aValue = 0.0;
|
||||||
for(a = myV.Length(); a > 0; a--)
|
for(a = myV.Length(); a > 0; a--)
|
||||||
{
|
{
|
||||||
if (aResultIndex == 0 || Abs(aValue) > Abs(myV.Value(a)))
|
if (aResultIndex == 0 || Abs(aValue) > Abs(myV.Value(a)))
|
||||||
|
@@ -2708,14 +2708,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
|||||||
TopoDS_Edge aLocalEdge = edgesau;
|
TopoDS_Edge aLocalEdge = edgesau;
|
||||||
if (edgesau.Orientation() != orient)
|
if (edgesau.Orientation() != orient)
|
||||||
aLocalEdge.Reverse();
|
aLocalEdge.Reverse();
|
||||||
C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge, Face[0], ubid, vbid);
|
C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge,Face[0],ubid,vbid);
|
||||||
|
|
||||||
if (C2dint1.IsNull())
|
|
||||||
{
|
|
||||||
//std::swap(Face[0], facesau);
|
|
||||||
C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge, facesau, ubid, vbid);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2725,7 +2718,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
|||||||
//// for periodic 3d curves ////
|
//// for periodic 3d curves ////
|
||||||
if (cad.IsPeriodic())
|
if (cad.IsPeriodic())
|
||||||
{
|
{
|
||||||
gp_Pnt2d P2d = BRep_Tool::Parameters(Vtx, facesau);
|
gp_Pnt2d P2d = BRep_Tool::Parameters( Vtx, Face[0] );
|
||||||
Geom2dAPI_ProjectPointOnCurve Projector( P2d, C2dint1 );
|
Geom2dAPI_ProjectPointOnCurve Projector( P2d, C2dint1 );
|
||||||
par = Projector.LowerDistanceParameter();
|
par = Projector.LowerDistanceParameter();
|
||||||
Standard_Real shift = par-ParVtx;
|
Standard_Real shift = par-ParVtx;
|
||||||
@@ -3922,7 +3915,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
|
|||||||
}
|
}
|
||||||
TopoDS_Face FFv;
|
TopoDS_Face FFv;
|
||||||
Standard_Real tol;
|
Standard_Real tol;
|
||||||
Standard_Integer prol;
|
Standard_Integer prol = 0;
|
||||||
BRep_Builder BRE;
|
BRep_Builder BRE;
|
||||||
Handle(Geom_Surface ) Sface;
|
Handle(Geom_Surface ) Sface;
|
||||||
Sface=BRep_Tool::Surface(Fv);
|
Sface=BRep_Tool::Surface(Fv);
|
||||||
|
@@ -1780,7 +1780,7 @@ void ChFi3d_ChBuilder::ExtentTwoCorner(const TopoDS_Vertex& V,
|
|||||||
Standard_Integer Sens = 0;
|
Standard_Integer Sens = 0;
|
||||||
ChFiDS_ListIteratorOfListOfStripe itel(LS);
|
ChFiDS_ListIteratorOfListOfStripe itel(LS);
|
||||||
Standard_Boolean FF = Standard_True;
|
Standard_Boolean FF = Standard_True;
|
||||||
Standard_Boolean isfirst[2];
|
Standard_Boolean isfirst[2] = { Standard_True, Standard_True };
|
||||||
Standard_Integer Iedge[2];
|
Standard_Integer Iedge[2];
|
||||||
Iedge[0] = 1;
|
Iedge[0] = 1;
|
||||||
Iedge[1] = 1;
|
Iedge[1] = 1;
|
||||||
|
@@ -27,14 +27,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(DE_Wrapper, Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(DE_Wrapper, Standard_Transient)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "global";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope ("global");
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : DE_Wrapper
|
// function : DE_Wrapper
|
||||||
@@ -260,7 +253,7 @@ Standard_Boolean DE_Wrapper::Load(const TCollection_AsciiString& theResource,
|
|||||||
Standard_Boolean DE_Wrapper::Load(const Handle(DE_ConfigurationContext)& theResource,
|
Standard_Boolean DE_Wrapper::Load(const Handle(DE_ConfigurationContext)& theResource,
|
||||||
const Standard_Boolean theIsRecursive)
|
const Standard_Boolean theIsRecursive)
|
||||||
{
|
{
|
||||||
GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit", GlobalParameters.LengthUnit, THE_CONFIGURATION_SCOPE());
|
GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit", GlobalParameters.LengthUnit, THE_CONFIGURATION_SCOPE);
|
||||||
if (theIsRecursive)
|
if (theIsRecursive)
|
||||||
{
|
{
|
||||||
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
||||||
@@ -333,7 +326,7 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
|
|||||||
aFormatIter.More(); aFormatIter.Next())
|
aFormatIter.More(); aFormatIter.Next())
|
||||||
{
|
{
|
||||||
const TCollection_AsciiString& aFormat = aFormatIter.Key();
|
const TCollection_AsciiString& aFormat = aFormatIter.Key();
|
||||||
aResult += THE_CONFIGURATION_SCOPE() + '.' + "priority" + '.' + aFormat + " :\t ";
|
aResult += THE_CONFIGURATION_SCOPE + '.' + "priority" + '.' + aFormat + " :\t ";
|
||||||
for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
|
for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
|
||||||
aVendorIter.More(); aVendorIter.Next())
|
aVendorIter.More(); aVendorIter.Next())
|
||||||
{
|
{
|
||||||
@@ -344,7 +337,7 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
|
|||||||
}
|
}
|
||||||
aResult += "!Global parameters. Used for all providers\n";
|
aResult += "!Global parameters. Used for all providers\n";
|
||||||
aResult += "!Length scale unit value. Should be more the 0. Default value: 1.0(MM)\n";
|
aResult += "!Length scale unit value. Should be more the 0. Default value: 1.0(MM)\n";
|
||||||
aResult += THE_CONFIGURATION_SCOPE() + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
|
aResult += THE_CONFIGURATION_SCOPE + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
|
||||||
if (theIsRecursive)
|
if (theIsRecursive)
|
||||||
{
|
{
|
||||||
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
||||||
@@ -532,7 +525,7 @@ Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void DE_Wrapper::sort(const Handle(DE_ConfigurationContext)& theResource)
|
void DE_Wrapper::sort(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
const TCollection_AsciiString aScope(THE_CONFIGURATION_SCOPE() + '.' + "priority");
|
const TCollection_AsciiString aScope(THE_CONFIGURATION_SCOPE + '.' + "priority");
|
||||||
NCollection_List<Handle(DE_ConfigurationNode)> aVendors;
|
NCollection_List<Handle(DE_ConfigurationNode)> aVendors;
|
||||||
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
||||||
aFormatIter.More(); aFormatIter.Next())
|
aFormatIter.More(); aFormatIter.Next())
|
||||||
|
@@ -19,14 +19,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(DEBRepCascade_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(DEBRepCascade_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : DEBRepCascade_ConfigurationNode
|
// function : DEBRepCascade_ConfigurationNode
|
||||||
@@ -55,7 +48,7 @@ DEBRepCascade_ConfigurationNode::DEBRepCascade_ConfigurationNode(const Handle(DE
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool DEBRepCascade_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool DEBRepCascade_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
|
|
||||||
InternalParameters.WriteBinary =
|
InternalParameters.WriteBinary =
|
||||||
theResource->BooleanVal("write.binary", InternalParameters.WriteBinary, aScope);
|
theResource->BooleanVal("write.binary", InternalParameters.WriteBinary, aScope);
|
||||||
@@ -79,7 +72,7 @@ TCollection_AsciiString DEBRepCascade_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Write parameters:\n";
|
aResult += "!Write parameters:\n";
|
||||||
|
@@ -19,14 +19,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(DEXCAFCascade_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(DEXCAFCascade_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : DEXCAFCascade_ConfigurationNode
|
// function : DEXCAFCascade_ConfigurationNode
|
||||||
@@ -55,7 +48,7 @@ DEXCAFCascade_ConfigurationNode::DEXCAFCascade_ConfigurationNode(const Handle(DE
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool DEXCAFCascade_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool DEXCAFCascade_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
|
|
||||||
InternalParameters.ReadAppendMode = (PCDM_ReaderFilter::AppendMode)
|
InternalParameters.ReadAppendMode = (PCDM_ReaderFilter::AppendMode)
|
||||||
theResource->IntegerVal("read.append.mode", InternalParameters.ReadAppendMode, aScope);
|
theResource->IntegerVal("read.append.mode", InternalParameters.ReadAppendMode, aScope);
|
||||||
@@ -74,7 +67,7 @@ TCollection_AsciiString DEXCAFCascade_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Read parameters:\n";
|
aResult += "!Read parameters:\n";
|
||||||
|
@@ -7,10 +7,6 @@ TKOpenGlesTest
|
|||||||
TKViewerTest
|
TKViewerTest
|
||||||
TKDraw
|
TKDraw
|
||||||
TKMeshVS
|
TKMeshVS
|
||||||
TKXDECascade
|
|
||||||
TKTObj
|
|
||||||
TKBinTObj
|
|
||||||
TKXmlTObj
|
|
||||||
TKXDESTEP
|
TKXDESTEP
|
||||||
TKSTEP
|
TKSTEP
|
||||||
TKSTEPAttr
|
TKSTEPAttr
|
||||||
@@ -22,7 +18,6 @@ TKXSBase
|
|||||||
TKVRML
|
TKVRML
|
||||||
TKSTL
|
TKSTL
|
||||||
TKRWMesh
|
TKRWMesh
|
||||||
TKXDE
|
|
||||||
TKBinXCAF
|
TKBinXCAF
|
||||||
TKXmlXCAF
|
TKXmlXCAF
|
||||||
TKBin
|
TKBin
|
||||||
|
@@ -60,7 +60,6 @@ Font_TextFormatter::Font_TextFormatter()
|
|||||||
myAlignY (Graphic3d_VTA_TOP),
|
myAlignY (Graphic3d_VTA_TOP),
|
||||||
myTabSize (8),
|
myTabSize (8),
|
||||||
myWrappingWidth (0.0f),
|
myWrappingWidth (0.0f),
|
||||||
myIsWordWrapping (true),
|
|
||||||
myLastSymbolWidth (0.0f),
|
myLastSymbolWidth (0.0f),
|
||||||
myMaxSymbolWidth (0.0f),
|
myMaxSymbolWidth (0.0f),
|
||||||
//
|
//
|
||||||
@@ -250,7 +249,6 @@ void Font_TextFormatter::Format()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Utf32Char aCharPrev = 0;
|
|
||||||
for (Font_TextFormatter::Iterator aFormatterIt(*this);
|
for (Font_TextFormatter::Iterator aFormatterIt(*this);
|
||||||
aFormatterIt.More(); aFormatterIt.Next())
|
aFormatterIt.More(); aFormatterIt.Next())
|
||||||
{
|
{
|
||||||
@@ -271,30 +269,12 @@ void Font_TextFormatter::Format()
|
|||||||
Font_Rect aBndBox;
|
Font_Rect aBndBox;
|
||||||
GlyphBoundingBox (aRectIter, aBndBox);
|
GlyphBoundingBox (aRectIter, aBndBox);
|
||||||
const Standard_ShortReal aNextXPos = aBndBox.Right - BottomLeft (aFirstCornerId).x();
|
const Standard_ShortReal aNextXPos = aBndBox.Right - BottomLeft (aFirstCornerId).x();
|
||||||
Standard_Boolean isCurWordFits = true;
|
if (aNextXPos > aMaxLineWidth) // wrap the line and do processing of the symbol
|
||||||
if(myIsWordWrapping && IsSeparatorSymbol(aCharPrev))
|
|
||||||
{
|
|
||||||
for (Font_TextFormatter::Iterator aWordIt = aFormatterIt; aWordIt.More(); aWordIt.Next())
|
|
||||||
{
|
|
||||||
if (IsSeparatorSymbol(aWordIt.Symbol()))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
float aWordWidthPx = myCorners[aWordIt.SymbolPosition()].x() - myCorners[aRectIter].x();
|
|
||||||
if (aNextXPos + aWordWidthPx > aMaxLineWidth)
|
|
||||||
{
|
|
||||||
isCurWordFits = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aNextXPos > aMaxLineWidth || !isCurWordFits) // wrap the line and do processing of the symbol
|
|
||||||
{
|
{
|
||||||
const Standard_Integer aLastRect = aRectIter - 1; // last rect on current line
|
const Standard_Integer aLastRect = aRectIter - 1; // last rect on current line
|
||||||
newLine (aLastRect, aMaxLineWidth);
|
newLine (aLastRect, aMaxLineWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aCharPrev = aCharThis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myBndWidth = aMaxLineWidth;
|
myBndWidth = aMaxLineWidth;
|
||||||
|
@@ -220,12 +220,6 @@ public:
|
|||||||
//! Returns text maximum width, zero means that the text is not bounded by width
|
//! Returns text maximum width, zero means that the text is not bounded by width
|
||||||
Standard_ShortReal Wrapping() const { return myWrappingWidth; }
|
Standard_ShortReal Wrapping() const { return myWrappingWidth; }
|
||||||
|
|
||||||
//! returns TRUE when trying not to break words when wrapping text
|
|
||||||
Standard_Boolean WordWrapping () const { return myIsWordWrapping; }
|
|
||||||
|
|
||||||
//! returns TRUE when trying not to break words when wrapping text
|
|
||||||
void SetWordWrapping (const Standard_Boolean theIsWordWrapping) { myIsWordWrapping = theIsWordWrapping; }
|
|
||||||
|
|
||||||
//! @return width of formatted text.
|
//! @return width of formatted text.
|
||||||
inline Standard_ShortReal ResultWidth() const
|
inline Standard_ShortReal ResultWidth() const
|
||||||
{
|
{
|
||||||
@@ -280,14 +274,6 @@ public:
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns true if the symbol separates words when wrapping is enabled
|
|
||||||
static Standard_Boolean IsSeparatorSymbol (const Standard_Utf32Char& theSymbol)
|
|
||||||
{
|
|
||||||
return theSymbol == '\x0A' // new line
|
|
||||||
|| theSymbol == ' ' // space
|
|
||||||
|| theSymbol == '\x09'; // tab
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT (Font_TextFormatter, Standard_Transient)
|
DEFINE_STANDARD_RTTIEXT (Font_TextFormatter, Standard_Transient)
|
||||||
|
|
||||||
protected: //! @name class auxiliary methods
|
protected: //! @name class auxiliary methods
|
||||||
@@ -302,7 +288,6 @@ protected: //! @name configuration
|
|||||||
Graphic3d_VerticalTextAlignment myAlignY; //!< vertical alignment style
|
Graphic3d_VerticalTextAlignment myAlignY; //!< vertical alignment style
|
||||||
Standard_Integer myTabSize; //!< horizontal tabulation width (number of space symbols)
|
Standard_Integer myTabSize; //!< horizontal tabulation width (number of space symbols)
|
||||||
Standard_ShortReal myWrappingWidth; //!< text is wrapped by the width if defined (more 0)
|
Standard_ShortReal myWrappingWidth; //!< text is wrapped by the width if defined (more 0)
|
||||||
Standard_Boolean myIsWordWrapping; //!< if TRUE try not to break words when wrapping text (true by default)
|
|
||||||
Standard_ShortReal myLastSymbolWidth; //!< width of the last symbol
|
Standard_ShortReal myLastSymbolWidth; //!< width of the last symbol
|
||||||
Standard_ShortReal myMaxSymbolWidth; //!< maximum symbol width of the formatter string
|
Standard_ShortReal myMaxSymbolWidth; //!< maximum symbol width of the formatter string
|
||||||
|
|
||||||
|
@@ -20,14 +20,3 @@ GeomConvert_CompCurveToBSplineCurve.cxx
|
|||||||
GeomConvert_CompCurveToBSplineCurve.hxx
|
GeomConvert_CompCurveToBSplineCurve.hxx
|
||||||
GeomConvert_Units.cxx
|
GeomConvert_Units.cxx
|
||||||
GeomConvert_Units.hxx
|
GeomConvert_Units.hxx
|
||||||
GeomConvert_CurveToAnaCurve.cxx
|
|
||||||
GeomConvert_CurveToAnaCurve.hxx
|
|
||||||
GeomConvert_SurfToAnaSurf.cxx
|
|
||||||
GeomConvert_SurfToAnaSurf.hxx
|
|
||||||
GeomConvert_ConvType.hxx
|
|
||||||
GeomConvert_FuncSphereLSDist.cxx
|
|
||||||
GeomConvert_FuncSphereLSDist.hxx
|
|
||||||
GeomConvert_FuncCylinderLSDist.cxx
|
|
||||||
GeomConvert_FuncCylinderLSDist.hxx
|
|
||||||
GeomConvert_FuncConeLSDist.cxx
|
|
||||||
GeomConvert_FuncConeLSDist.hxx
|
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
// Copyright (c) 2022 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 _GeomConvert_ConvType_HeaderFile
|
|
||||||
#define _GeomConvert_ConvType_HeaderFile
|
|
||||||
enum GeomConvert_ConvType
|
|
||||||
{
|
|
||||||
GeomConvert_Target,
|
|
||||||
GeomConvert_Simplest,
|
|
||||||
GeomConvert_MinGap
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _GeomConvert_ConvType_HeaderFile
|
|
@@ -1,768 +0,0 @@
|
|||||||
// Created: 2001-05-21
|
|
||||||
//
|
|
||||||
// Copyright (c) 2001-2013 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 <ElCLib.hxx>
|
|
||||||
#include <gce_MakeCirc.hxx>
|
|
||||||
#include <Geom_BezierCurve.hxx>
|
|
||||||
#include <Geom_BSplineCurve.hxx>
|
|
||||||
#include <Geom_Circle.hxx>
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <Geom_Ellipse.hxx>
|
|
||||||
#include <Geom_Line.hxx>
|
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
|
||||||
#include <gp_Ax2.hxx>
|
|
||||||
#include <gp_Ax3.hxx>
|
|
||||||
#include <gp_Circ.hxx>
|
|
||||||
#include <gp_Lin.hxx>
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
#include <Precision.hxx>
|
|
||||||
#include <GeomConvert_CurveToAnaCurve.hxx>
|
|
||||||
#include <TColgp_Array1OfPnt.hxx>
|
|
||||||
#include <TColgp_HArray1OfPnt.hxx>
|
|
||||||
#include <TColStd_Array1OfReal.hxx>
|
|
||||||
#include <TColStd_Array2OfReal.hxx>
|
|
||||||
#include <GeomAbs_CurveType.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
#include <math_Matrix.hxx>
|
|
||||||
#include <math_Gauss.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
GeomConvert_CurveToAnaCurve::GeomConvert_CurveToAnaCurve():
|
|
||||||
myGap(Precision::Infinite()),
|
|
||||||
myConvType(GeomConvert_MinGap),
|
|
||||||
myTarget(GeomAbs_Line)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
GeomConvert_CurveToAnaCurve::GeomConvert_CurveToAnaCurve(const Handle(Geom_Curve)& C) :
|
|
||||||
myGap(Precision::Infinite()),
|
|
||||||
myConvType(GeomConvert_MinGap),
|
|
||||||
myTarget(GeomAbs_Line)
|
|
||||||
{
|
|
||||||
myCurve = C;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeomConvert_CurveToAnaCurve::Init(const Handle(Geom_Curve)& C)
|
|
||||||
{
|
|
||||||
myCurve = C;
|
|
||||||
myGap = Precision::Infinite();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ConvertToAnalytical
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GeomConvert_CurveToAnaCurve::ConvertToAnalytical(const Standard_Real tol,
|
|
||||||
Handle(Geom_Curve)& theResultCurve,
|
|
||||||
const Standard_Real F, const Standard_Real L,
|
|
||||||
Standard_Real& NewF, Standard_Real& NewL)
|
|
||||||
{
|
|
||||||
if(myCurve.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
Handle(Geom_Curve) aCurve = myCurve;
|
|
||||||
while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
|
||||||
Handle(Geom_TrimmedCurve) aTrimmed = Handle(Geom_TrimmedCurve)::
|
|
||||||
DownCast(aCurve);
|
|
||||||
aCurve = aTrimmed->BasisCurve();
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Geom_Curve) C = ComputeCurve(aCurve,tol,F, L, NewF, NewL, myGap, myConvType, myTarget);
|
|
||||||
|
|
||||||
if(C.IsNull()) return Standard_False;
|
|
||||||
theResultCurve = C;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsLinear
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GeomConvert_CurveToAnaCurve::IsLinear(const TColgp_Array1OfPnt& aPoles,
|
|
||||||
const Standard_Real tolerance,
|
|
||||||
Standard_Real& Deviation)
|
|
||||||
{
|
|
||||||
Standard_Integer nbPoles = aPoles.Length();
|
|
||||||
if(nbPoles < 2)
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
Standard_Real dMax = 0;
|
|
||||||
Standard_Integer iMax1=0,iMax2=0;
|
|
||||||
|
|
||||||
Standard_Integer i;
|
|
||||||
for(i = 1; i < nbPoles; i++)
|
|
||||||
for(Standard_Integer j = i+1; j <= nbPoles; j++) {
|
|
||||||
Standard_Real dist = aPoles(i).SquareDistance(aPoles(j));
|
|
||||||
if(dist > dMax) {
|
|
||||||
dMax = dist;
|
|
||||||
iMax1 = i;
|
|
||||||
iMax2 = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dMax < Precision::SquareConfusion())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
Standard_Real tol2 = tolerance*tolerance;
|
|
||||||
gp_Vec avec (aPoles(iMax1),aPoles(iMax2)); gp_Dir adir (avec); gp_Lin alin (aPoles(iMax1),adir);
|
|
||||||
|
|
||||||
Standard_Real aMax = 0.;
|
|
||||||
for(i = 1; i <= nbPoles; i++) {
|
|
||||||
Standard_Real dist = alin.SquareDistance(aPoles(i));
|
|
||||||
if(dist > tol2)
|
|
||||||
return Standard_False;
|
|
||||||
if(dist > aMax)
|
|
||||||
aMax = dist;
|
|
||||||
}
|
|
||||||
Deviation = sqrt(aMax);
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetLine
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
gp_Lin GeomConvert_CurveToAnaCurve::GetLine(const gp_Pnt& P1, const gp_Pnt& P2,
|
|
||||||
Standard_Real& cf, Standard_Real& cl)
|
|
||||||
{
|
|
||||||
gp_Vec avec(P1, P2); gp_Dir adir(avec); gp_Lin alin(P1, adir);
|
|
||||||
cf = ElCLib::Parameter(alin, P1);
|
|
||||||
cl = ElCLib::Parameter(alin, P2);
|
|
||||||
return alin;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : ComputeLine
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Geom_Line) GeomConvert_CurveToAnaCurve::ComputeLine (const Handle(Geom_Curve)& curve,
|
|
||||||
const Standard_Real tolerance,
|
|
||||||
const Standard_Real c1, const Standard_Real c2,
|
|
||||||
Standard_Real& cf, Standard_Real& cl,
|
|
||||||
Standard_Real& Deviation)
|
|
||||||
{
|
|
||||||
Handle(Geom_Line) line;
|
|
||||||
if (curve.IsNull()) return line;
|
|
||||||
line = Handle(Geom_Line)::DownCast(curve); // qui sait
|
|
||||||
if (!line.IsNull()) {
|
|
||||||
cf = c1;
|
|
||||||
cl = c2;
|
|
||||||
Deviation = 0.;
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Pnt P1 = curve->Value (c1);
|
|
||||||
gp_Pnt P2 = curve->Value (c2);
|
|
||||||
if(P1.SquareDistance(P2) < Precision::SquareConfusion())
|
|
||||||
return line;
|
|
||||||
cf = c1; cl = c2;
|
|
||||||
|
|
||||||
Handle(TColgp_HArray1OfPnt) Poles;
|
|
||||||
Standard_Integer nbPoles;
|
|
||||||
Handle(Geom_BSplineCurve) bsc = Handle(Geom_BSplineCurve)::DownCast(curve);
|
|
||||||
if (!bsc.IsNull()) {
|
|
||||||
nbPoles = bsc->NbPoles();
|
|
||||||
Poles = new TColgp_HArray1OfPnt(1, nbPoles);
|
|
||||||
bsc->Poles(Poles->ChangeArray1());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Handle(Geom_BezierCurve) bzc = Handle(Geom_BezierCurve)::DownCast(curve);
|
|
||||||
if (!bzc.IsNull()) {
|
|
||||||
nbPoles = bzc->NbPoles();
|
|
||||||
Poles = new TColgp_HArray1OfPnt(1, nbPoles);
|
|
||||||
bzc->Poles(Poles->ChangeArray1());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nbPoles = 23;
|
|
||||||
Poles = new TColgp_HArray1OfPnt(1, nbPoles);
|
|
||||||
Standard_Real dt = (c2 - c1) / (nbPoles - 1);
|
|
||||||
Poles->SetValue(1, P1);
|
|
||||||
Poles->SetValue(nbPoles, P2);
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = 2; i < nbPoles; ++i)
|
|
||||||
{
|
|
||||||
Poles->SetValue(i, curve->Value(c1 + (i - 1) * dt));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!IsLinear(Poles->Array1(),tolerance,Deviation)) return line; // non
|
|
||||||
gp_Lin alin = GetLine (P1, P2, cf, cl);
|
|
||||||
line = new Geom_Line (alin);
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetCircle
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GeomConvert_CurveToAnaCurve::GetCircle (gp_Circ& crc,
|
|
||||||
const gp_Pnt& P0,const gp_Pnt& P1, const gp_Pnt& P2)
|
|
||||||
{
|
|
||||||
// Control if points are not aligned (should be done by MakeCirc
|
|
||||||
Standard_Real aMaxCoord = Sqrt(Precision::Infinite());
|
|
||||||
if (Abs(P0.X()) > aMaxCoord || Abs(P0.Y()) > aMaxCoord || Abs(P0.Z()) > aMaxCoord)
|
|
||||||
return Standard_False;
|
|
||||||
if (Abs(P1.X()) > aMaxCoord || Abs(P1.Y()) > aMaxCoord || Abs(P1.Z()) > aMaxCoord)
|
|
||||||
return Standard_False;
|
|
||||||
if (Abs(P2.X()) > aMaxCoord || Abs(P2.Y()) > aMaxCoord || Abs(P2.Z()) > aMaxCoord)
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
// Building the circle
|
|
||||||
gce_MakeCirc mkc (P0,P1,P2);
|
|
||||||
if (!mkc.IsDone()) return Standard_False;
|
|
||||||
crc = mkc.Value();
|
|
||||||
if (crc.Radius() < gp::Resolution()) return Standard_False;
|
|
||||||
// Recalage sur P0
|
|
||||||
gp_Pnt PC = crc.Location();
|
|
||||||
gp_Ax2 axe = crc.Position();
|
|
||||||
gp_Vec VX (PC,P0);
|
|
||||||
axe.SetXDirection (VX);
|
|
||||||
crc.SetPosition (axe);
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ComputeCircle
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCircle (const Handle(Geom_Curve)& c3d,
|
|
||||||
const Standard_Real tol,
|
|
||||||
const Standard_Real c1, const Standard_Real c2,
|
|
||||||
Standard_Real& cf, Standard_Real& cl,
|
|
||||||
Standard_Real& Deviation)
|
|
||||||
{
|
|
||||||
if (c3d->IsKind (STANDARD_TYPE(Geom_Circle))) {
|
|
||||||
cf = c1;
|
|
||||||
cl = c2;
|
|
||||||
Deviation = 0.;
|
|
||||||
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(c3d);
|
|
||||||
return aCirc;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Geom_Circle) circ;
|
|
||||||
gp_Pnt P0,P1,P2;
|
|
||||||
Standard_Real ca = (c1+c1+c2) / 3; Standard_Real cb = (c1+c2+c2) / 3;
|
|
||||||
P0 = c3d->Value(c1);
|
|
||||||
P1 = c3d->Value(ca);
|
|
||||||
P2 = c3d->Value(cb);
|
|
||||||
|
|
||||||
gp_Circ crc;
|
|
||||||
if (!GetCircle (crc,P0,P1,P2)) return circ;
|
|
||||||
|
|
||||||
// Reste a controler que c est bien un cercle : prendre 20 points
|
|
||||||
Standard_Real du = (c2-c1)/20;
|
|
||||||
Standard_Integer i;
|
|
||||||
Standard_Real aMax = 0.;
|
|
||||||
for (i = 0; i <= 20; i ++) {
|
|
||||||
Standard_Real u = c1+(du*i);
|
|
||||||
gp_Pnt PP = c3d->Value(u);
|
|
||||||
Standard_Real dist = crc.Distance(PP);
|
|
||||||
if (dist > tol) return circ; // not done
|
|
||||||
if (dist > aMax)
|
|
||||||
aMax = dist;
|
|
||||||
}
|
|
||||||
Deviation = aMax;
|
|
||||||
|
|
||||||
// defining the parameters
|
|
||||||
Standard_Real PI2 = 2 * M_PI;
|
|
||||||
|
|
||||||
cf = ElCLib::Parameter (crc,c3d->Value (c1));
|
|
||||||
cf = ElCLib::InPeriod(cf, 0., PI2);
|
|
||||||
|
|
||||||
//first parameter should be closed to zero
|
|
||||||
|
|
||||||
if(Abs(cf) < Precision::PConfusion() || Abs(PI2-cf) < Precision::PConfusion())
|
|
||||||
cf = 0.;
|
|
||||||
|
|
||||||
Standard_Real cm = ElCLib::Parameter (crc,c3d->Value ((c1+c2)/2.));
|
|
||||||
cm = ElCLib::InPeriod(cm, cf, cf + PI2);
|
|
||||||
|
|
||||||
cl = ElCLib::Parameter (crc,c3d->Value (c2));
|
|
||||||
cl = ElCLib::InPeriod(cl, cm, cm + PI2);
|
|
||||||
|
|
||||||
circ = new Geom_Circle (crc);
|
|
||||||
return circ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Compute Ellipse
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsArrayPntPlanar
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
static Standard_Boolean IsArrayPntPlanar(const Handle(TColgp_HArray1OfPnt)& HAP,
|
|
||||||
gp_Dir& Norm, const Standard_Real prec)
|
|
||||||
{
|
|
||||||
Standard_Integer size = HAP->Length();
|
|
||||||
if(size<3)
|
|
||||||
return Standard_False;
|
|
||||||
gp_Pnt P1 = HAP->Value(1);
|
|
||||||
gp_Pnt P2 = HAP->Value(2);
|
|
||||||
gp_Pnt P3 = HAP->Value(3);
|
|
||||||
Standard_Real dist1 = P1.Distance(P2);
|
|
||||||
Standard_Real dist2 = P1.Distance(P3);
|
|
||||||
if( dist1<prec || dist2<prec )
|
|
||||||
return Standard_False;
|
|
||||||
gp_Vec V1(P1,P2);
|
|
||||||
gp_Vec V2(P1,P3);
|
|
||||||
if(V1.IsParallel(V2,prec))
|
|
||||||
return Standard_False;
|
|
||||||
gp_Vec NV = V1.Crossed(V2);
|
|
||||||
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = 1; i <= 3; ++i)
|
|
||||||
{
|
|
||||||
if (Precision::IsInfinite(NV.Coord(i)))
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(NV.Magnitude() < gp::Resolution())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
if(size>3) {
|
|
||||||
for(i=4; i<=size; i++) {
|
|
||||||
gp_Pnt PN = HAP->Value(i);
|
|
||||||
dist1 = P1.Distance(PN);
|
|
||||||
if (dist1 < prec || Precision::IsInfinite(dist1))
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
gp_Vec VN(P1,PN);
|
|
||||||
if(!NV.IsNormal(VN,prec))
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Norm = NV;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ConicdDefinition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
static Standard_Boolean ConicDefinition
|
|
||||||
( const Standard_Real a, const Standard_Real b1, const Standard_Real c,
|
|
||||||
const Standard_Real d1, const Standard_Real e1, const Standard_Real f,
|
|
||||||
const Standard_Boolean IsParab, const Standard_Boolean IsEllip,
|
|
||||||
gp_Pnt& Center, gp_Dir& MainAxis, Standard_Real& Rmin, Standard_Real& Rmax )
|
|
||||||
{
|
|
||||||
Standard_Real Xcen = 0.,Ycen = 0., Xax = 0.,Yax = 0.;
|
|
||||||
Standard_Real b,d,e;
|
|
||||||
// conic : a*x2 + 2*b*x*y + c*y2 + 2*d*x + 2*e*y + f = 0.
|
|
||||||
//Equation (a,b,c,d,e,f);
|
|
||||||
b = b1/2.; d = d1/2.; e = e1/2.; // chgt de variable
|
|
||||||
|
|
||||||
Standard_Real eps = 1.E-08; // ?? comme ComputedForm
|
|
||||||
|
|
||||||
if (IsParab) {
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// -> Conique a centre, cas general
|
|
||||||
// On utilise les Determinants des matrices :
|
|
||||||
// | a b d |
|
|
||||||
// gdet (3x3) = | b c e | et pdet (2X2) = | a b |
|
|
||||||
// | d e f | | b c |
|
|
||||||
|
|
||||||
Standard_Real gdet = a*c*f + 2*b*d*e - c*d*d - a*e*e - b*b*f;
|
|
||||||
Standard_Real pdet = a*c - b*b;
|
|
||||||
|
|
||||||
Xcen = (b*e - c*d) / pdet;
|
|
||||||
Ycen = (b*d - a*e) / pdet;
|
|
||||||
|
|
||||||
Standard_Real term1 = a-c;
|
|
||||||
Standard_Real term2 = 2*b;
|
|
||||||
Standard_Real cos2t;
|
|
||||||
Standard_Real auxil;
|
|
||||||
|
|
||||||
if (Abs(term2) <= eps && Abs(term1) <= eps) {
|
|
||||||
cos2t = 1.;
|
|
||||||
auxil = 0.;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (Abs(term1) < eps)
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
Standard_Real t2d = term2/term1; //skl 21.11.2001
|
|
||||||
cos2t = 1./sqrt(1+t2d*t2d);
|
|
||||||
auxil = sqrt (term1*term1 + term2*term2);
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real cost = sqrt ( (1+cos2t)/2. );
|
|
||||||
Standard_Real sint = sqrt ( (1-cos2t)/2. );
|
|
||||||
|
|
||||||
Standard_Real aprim = (a+c+auxil)/2.;
|
|
||||||
Standard_Real cprim = (a+c-auxil)/2.;
|
|
||||||
|
|
||||||
if (Abs(aprim) < gp::Resolution() || Abs(cprim) < gp::Resolution())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
term1 = -gdet/(aprim*pdet);
|
|
||||||
term2 = -gdet/(cprim*pdet);
|
|
||||||
|
|
||||||
if (IsEllip) {
|
|
||||||
Xax = cost;
|
|
||||||
Yax = sint;
|
|
||||||
Rmin = sqrt ( term1);
|
|
||||||
Rmax = sqrt ( term2);
|
|
||||||
if(Rmax<Rmin){
|
|
||||||
Rmax = sqrt ( term1);
|
|
||||||
Rmin = sqrt ( term2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (term1 <= eps){
|
|
||||||
Xax = -sint;
|
|
||||||
Yax = cost;
|
|
||||||
Rmin = sqrt (-term1);
|
|
||||||
Rmax = sqrt (term2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Xax = cost;
|
|
||||||
Yax = sint;
|
|
||||||
Rmin = sqrt (-term2);
|
|
||||||
Rmax = sqrt (term1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Center.SetCoord (Xcen,Ycen,0.);
|
|
||||||
MainAxis.SetCoord (Xax,Yax,0.);
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ComputeEllipse
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeEllipse(const Handle(Geom_Curve)& c3d,
|
|
||||||
const Standard_Real tol,
|
|
||||||
const Standard_Real c1, const Standard_Real c2,
|
|
||||||
Standard_Real& cf, Standard_Real& cl,
|
|
||||||
Standard_Real& Deviation)
|
|
||||||
{
|
|
||||||
if (c3d->IsKind (STANDARD_TYPE(Geom_Ellipse))) {
|
|
||||||
cf = c1;
|
|
||||||
cl = c2;
|
|
||||||
Deviation = 0.;
|
|
||||||
Handle(Geom_Ellipse) anElips = Handle(Geom_Ellipse)::DownCast(c3d);
|
|
||||||
return anElips;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Geom_Curve) res;
|
|
||||||
Standard_Real prec = Precision::PConfusion();
|
|
||||||
|
|
||||||
Standard_Real AF,BF,CF,DF,EF,Q1,Q2,Q3,c2n;
|
|
||||||
Standard_Integer i;
|
|
||||||
|
|
||||||
gp_Pnt PStart = c3d->Value(c1);
|
|
||||||
gp_Pnt PEnd = c3d->Value(c2);
|
|
||||||
|
|
||||||
const Standard_Boolean IsClos = PStart.Distance(PEnd) < prec;
|
|
||||||
if (IsClos)
|
|
||||||
{
|
|
||||||
c2n=c2-(c2-c1)/5;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
c2n=c2;
|
|
||||||
//
|
|
||||||
gp_XYZ aBC;
|
|
||||||
Handle(TColgp_HArray1OfPnt) AP = new TColgp_HArray1OfPnt(1,5);
|
|
||||||
AP->SetValue(1,PStart);
|
|
||||||
aBC += PStart.XYZ();
|
|
||||||
Standard_Real dc=(c2n-c1)/4;
|
|
||||||
for (i = 1; i < 5; i++)
|
|
||||||
{
|
|
||||||
gp_Pnt aP = c3d->Value(c1 + dc*i);
|
|
||||||
AP->SetValue(i + 1, aP);
|
|
||||||
aBC += aP.XYZ();
|
|
||||||
}
|
|
||||||
aBC /= 5;
|
|
||||||
aBC *= -1;
|
|
||||||
gp_Vec aTrans(aBC);
|
|
||||||
for (i = 1; i <= 5; ++i)
|
|
||||||
{
|
|
||||||
AP->ChangeValue(i).Translate(aTrans);
|
|
||||||
}
|
|
||||||
gp_Dir ndir;
|
|
||||||
if(!IsArrayPntPlanar(AP,ndir,prec))
|
|
||||||
return res;
|
|
||||||
|
|
||||||
if (Abs(ndir.X()) < gp::Resolution() && Abs(ndir.Y()) < gp::Resolution()
|
|
||||||
&& Abs(ndir.Z()) < gp::Resolution())
|
|
||||||
return res;
|
|
||||||
|
|
||||||
gp_Ax3 AX(gp_Pnt(0,0,0),ndir);
|
|
||||||
gp_Trsf Tr;
|
|
||||||
Tr.SetTransformation(AX);
|
|
||||||
gp_Trsf Tr2 = Tr.Inverted();
|
|
||||||
|
|
||||||
math_Matrix Dt(1, 5, 1, 5);
|
|
||||||
math_Vector F(1, 5), Sl(1, 5);
|
|
||||||
|
|
||||||
Standard_Real XN,YN,ZN = 0.;
|
|
||||||
gp_Pnt PT,PP;
|
|
||||||
for(i=1; i<=5; i++) {
|
|
||||||
PT = AP->Value(i).Transformed(Tr);
|
|
||||||
PT.Coord(XN,YN,ZN);
|
|
||||||
Dt(i, 1) = XN*XN;
|
|
||||||
Dt(i, 2) = XN*YN;
|
|
||||||
Dt(i, 3) = YN*YN;
|
|
||||||
Dt(i, 4) = XN;
|
|
||||||
Dt(i, 5) = YN;
|
|
||||||
F(i) = -1.;
|
|
||||||
}
|
|
||||||
|
|
||||||
math_Gauss aSolver(Dt);
|
|
||||||
if (!aSolver.IsDone())
|
|
||||||
return res;
|
|
||||||
|
|
||||||
aSolver.Solve(F, Sl);
|
|
||||||
|
|
||||||
AF=Sl(1);
|
|
||||||
BF=Sl(2);
|
|
||||||
CF=Sl(3);
|
|
||||||
DF=Sl(4);
|
|
||||||
EF=Sl(5);
|
|
||||||
|
|
||||||
Q1=AF*CF+BF*EF*DF/4-CF*DF*DF/4-BF*BF/4-AF*EF*EF/4;
|
|
||||||
Q2=AF*CF-BF*BF/4;
|
|
||||||
Q3=AF+CF;
|
|
||||||
|
|
||||||
Standard_Real Rmax, Rmin;
|
|
||||||
gp_Pnt Center;
|
|
||||||
gp_Dir MainAxis;
|
|
||||||
Standard_Boolean IsParab = Standard_False, IsEllip = Standard_False;
|
|
||||||
|
|
||||||
if (Q2 > 0 && Q1*Q3 < 0) {
|
|
||||||
// ellipse
|
|
||||||
IsEllip = Standard_True;
|
|
||||||
if (ConicDefinition(AF, BF, CF, DF, EF, 1., IsParab, IsEllip,
|
|
||||||
Center, MainAxis, Rmin, Rmax)) {
|
|
||||||
// create ellipse
|
|
||||||
if (Rmax - Rmin < Precision::Confusion())
|
|
||||||
{
|
|
||||||
return res; //really it is circle, which must be recognized in other method
|
|
||||||
}
|
|
||||||
aTrans *= -1;
|
|
||||||
Center.SetZ(ZN);
|
|
||||||
gp_Pnt NewCenter = Center.Transformed(Tr2);
|
|
||||||
gp_Pnt Ptmp(Center.X() + MainAxis.X() * 10,
|
|
||||||
Center.Y() + MainAxis.Y() * 10,
|
|
||||||
Center.Z() + MainAxis.Z() * 10);
|
|
||||||
gp_Pnt NewPtmp = Ptmp.Transformed(Tr2);
|
|
||||||
gp_Dir NewMainAxis(NewPtmp.X() - NewCenter.X(),
|
|
||||||
NewPtmp.Y() - NewCenter.Y(),
|
|
||||||
NewPtmp.Z() - NewCenter.Z());
|
|
||||||
gp_Ax2 ax2(NewCenter, ndir, NewMainAxis);
|
|
||||||
|
|
||||||
gp_Elips anEllipse(ax2, Rmax, Rmin);
|
|
||||||
anEllipse.Translate(aTrans);
|
|
||||||
Handle(Geom_Ellipse) gell = new Geom_Ellipse(anEllipse);
|
|
||||||
|
|
||||||
// test for 20 points
|
|
||||||
Standard_Real param2 = 0;
|
|
||||||
dc = (c2 - c1) / 20;
|
|
||||||
for (i = 1; i <= 20; i++) {
|
|
||||||
PP = c3d->Value(c1 + i*dc);
|
|
||||||
Standard_Real aPar = ElCLib::Parameter(anEllipse, PP);
|
|
||||||
Standard_Real dist = gell->Value(aPar).Distance(PP);
|
|
||||||
if (dist > tol) return res; // not done
|
|
||||||
if (dist > param2)
|
|
||||||
param2 = dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Deviation = param2;
|
|
||||||
|
|
||||||
Standard_Real PI2 = 2 * M_PI;
|
|
||||||
cf = ElCLib::Parameter(anEllipse, c3d->Value(c1));
|
|
||||||
cf = ElCLib::InPeriod(cf, 0., PI2);
|
|
||||||
|
|
||||||
//first parameter should be closed to zero
|
|
||||||
|
|
||||||
if (Abs(cf) < Precision::PConfusion() || Abs(PI2 - cf) < Precision::PConfusion())
|
|
||||||
cf = 0.;
|
|
||||||
|
|
||||||
Standard_Real cm = ElCLib::Parameter(anEllipse, c3d->Value((c1 + c2) / 2.));
|
|
||||||
cm = ElCLib::InPeriod(cm, cf, cf + PI2);
|
|
||||||
|
|
||||||
cl = ElCLib::Parameter(anEllipse, c3d->Value(c2));
|
|
||||||
cl = ElCLib::InPeriod(cl, cm, cm + PI2);
|
|
||||||
|
|
||||||
res = gell;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (Q2 < 0 && Q1 != 0) {
|
|
||||||
// hyberbola
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Q2 == 0 && Q1 != 0) {
|
|
||||||
// parabola
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ComputeCurve
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCurve(const Handle(Geom_Curve)& theC3d,
|
|
||||||
const Standard_Real tolerance,
|
|
||||||
const Standard_Real c1, const Standard_Real c2,
|
|
||||||
Standard_Real& cf, Standard_Real& cl,
|
|
||||||
Standard_Real& theGap,
|
|
||||||
const GeomConvert_ConvType theConvType, const GeomAbs_CurveType theTarget)
|
|
||||||
{
|
|
||||||
cf = c1; cl = c2;
|
|
||||||
Handle(Geom_Curve) c3d, newc3d[3];
|
|
||||||
Standard_Integer i, imin = -1;
|
|
||||||
c3d = theC3d;
|
|
||||||
if (c3d.IsNull()) return newc3d[imin];
|
|
||||||
gp_Pnt P1 = c3d->Value(c1);
|
|
||||||
gp_Pnt P2 = c3d->Value(c2);
|
|
||||||
gp_Pnt P3 = c3d->Value(c1 + (c2 - c1) / 2);
|
|
||||||
Standard_Real d[3] = { RealLast(), RealLast(), RealLast() };
|
|
||||||
Standard_Real fp[3], lp[3];
|
|
||||||
|
|
||||||
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
|
||||||
Handle(Geom_TrimmedCurve) aTc = Handle(Geom_TrimmedCurve)::DownCast(c3d);
|
|
||||||
c3d = aTc->BasisCurve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theConvType == GeomConvert_Target)
|
|
||||||
{
|
|
||||||
theGap = RealLast();
|
|
||||||
if (theTarget == GeomAbs_Line)
|
|
||||||
{
|
|
||||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], theGap);
|
|
||||||
cf = fp[0];
|
|
||||||
cl = lp[0];
|
|
||||||
return newc3d[0];
|
|
||||||
}
|
|
||||||
if (theTarget == GeomAbs_Circle)
|
|
||||||
{
|
|
||||||
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], theGap);
|
|
||||||
cf = fp[1];
|
|
||||||
cl = lp[1];
|
|
||||||
return newc3d[1];
|
|
||||||
}
|
|
||||||
if (theTarget == GeomAbs_Ellipse)
|
|
||||||
{
|
|
||||||
newc3d[2] = ComputeEllipse(c3d, tolerance, c1, c2, fp[2], lp[2], theGap);
|
|
||||||
cf = fp[2];
|
|
||||||
cl = lp[2];
|
|
||||||
return newc3d[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (theConvType == GeomConvert_Simplest)
|
|
||||||
{
|
|
||||||
theGap = RealLast();
|
|
||||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], theGap);
|
|
||||||
if (!newc3d[0].IsNull())
|
|
||||||
{
|
|
||||||
cf = fp[0];
|
|
||||||
cl = lp[0];
|
|
||||||
return newc3d[0];
|
|
||||||
}
|
|
||||||
theGap = RealLast();
|
|
||||||
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], theGap);
|
|
||||||
if (!newc3d[1].IsNull())
|
|
||||||
{
|
|
||||||
cf = fp[1];
|
|
||||||
cl = lp[1];
|
|
||||||
return newc3d[1];
|
|
||||||
}
|
|
||||||
theGap = RealLast();
|
|
||||||
newc3d[2] = ComputeEllipse(c3d, tolerance, c1, c2, fp[2], lp[2], theGap);
|
|
||||||
if (!newc3d[2].IsNull())
|
|
||||||
{
|
|
||||||
cf = fp[2];
|
|
||||||
cl = lp[2];
|
|
||||||
return newc3d[2];
|
|
||||||
}
|
|
||||||
// Conversion failed, returns null curve
|
|
||||||
return newc3d[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// theConvType == GeomConvert_MinGap
|
|
||||||
// recognition in case of small curve
|
|
||||||
imin = -1;
|
|
||||||
if((P1.Distance(P2) < 2*tolerance) && (P1.Distance(P3) < 2*tolerance)) {
|
|
||||||
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], d[1]);
|
|
||||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], d[0]);
|
|
||||||
imin = 1;
|
|
||||||
if (newc3d[1].IsNull() || d[0] < d[1])
|
|
||||||
{
|
|
||||||
imin = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
d[0] = RealLast();
|
|
||||||
newc3d[0] = ComputeLine (c3d,tolerance,c1,c2,fp[0],lp[0],d[0]);
|
|
||||||
Standard_Real tol = Min(tolerance, d[0]);
|
|
||||||
if (!Precision::IsInfinite(c1) && !Precision::IsInfinite(c2))
|
|
||||||
{
|
|
||||||
d[1] = RealLast();
|
|
||||||
newc3d[1] = ComputeCircle(c3d, tol, c1, c2, fp[1], lp[1], d[1]);
|
|
||||||
tol = Min(tol, d[1]);
|
|
||||||
d[2] = RealLast();
|
|
||||||
newc3d[2] = ComputeEllipse(c3d, tol, c1, c2, fp[2], lp[2], d[2]);
|
|
||||||
}
|
|
||||||
Standard_Real dd = RealLast();
|
|
||||||
for (i = 0; i < 3; ++i)
|
|
||||||
{
|
|
||||||
if (newc3d[i].IsNull()) continue;
|
|
||||||
if (d[i] < dd)
|
|
||||||
{
|
|
||||||
dd = d[i];
|
|
||||||
imin = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imin >= 0)
|
|
||||||
{
|
|
||||||
cf = fp[imin];
|
|
||||||
cl = lp[imin];
|
|
||||||
theGap = d[imin];
|
|
||||||
return newc3d[imin];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cf = c1;
|
|
||||||
cl = c2;
|
|
||||||
theGap = -1.;
|
|
||||||
return newc3d[0]; // must be null curve;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,133 +0,0 @@
|
|||||||
// Created: 2001-05-21
|
|
||||||
//
|
|
||||||
// Copyright (c) 2001-2013 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 _GeomConvert_CurveToAnaCurve_HeaderFile
|
|
||||||
#define _GeomConvert_CurveToAnaCurve_HeaderFile
|
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_DefineAlloc.hxx>
|
|
||||||
#include <Standard_Handle.hxx>
|
|
||||||
#include <Standard_Boolean.hxx>
|
|
||||||
#include <Standard_Real.hxx>
|
|
||||||
#include <TColgp_Array1OfPnt.hxx>
|
|
||||||
#include <GeomConvert_ConvType.hxx>
|
|
||||||
#include <GeomAbs_CurveType.hxx>
|
|
||||||
|
|
||||||
class Geom_Curve;
|
|
||||||
class Geom_Line;
|
|
||||||
class gp_Lin;
|
|
||||||
class gp_Pnt;
|
|
||||||
class gp_Circ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GeomConvert_CurveToAnaCurve
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_CurveToAnaCurve();
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_CurveToAnaCurve(const Handle(Geom_Curve)& C);
|
|
||||||
|
|
||||||
Standard_EXPORT void Init (const Handle(Geom_Curve)& C);
|
|
||||||
|
|
||||||
//! Converts me to analytical if possible with given
|
|
||||||
//! tolerance. The new first and last parameters are
|
|
||||||
//! returned to newF, newL
|
|
||||||
Standard_EXPORT Standard_Boolean ConvertToAnalytical (const Standard_Real theTol, Handle(Geom_Curve)& theResultCurve, const Standard_Real F, const Standard_Real L, Standard_Real& newF, Standard_Real& newL);
|
|
||||||
|
|
||||||
Standard_EXPORT static Handle(Geom_Curve) ComputeCurve (const Handle(Geom_Curve)& curve, const Standard_Real tolerance,
|
|
||||||
const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl,
|
|
||||||
Standard_Real& theGap, const GeomConvert_ConvType theCurvType = GeomConvert_MinGap, const GeomAbs_CurveType theTarget = GeomAbs_Line);
|
|
||||||
|
|
||||||
//! Tries to convert the given curve to circle with given
|
|
||||||
//! tolerance. Returns NULL curve if conversion is
|
|
||||||
//! not possible.
|
|
||||||
Standard_EXPORT static Handle(Geom_Curve) ComputeCircle (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
|
|
||||||
|
|
||||||
//! Tries to convert the given curve to ellipse with given
|
|
||||||
//! tolerance. Returns NULL curve if conversion is
|
|
||||||
//! not possible.
|
|
||||||
Standard_EXPORT static Handle(Geom_Curve) ComputeEllipse (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
|
|
||||||
|
|
||||||
//! Tries to convert the given curve to line with given
|
|
||||||
//! tolerance. Returns NULL curve if conversion is
|
|
||||||
//! not possible.
|
|
||||||
Standard_EXPORT static Handle(Geom_Line) ComputeLine (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
|
|
||||||
|
|
||||||
//! Returns true if the set of points is linear with given
|
|
||||||
//! tolerance
|
|
||||||
Standard_EXPORT static Standard_Boolean IsLinear (const TColgp_Array1OfPnt& aPoints, const Standard_Real tolerance, Standard_Real& Deviation);
|
|
||||||
|
|
||||||
//! Creates line on two points.
|
|
||||||
//! Resulting parameters returned
|
|
||||||
Standard_EXPORT static gp_Lin GetLine(const gp_Pnt& P1, const gp_Pnt& P2, Standard_Real& cf, Standard_Real& cl);
|
|
||||||
|
|
||||||
//! Creates circle on points. Returns true if OK.
|
|
||||||
Standard_EXPORT static Standard_Boolean GetCircle(gp_Circ& Circ, const gp_Pnt& P0, const gp_Pnt& P1, const gp_Pnt& P2);
|
|
||||||
|
|
||||||
//! Returns maximal deviation of converted surface from the original
|
|
||||||
//! one computed by last call to ConvertToAnalytical
|
|
||||||
Standard_Real Gap() const
|
|
||||||
{
|
|
||||||
return myGap;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns conversion type
|
|
||||||
GeomConvert_ConvType GetConvType() const
|
|
||||||
{
|
|
||||||
return myConvType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets type of convertion
|
|
||||||
void SetConvType(const GeomConvert_ConvType theConvType)
|
|
||||||
{
|
|
||||||
myConvType = theConvType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns target curve type
|
|
||||||
GeomAbs_CurveType GetTarget() const
|
|
||||||
{
|
|
||||||
return myTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets target curve type
|
|
||||||
void SetTarget(const GeomAbs_CurveType theTarget)
|
|
||||||
{
|
|
||||||
myTarget = theTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(Geom_Curve) myCurve;
|
|
||||||
Standard_Real myGap;
|
|
||||||
GeomConvert_ConvType myConvType;
|
|
||||||
GeomAbs_CurveType myTarget;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _GeomConvert_CurveToAnaCurve_HeaderFile
|
|
@@ -1,68 +0,0 @@
|
|||||||
// Copyright (c) 1995-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2022 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 <GeomConvert_FuncConeLSDist.hxx>
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
#include <gp_Ax3.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
#include <ElSLib.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GeomConvert_FuncConeLSDist
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GeomConvert_FuncConeLSDist::GeomConvert_FuncConeLSDist(
|
|
||||||
const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
|
||||||
const gp_Dir& theDir):
|
|
||||||
myPoints(thePoints), myDir(theDir)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVariables
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer GeomConvert_FuncConeLSDist::NbVariables () const
|
|
||||||
{
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncConeLSDist::Value(const math_Vector& X, Standard_Real& F)
|
|
||||||
{
|
|
||||||
gp_Pnt aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real aSemiAngle = X(4), anR = X(5);
|
|
||||||
gp_Ax3 aPos(aLoc, myDir);
|
|
||||||
|
|
||||||
F = 0.;
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
Standard_Real u, v;
|
|
||||||
gp_Pnt aPi(myPoints->Value(i));
|
|
||||||
ElSLib::ConeParameters(aPos, anR, aSemiAngle, aPi, u, v);
|
|
||||||
gp_Pnt aPp;
|
|
||||||
ElSLib::ConeD0(u, v, aPos, anR, aSemiAngle, aPp);
|
|
||||||
F += aPi.SquareDistance(aPp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@@ -1,66 +0,0 @@
|
|||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2022 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 _GeomConvert_FuncConeLSDist_HeaderFile
|
|
||||||
#define _GeomConvert_FuncConeLSDist_HeaderFile
|
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_DefineAlloc.hxx>
|
|
||||||
|
|
||||||
#include <math_MultipleVarFunction.hxx>
|
|
||||||
#include <TColgp_HArray1OfXYZ.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
#include <gp_Dir.hxx>
|
|
||||||
|
|
||||||
//! Function for search of Cone canonic parameters: coordinates of center local coordinate system,
|
|
||||||
//! direction of axis, radius and semi-angle from set of points
|
|
||||||
//! by least square method.
|
|
||||||
//!
|
|
||||||
//!
|
|
||||||
class GeomConvert_FuncConeLSDist : public math_MultipleVarFunction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
//! Constructor.
|
|
||||||
Standard_EXPORT GeomConvert_FuncConeLSDist() {};
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_FuncConeLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
|
||||||
const gp_Dir& theDir);
|
|
||||||
|
|
||||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
|
||||||
{
|
|
||||||
myPoints = thePoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetDir(const gp_Dir& theDir)
|
|
||||||
{
|
|
||||||
myDir = theDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Number of variables.
|
|
||||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Value.
|
|
||||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
|
||||||
gp_Dir myDir;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif // _GeomConvert_FuncConeLSDist_HeaderFile
|
|
@@ -1,140 +0,0 @@
|
|||||||
// Copyright (c) 1995-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2022 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 <GeomConvert_FuncCylinderLSDist.hxx>
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GeomConvert_FuncCylinderLSDist
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GeomConvert_FuncCylinderLSDist::GeomConvert_FuncCylinderLSDist(
|
|
||||||
const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
|
||||||
const gp_Dir& theDir):
|
|
||||||
myPoints(thePoints), myDir(theDir)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVariables
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer GeomConvert_FuncCylinderLSDist::NbVariables () const
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Value(const math_Vector& X,Standard_Real& F)
|
|
||||||
{
|
|
||||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real anR2 = X(4)*X(4);
|
|
||||||
|
|
||||||
F = 0.;
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
gp_Vec aV(myPoints->Value(i) - aLoc);
|
|
||||||
Standard_Real aD2 = aV.CrossSquareMagnitude(myDir);
|
|
||||||
Standard_Real d = aD2 - anR2;
|
|
||||||
F += d * d;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Gradient
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
|
||||||
|
|
||||||
{
|
|
||||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
|
||||||
Standard_Real x = myDir.X(), y = myDir.Y(), z = myDir.Z();
|
|
||||||
G.Init(0.);
|
|
||||||
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
gp_Vec aV(myPoints->Value(i) - aLoc);
|
|
||||||
Standard_Real aD2 = aV.CrossSquareMagnitude(myDir);
|
|
||||||
Standard_Real d = aD2 - anR2;
|
|
||||||
Standard_Real Dx0 = 2.*(aV.Z()*x - aV.X()*z)*z
|
|
||||||
-2.*(aV.X()*y - aV.Y()*x)*y;
|
|
||||||
Standard_Real Dy0 = -2.*(aV.Y()*z - aV.Z()*y)*z
|
|
||||||
+2.*(aV.X()*y - aV.Y()*x)*x;
|
|
||||||
Standard_Real Dz0 = 2.*(aV.Y()*z - aV.Z()*y)*y
|
|
||||||
-2.*(aV.Z()*x - aV.X()*z)*x;
|
|
||||||
|
|
||||||
G(1) += d * Dx0;
|
|
||||||
G(2) += d * Dy0;
|
|
||||||
G(3) += d * Dz0;
|
|
||||||
//
|
|
||||||
G(4) += d;
|
|
||||||
}
|
|
||||||
|
|
||||||
G *= 2;
|
|
||||||
G(6) *= -2.*anR;
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Values
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
|
||||||
{
|
|
||||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
|
||||||
Standard_Real x = myDir.X(), y = myDir.Y(), z = myDir.Z();
|
|
||||||
|
|
||||||
F = 0.;
|
|
||||||
G.Init(0.);
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
gp_Vec aV(myPoints->Value(i) - aLoc);
|
|
||||||
Standard_Real aD2 = aV.CrossSquareMagnitude(myDir);
|
|
||||||
Standard_Real d = aD2 - anR2;
|
|
||||||
Standard_Real Dx0 = 2.*(aV.Z()*x - aV.X()*z)*z
|
|
||||||
- 2.*(aV.X()*y - aV.Y()*x)*y;
|
|
||||||
Standard_Real Dy0 = -2.*(aV.Y()*z - aV.Z()*y)*z
|
|
||||||
+ 2.*(aV.X()*y - aV.Y()*x)*x;
|
|
||||||
Standard_Real Dz0 = 2.*(aV.Y()*z - aV.Z()*y)*y
|
|
||||||
- 2.*(aV.Z()*x - aV.X()*z)*x;
|
|
||||||
|
|
||||||
G(1) += d * Dx0;
|
|
||||||
G(2) += d * Dy0;
|
|
||||||
G(3) += d * Dz0;
|
|
||||||
//
|
|
||||||
G(4) += d;
|
|
||||||
//
|
|
||||||
F += d * d;
|
|
||||||
}
|
|
||||||
|
|
||||||
G *= 2;
|
|
||||||
G(4) *= -2.*anR;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
@@ -1,100 +0,0 @@
|
|||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2022 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 _GeomConvert_FuncCylinderLSDist_HeaderFile
|
|
||||||
#define _GeomConvert_FuncCylinderLSDist_HeaderFile
|
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_DefineAlloc.hxx>
|
|
||||||
|
|
||||||
#include <math_MultipleVarFunctionWithGradient.hxx>
|
|
||||||
#include <TColgp_HArray1OfXYZ.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
#include <gp_Dir.hxx>
|
|
||||||
|
|
||||||
//! Function for search of cylinder canonic parameters: coordinates of center local coordinate system,
|
|
||||||
//! direction of axis and radius from set of points
|
|
||||||
//! by least square method.
|
|
||||||
//!
|
|
||||||
//! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
|
|
||||||
//! for use in math_BFGS algorithm.
|
|
||||||
//!
|
|
||||||
//! Parametrisation:
|
|
||||||
//! Cylinder is defined by its axis and radius. Axis is defined by 3 cartesian coordinats it location x0, y0, z0
|
|
||||||
//! and direction, which is constant and set by user:
|
|
||||||
//! dir.x, dir.y, dir.z
|
|
||||||
//! The criteria is:
|
|
||||||
//! F(x0, y0, z0, theta, phi, R) = Sum[|(P(i) - Loc)^dir|^2 - R^2]^2 => min
|
|
||||||
//! P(i) is i-th sample point, Loc, dir - axis location and direction, R - radius
|
|
||||||
//!
|
|
||||||
//! The square vector product |(P(i) - Loc)^dir|^2 is:
|
|
||||||
//!
|
|
||||||
//! [(y - y0)*dir.z - (z - z0)*dir.y]^2 +
|
|
||||||
//! [(z - z0)*dir.x - (x - x0)*dir.z]^2 +
|
|
||||||
//! [(x - x0)*dir.y - (y - y0)*dir.x]^2
|
|
||||||
//!
|
|
||||||
//! First derivative of square vector product are:
|
|
||||||
//! Dx0 = 2*[(z - z0)*dir.x - (x - x0)*dir.z]*dir.z
|
|
||||||
//! -2*[(x - x0)*dir.y - (y - y0)*dir.x]*dir.y
|
|
||||||
//! Dy0 = -2*[(y - y0)*dir.z - (z - z0)*dir.y]*dir.z
|
|
||||||
//! +2*[(x - x0)*dir.y - (y - y0)*dir.x]*dir.x
|
|
||||||
//! Dz0 = 2*[(y - y0)*dir.z - (z - z0)*dir.y]*dir.y
|
|
||||||
//! -2*[(z - z0)*dir.x - (x - x0)*dir.z]*dir.x
|
|
||||||
//!
|
|
||||||
//! dF/dx0 : G1(...) = 2*Sum{[...]*Dx0}
|
|
||||||
//! dF/dy0 : G2(...) = 2*Sum{[...]*Dy0}
|
|
||||||
//! dF/dz0 : G3(...) = 2*Sum{[...]*Dz0}
|
|
||||||
//! dF/dR : G4(...) = -4*R*Sum[...]
|
|
||||||
//! [...] = [|(P(i) - Loc)^dir|^2 - R^2]
|
|
||||||
class GeomConvert_FuncCylinderLSDist : public math_MultipleVarFunctionWithGradient
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
//! Constructor.
|
|
||||||
Standard_EXPORT GeomConvert_FuncCylinderLSDist() {};
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_FuncCylinderLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
|
||||||
const gp_Dir& theDir);
|
|
||||||
|
|
||||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
|
||||||
{
|
|
||||||
myPoints = thePoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetDir(const gp_Dir& theDir)
|
|
||||||
{
|
|
||||||
myDir = theDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Number of variables.
|
|
||||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Value.
|
|
||||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Gradient.
|
|
||||||
Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Value and gradient.
|
|
||||||
Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
|
||||||
gp_Dir myDir;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif // _GeomConvert_FuncCylinderLSDist_HeaderFile
|
|
@@ -1,115 +0,0 @@
|
|||||||
// Created on: 2016-05-10
|
|
||||||
// Created by: Alexander MALYSHEV
|
|
||||||
// Copyright (c) 1995-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2016 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 <GeomConvert_FuncSphereLSDist.hxx>
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GeomConvert_FuncSphereLSDist
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GeomConvert_FuncSphereLSDist::GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints):
|
|
||||||
myPoints(thePoints)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVariables
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer GeomConvert_FuncSphereLSDist::NbVariables () const
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Value(const math_Vector& X,Standard_Real& F)
|
|
||||||
{
|
|
||||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real anR2 = X(4)*X(4);
|
|
||||||
|
|
||||||
F = 0.;
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
Standard_Real d = (myPoints->Value(i) - aLoc).SquareModulus() - anR2;
|
|
||||||
F += d * d;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Gradient
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
|
||||||
|
|
||||||
{
|
|
||||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
|
||||||
|
|
||||||
G.Init(0.);
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
gp_XYZ dLoc = myPoints->Value(i) - aLoc;
|
|
||||||
Standard_Real d = dLoc.SquareModulus() - anR2;
|
|
||||||
G(1) += d * dLoc.X();
|
|
||||||
G(2) += d * dLoc.Y();
|
|
||||||
G(3) += d * dLoc.Z();
|
|
||||||
G(4) += d;
|
|
||||||
}
|
|
||||||
G *= -4;
|
|
||||||
G(4) *= anR;
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Values
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
|
||||||
{
|
|
||||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
|
||||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
|
||||||
|
|
||||||
G.Init(0.);
|
|
||||||
F = 0.;
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
|
||||||
{
|
|
||||||
gp_XYZ dLoc = myPoints->Value(i) - aLoc;
|
|
||||||
Standard_Real d = dLoc.SquareModulus() - anR2;
|
|
||||||
G(1) += d * dLoc.X();
|
|
||||||
G(2) += d * dLoc.Y();
|
|
||||||
G(3) += d * dLoc.Z();
|
|
||||||
G(4) += d;
|
|
||||||
F += d * d;
|
|
||||||
}
|
|
||||||
G *= -4;
|
|
||||||
G(4) *= anR;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
@@ -1,77 +0,0 @@
|
|||||||
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2022 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 _GeomConvert_FuncSphereLSDist_HeaderFile
|
|
||||||
#define _GeomConvert_FuncSphereLSDist_HeaderFile
|
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_DefineAlloc.hxx>
|
|
||||||
|
|
||||||
#include <math_MultipleVarFunctionWithGradient.hxx>
|
|
||||||
#include <TColgp_HArray1OfXYZ.hxx>
|
|
||||||
#include <math_Vector.hxx>
|
|
||||||
|
|
||||||
//! Function for search of sphere canonic parameters: coordinates of center and radius from set of moints
|
|
||||||
//! by least square method.
|
|
||||||
//! //!
|
|
||||||
//! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
|
|
||||||
//! for use in math_BFGS algorithm.
|
|
||||||
//!
|
|
||||||
//! The criteria is:
|
|
||||||
//! F(x0, y0, z0, R) = Sum[(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2]^2 => min,
|
|
||||||
//! x(i), y(i), z(i) - coordinates of sample points, x0, y0, z0, R - coordinates of center and radius of sphere,
|
|
||||||
//! which must be defined
|
|
||||||
//!
|
|
||||||
//! The first derivative are:
|
|
||||||
//! dF/dx0 : G1(x0, y0, z0, R) = -4*Sum{[...]*(x(i) - x0)}
|
|
||||||
//! dF/dy0 : G2(x0, y0, z0, R) = -4*Sum{[...]*(y(i) - y0)}
|
|
||||||
//! dF/dz0 : G3(x0, y0, z0, R) = -4*Sum{[...]*(z(i) - z0)}
|
|
||||||
//! dF/dR : G4(x0, y0, z0, R) = -4*R*Sum[...]
|
|
||||||
//! [...] = [(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2]
|
|
||||||
//!
|
|
||||||
class GeomConvert_FuncSphereLSDist : public math_MultipleVarFunctionWithGradient
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
//! Constructor.
|
|
||||||
Standard_EXPORT GeomConvert_FuncSphereLSDist() {};
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints);
|
|
||||||
|
|
||||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
|
||||||
{
|
|
||||||
myPoints = thePoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Number of variables.
|
|
||||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Value.
|
|
||||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Gradient.
|
|
||||||
Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Value and gradient.
|
|
||||||
Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif // _GeomConvert_FuncSphereLSDist_HeaderFile
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,135 +0,0 @@
|
|||||||
// Created: 1998-06-03
|
|
||||||
//
|
|
||||||
// Copyright (c) 1999-2013 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 _GeomConvert_SurfToAnaSurf_HeaderFile
|
|
||||||
#define _GeomConvert_SurfToAnaSurf_HeaderFile
|
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_DefineAlloc.hxx>
|
|
||||||
#include <Standard_Handle.hxx>
|
|
||||||
|
|
||||||
#include <Standard_Real.hxx>
|
|
||||||
#include <Standard_Boolean.hxx>
|
|
||||||
#include <GeomConvert_ConvType.hxx>
|
|
||||||
#include <GeomAbs_SurfaceType.hxx>
|
|
||||||
#include <TColgp_HArray1OfXYZ.hxx>
|
|
||||||
class Geom_Surface;
|
|
||||||
class Geom_SurfaceOfRevolution;
|
|
||||||
class Geom_Circle;
|
|
||||||
|
|
||||||
//! Converts a surface to the analitical form with given
|
|
||||||
//! precision. Conversion is done only the surface is bspline
|
|
||||||
//! of bezier and this can be approximed by some analytical
|
|
||||||
//! surface with that precision.
|
|
||||||
class GeomConvert_SurfToAnaSurf
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_SurfToAnaSurf();
|
|
||||||
|
|
||||||
Standard_EXPORT GeomConvert_SurfToAnaSurf(const Handle(Geom_Surface)& S);
|
|
||||||
|
|
||||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& S);
|
|
||||||
|
|
||||||
void SetConvType(const GeomConvert_ConvType theConvType = GeomConvert_Simplest)
|
|
||||||
{
|
|
||||||
myConvType = theConvType;
|
|
||||||
}
|
|
||||||
void SetTarget(const GeomAbs_SurfaceType theSurfType = GeomAbs_Plane)
|
|
||||||
{
|
|
||||||
myTarget = theSurfType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns maximal deviation of converted surface from the original
|
|
||||||
//! one computed by last call to ConvertToAnalytical
|
|
||||||
Standard_Real Gap() const
|
|
||||||
{
|
|
||||||
return myGap;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Tries to convert the Surface to an Analytic form
|
|
||||||
//! Returns the result
|
|
||||||
//! In case of failure, returns a Null Handle
|
|
||||||
//!
|
|
||||||
Standard_EXPORT Handle(Geom_Surface) ConvertToAnalytical (const Standard_Real InitialToler);
|
|
||||||
Standard_EXPORT Handle(Geom_Surface) ConvertToAnalytical (const Standard_Real InitialToler,
|
|
||||||
const Standard_Real Umin, const Standard_Real Umax,
|
|
||||||
const Standard_Real Vmin, const Standard_Real Vmax);
|
|
||||||
|
|
||||||
//! Returns true if surfaces is same with the given tolerance
|
|
||||||
Standard_EXPORT static Standard_Boolean IsSame (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real tol);
|
|
||||||
|
|
||||||
//! Returns true, if surface is canonical
|
|
||||||
Standard_EXPORT static Standard_Boolean IsCanonical (const Handle(Geom_Surface)& S);
|
|
||||||
|
|
||||||
private:
|
|
||||||
//!static method for checking surface of revolution
|
|
||||||
//!To avoid two-parts cone-like surface
|
|
||||||
static void CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSurf,
|
|
||||||
Standard_Real& V1, Standard_Real& V2);
|
|
||||||
|
|
||||||
//!static method to try create cylindrical or conical surface
|
|
||||||
static Handle(Geom_Surface) TryCylinerCone(const Handle(Geom_Surface)& theSurf, const Standard_Boolean theVCase,
|
|
||||||
const Handle(Geom_Curve)& theUmidiso, const Handle(Geom_Curve)& theVmidiso,
|
|
||||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
|
||||||
const Standard_Real theToler);
|
|
||||||
|
|
||||||
//!static method to try create cylinrical surface using least square method
|
|
||||||
static Standard_Boolean GetCylByLS(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
gp_Ax3& thePos, Standard_Real& theR,
|
|
||||||
Standard_Real& theGap);
|
|
||||||
|
|
||||||
//!static method to try create cylinrical surface based on its Gauss field
|
|
||||||
static Handle(Geom_Surface) TryCylinderByGaussField(const Handle(Geom_Surface)& theSurf,
|
|
||||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
|
||||||
const Standard_Real theToler, const Standard_Integer theNbU = 20, const Standard_Integer theNbV = 20,
|
|
||||||
const Standard_Boolean theLeastSquare = Standard_False);
|
|
||||||
|
|
||||||
//! static method to try create toroidal surface.
|
|
||||||
//! In case <isTryUMajor> = Standard_True try to use V isoline radius as minor radaius.
|
|
||||||
static Handle(Geom_Surface) TryTorusSphere(const Handle(Geom_Surface)& theSurf,
|
|
||||||
const Handle(Geom_Circle)& circle,
|
|
||||||
const Handle(Geom_Circle)& otherCircle,
|
|
||||||
const Standard_Real Param1,
|
|
||||||
const Standard_Real Param2,
|
|
||||||
const Standard_Real aParam1ToCrv,
|
|
||||||
const Standard_Real aParam2ToCrv,
|
|
||||||
const Standard_Real toler,
|
|
||||||
const Standard_Boolean isTryUMajor);
|
|
||||||
|
|
||||||
static Standard_Real ComputeGap(const Handle(Geom_Surface)& theSurf,
|
|
||||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
|
||||||
const Handle(Geom_Surface) theNewSurf, const Standard_Real theTol = RealLast());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(Geom_Surface) mySurf;
|
|
||||||
Standard_Real myGap;
|
|
||||||
GeomConvert_ConvType myConvType;
|
|
||||||
GeomAbs_SurfaceType myTarget;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _GeomConvert_SurfToAnaSurf_HeaderFile
|
|
@@ -59,9 +59,7 @@
|
|||||||
#include <Geom2dConvert.hxx>
|
#include <Geom2dConvert.hxx>
|
||||||
#include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
|
#include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
|
||||||
#include <GeomLProp_SLProps.hxx>
|
#include <GeomLProp_SLProps.hxx>
|
||||||
#include <GeomConvert_SurfToAnaSurf.hxx>
|
|
||||||
#include <GeomConvert_CurveToAnaCurve.hxx>
|
|
||||||
#include <GeomConvert_ConvType.hxx>
|
|
||||||
|
|
||||||
#include <DrawTrSurf_BezierSurface.hxx>
|
#include <DrawTrSurf_BezierSurface.hxx>
|
||||||
#include <DrawTrSurf_BSplineSurface.hxx>
|
#include <DrawTrSurf_BSplineSurface.hxx>
|
||||||
@@ -524,111 +522,6 @@ static Standard_Integer converting(Draw_Interpretor& , Standard_Integer n, const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : converting to canonical
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
static Standard_Integer tocanon(Draw_Interpretor& di, Standard_Integer n, const char ** a)
|
|
||||||
{
|
|
||||||
if (n < 3) return 1;
|
|
||||||
|
|
||||||
GeomConvert_ConvType aConvType = GeomConvert_Simplest;
|
|
||||||
GeomAbs_CurveType aCurv = GeomAbs_Line;
|
|
||||||
GeomAbs_SurfaceType aSurf = GeomAbs_Plane;
|
|
||||||
if (n > 4)
|
|
||||||
{
|
|
||||||
if (strcmp(a[4], "sim") == 0) {
|
|
||||||
aConvType = GeomConvert_Simplest;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "gap") == 0) {
|
|
||||||
aConvType = GeomConvert_MinGap;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "lin") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aCurv = GeomAbs_Line;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "cir") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aCurv = GeomAbs_Circle;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "ell") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aCurv = GeomAbs_Ellipse;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "pln") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aSurf = GeomAbs_Plane;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "cyl") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aSurf = GeomAbs_Cylinder;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "con") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aSurf = GeomAbs_Cone;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "sph") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aSurf = GeomAbs_Sphere;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[4], "tor") == 0) {
|
|
||||||
aConvType = GeomConvert_Target;
|
|
||||||
aSurf = GeomAbs_Torus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real tol = Precision::Confusion();
|
|
||||||
if (n > 3)
|
|
||||||
{
|
|
||||||
tol = Draw::Atof(a[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
|
|
||||||
if (GC.IsNull()) {
|
|
||||||
Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
|
|
||||||
if (GS.IsNull()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
GeomConvert_SurfToAnaSurf aSurfToAna(GS);
|
|
||||||
aSurfToAna.SetConvType(aConvType);
|
|
||||||
if(aConvType == GeomConvert_Target)
|
|
||||||
aSurfToAna.SetTarget(aSurf);
|
|
||||||
Handle(Geom_Surface) anAnaSurf = aSurfToAna.ConvertToAnalytical(tol);
|
|
||||||
if (!anAnaSurf.IsNull())
|
|
||||||
{
|
|
||||||
DrawTrSurf::Set(a[1], anAnaSurf);
|
|
||||||
Standard_Real aGap = aSurfToAna.Gap();
|
|
||||||
di << "Gap = " << aGap << "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
di << "Conversion failed" << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
GeomConvert_CurveToAnaCurve aCurvToAna(GC);
|
|
||||||
aCurvToAna.SetConvType(aConvType);
|
|
||||||
if (aConvType == GeomConvert_Target)
|
|
||||||
aCurvToAna.SetTarget(aCurv);
|
|
||||||
|
|
||||||
Handle(Geom_Curve) anAnaCurv;
|
|
||||||
Standard_Real tf = GC->FirstParameter(), tl = GC->LastParameter(), ntf, ntl;
|
|
||||||
Standard_Boolean isdone = aCurvToAna.ConvertToAnalytical(tol, anAnaCurv, tf, tl, ntf, ntl);
|
|
||||||
if (isdone)
|
|
||||||
{
|
|
||||||
anAnaCurv = new Geom_TrimmedCurve(anAnaCurv, ntf, ntl);
|
|
||||||
DrawTrSurf::Set(a[1], anAnaCurv);
|
|
||||||
Standard_Real aGap = aCurvToAna.Gap();
|
|
||||||
di << "Gap = " << aGap << "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
di << "Conversion failed" << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : tobezier
|
//function : tobezier
|
||||||
@@ -650,7 +543,11 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
|||||||
if ( C3d.IsNull()) {
|
if ( C3d.IsNull()) {
|
||||||
Handle(Geom_BSplineSurface) S =
|
Handle(Geom_BSplineSurface) S =
|
||||||
DrawTrSurf::GetBSplineSurface(a[2]);
|
DrawTrSurf::GetBSplineSurface(a[2]);
|
||||||
if ( S.IsNull()) return 1;
|
if (S.IsNull())
|
||||||
|
{
|
||||||
|
delete[] name;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (n == 7) {
|
if (n == 7) {
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
U1 = Draw::Atof(a[3]);
|
U1 = Draw::Atof(a[3]);
|
||||||
@@ -738,6 +635,8 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] name;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1821,11 +1720,6 @@ void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
|||||||
__FILE__,
|
__FILE__,
|
||||||
converting,g);
|
converting,g);
|
||||||
|
|
||||||
theCommands.Add("tocanon",
|
|
||||||
"tocanon result c3d/surf [tol [sim gap lin cir ell pln cyl con sph tor]]",
|
|
||||||
__FILE__,
|
|
||||||
tocanon, g);
|
|
||||||
|
|
||||||
theCommands.Add("tobezier",
|
theCommands.Add("tobezier",
|
||||||
"tobezier result c2d/c3d/surf [ufirst, ulast / ufirst, ulast, vfirst, vlast]",
|
"tobezier result c2d/c3d/surf [ufirst, ulast / ufirst, ulast, vfirst, vlast]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
|
@@ -23,8 +23,8 @@ enum Graphic3d_DisplayPriority
|
|||||||
Graphic3d_DisplayPriority_INVALID = -1,
|
Graphic3d_DisplayPriority_INVALID = -1,
|
||||||
Graphic3d_DisplayPriority_Bottom = 0,
|
Graphic3d_DisplayPriority_Bottom = 0,
|
||||||
Graphic3d_DisplayPriority_AlmostBottom = 1,
|
Graphic3d_DisplayPriority_AlmostBottom = 1,
|
||||||
Graphic3d_DisplayPriority_Below2 = 2,
|
Graphic3d_DisplayPriority_Below3 = 2,
|
||||||
Graphic3d_DisplayPriority_Below1 = 3,
|
Graphic3d_DisplayPriority_Below2 = 3,
|
||||||
Graphic3d_DisplayPriority_Below = 4,
|
Graphic3d_DisplayPriority_Below = 4,
|
||||||
Graphic3d_DisplayPriority_Normal = 5,
|
Graphic3d_DisplayPriority_Normal = 5,
|
||||||
Graphic3d_DisplayPriority_Above = 6,
|
Graphic3d_DisplayPriority_Above = 6,
|
||||||
|
@@ -1547,7 +1547,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||||
aProgramSrc->SetPBR (theIsPBR); // should be set before defaultGlslVersion()
|
aProgramSrc->SetPBR (theIsPBR);
|
||||||
|
|
||||||
TCollection_AsciiString aSrcVert, aSrcVertExtraFunc, aSrcVertExtraMain;
|
TCollection_AsciiString aSrcVert, aSrcVertExtraFunc, aSrcVertExtraMain;
|
||||||
TCollection_AsciiString aSrcFrag, aSrcFragGetVertColor, aSrcFragExtraMain;
|
TCollection_AsciiString aSrcFrag, aSrcFragGetVertColor, aSrcFragExtraMain;
|
||||||
@@ -1987,8 +1987,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
|||||||
{
|
{
|
||||||
Standard_ASSERT_RAISE (theIndex >= 0 && theIndex <= 2,"");
|
Standard_ASSERT_RAISE (theIndex >= 0 && theIndex <= 2,"");
|
||||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||||
aProgramSrc->SetPBR (true); // should be set before defaultGlslVersion()
|
|
||||||
|
|
||||||
Graphic3d_ShaderObject::ShaderVariableList aUniforms, aStageInOuts;
|
Graphic3d_ShaderObject::ShaderVariableList aUniforms, aStageInOuts;
|
||||||
|
|
||||||
TCollection_AsciiString aSrcVert = TCollection_AsciiString()
|
TCollection_AsciiString aSrcVert = TCollection_AsciiString()
|
||||||
@@ -2035,6 +2033,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
|||||||
aProgramSrc->SetNbLightsMax (0);
|
aProgramSrc->SetNbLightsMax (0);
|
||||||
aProgramSrc->SetNbShadowMaps (0);
|
aProgramSrc->SetNbShadowMaps (0);
|
||||||
aProgramSrc->SetNbClipPlanesMax (0);
|
aProgramSrc->SetNbClipPlanesMax (0);
|
||||||
|
aProgramSrc->SetPBR (true);
|
||||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
|
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
|
||||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
|
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
|
||||||
return aProgramSrc;
|
return aProgramSrc;
|
||||||
|
@@ -24,7 +24,6 @@ enum Graphic3d_TypeOfBackfacingModel
|
|||||||
//! (e.g. solids, see Graphic3d_Group::IsClosed())
|
//! (e.g. solids, see Graphic3d_Group::IsClosed())
|
||||||
Graphic3d_TypeOfBackfacingModel_DoubleSided, //!< no culling (double-sided shading)
|
Graphic3d_TypeOfBackfacingModel_DoubleSided, //!< no culling (double-sided shading)
|
||||||
Graphic3d_TypeOfBackfacingModel_BackCulled, //!< back face culling
|
Graphic3d_TypeOfBackfacingModel_BackCulled, //!< back face culling
|
||||||
Graphic3d_TypeOfBackfacingModel_FrontCulled, //!< front face culling
|
|
||||||
// old aliases
|
// old aliases
|
||||||
Graphic3d_TOBM_AUTOMATIC = Graphic3d_TypeOfBackfacingModel_Auto,
|
Graphic3d_TOBM_AUTOMATIC = Graphic3d_TypeOfBackfacingModel_Auto,
|
||||||
Graphic3d_TOBM_FORCE = Graphic3d_TypeOfBackfacingModel_DoubleSided,
|
Graphic3d_TOBM_FORCE = Graphic3d_TypeOfBackfacingModel_DoubleSided,
|
||||||
|
@@ -420,7 +420,8 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
|
|||||||
aSegIndices2->Conex2 = cnx2;
|
aSegIndices2->Conex2 = cnx2;
|
||||||
aNodIndices3.NdSg = find;
|
aNodIndices3.NdSg = find;
|
||||||
|
|
||||||
Standard_Integer iOld,iNew,iTr,skip,ip4,itpk[2];
|
Standard_Integer iOld,iNew,iTr,skip,ip4;
|
||||||
|
Standard_Integer itpk[2] = { -1, -1 };
|
||||||
Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
|
Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
|
||||||
New[0] = cnx1;
|
New[0] = cnx1;
|
||||||
New[2] = myNbTData + 1;
|
New[2] = myNbTData + 1;
|
||||||
|
@@ -19,14 +19,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(IGESCAFControl_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(IGESCAFControl_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : IGESCAFControl_ConfigurationNode
|
// function : IGESCAFControl_ConfigurationNode
|
||||||
@@ -55,7 +48,7 @@ IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode(const Handle(
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool IGESCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool IGESCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
|
|
||||||
InternalParameters.ReadBSplineContinuity = (ReadMode_BSplineContinuity)
|
InternalParameters.ReadBSplineContinuity = (ReadMode_BSplineContinuity)
|
||||||
theResource->IntegerVal("read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope);
|
theResource->IntegerVal("read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope);
|
||||||
@@ -136,7 +129,7 @@ TCollection_AsciiString IGESCAFControl_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Common parameters:\n";
|
aResult += "!Common parameters:\n";
|
||||||
|
@@ -63,7 +63,7 @@ void IGESCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& the
|
|||||||
myOldValues.ReadApproxd1 = Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1;
|
myOldValues.ReadApproxd1 = Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1;
|
||||||
myOldValues.ReadResourceName = Interface_Static::CVal("read.iges.resource.name");
|
myOldValues.ReadResourceName = Interface_Static::CVal("read.iges.resource.name");
|
||||||
myOldValues.ReadSequence = Interface_Static::CVal("read.iges.sequence");
|
myOldValues.ReadSequence = Interface_Static::CVal("read.iges.sequence");
|
||||||
myOldValues.ReadFaultyEntities = Interface_Static::IVal("read.iges.faulty.entities") == 1;
|
myOldValues.ReadFaultyEntities = Interface_Static::IVal("read.iges.faulty.entities");
|
||||||
myOldValues.ReadOnlyVisible = Interface_Static::IVal("read.iges.onlyvisible") == 1;
|
myOldValues.ReadOnlyVisible = Interface_Static::IVal("read.iges.onlyvisible") == 1;
|
||||||
|
|
||||||
myOldValues.WriteBRepMode = (IGESCAFControl_ConfigurationNode::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode");
|
myOldValues.WriteBRepMode = (IGESCAFControl_ConfigurationNode::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode");
|
||||||
|
@@ -999,7 +999,8 @@ static void TestWLineToRLine(const IntPatch_SequenceOfLine& slinref,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resolve arcs for vertices not having a link to an arc
|
// resolve arcs for vertices not having a link to an arc
|
||||||
Standard_Real utst,vtst;
|
Standard_Real utst = 0.0;
|
||||||
|
Standard_Real vtst = 0.0;
|
||||||
TColStd_Array1OfReal paramsResolved(1,nbvtx);
|
TColStd_Array1OfReal paramsResolved(1,nbvtx);
|
||||||
TColStd_Array1OfTransient arcsResolved(1,nbvtx);
|
TColStd_Array1OfTransient arcsResolved(1,nbvtx);
|
||||||
arcsResolved.Init(Handle(Adaptor2d_Curve2d)());
|
arcsResolved.Init(Handle(Adaptor2d_Curve2d)());
|
||||||
|
@@ -2335,7 +2335,7 @@ Standard_Boolean ClassifyLin2d(const Handle(GeomAdaptor_Surface)& theS,
|
|||||||
|
|
||||||
{
|
{
|
||||||
Standard_Real xmin, xmax, ymin, ymax, d1, d2, A, B, C;
|
Standard_Real xmin, xmax, ymin, ymax, d1, d2, A, B, C;
|
||||||
Standard_Real par[2];
|
Standard_Real par[2] = { 0.0, 0.0 };
|
||||||
Standard_Integer nbi = 0;
|
Standard_Integer nbi = 0;
|
||||||
|
|
||||||
xmin = theS->FirstUParameter();
|
xmin = theS->FirstUParameter();
|
||||||
|
@@ -232,15 +232,14 @@ Standard_Real LProp_CLProps::Curvature ()
|
|||||||
{
|
{
|
||||||
Standard_Real N = myDerivArr[0].CrossSquareMagnitude(myDerivArr[1]);
|
Standard_Real N = myDerivArr[0].CrossSquareMagnitude(myDerivArr[1]);
|
||||||
// if d[0] and d[1] are colinear the curvature is null.
|
// if d[0] and d[1] are colinear the curvature is null.
|
||||||
//Standard_Real t = N/(DD1*DD2);
|
Standard_Real t = N/(DD1*DD2);
|
||||||
Standard_Real t = N / DD1 / DD2;
|
|
||||||
if (t<=Tol)
|
if (t<=Tol)
|
||||||
{
|
{
|
||||||
myCurvature = 0.0;
|
myCurvature = 0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myCurvature = sqrt(N) / DD1 / sqrt(DD1);
|
myCurvature = sqrt(N) / (DD1*sqrt(DD1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -318,7 +318,7 @@ Bnd_Box MeshVS_DataSource::GetBoundingBox() const
|
|||||||
const TColStd_PackedMapOfInteger& aNodes = GetAllNodes();
|
const TColStd_PackedMapOfInteger& aNodes = GetAllNodes();
|
||||||
if( aNodes.Extent() )
|
if( aNodes.Extent() )
|
||||||
{
|
{
|
||||||
Standard_Real aCoordsBuf[ 3 ];
|
const Standard_Real aCoordsBuf[3] = { 0.0, 0.0, 0.0 };
|
||||||
TColStd_Array1OfReal aCoords (*aCoordsBuf, 1, 3);
|
TColStd_Array1OfReal aCoords (*aCoordsBuf, 1, 3);
|
||||||
Standard_Integer nbNodes;
|
Standard_Integer nbNodes;
|
||||||
MeshVS_EntityType aType;
|
MeshVS_EntityType aType;
|
||||||
|
@@ -625,11 +625,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
|||||||
}
|
}
|
||||||
|
|
||||||
aGroup2->AddPrimitiveArray (aFaceTriangles);
|
aGroup2->AddPrimitiveArray (aFaceTriangles);
|
||||||
if (anEdgeOn)
|
|
||||||
{
|
|
||||||
aSGroup->AddPrimitiveArray (anEdgeSegments);
|
aSGroup->AddPrimitiveArray (anEdgeSegments);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
|
@@ -108,7 +108,7 @@ void MeshVS_MeshPrsBuilder::BuildNodes ( const Handle(Prs3d_Presentation)& Prs,
|
|||||||
Standard_Boolean HasSelectFlag = ( ( DisplayMode & MeshVS_DMF_SelectionPrs ) != 0 );
|
Standard_Boolean HasSelectFlag = ( ( DisplayMode & MeshVS_DMF_SelectionPrs ) != 0 );
|
||||||
Standard_Boolean HasHilightFlag = ( ( DisplayMode & MeshVS_DMF_HilightPrs ) != 0 );
|
Standard_Boolean HasHilightFlag = ( ( DisplayMode & MeshVS_DMF_HilightPrs ) != 0 );
|
||||||
|
|
||||||
Standard_Real aCoordsBuf[ 3 ];
|
const Standard_Real aCoordsBuf[3] = { 0.0, 0.0, 0.0 };
|
||||||
TColStd_Array1OfReal aCoords( *aCoordsBuf, 1, 3 );
|
TColStd_Array1OfReal aCoords( *aCoordsBuf, 1, 3 );
|
||||||
Standard_Integer NbNodes;
|
Standard_Integer NbNodes;
|
||||||
MeshVS_EntityType aType;
|
MeshVS_EntityType aType;
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
#include <Standard_OutOfMemory.hxx>
|
#include <Standard_OutOfMemory.hxx>
|
||||||
#include <Standard_OutOfRange.hxx>
|
#include <Standard_OutOfRange.hxx>
|
||||||
#include <Standard_TypeMismatch.hxx>
|
#include <Standard_TypeMismatch.hxx>
|
||||||
#include <Standard_Macro.hxx>
|
|
||||||
|
|
||||||
//! Defines an array of values of configurable size.
|
//! Defines an array of values of configurable size.
|
||||||
//! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime.
|
//! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime.
|
||||||
@@ -64,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Move constructor
|
//! Move constructor
|
||||||
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) Standard_Noexcept
|
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) noexcept
|
||||||
: myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable)
|
: myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable)
|
||||||
{
|
{
|
||||||
theOther.myDeletable = false;
|
theOther.myDeletable = false;
|
||||||
|
@@ -17,10 +17,8 @@
|
|||||||
proc DataExchange:toolkits { } {
|
proc DataExchange:toolkits { } {
|
||||||
return [list TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES \
|
return [list TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES \
|
||||||
TKXCAF TKXDEIGES TKXDESTEP \
|
TKXCAF TKXDEIGES TKXDESTEP \
|
||||||
TKXDE TKXDECascade \
|
|
||||||
TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh]
|
TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh]
|
||||||
}
|
}
|
||||||
|
|
||||||
;#
|
;#
|
||||||
;# Autres UDs a prendre.
|
;# Autres UDs a prendre.
|
||||||
;#
|
;#
|
||||||
|
@@ -294,7 +294,7 @@ static LONG CallHandler (DWORD theExceptionCode,
|
|||||||
&& theExceptionCode != EXCEPTION_NONCONTINUABLE_EXCEPTION)
|
&& theExceptionCode != EXCEPTION_NONCONTINUABLE_EXCEPTION)
|
||||||
{
|
{
|
||||||
MessageBeep (MB_ICONHAND);
|
MessageBeep (MB_ICONHAND);
|
||||||
char aMsgBoxBuffer[2048];
|
char aMsgBoxBuffer[2048] = { '\0' };
|
||||||
strcat_s (aMsgBoxBuffer, sizeof(aMsgBoxBuffer), aBuffer);
|
strcat_s (aMsgBoxBuffer, sizeof(aMsgBoxBuffer), aBuffer);
|
||||||
if (aStackBuffer != NULL)
|
if (aStackBuffer != NULL)
|
||||||
{
|
{
|
||||||
|
@@ -237,7 +237,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
|||||||
myRenderMode (GL_RENDER),
|
myRenderMode (GL_RENDER),
|
||||||
myShadeModel (GL_SMOOTH),
|
myShadeModel (GL_SMOOTH),
|
||||||
myPolygonMode (GL_FILL),
|
myPolygonMode (GL_FILL),
|
||||||
myFaceCulling (Graphic3d_TypeOfBackfacingModel_DoubleSided),
|
myToCullBackFaces (false),
|
||||||
myReadBuffer (0),
|
myReadBuffer (0),
|
||||||
myDrawBuffers (0, 7),
|
myDrawBuffers (0, 7),
|
||||||
myDefaultVao (0),
|
myDefaultVao (0),
|
||||||
@@ -547,35 +547,26 @@ void OpenGl_Context::SetFrameBufferSRGB (bool theIsFbo, bool theIsFboSRgb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SetFaceCulling
|
// function : SetCullBackFaces
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Context::SetFaceCulling (Graphic3d_TypeOfBackfacingModel theMode)
|
void OpenGl_Context::SetCullBackFaces (bool theToEnable)
|
||||||
{
|
{
|
||||||
if (myFaceCulling == theMode)
|
if (myToCullBackFaces == theToEnable)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theMode == Graphic3d_TypeOfBackfacingModel_BackCulled)
|
myToCullBackFaces = theToEnable;
|
||||||
|
if (theToEnable)
|
||||||
{
|
{
|
||||||
if (myFaceCulling == Graphic3d_TypeOfBackfacingModel_FrontCulled)
|
//glCullFace (GL_BACK); GL_BACK by default
|
||||||
{
|
|
||||||
core11fwd->glCullFace (GL_BACK);
|
|
||||||
}
|
|
||||||
core11fwd->glEnable (GL_CULL_FACE);
|
|
||||||
}
|
|
||||||
else if (theMode == Graphic3d_TypeOfBackfacingModel_FrontCulled)
|
|
||||||
{
|
|
||||||
core11fwd->glCullFace (GL_FRONT);
|
|
||||||
core11fwd->glEnable (GL_CULL_FACE);
|
core11fwd->glEnable (GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
core11fwd->glCullFace (GL_BACK);
|
|
||||||
core11fwd->glDisable (GL_CULL_FACE);
|
core11fwd->glDisable (GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
myFaceCulling = theMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -3093,7 +3084,7 @@ void OpenGl_Context::DumpJson (Standard_OStream& theOStream, Standard_Integer th
|
|||||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRenderMode)
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRenderMode)
|
||||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPolygonMode)
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPolygonMode)
|
||||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset)
|
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset)
|
||||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceCulling)
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToCullBackFaces)
|
||||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myReadBuffer)
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myReadBuffer)
|
||||||
|
|
||||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDefaultVao)
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDefaultVao)
|
||||||
|
@@ -803,19 +803,10 @@ public: //! @name methods to alter or retrieve current state
|
|||||||
Standard_EXPORT bool SetSampleAlphaToCoverage (bool theToEnable);
|
Standard_EXPORT bool SetSampleAlphaToCoverage (bool theToEnable);
|
||||||
|
|
||||||
//! Return back face culling state.
|
//! Return back face culling state.
|
||||||
Graphic3d_TypeOfBackfacingModel FaceCulling() const { return myFaceCulling; }
|
bool ToCullBackFaces() const { return myToCullBackFaces; }
|
||||||
|
|
||||||
//! Enable or disable back face culling (glEnable (GL_CULL_FACE)).
|
//! Enable or disable back face culling (glEnable (GL_CULL_FACE)).
|
||||||
Standard_EXPORT void SetFaceCulling (Graphic3d_TypeOfBackfacingModel theMode);
|
Standard_EXPORT void SetCullBackFaces (bool theToEnable);
|
||||||
|
|
||||||
//! Return back face culling state.
|
|
||||||
bool ToCullBackFaces() const { return myFaceCulling == Graphic3d_TypeOfBackfacingModel_BackCulled; }
|
|
||||||
|
|
||||||
//! Enable or disable back face culling (glCullFace() + glEnable(GL_CULL_FACE)).
|
|
||||||
void SetCullBackFaces (bool theToEnable)
|
|
||||||
{
|
|
||||||
SetFaceCulling (theToEnable ? Graphic3d_TypeOfBackfacingModel_BackCulled : Graphic3d_TypeOfBackfacingModel_DoubleSided);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Fetch OpenGl context state. This class tracks value of several OpenGl
|
//! Fetch OpenGl context state. This class tracks value of several OpenGl
|
||||||
//! state variables. Consulting the cached values is quicker than
|
//! state variables. Consulting the cached values is quicker than
|
||||||
@@ -1164,7 +1155,7 @@ private: //! @name fields tracking current state
|
|||||||
Standard_Integer myShadeModel; //!< currently used shade model (glShadeModel)
|
Standard_Integer myShadeModel; //!< currently used shade model (glShadeModel)
|
||||||
Standard_Integer myPolygonMode; //!< currently used polygon rasterization mode (glPolygonMode)
|
Standard_Integer myPolygonMode; //!< currently used polygon rasterization mode (glPolygonMode)
|
||||||
Graphic3d_PolygonOffset myPolygonOffset; //!< currently applied polygon offset
|
Graphic3d_PolygonOffset myPolygonOffset; //!< currently applied polygon offset
|
||||||
Graphic3d_TypeOfBackfacingModel myFaceCulling; //!< back face culling mode enabled state (glIsEnabled (GL_CULL_FACE))
|
bool myToCullBackFaces; //!< back face culling mode enabled state (glIsEnabled (GL_CULL_FACE))
|
||||||
Standard_Integer myReadBuffer; //!< current read buffer
|
Standard_Integer myReadBuffer; //!< current read buffer
|
||||||
NCollection_Array1<Standard_Integer>
|
NCollection_Array1<Standard_Integer>
|
||||||
myDrawBuffers; //!< current draw buffers
|
myDrawBuffers; //!< current draw buffers
|
||||||
|
@@ -1030,9 +1030,10 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
|||||||
anOutlineProgram->SetUniform (aCtx, anOutlineProgram->GetStateLocation (OpenGl_OCCT_ORTHO_SCALE), anOrthoScale);
|
anOutlineProgram->SetUniform (aCtx, anOutlineProgram->GetStateLocation (OpenGl_OCCT_ORTHO_SCALE), anOrthoScale);
|
||||||
aCtx->SetColor4fv (anAspectFace->Aspect()->EdgeColorRGBA());
|
aCtx->SetColor4fv (anAspectFace->Aspect()->EdgeColorRGBA());
|
||||||
|
|
||||||
aCtx->SetFaceCulling (Graphic3d_TypeOfBackfacingModel_FrontCulled);
|
aCtx->core11fwd->glCullFace (GL_FRONT);
|
||||||
drawArray (theWorkspace, NULL, false);
|
drawArray (theWorkspace, NULL, false);
|
||||||
aCtx->SetFaceCulling (Graphic3d_TypeOfBackfacingModel_BackCulled);
|
|
||||||
|
aCtx->core11fwd->glCullFace (GL_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isForcedBlend)
|
if (isForcedBlend)
|
||||||
|
@@ -255,16 +255,14 @@ const OpenGl_Aspects* OpenGl_Workspace::SetAspects (const OpenGl_Aspects* theAsp
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_Aspects* OpenGl_Workspace::ApplyAspects (bool theToBindTextures)
|
const OpenGl_Aspects* OpenGl_Workspace::ApplyAspects (bool theToBindTextures)
|
||||||
{
|
{
|
||||||
//bool toSuppressBackFaces = myView->BackfacingModel() == Graphic3d_TypeOfBackfacingModel_BackCulled;
|
bool toSuppressBackFaces = myView->BackfacingModel() == Graphic3d_TypeOfBackfacingModel_BackCulled;
|
||||||
Graphic3d_TypeOfBackfacingModel aCullFacesMode = myView->BackfacingModel();
|
if (myView->BackfacingModel() == Graphic3d_TypeOfBackfacingModel_Auto)
|
||||||
if (aCullFacesMode == Graphic3d_TypeOfBackfacingModel_Auto)
|
|
||||||
{
|
{
|
||||||
aCullFacesMode = myAspectsSet->Aspect()->FaceCulling();
|
toSuppressBackFaces = myAspectsSet->Aspect()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_BackCulled;
|
||||||
if (aCullFacesMode == Graphic3d_TypeOfBackfacingModel_Auto)
|
if (myAspectsSet->Aspect()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_Auto
|
||||||
{
|
&& myToAllowFaceCulling)
|
||||||
aCullFacesMode = Graphic3d_TypeOfBackfacingModel_DoubleSided;
|
|
||||||
if (myToAllowFaceCulling)
|
|
||||||
{
|
{
|
||||||
|
toSuppressBackFaces = true;
|
||||||
if (myAspectsSet->Aspect()->InteriorStyle() == Aspect_IS_HATCH
|
if (myAspectsSet->Aspect()->InteriorStyle() == Aspect_IS_HATCH
|
||||||
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Blend
|
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Blend
|
||||||
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Mask
|
|| myAspectsSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Mask
|
||||||
@@ -273,16 +271,11 @@ const OpenGl_Aspects* OpenGl_Workspace::ApplyAspects (bool theToBindTextures)
|
|||||||
&& myAspectsSet->Aspect()->FrontMaterial().Transparency() != 0.0f))
|
&& myAspectsSet->Aspect()->FrontMaterial().Transparency() != 0.0f))
|
||||||
{
|
{
|
||||||
// disable culling in case of translucent shading aspect
|
// disable culling in case of translucent shading aspect
|
||||||
aCullFacesMode = Graphic3d_TypeOfBackfacingModel_DoubleSided;
|
toSuppressBackFaces = false;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aCullFacesMode = Graphic3d_TypeOfBackfacingModel_BackCulled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
myGlContext->SetCullBackFaces (toSuppressBackFaces);
|
||||||
myGlContext->SetFaceCulling (aCullFacesMode);
|
|
||||||
|
|
||||||
if (myAspectsSet->Aspect() == myAspectsApplied
|
if (myAspectsSet->Aspect() == myAspectsApplied
|
||||||
&& myHighlightStyle == myAspectFaceAppliedWithHL)
|
&& myHighlightStyle == myAspectFaceAppliedWithHL)
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#include <NCollection_AliasedArray.hxx>
|
#include <NCollection_AliasedArray.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Vec3f.hxx>
|
#include <gp_Vec3f.hxx>
|
||||||
#include <Standard_Macro.hxx>
|
|
||||||
|
|
||||||
//! Defines an array of 3D nodes of single/double precision configurable at construction time.
|
//! Defines an array of 3D nodes of single/double precision configurable at construction time.
|
||||||
class Poly_ArrayOfNodes : public NCollection_AliasedArray<>
|
class Poly_ArrayOfNodes : public NCollection_AliasedArray<>
|
||||||
@@ -86,14 +85,14 @@ public:
|
|||||||
Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); }
|
Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); }
|
||||||
|
|
||||||
//! Move constructor
|
//! Move constructor
|
||||||
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
|
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) noexcept
|
||||||
: NCollection_AliasedArray (std::move (theOther))
|
: NCollection_AliasedArray (std::move (theOther))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Move assignment operator; @sa Move()
|
//! Move assignment operator; @sa Move()
|
||||||
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
|
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) noexcept
|
||||||
{
|
{
|
||||||
return Move (theOther);
|
return Move (theOther);
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#include <NCollection_AliasedArray.hxx>
|
#include <NCollection_AliasedArray.hxx>
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
#include <gp_Vec2f.hxx>
|
#include <gp_Vec2f.hxx>
|
||||||
#include <Standard_Macro.hxx>
|
|
||||||
|
|
||||||
//! Defines an array of 2D nodes of single/double precision configurable at construction time.
|
//! Defines an array of 2D nodes of single/double precision configurable at construction time.
|
||||||
class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<>
|
class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<>
|
||||||
@@ -86,14 +85,14 @@ public:
|
|||||||
Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
|
Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
|
||||||
|
|
||||||
//! Move constructor
|
//! Move constructor
|
||||||
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
|
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) noexcept
|
||||||
: NCollection_AliasedArray (std::move (theOther))
|
: NCollection_AliasedArray (std::move (theOther))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Move assignment operator; @sa Move()
|
//! Move assignment operator; @sa Move()
|
||||||
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
|
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) noexcept
|
||||||
{
|
{
|
||||||
return Move (theOther);
|
return Move (theOther);
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,6 @@
|
|||||||
#include <OSD_Timer.hxx>
|
#include <OSD_Timer.hxx>
|
||||||
#include <TDataStd_Name.hxx>
|
#include <TDataStd_Name.hxx>
|
||||||
#include <AppCont_Function.hxx>
|
#include <AppCont_Function.hxx>
|
||||||
#include <math_ComputeKronrodPointsAndWeights.hxx>
|
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
@@ -4262,28 +4261,6 @@ static Standard_Integer OCC33009(Draw_Interpretor&, Standard_Integer, const char
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Standard_Integer OCC33048(Draw_Interpretor&, Standard_Integer, const char**)
|
|
||||||
{
|
|
||||||
Standard_Real isOK = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// This method uses raw pointers for memory manipulations and not used in OCCT.
|
|
||||||
math_ComputeKronrodPointsAndWeights aCalc(125);
|
|
||||||
isOK = aCalc.IsDone();
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
isOK = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isOK)
|
|
||||||
std::cout << "OK: Kronrod points and weights are calculated successfully." << std::endl;
|
|
||||||
else
|
|
||||||
std::cout << "Error: Problem occurred during calculation of Kronrod points and weights." << std::endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : QACheckBends
|
//function : QACheckBends
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -4458,10 +4435,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
|||||||
"Tests the case when",
|
"Tests the case when",
|
||||||
__FILE__, OCC33009, group);
|
__FILE__, OCC33009, group);
|
||||||
|
|
||||||
theCommands.Add("OCC33048",
|
|
||||||
"Kronrod points and weights calculation",
|
|
||||||
__FILE__, OCC33048, group);
|
|
||||||
|
|
||||||
theCommands.Add("QACheckBends",
|
theCommands.Add("QACheckBends",
|
||||||
"QACheckBends curve [CosMaxAngle [theNbPoints]]",
|
"QACheckBends curve [CosMaxAngle [theNbPoints]]",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
|
@@ -4,7 +4,6 @@ RWGltf_CafWriter.cxx
|
|||||||
RWGltf_CafWriter.hxx
|
RWGltf_CafWriter.hxx
|
||||||
RWGltf_ConfigurationNode.cxx
|
RWGltf_ConfigurationNode.cxx
|
||||||
RWGltf_ConfigurationNode.hxx
|
RWGltf_ConfigurationNode.hxx
|
||||||
RWGltf_DracoParameters.hxx
|
|
||||||
RWGltf_GltfAccessor.hxx
|
RWGltf_GltfAccessor.hxx
|
||||||
RWGltf_GltfAccessorCompType.hxx
|
RWGltf_GltfAccessorCompType.hxx
|
||||||
RWGltf_GltfAccessorLayout.hxx
|
RWGltf_GltfAccessorLayout.hxx
|
||||||
|
@@ -21,9 +21,8 @@
|
|||||||
#include <NCollection_DataMap.hxx>
|
#include <NCollection_DataMap.hxx>
|
||||||
#include <OSD_FileSystem.hxx>
|
#include <OSD_FileSystem.hxx>
|
||||||
#include <OSD_File.hxx>
|
#include <OSD_File.hxx>
|
||||||
#include <OSD_Parallel.hxx>
|
|
||||||
#include <OSD_Path.hxx>
|
#include <OSD_Path.hxx>
|
||||||
#include <OSD_Timer.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <RWGltf_GltfAccessorLayout.hxx>
|
#include <RWGltf_GltfAccessorLayout.hxx>
|
||||||
#include <RWGltf_GltfArrayType.hxx>
|
#include <RWGltf_GltfArrayType.hxx>
|
||||||
#include <RWGltf_GltfMaterialMap.hxx>
|
#include <RWGltf_GltfMaterialMap.hxx>
|
||||||
@@ -45,12 +44,6 @@
|
|||||||
#include <RWGltf_GltfOStreamWriter.hxx>
|
#include <RWGltf_GltfOStreamWriter.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DRACO
|
|
||||||
#include <Standard_WarningsDisable.hxx>
|
|
||||||
#include <draco/compression/encode.h>
|
|
||||||
#include <Standard_WarningsRestore.hxx>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(RWGltf_CafWriter, Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(RWGltf_CafWriter, Standard_Transient)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -91,152 +84,8 @@ namespace
|
|||||||
{
|
{
|
||||||
theStream.write ((const char* )theTri.GetData(), sizeof(theTri));
|
theStream.write ((const char* )theTri.GetData(), sizeof(theTri));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DRACO
|
|
||||||
//! Write nodes to Draco mesh
|
|
||||||
static void writeNodesToDracoMesh (draco::Mesh& theMesh,
|
|
||||||
const std::vector<Graphic3d_Vec3>& theNodes)
|
|
||||||
{
|
|
||||||
if (theNodes.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
draco::PointAttribute anAttr;
|
|
||||||
anAttr.Init (draco::GeometryAttribute::POSITION, 3, draco::DT_FLOAT32, false, sizeof(float) * 3);
|
|
||||||
const int anId = theMesh.AddAttribute (anAttr, true, uint32_t(theNodes.size()));
|
|
||||||
draco::PointAttribute* aPtr = theMesh.attribute (anId);
|
|
||||||
draco::PointIndex anIndex(0);
|
|
||||||
for (size_t aNodeInd = 0; aNodeInd < theNodes.size(); ++aNodeInd, ++anIndex)
|
|
||||||
{
|
|
||||||
aPtr->SetAttributeValue (aPtr->mapped_index(anIndex), theNodes[aNodeInd].GetData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Write normals to Draco mesh
|
|
||||||
static void writeNormalsToDracoMesh (draco::Mesh& theMesh,
|
|
||||||
const std::vector<Graphic3d_Vec3>& theNormals)
|
|
||||||
{
|
|
||||||
if (theNormals.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
draco::PointAttribute anAttr;
|
|
||||||
anAttr.Init (draco::GeometryAttribute::NORMAL, 3, draco::DT_FLOAT32, false, sizeof(float) * 3);
|
|
||||||
const int anId = theMesh.AddAttribute (anAttr, true, uint32_t(theNormals.size()));
|
|
||||||
draco::PointAttribute* aPtr = theMesh.attribute (anId);
|
|
||||||
draco::PointIndex anIndex(0);
|
|
||||||
for (size_t aNormInd = 0; aNormInd < theNormals.size(); ++aNormInd, ++anIndex)
|
|
||||||
{
|
|
||||||
aPtr->SetAttributeValue (aPtr->mapped_index(anIndex), theNormals[aNormInd].GetData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Write texture UV coordinates to Draco mesh
|
|
||||||
static void writeTexCoordsToDracoMesh (draco::Mesh& theMesh,
|
|
||||||
const std::vector<Graphic3d_Vec2>& theTexCoord)
|
|
||||||
{
|
|
||||||
if (theTexCoord.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
draco::PointAttribute anAttr;
|
|
||||||
anAttr.Init (draco::GeometryAttribute::TEX_COORD, 2, draco::DT_FLOAT32, false, sizeof(float) * 2);
|
|
||||||
const int anId = theMesh.AddAttribute (anAttr, true, uint32_t(theTexCoord.size()));
|
|
||||||
draco::PointAttribute* aPtr = theMesh.attribute (anId);
|
|
||||||
draco::PointIndex anIndex(0);
|
|
||||||
for (size_t aTexInd = 0; aTexInd < theTexCoord.size(); ++aTexInd, ++anIndex)
|
|
||||||
{
|
|
||||||
aPtr->SetAttributeValue (aPtr->mapped_index(anIndex), theTexCoord[aTexInd].GetData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Write indices to Draco mesh
|
|
||||||
static void writeIndicesToDracoMesh (draco::Mesh& theMesh,
|
|
||||||
const std::vector<Poly_Triangle>& theIndices)
|
|
||||||
{
|
|
||||||
draco::Mesh::Face aFace;
|
|
||||||
int anIndex = 0;
|
|
||||||
for (size_t anInd = 0; anInd < theIndices.size(); ++anInd, ++anIndex)
|
|
||||||
{
|
|
||||||
const Poly_Triangle& anElem = theIndices[anInd];
|
|
||||||
aFace[0] = anElem.Value(1);
|
|
||||||
aFace[1] = anElem.Value(2);
|
|
||||||
aFace[2] = anElem.Value(3);
|
|
||||||
theMesh.SetFace (draco::FaceIndex (anIndex), aFace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DRACO
|
|
||||||
//! Functor for parallel execution of encoding meshes to Draco buffers.
|
|
||||||
class DracoEncodingFunctor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DracoEncodingFunctor (const Message_ProgressRange& theProgress,
|
|
||||||
draco::Encoder& theDracoEncoder,
|
|
||||||
const std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>>& theMeshes,
|
|
||||||
std::vector<std::shared_ptr<draco::EncoderBuffer>>& theEncoderBuffers)
|
|
||||||
: myProgress(theProgress, "Draco compression", Max(1, int(theMeshes.size()))),
|
|
||||||
myDracoEncoder(&theDracoEncoder),
|
|
||||||
myRanges(0, int(theMeshes.size()) - 1),
|
|
||||||
myMeshes(&theMeshes),
|
|
||||||
myEncoderBuffers(&theEncoderBuffers)
|
|
||||||
{
|
|
||||||
for (int anIndex = 0; anIndex != int(theMeshes.size()); ++anIndex)
|
|
||||||
{
|
|
||||||
myRanges.SetValue(anIndex, myProgress.Next());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator () (int theMeshIndex) const
|
|
||||||
{
|
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& aCurrentMesh = myMeshes->at(theMeshIndex);
|
|
||||||
if (aCurrentMesh->NodesVec.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Message_ProgressScope aScope(myRanges[theMeshIndex], NULL, 1);
|
|
||||||
|
|
||||||
draco::Mesh aMesh;
|
|
||||||
writeNodesToDracoMesh (aMesh, aCurrentMesh->NodesVec);
|
|
||||||
|
|
||||||
if (!aCurrentMesh->NormalsVec.empty())
|
|
||||||
{
|
|
||||||
writeNormalsToDracoMesh (aMesh, aCurrentMesh->NormalsVec);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aCurrentMesh->TexCoordsVec.empty())
|
|
||||||
{
|
|
||||||
writeTexCoordsToDracoMesh (aMesh, aCurrentMesh->TexCoordsVec);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeIndicesToDracoMesh (aMesh, aCurrentMesh->IndicesVec);
|
|
||||||
|
|
||||||
std::shared_ptr<draco::EncoderBuffer> anEncoderBuffer = std::make_shared<draco::EncoderBuffer>();
|
|
||||||
draco::Status aStatus = myDracoEncoder->EncodeMeshToBuffer (aMesh, anEncoderBuffer.get());
|
|
||||||
if (aStatus.ok())
|
|
||||||
{
|
|
||||||
myEncoderBuffers->at(theMeshIndex) = anEncoderBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
aScope.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Message_ProgressScope myProgress;
|
|
||||||
draco::Encoder* myDracoEncoder;
|
|
||||||
NCollection_Array1<Message_ProgressRange> myRanges;
|
|
||||||
const std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>>* myMeshes;
|
|
||||||
std::vector<std::shared_ptr<draco::EncoderBuffer>>* myEncoderBuffers;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : Constructor
|
// Function : Constructor
|
||||||
// Purpose :
|
// Purpose :
|
||||||
@@ -252,8 +101,7 @@ RWGltf_CafWriter::RWGltf_CafWriter (const TCollection_AsciiString& theFile,
|
|||||||
myToEmbedTexturesInGlb (true),
|
myToEmbedTexturesInGlb (true),
|
||||||
myToMergeFaces (false),
|
myToMergeFaces (false),
|
||||||
myToSplitIndices16 (false),
|
myToSplitIndices16 (false),
|
||||||
myBinDataLen64 (0),
|
myBinDataLen64 (0)
|
||||||
myToParallel (false)
|
|
||||||
{
|
{
|
||||||
myCSTrsf.SetOutputLengthUnit (1.0); // meters
|
myCSTrsf.SetOutputLengthUnit (1.0); // meters
|
||||||
myCSTrsf.SetOutputCoordinateSystem (RWMesh_CoordinateSystem_glTF);
|
myCSTrsf.SetOutputCoordinateSystem (RWMesh_CoordinateSystem_glTF);
|
||||||
@@ -302,8 +150,7 @@ Standard_Boolean RWGltf_CafWriter::toSkipFaceMesh (const RWMesh_FaceIterator& th
|
|||||||
void RWGltf_CafWriter::saveNodes (RWGltf_GltfFace& theGltfFace,
|
void RWGltf_CafWriter::saveNodes (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
const RWMesh_FaceIterator& theFaceIter,
|
const RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb) const
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh) const
|
|
||||||
{
|
{
|
||||||
if (theGltfFace.NodePos.Id == RWGltf_GltfAccessor::INVALID_ID)
|
if (theGltfFace.NodePos.Id == RWGltf_GltfAccessor::INVALID_ID)
|
||||||
{
|
{
|
||||||
@@ -313,12 +160,9 @@ void RWGltf_CafWriter::saveNodes (RWGltf_GltfFace& theGltfFace,
|
|||||||
theGltfFace.NodePos.ComponentType = RWGltf_GltfAccessorCompType_Float32;
|
theGltfFace.NodePos.ComponentType = RWGltf_GltfAccessorCompType_Float32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (theMesh.get() == nullptr)
|
|
||||||
{
|
{
|
||||||
const int64_t aPos = theGltfFace.NodePos.ByteOffset + myBuffViewPos.ByteOffset + theGltfFace.NodePos.Count * sizeof(Graphic3d_Vec3);
|
const int64_t aPos = theGltfFace.NodePos.ByteOffset + myBuffViewPos.ByteOffset + theGltfFace.NodePos.Count * sizeof(Graphic3d_Vec3);
|
||||||
Standard_ASSERT_RAISE(aPos == (int64_t)theBinFile.tellp(), "wrong offset");
|
Standard_ASSERT_RAISE (aPos == (int64_t )theBinFile.tellp(), "wrong offset");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
theGltfFace.NodePos.Count += theFaceIter.NbNodes();
|
theGltfFace.NodePos.Count += theFaceIter.NbNodes();
|
||||||
|
|
||||||
@@ -328,14 +172,7 @@ void RWGltf_CafWriter::saveNodes (RWGltf_GltfFace& theGltfFace,
|
|||||||
gp_XYZ aNode = theFaceIter.NodeTransformed (aNodeIter).XYZ();
|
gp_XYZ aNode = theFaceIter.NodeTransformed (aNodeIter).XYZ();
|
||||||
myCSTrsf.TransformPosition (aNode);
|
myCSTrsf.TransformPosition (aNode);
|
||||||
theGltfFace.NodePos.BndBox.Add (Graphic3d_Vec3d(aNode.X(), aNode.Y(), aNode.Z()));
|
theGltfFace.NodePos.BndBox.Add (Graphic3d_Vec3d(aNode.X(), aNode.Y(), aNode.Z()));
|
||||||
if (theMesh.get() != nullptr)
|
writeVec3 (theBinFile, aNode);
|
||||||
{
|
|
||||||
theMesh->NodesVec.push_back(Graphic3d_Vec3(float(aNode.X()), float(aNode.Y()), float(aNode.Z())));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writeVec3(theBinFile, aNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,8 +183,7 @@ void RWGltf_CafWriter::saveNodes (RWGltf_GltfFace& theGltfFace,
|
|||||||
void RWGltf_CafWriter::saveNormals (RWGltf_GltfFace& theGltfFace,
|
void RWGltf_CafWriter::saveNormals (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
RWMesh_FaceIterator& theFaceIter,
|
RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb) const
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh) const
|
|
||||||
{
|
{
|
||||||
if (!theFaceIter.HasNormals())
|
if (!theFaceIter.HasNormals())
|
||||||
{
|
{
|
||||||
@@ -362,12 +198,9 @@ void RWGltf_CafWriter::saveNormals (RWGltf_GltfFace& theGltfFace,
|
|||||||
theGltfFace.NodeNorm.ComponentType = RWGltf_GltfAccessorCompType_Float32;
|
theGltfFace.NodeNorm.ComponentType = RWGltf_GltfAccessorCompType_Float32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (theMesh.get() == nullptr)
|
|
||||||
{
|
{
|
||||||
const int64_t aPos = theGltfFace.NodeNorm.ByteOffset + myBuffViewNorm.ByteOffset + theGltfFace.NodeNorm.Count * sizeof(Graphic3d_Vec3);
|
const int64_t aPos = theGltfFace.NodeNorm.ByteOffset + myBuffViewNorm.ByteOffset + theGltfFace.NodeNorm.Count * sizeof(Graphic3d_Vec3);
|
||||||
Standard_ASSERT_RAISE(aPos == (int64_t)theBinFile.tellp(), "wrong offset");
|
Standard_ASSERT_RAISE (aPos == (int64_t )theBinFile.tellp(), "wrong offset");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
theGltfFace.NodeNorm.Count += theFaceIter.NbNodes();
|
theGltfFace.NodeNorm.Count += theFaceIter.NbNodes();
|
||||||
|
|
||||||
@@ -377,14 +210,7 @@ void RWGltf_CafWriter::saveNormals (RWGltf_GltfFace& theGltfFace,
|
|||||||
const gp_Dir aNormal = theFaceIter.NormalTransformed (aNodeIter);
|
const gp_Dir aNormal = theFaceIter.NormalTransformed (aNodeIter);
|
||||||
Graphic3d_Vec3 aVecNormal ((float )aNormal.X(), (float )aNormal.Y(), (float )aNormal.Z());
|
Graphic3d_Vec3 aVecNormal ((float )aNormal.X(), (float )aNormal.Y(), (float )aNormal.Z());
|
||||||
myCSTrsf.TransformNormal (aVecNormal);
|
myCSTrsf.TransformNormal (aVecNormal);
|
||||||
if (theMesh.get() != nullptr)
|
writeVec3 (theBinFile, aVecNormal);
|
||||||
{
|
|
||||||
theMesh->NormalsVec.push_back(aVecNormal);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writeVec3(theBinFile, aVecNormal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,8 +221,7 @@ void RWGltf_CafWriter::saveNormals (RWGltf_GltfFace& theGltfFace,
|
|||||||
void RWGltf_CafWriter::saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
void RWGltf_CafWriter::saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
const RWMesh_FaceIterator& theFaceIter,
|
const RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb) const
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh) const
|
|
||||||
{
|
{
|
||||||
if (!theFaceIter.HasTexCoords())
|
if (!theFaceIter.HasTexCoords())
|
||||||
{
|
{
|
||||||
@@ -427,12 +252,9 @@ void RWGltf_CafWriter::saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
|||||||
theGltfFace.NodeUV.ComponentType = RWGltf_GltfAccessorCompType_Float32;
|
theGltfFace.NodeUV.ComponentType = RWGltf_GltfAccessorCompType_Float32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (theMesh.get() == nullptr)
|
|
||||||
{
|
{
|
||||||
const int64_t aPos = theGltfFace.NodeUV.ByteOffset + myBuffViewTextCoord.ByteOffset + theGltfFace.NodeUV.Count * sizeof(Graphic3d_Vec2);
|
const int64_t aPos = theGltfFace.NodeUV.ByteOffset + myBuffViewTextCoord.ByteOffset + theGltfFace.NodeUV.Count * sizeof(Graphic3d_Vec2);
|
||||||
Standard_ASSERT_RAISE(aPos == (int64_t)theBinFile.tellp(), "wrong offset");
|
Standard_ASSERT_RAISE (aPos == (int64_t )theBinFile.tellp(), "wrong offset");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
theGltfFace.NodeUV.Count += theFaceIter.NbNodes();
|
theGltfFace.NodeUV.Count += theFaceIter.NbNodes();
|
||||||
|
|
||||||
@@ -441,14 +263,7 @@ void RWGltf_CafWriter::saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
|||||||
{
|
{
|
||||||
gp_Pnt2d aTexCoord = theFaceIter.NodeTexCoord (aNodeIter);
|
gp_Pnt2d aTexCoord = theFaceIter.NodeTexCoord (aNodeIter);
|
||||||
aTexCoord.SetY (1.0 - aTexCoord.Y());
|
aTexCoord.SetY (1.0 - aTexCoord.Y());
|
||||||
if (theMesh.get() != nullptr)
|
writeVec2 (theBinFile, aTexCoord.XY());
|
||||||
{
|
|
||||||
theMesh->TexCoordsVec.push_back(Graphic3d_Vec2((float)aTexCoord.X(), (float)aTexCoord.Y()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writeVec2(theBinFile, aTexCoord.XY());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,8 +274,7 @@ void RWGltf_CafWriter::saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
|||||||
void RWGltf_CafWriter::saveIndices (RWGltf_GltfFace& theGltfFace,
|
void RWGltf_CafWriter::saveIndices (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
const RWMesh_FaceIterator& theFaceIter,
|
const RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb)
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh)
|
|
||||||
{
|
{
|
||||||
if (theGltfFace.Indices.Id == RWGltf_GltfAccessor::INVALID_ID)
|
if (theGltfFace.Indices.Id == RWGltf_GltfAccessor::INVALID_ID)
|
||||||
{
|
{
|
||||||
@@ -472,8 +286,6 @@ void RWGltf_CafWriter::saveIndices (RWGltf_GltfFace& theGltfFace,
|
|||||||
: RWGltf_GltfAccessorCompType_UInt16;
|
: RWGltf_GltfAccessorCompType_UInt16;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (theMesh.get() == nullptr)
|
|
||||||
{
|
{
|
||||||
const int64_t aRefPos = (int64_t )theBinFile.tellp();
|
const int64_t aRefPos = (int64_t )theBinFile.tellp();
|
||||||
const int64_t aPos = theGltfFace.Indices.ByteOffset
|
const int64_t aPos = theGltfFace.Indices.ByteOffset
|
||||||
@@ -481,7 +293,6 @@ void RWGltf_CafWriter::saveIndices (RWGltf_GltfFace& theGltfFace,
|
|||||||
+ theGltfFace.Indices.Count * (theGltfFace.Indices.ComponentType == RWGltf_GltfAccessorCompType_UInt32 ? sizeof(uint32_t) : sizeof(uint16_t));
|
+ theGltfFace.Indices.Count * (theGltfFace.Indices.ComponentType == RWGltf_GltfAccessorCompType_UInt32 ? sizeof(uint32_t) : sizeof(uint16_t));
|
||||||
Standard_ASSERT_RAISE (aPos == aRefPos, "wrong offset");
|
Standard_ASSERT_RAISE (aPos == aRefPos, "wrong offset");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const Standard_Integer aNodeFirst = theGltfFace.NbIndexedNodes - theFaceIter.ElemLower();
|
const Standard_Integer aNodeFirst = theGltfFace.NbIndexedNodes - theFaceIter.ElemLower();
|
||||||
theGltfFace.NbIndexedNodes += theFaceIter.NbNodes();
|
theGltfFace.NbIndexedNodes += theFaceIter.NbNodes();
|
||||||
@@ -495,20 +306,13 @@ void RWGltf_CafWriter::saveIndices (RWGltf_GltfFace& theGltfFace,
|
|||||||
aTri(1) += aNodeFirst;
|
aTri(1) += aNodeFirst;
|
||||||
aTri(2) += aNodeFirst;
|
aTri(2) += aNodeFirst;
|
||||||
aTri(3) += aNodeFirst;
|
aTri(3) += aNodeFirst;
|
||||||
if (theMesh.get() != nullptr)
|
|
||||||
{
|
|
||||||
theMesh->IndicesVec.push_back(aTri);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (theGltfFace.Indices.ComponentType == RWGltf_GltfAccessorCompType_UInt16)
|
if (theGltfFace.Indices.ComponentType == RWGltf_GltfAccessorCompType_UInt16)
|
||||||
{
|
{
|
||||||
writeTriangle16(theBinFile, NCollection_Vec3<uint16_t>((uint16_t)aTri(1), (uint16_t)aTri(2), (uint16_t)aTri(3)));
|
writeTriangle16 (theBinFile, NCollection_Vec3<uint16_t>((uint16_t)aTri(1), (uint16_t)aTri(2), (uint16_t)aTri(3)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeTriangle32(theBinFile, Graphic3d_Vec3i(aTri(1), aTri(2), aTri(3)));
|
writeTriangle32 (theBinFile, Graphic3d_Vec3i (aTri(1), aTri(2), aTri(3)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -569,14 +373,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
const TColStd_MapOfAsciiString* theLabelFilter,
|
const TColStd_MapOfAsciiString* theLabelFilter,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DRACO
|
|
||||||
if (myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
Message::SendFail ("Error: cannot use Draco compression, Draco library missing.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
myBuffViewPos.Id = RWGltf_GltfAccessor::INVALID_ID;
|
myBuffViewPos.Id = RWGltf_GltfAccessor::INVALID_ID;
|
||||||
myBuffViewPos.ByteOffset = 0;
|
myBuffViewPos.ByteOffset = 0;
|
||||||
myBuffViewPos.ByteLength = 0;
|
myBuffViewPos.ByteLength = 0;
|
||||||
@@ -600,13 +396,9 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
myBuffViewInd.ByteLength = 0;
|
myBuffViewInd.ByteLength = 0;
|
||||||
myBuffViewInd.Target = RWGltf_GltfBufferViewTarget_ELEMENT_ARRAY_BUFFER;
|
myBuffViewInd.Target = RWGltf_GltfBufferViewTarget_ELEMENT_ARRAY_BUFFER;
|
||||||
|
|
||||||
myBuffViewsDraco.clear();
|
|
||||||
|
|
||||||
myBinDataMap.Clear();
|
myBinDataMap.Clear();
|
||||||
myBinDataLen64 = 0;
|
myBinDataLen64 = 0;
|
||||||
|
|
||||||
Message_ProgressScope aScope(theProgress, "Write binary data", myDracoParameters.DracoCompression ? 2 : 1);
|
|
||||||
|
|
||||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||||
std::shared_ptr<std::ostream> aBinFile = aFileSystem->OpenOStream (myBinFileNameFull, std::ios::out | std::ios::binary);
|
std::shared_ptr<std::ostream> aBinFile = aFileSystem->OpenOStream (myBinFileNameFull, std::ios::out | std::ios::binary);
|
||||||
if (aBinFile.get() == NULL
|
if (aBinFile.get() == NULL
|
||||||
@@ -616,7 +408,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message_ProgressScope aPSentryBin (aScope.Next(), "Binary data", 4);
|
Message_ProgressScope aPSentryBin (theProgress, "Binary data", 4);
|
||||||
const RWGltf_GltfArrayType anArrTypes[4] =
|
const RWGltf_GltfArrayType anArrTypes[4] =
|
||||||
{
|
{
|
||||||
RWGltf_GltfArrayType_Position,
|
RWGltf_GltfArrayType_Position,
|
||||||
@@ -716,7 +508,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>> aMeshes;
|
|
||||||
Standard_Integer aNbAccessors = 0;
|
Standard_Integer aNbAccessors = 0;
|
||||||
NCollection_Map<Handle(RWGltf_GltfFaceList)> aWrittenFaces;
|
NCollection_Map<Handle(RWGltf_GltfFaceList)> aWrittenFaces;
|
||||||
NCollection_DataMap<TopoDS_Shape, Handle(RWGltf_GltfFace), TopTools_ShapeMapHasher> aWrittenPrimData;
|
NCollection_DataMap<TopoDS_Shape, Handle(RWGltf_GltfFace), TopTools_ShapeMapHasher> aWrittenPrimData;
|
||||||
@@ -735,7 +526,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
aBuffView->ByteOffset = aBinFile->tellp();
|
aBuffView->ByteOffset = aBinFile->tellp();
|
||||||
aWrittenFaces.Clear (false);
|
aWrittenFaces.Clear (false);
|
||||||
aWrittenPrimData.Clear (false);
|
aWrittenPrimData.Clear (false);
|
||||||
size_t aMeshIndex = 0;
|
|
||||||
for (ShapeToGltfFaceMap::Iterator aBinDataIter (myBinDataMap); aBinDataIter.More() && aPSentryBin.More(); aBinDataIter.Next())
|
for (ShapeToGltfFaceMap::Iterator aBinDataIter (myBinDataMap); aBinDataIter.More() && aPSentryBin.More(); aBinDataIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(RWGltf_GltfFaceList)& aGltfFaceList = aBinDataIter.Value();
|
const Handle(RWGltf_GltfFaceList)& aGltfFaceList = aBinDataIter.Value();
|
||||||
@@ -744,23 +534,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RWGltf_CafWriter::Mesh> aMeshPtr;
|
|
||||||
++aMeshIndex;
|
|
||||||
#ifdef HAVE_DRACO
|
|
||||||
if (myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
if (aMeshIndex <= aMeshes.size())
|
|
||||||
{
|
|
||||||
aMeshPtr = aMeshes.at(aMeshIndex - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aMeshes.push_back(std::make_shared<RWGltf_CafWriter::Mesh>(RWGltf_CafWriter::Mesh()));
|
|
||||||
aMeshPtr = aMeshes.back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (RWGltf_GltfFaceList::Iterator aGltfFaceIter (*aGltfFaceList); aGltfFaceIter.More() && aPSentryBin.More(); aGltfFaceIter.Next())
|
for (RWGltf_GltfFaceList::Iterator aGltfFaceIter (*aGltfFaceList); aGltfFaceIter.More() && aPSentryBin.More(); aGltfFaceIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(RWGltf_GltfFace)& aGltfFace = aGltfFaceIter.Value();
|
const Handle(RWGltf_GltfFace)& aGltfFace = aGltfFaceIter.Value();
|
||||||
@@ -806,22 +579,22 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
case RWGltf_GltfArrayType_Position:
|
case RWGltf_GltfArrayType_Position:
|
||||||
{
|
{
|
||||||
aGltfFace->NbIndexedNodes = 0; // reset to zero before RWGltf_GltfArrayType_Indices step
|
aGltfFace->NbIndexedNodes = 0; // reset to zero before RWGltf_GltfArrayType_Indices step
|
||||||
saveNodes (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors, aMeshPtr);
|
saveNodes (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RWGltf_GltfArrayType_Normal:
|
case RWGltf_GltfArrayType_Normal:
|
||||||
{
|
{
|
||||||
saveNormals (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors, aMeshPtr);
|
saveNormals (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RWGltf_GltfArrayType_TCoord0:
|
case RWGltf_GltfArrayType_TCoord0:
|
||||||
{
|
{
|
||||||
saveTextCoords (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors, aMeshPtr);
|
saveTextCoords (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RWGltf_GltfArrayType_Indices:
|
case RWGltf_GltfArrayType_Indices:
|
||||||
{
|
{
|
||||||
saveIndices (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors, aMeshPtr);
|
saveIndices (*aGltfFace, *aBinFile, aFaceIter, aNbAccessors);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -838,22 +611,16 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add alignment by 4 bytes (might happen on RWGltf_GltfAccessorCompType_UInt16 indices)
|
// add alignment by 4 bytes (might happen on RWGltf_GltfAccessorCompType_UInt16 indices)
|
||||||
if (!myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
int64_t aContentLen64 = (int64_t)aBinFile->tellp();
|
int64_t aContentLen64 = (int64_t)aBinFile->tellp();
|
||||||
while (aContentLen64 % 4 != 0)
|
while (aContentLen64 % 4 != 0)
|
||||||
{
|
{
|
||||||
aBinFile->write(" ", 1);
|
aBinFile->write (" ", 1);
|
||||||
++aContentLen64;
|
++aContentLen64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!myDracoParameters.DracoCompression)
|
aBuffView->ByteLength = (int64_t )aBinFile->tellp() - aBuffView->ByteOffset;
|
||||||
{
|
|
||||||
aBuffView->ByteLength = (int64_t)aBinFile->tellp() - aBuffView->ByteOffset;
|
|
||||||
}
|
|
||||||
if (!aPSentryBin.More())
|
if (!aPSentryBin.More())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -862,56 +629,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
|||||||
aPSentryBin.Next();
|
aPSentryBin.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DRACO
|
|
||||||
OSD_Timer aDracoTimer;
|
|
||||||
aDracoTimer.Start();
|
|
||||||
draco::Encoder aDracoEncoder;
|
|
||||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::POSITION, myDracoParameters.QuantizePositionBits);
|
|
||||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::NORMAL, myDracoParameters.QuantizeNormalBits);
|
|
||||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::TEX_COORD, myDracoParameters.QuantizeTexcoordBits);
|
|
||||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::COLOR, myDracoParameters.QuantizeColorBits);
|
|
||||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::GENERIC, myDracoParameters.QuantizeGenericBits);
|
|
||||||
aDracoEncoder.SetSpeedOptions (myDracoParameters.CompressionLevel, myDracoParameters.CompressionLevel);
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<draco::EncoderBuffer>> anEncoderBuffers(aMeshes.size());
|
|
||||||
DracoEncodingFunctor aFunctor (aScope.Next(), aDracoEncoder, aMeshes, anEncoderBuffers);
|
|
||||||
OSD_Parallel::For (0, int(aMeshes.size()), aFunctor, !myToParallel);
|
|
||||||
|
|
||||||
for (size_t aBuffInd = 0; aBuffInd != anEncoderBuffers.size(); ++aBuffInd)
|
|
||||||
{
|
|
||||||
if (anEncoderBuffers.at(aBuffInd).get() == nullptr)
|
|
||||||
{
|
|
||||||
Message::SendFail(TCollection_AsciiString("Error: mesh not encoded in draco buffer."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
RWGltf_GltfBufferView aBuffViewDraco;
|
|
||||||
aBuffViewDraco.Id = (int)aBuffInd;
|
|
||||||
aBuffViewDraco.ByteOffset = aBinFile->tellp();
|
|
||||||
const draco::EncoderBuffer& anEncoderBuff = *anEncoderBuffers.at(aBuffInd);
|
|
||||||
aBinFile->write(anEncoderBuff.data(), std::streamsize(anEncoderBuff.size()));
|
|
||||||
if (!aBinFile->good())
|
|
||||||
{
|
|
||||||
Message::SendFail (TCollection_AsciiString("File '") + myBinFileNameFull + "' cannot be written");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t aLength = (int64_t)aBinFile->tellp();
|
|
||||||
while (aLength % 4 != 0)
|
|
||||||
{
|
|
||||||
aBinFile->write(" ", 1);
|
|
||||||
++aLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
aBuffViewDraco.ByteLength = aLength - aBuffViewDraco.ByteOffset;
|
|
||||||
myBuffViewsDraco.push_back (aBuffViewDraco);
|
|
||||||
}
|
|
||||||
aDracoTimer.Stop();
|
|
||||||
Message::SendInfo (TCollection_AsciiString("Draco compression time: ") + aDracoTimer.ElapsedTime() + " s");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myIsBinary
|
if (myIsBinary
|
||||||
&& myToEmbedTexturesInGlb)
|
&& myToEmbedTexturesInGlb)
|
||||||
{
|
{
|
||||||
@@ -1303,13 +1020,10 @@ void RWGltf_CafWriter::writePositions (const RWGltf_GltfFace& theGltfFace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myWriter->StartObject();
|
myWriter->StartObject();
|
||||||
if (!myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
myWriter->Key ("bufferView");
|
myWriter->Key ("bufferView");
|
||||||
myWriter->Int (myBuffViewPos.Id);
|
myWriter->Int (myBuffViewPos.Id);
|
||||||
myWriter->Key ("byteOffset");
|
myWriter->Key ("byteOffset");
|
||||||
myWriter->Int64 (theGltfFace.NodePos.ByteOffset);
|
myWriter->Int64 (theGltfFace.NodePos.ByteOffset);
|
||||||
}
|
|
||||||
myWriter->Key ("componentType");
|
myWriter->Key ("componentType");
|
||||||
myWriter->Int (theGltfFace.NodePos.ComponentType);
|
myWriter->Int (theGltfFace.NodePos.ComponentType);
|
||||||
myWriter->Key ("count");
|
myWriter->Key ("count");
|
||||||
@@ -1354,13 +1068,10 @@ void RWGltf_CafWriter::writeNormals (const RWGltf_GltfFace& theGltfFace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myWriter->StartObject();
|
myWriter->StartObject();
|
||||||
if (!myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
myWriter->Key ("bufferView");
|
myWriter->Key ("bufferView");
|
||||||
myWriter->Int (myBuffViewNorm.Id);
|
myWriter->Int (myBuffViewNorm.Id);
|
||||||
myWriter->Key ("byteOffset");
|
myWriter->Key ("byteOffset");
|
||||||
myWriter->Int64 (theGltfFace.NodeNorm.ByteOffset);
|
myWriter->Int64 (theGltfFace.NodeNorm.ByteOffset);
|
||||||
}
|
|
||||||
myWriter->Key ("componentType");
|
myWriter->Key ("componentType");
|
||||||
myWriter->Int (theGltfFace.NodeNorm.ComponentType);
|
myWriter->Int (theGltfFace.NodeNorm.ComponentType);
|
||||||
myWriter->Key ("count");
|
myWriter->Key ("count");
|
||||||
@@ -1405,13 +1116,10 @@ void RWGltf_CafWriter::writeTextCoords (const RWGltf_GltfFace& theGltfFace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myWriter->StartObject();
|
myWriter->StartObject();
|
||||||
if (!myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
myWriter->Key ("bufferView");
|
myWriter->Key ("bufferView");
|
||||||
myWriter->Int (myBuffViewTextCoord.Id);
|
myWriter->Int (myBuffViewTextCoord.Id);
|
||||||
myWriter->Key ("byteOffset");
|
myWriter->Key ("byteOffset");
|
||||||
myWriter->Int64 (theGltfFace.NodeUV.ByteOffset);
|
myWriter->Int64 (theGltfFace.NodeUV.ByteOffset);
|
||||||
}
|
|
||||||
myWriter->Key ("componentType");
|
myWriter->Key ("componentType");
|
||||||
myWriter->Int (theGltfFace.NodeUV.ComponentType);
|
myWriter->Int (theGltfFace.NodeUV.ComponentType);
|
||||||
myWriter->Key ("count");
|
myWriter->Key ("count");
|
||||||
@@ -1456,13 +1164,10 @@ void RWGltf_CafWriter::writeIndices (const RWGltf_GltfFace& theGltfFace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myWriter->StartObject();
|
myWriter->StartObject();
|
||||||
if (!myDracoParameters.DracoCompression)
|
myWriter->Key ("bufferView");
|
||||||
{
|
myWriter->Int (myBuffViewInd.Id);
|
||||||
myWriter->Key("bufferView");
|
myWriter->Key ("byteOffset");
|
||||||
myWriter->Int(myBuffViewInd.Id);
|
myWriter->Int64 (theGltfFace.Indices.ByteOffset);
|
||||||
myWriter->Key("byteOffset");
|
|
||||||
myWriter->Int64(theGltfFace.Indices.ByteOffset);
|
|
||||||
}
|
|
||||||
myWriter->Key ("componentType");
|
myWriter->Key ("componentType");
|
||||||
myWriter->Int (theGltfFace.Indices.ComponentType);
|
myWriter->Int (theGltfFace.Indices.ComponentType);
|
||||||
myWriter->Key ("count");
|
myWriter->Key ("count");
|
||||||
@@ -1604,24 +1309,6 @@ void RWGltf_CafWriter::writeBufferViews (const Standard_Integer theBinDataBuffer
|
|||||||
myWriter->Int (myBuffViewInd.Target);
|
myWriter->Int (myBuffViewInd.Target);
|
||||||
myWriter->EndObject();
|
myWriter->EndObject();
|
||||||
}
|
}
|
||||||
if (myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
for (size_t aBufInd = 0; aBufInd != myBuffViewsDraco.size(); ++aBufInd)
|
|
||||||
{
|
|
||||||
if (myBuffViewsDraco[aBufInd].Id != RWGltf_GltfAccessor::INVALID_ID)
|
|
||||||
{
|
|
||||||
aBuffViewId++;
|
|
||||||
myWriter->StartObject();
|
|
||||||
myWriter->Key("buffer");
|
|
||||||
myWriter->Int(theBinDataBufferId);
|
|
||||||
myWriter->Key("byteLength");
|
|
||||||
myWriter->Int64(myBuffViewsDraco[aBufInd].ByteLength);
|
|
||||||
myWriter->Key("byteOffset");
|
|
||||||
myWriter->Int64(myBuffViewsDraco[aBufInd].ByteOffset);
|
|
||||||
myWriter->EndObject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myMaterialMap->FlushGlbBufferViews (myWriter.get(), theBinDataBufferId, aBuffViewId);
|
myMaterialMap->FlushGlbBufferViews (myWriter.get(), theBinDataBufferId, aBuffViewId);
|
||||||
|
|
||||||
@@ -1665,28 +1352,7 @@ void RWGltf_CafWriter::writeBuffers()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void RWGltf_CafWriter::writeExtensions()
|
void RWGltf_CafWriter::writeExtensions()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_RAPIDJSON
|
|
||||||
Standard_ProgramError_Raise_if (myWriter.get() == NULL, "Internal error: RWGltf_CafWriter::writeExtensions()");
|
Standard_ProgramError_Raise_if (myWriter.get() == NULL, "Internal error: RWGltf_CafWriter::writeExtensions()");
|
||||||
|
|
||||||
if (myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
myWriter->Key(RWGltf_GltfRootElementName(RWGltf_GltfRootElement_ExtensionsUsed));
|
|
||||||
|
|
||||||
myWriter->StartArray();
|
|
||||||
{
|
|
||||||
myWriter->Key("KHR_draco_mesh_compression");
|
|
||||||
}
|
|
||||||
myWriter->EndArray();
|
|
||||||
|
|
||||||
myWriter->Key(RWGltf_GltfRootElementName(RWGltf_GltfRootElement_ExtensionsRequired));
|
|
||||||
|
|
||||||
myWriter->StartArray();
|
|
||||||
{
|
|
||||||
myWriter->Key("KHR_draco_mesh_compression");
|
|
||||||
}
|
|
||||||
myWriter->EndArray();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -1759,7 +1425,6 @@ void RWGltf_CafWriter::writeMaterials (const RWGltf_GltfSceneNodeMap& theSceneNo
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void RWGltf_CafWriter::writePrimArray (const RWGltf_GltfFace& theGltfFace,
|
void RWGltf_CafWriter::writePrimArray (const RWGltf_GltfFace& theGltfFace,
|
||||||
const TCollection_AsciiString& theName,
|
const TCollection_AsciiString& theName,
|
||||||
const int theDracoBufInd,
|
|
||||||
bool& theToStartPrims)
|
bool& theToStartPrims)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_RAPIDJSON
|
#ifdef HAVE_RAPIDJSON
|
||||||
@@ -1806,48 +1471,12 @@ void RWGltf_CafWriter::writePrimArray (const RWGltf_GltfFace& theGltfFace,
|
|||||||
}
|
}
|
||||||
myWriter->Key ("mode");
|
myWriter->Key ("mode");
|
||||||
myWriter->Int (RWGltf_GltfPrimitiveMode_Triangles);
|
myWriter->Int (RWGltf_GltfPrimitiveMode_Triangles);
|
||||||
|
|
||||||
if (myDracoParameters.DracoCompression)
|
|
||||||
{
|
|
||||||
myWriter->Key("extensions");
|
|
||||||
myWriter->StartObject();
|
|
||||||
{
|
|
||||||
myWriter->Key("KHR_draco_mesh_compression");
|
|
||||||
myWriter->StartObject();
|
|
||||||
myWriter->Key("bufferView");
|
|
||||||
myWriter->Int(myBuffViewsDraco[theDracoBufInd].Id);
|
|
||||||
myWriter->Key("attributes");
|
|
||||||
myWriter->StartObject();
|
|
||||||
{
|
|
||||||
int anAttrInd = 0;
|
|
||||||
if (theGltfFace.NodePos.Id != RWGltf_GltfAccessor::INVALID_ID)
|
|
||||||
{
|
|
||||||
myWriter->Key("POSITION");
|
|
||||||
myWriter->Int(anAttrInd++);
|
|
||||||
}
|
|
||||||
if (theGltfFace.NodeNorm.Id != RWGltf_GltfAccessor::INVALID_ID)
|
|
||||||
{
|
|
||||||
myWriter->Key("NORMAL");
|
|
||||||
myWriter->Int(anAttrInd++);
|
|
||||||
}
|
|
||||||
if (theGltfFace.NodeUV.Id != RWGltf_GltfAccessor::INVALID_ID)
|
|
||||||
{
|
|
||||||
myWriter->Key("TEXCOORD_0");
|
|
||||||
myWriter->Int(anAttrInd++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myWriter->EndObject();
|
|
||||||
myWriter->EndObject();
|
|
||||||
}
|
|
||||||
myWriter->EndObject();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
myWriter->EndObject();
|
myWriter->EndObject();
|
||||||
#else
|
#else
|
||||||
(void )theGltfFace;
|
(void )theGltfFace;
|
||||||
(void )theName;
|
(void )theName;
|
||||||
(void )theToStartPrims;
|
(void )theToStartPrims;
|
||||||
(void )theDracoBufInd;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1863,8 +1492,6 @@ void RWGltf_CafWriter::writeMeshes (const RWGltf_GltfSceneNodeMap& theSceneNodeM
|
|||||||
myWriter->Key (RWGltf_GltfRootElementName (RWGltf_GltfRootElement_Meshes));
|
myWriter->Key (RWGltf_GltfRootElementName (RWGltf_GltfRootElement_Meshes));
|
||||||
myWriter->StartArray();
|
myWriter->StartArray();
|
||||||
|
|
||||||
int aDracoBufInd = 0;
|
|
||||||
NCollection_IndexedDataMap<int, int> aDracoBufIndMap;
|
|
||||||
NCollection_Map<Handle(RWGltf_GltfFaceList)> aWrittenFaces;
|
NCollection_Map<Handle(RWGltf_GltfFaceList)> aWrittenFaces;
|
||||||
for (RWGltf_GltfSceneNodeMap::Iterator aSceneNodeIter (theSceneNodeMap); aSceneNodeIter.More(); aSceneNodeIter.Next())
|
for (RWGltf_GltfSceneNodeMap::Iterator aSceneNodeIter (theSceneNodeMap); aSceneNodeIter.More(); aSceneNodeIter.Next())
|
||||||
{
|
{
|
||||||
@@ -1895,23 +1522,7 @@ void RWGltf_CafWriter::writeMeshes (const RWGltf_GltfSceneNodeMap& theSceneNodeM
|
|||||||
for (RWGltf_GltfFaceList::Iterator aFaceGroupIter (*aGltfFaceList); aFaceGroupIter.More(); aFaceGroupIter.Next())
|
for (RWGltf_GltfFaceList::Iterator aFaceGroupIter (*aGltfFaceList); aFaceGroupIter.More(); aFaceGroupIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(RWGltf_GltfFace)& aGltfFace = aFaceGroupIter.Value();
|
const Handle(RWGltf_GltfFace)& aGltfFace = aFaceGroupIter.Value();
|
||||||
const int aPrevSize = aDracoBufIndMap.Size();
|
writePrimArray (*aGltfFace, aNodeName, toStartPrims);
|
||||||
const int aTempDracoBufInd = aDracoBufInd;
|
|
||||||
if (myDracoParameters.DracoCompression
|
|
||||||
&& !aDracoBufIndMap.FindFromKey (aGltfFace->NodePos.Id, aDracoBufInd))
|
|
||||||
{
|
|
||||||
aDracoBufIndMap.Add (aGltfFace->NodePos.Id, aDracoBufInd);
|
|
||||||
}
|
|
||||||
|
|
||||||
writePrimArray (*aGltfFace, aNodeName, aDracoBufInd, toStartPrims);
|
|
||||||
if (aTempDracoBufInd != aDracoBufInd)
|
|
||||||
{
|
|
||||||
aDracoBufInd = aTempDracoBufInd;
|
|
||||||
}
|
|
||||||
if (!myDracoParameters.DracoCompression || aDracoBufIndMap.Size() > aPrevSize)
|
|
||||||
{
|
|
||||||
++aDracoBufInd;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1931,23 +1542,7 @@ void RWGltf_CafWriter::writeMeshes (const RWGltf_GltfSceneNodeMap& theSceneNodeM
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Handle(RWGltf_GltfFace)& aGltfFace = aGltfFaceList->First();
|
const Handle(RWGltf_GltfFace)& aGltfFace = aGltfFaceList->First();
|
||||||
const int aPrevSize = aDracoBufIndMap.Size();
|
writePrimArray (*aGltfFace, aNodeName, toStartPrims);
|
||||||
const int aTempDracoBufInd = aDracoBufInd;
|
|
||||||
if (myDracoParameters.DracoCompression
|
|
||||||
&& !aDracoBufIndMap.FindFromKey(aGltfFace->NodePos.Id, aDracoBufInd))
|
|
||||||
{
|
|
||||||
aDracoBufIndMap.Add(aGltfFace->NodePos.Id, aDracoBufInd);
|
|
||||||
}
|
|
||||||
|
|
||||||
writePrimArray (*aGltfFace, aNodeName, aDracoBufInd, toStartPrims);
|
|
||||||
if (aTempDracoBufInd != aDracoBufInd)
|
|
||||||
{
|
|
||||||
aDracoBufInd = aTempDracoBufInd;
|
|
||||||
}
|
|
||||||
if (!myDracoParameters.DracoCompression || aDracoBufIndMap.Size() > aPrevSize)
|
|
||||||
{
|
|
||||||
++aDracoBufInd;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,14 +18,12 @@
|
|||||||
#include <TColStd_MapOfAsciiString.hxx>
|
#include <TColStd_MapOfAsciiString.hxx>
|
||||||
#include <TDF_LabelSequence.hxx>
|
#include <TDF_LabelSequence.hxx>
|
||||||
#include <TopTools_ShapeMapHasher.hxx>
|
#include <TopTools_ShapeMapHasher.hxx>
|
||||||
#include <RWGltf_DracoParameters.hxx>
|
|
||||||
#include <RWGltf_GltfBufferView.hxx>
|
#include <RWGltf_GltfBufferView.hxx>
|
||||||
#include <RWGltf_GltfFace.hxx>
|
#include <RWGltf_GltfFace.hxx>
|
||||||
#include <RWGltf_WriterTrsfFormat.hxx>
|
#include <RWGltf_WriterTrsfFormat.hxx>
|
||||||
#include <RWMesh_CoordinateSystemConverter.hxx>
|
#include <RWMesh_CoordinateSystemConverter.hxx>
|
||||||
#include <RWMesh_NameFormat.hxx>
|
#include <RWMesh_NameFormat.hxx>
|
||||||
#include <XCAFPrs_Style.hxx>
|
#include <XCAFPrs_Style.hxx>
|
||||||
#include <Poly_Triangle.hxx>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -42,15 +40,6 @@ class RWGltf_CafWriter : public Standard_Transient
|
|||||||
DEFINE_STANDARD_RTTIEXT(RWGltf_CafWriter, Standard_Transient)
|
DEFINE_STANDARD_RTTIEXT(RWGltf_CafWriter, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Mesh
|
|
||||||
struct Mesh
|
|
||||||
{
|
|
||||||
std::vector<Graphic3d_Vec3> NodesVec; //!< vector for mesh nodes
|
|
||||||
std::vector<Graphic3d_Vec3> NormalsVec; //!< vector for mesh normals
|
|
||||||
std::vector<Graphic3d_Vec2> TexCoordsVec; //!< vector for mesh texture UV coordinates
|
|
||||||
std::vector<Poly_Triangle> IndicesVec; //!< vector for mesh indices
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Main constructor.
|
//! Main constructor.
|
||||||
//! @param theFile [in] path to output glTF file
|
//! @param theFile [in] path to output glTF file
|
||||||
//! @param theIsBinary [in] flag to write into binary glTF format (.glb)
|
//! @param theIsBinary [in] flag to write into binary glTF format (.glb)
|
||||||
@@ -125,18 +114,6 @@ public:
|
|||||||
//! May reduce binary data size thanks to smaller triangle indexes.
|
//! May reduce binary data size thanks to smaller triangle indexes.
|
||||||
void SetSplitIndices16 (bool theToSplit) { myToSplitIndices16 = theToSplit; }
|
void SetSplitIndices16 (bool theToSplit) { myToSplitIndices16 = theToSplit; }
|
||||||
|
|
||||||
//! Return TRUE if multithreaded optimizations are allowed; FALSE by default.
|
|
||||||
bool ToParallel() const { return myToParallel; }
|
|
||||||
|
|
||||||
//! Setup multithreaded execution.
|
|
||||||
void SetParallel (bool theToParallel) { myToParallel = theToParallel; }
|
|
||||||
|
|
||||||
//! Return Draco parameters
|
|
||||||
const RWGltf_DracoParameters& CompressionParameters() const { return myDracoParameters; }
|
|
||||||
|
|
||||||
//! Set Draco parameters
|
|
||||||
void SetCompressionParameters(const RWGltf_DracoParameters& theDracoParameters) { myDracoParameters = theDracoParameters; }
|
|
||||||
|
|
||||||
//! Write glTF file and associated binary file.
|
//! Write glTF file and associated binary file.
|
||||||
//! Triangulation data should be precomputed within shapes!
|
//! Triangulation data should be precomputed within shapes!
|
||||||
//! @param theDocument [in] input document
|
//! @param theDocument [in] input document
|
||||||
@@ -209,48 +186,40 @@ protected:
|
|||||||
//! @param theBinFile [out] output file to write into
|
//! @param theBinFile [out] output file to write into
|
||||||
//! @param theFaceIter [in] current face to write
|
//! @param theFaceIter [in] current face to write
|
||||||
//! @param theAccessorNb [in] [out] last accessor index
|
//! @param theAccessorNb [in] [out] last accessor index
|
||||||
//! @param theMesh [in] [out] mesh
|
|
||||||
Standard_EXPORT virtual void saveNodes (RWGltf_GltfFace& theGltfFace,
|
Standard_EXPORT virtual void saveNodes (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
const RWMesh_FaceIterator& theFaceIter,
|
const RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb) const;
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh) const;
|
|
||||||
|
|
||||||
//! Write mesh normals into binary file.
|
//! Write mesh normals into binary file.
|
||||||
//! @param theGltfFace [out] glTF face definition
|
//! @param theGltfFace [out] glTF face definition
|
||||||
//! @param theBinFile [out] output file to write into
|
//! @param theBinFile [out] output file to write into
|
||||||
//! @param theFaceIter [in] current face to write
|
//! @param theFaceIter [in] current face to write
|
||||||
//! @param theAccessorNb [in] [out] last accessor index
|
//! @param theAccessorNb [in] [out] last accessor index
|
||||||
//! @param theMesh [in] [out] mesh
|
|
||||||
Standard_EXPORT virtual void saveNormals (RWGltf_GltfFace& theGltfFace,
|
Standard_EXPORT virtual void saveNormals (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
RWMesh_FaceIterator& theFaceIter,
|
RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb) const;
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh) const;
|
|
||||||
|
|
||||||
//! Write mesh texture UV coordinates into binary file.
|
//! Write mesh texture UV coordinates into binary file.
|
||||||
//! @param theGltfFace [out] glTF face definition
|
//! @param theGltfFace [out] glTF face definition
|
||||||
//! @param theBinFile [out] output file to write into
|
//! @param theBinFile [out] output file to write into
|
||||||
//! @param theFaceIter [in] current face to write
|
//! @param theFaceIter [in] current face to write
|
||||||
//! @param theAccessorNb [in] [out] last accessor index
|
//! @param theAccessorNb [in] [out] last accessor index
|
||||||
//! @param theMesh [in] [out] mesh
|
|
||||||
Standard_EXPORT virtual void saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
Standard_EXPORT virtual void saveTextCoords (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
const RWMesh_FaceIterator& theFaceIter,
|
const RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb) const;
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh) const;
|
|
||||||
|
|
||||||
//! Write mesh indexes into binary file.
|
//! Write mesh indexes into binary file.
|
||||||
//! @param theGltfFace [out] glTF face definition
|
//! @param theGltfFace [out] glTF face definition
|
||||||
//! @param theBinFile [out] output file to write into
|
//! @param theBinFile [out] output file to write into
|
||||||
//! @param theFaceIter [in] current face to write
|
//! @param theFaceIter [in] current face to write
|
||||||
//! @param theAccessorNb [in] [out] last accessor index
|
//! @param theAccessorNb [in] [out] last accessor index
|
||||||
//! @param theMesh [in] [out] mesh
|
|
||||||
Standard_EXPORT virtual void saveIndices (RWGltf_GltfFace& theGltfFace,
|
Standard_EXPORT virtual void saveIndices (RWGltf_GltfFace& theGltfFace,
|
||||||
std::ostream& theBinFile,
|
std::ostream& theBinFile,
|
||||||
const RWMesh_FaceIterator& theFaceIter,
|
const RWMesh_FaceIterator& theFaceIter,
|
||||||
Standard_Integer& theAccessorNb,
|
Standard_Integer& theAccessorNb);
|
||||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -311,11 +280,9 @@ protected:
|
|||||||
//! Write a primitive array to RWGltf_GltfRootElement_Meshes section.
|
//! Write a primitive array to RWGltf_GltfRootElement_Meshes section.
|
||||||
//! @param[in] theGltfFace face to write
|
//! @param[in] theGltfFace face to write
|
||||||
//! @param[in] theName primitive array name
|
//! @param[in] theName primitive array name
|
||||||
//! @param[in] theDracoBufInd draco buffer index
|
|
||||||
//! @param[in,out] theToStartPrims flag indicating that primitive array has been started
|
//! @param[in,out] theToStartPrims flag indicating that primitive array has been started
|
||||||
Standard_EXPORT virtual void writePrimArray (const RWGltf_GltfFace& theGltfFace,
|
Standard_EXPORT virtual void writePrimArray (const RWGltf_GltfFace& theGltfFace,
|
||||||
const TCollection_AsciiString& theName,
|
const TCollection_AsciiString& theName,
|
||||||
const int theDracoBufInd,
|
|
||||||
bool& theToStartPrims);
|
bool& theToStartPrims);
|
||||||
|
|
||||||
//! Write RWGltf_GltfRootElement_Nodes section.
|
//! Write RWGltf_GltfRootElement_Nodes section.
|
||||||
@@ -402,9 +369,6 @@ protected:
|
|||||||
ShapeToGltfFaceMap myBinDataMap; //!< map for TopoDS_Face to glTF face (merging duplicates)
|
ShapeToGltfFaceMap myBinDataMap; //!< map for TopoDS_Face to glTF face (merging duplicates)
|
||||||
int64_t myBinDataLen64; //!< length of binary file
|
int64_t myBinDataLen64; //!< length of binary file
|
||||||
|
|
||||||
std::vector<RWGltf_GltfBufferView> myBuffViewsDraco; //!< vector of buffers view with compression data
|
|
||||||
Standard_Boolean myToParallel; //!< flag to use multithreading; FALSE by default
|
|
||||||
RWGltf_DracoParameters myDracoParameters; //!< Draco parameters
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _RWGltf_CafWriter_HeaderFiler
|
#endif // _RWGltf_CafWriter_HeaderFiler
|
||||||
|
@@ -18,14 +18,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(RWGltf_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(RWGltf_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : RWGltf_ConfigurationNode
|
// function : RWGltf_ConfigurationNode
|
||||||
@@ -54,7 +47,7 @@ RWGltf_ConfigurationNode::RWGltf_ConfigurationNode(const Handle(RWGltf_Configura
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWGltf_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool RWGltf_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
|
|
||||||
InternalParameters.FileLengthUnit =
|
InternalParameters.FileLengthUnit =
|
||||||
theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope);
|
theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope);
|
||||||
@@ -121,7 +114,7 @@ TCollection_AsciiString RWGltf_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Common parameters:\n";
|
aResult += "!Common parameters:\n";
|
||||||
|
@@ -1,41 +0,0 @@
|
|||||||
// Copyright (c) 2022 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 _RWGltf_DracoParameters_HeaderFile
|
|
||||||
#define _RWGltf_DracoParameters_HeaderFile
|
|
||||||
|
|
||||||
//! Draco compression parameters
|
|
||||||
struct RWGltf_DracoParameters
|
|
||||||
{
|
|
||||||
RWGltf_DracoParameters()
|
|
||||||
: DracoCompression (false),
|
|
||||||
CompressionLevel (7),
|
|
||||||
QuantizePositionBits (14),
|
|
||||||
QuantizeNormalBits (10),
|
|
||||||
QuantizeTexcoordBits (12),
|
|
||||||
QuantizeColorBits (8),
|
|
||||||
QuantizeGenericBits (12),
|
|
||||||
UnifiedQuantization (false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool DracoCompression; //!< flag to use Draco compression (FALSE by default). If it is TRUE, compression is used
|
|
||||||
int CompressionLevel; //!< Draco compression level [0-10] (7 by default)
|
|
||||||
int QuantizePositionBits; //!< quantization bits for position attribute (14 by default)
|
|
||||||
int QuantizeNormalBits; //!< quantization bits for normal attribute (10 by default)
|
|
||||||
int QuantizeTexcoordBits; //!< quantization bits for texture coordinate attribute (12 by default)
|
|
||||||
int QuantizeColorBits; //!< quantization bits for color attributes (8 by default)
|
|
||||||
int QuantizeGenericBits; //!< quantization bits for skinning and custom attributes (12 by default)
|
|
||||||
bool UnifiedQuantization; //!< quantize positions of all primitives using the same quantization grid (FALSE by default)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@@ -493,8 +493,7 @@ void RWGltf_GltfMaterialMap::DefineMaterial (const XCAFPrs_Style& theStyle,
|
|||||||
// as both may share the same material having "auto" flag
|
// as both may share the same material having "auto" flag
|
||||||
if (theStyle.Material().IsNull()
|
if (theStyle.Material().IsNull()
|
||||||
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_Auto
|
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_Auto
|
||||||
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_DoubleSided
|
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_DoubleSided)
|
||||||
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_FrontCulled) // front culling flag cannot be exported to glTF
|
|
||||||
{
|
{
|
||||||
myWriter->Key ("doubleSided");
|
myWriter->Key ("doubleSided");
|
||||||
myWriter->Bool (true);
|
myWriter->Bool (true);
|
||||||
|
@@ -18,14 +18,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(RWObj_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(RWObj_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : RWObj_ConfigurationNode
|
// function : RWObj_ConfigurationNode
|
||||||
@@ -54,7 +47,7 @@ RWObj_ConfigurationNode::RWObj_ConfigurationNode(const Handle(RWObj_Configuratio
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWObj_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool RWObj_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
InternalParameters.FileLengthUnit =
|
InternalParameters.FileLengthUnit =
|
||||||
theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope);
|
theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope);
|
||||||
InternalParameters.SystemCS = (RWMesh_CoordinateSystem)
|
InternalParameters.SystemCS = (RWMesh_CoordinateSystem)
|
||||||
@@ -91,7 +84,7 @@ TCollection_AsciiString RWObj_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Common parameters:\n";
|
aResult += "!Common parameters:\n";
|
||||||
|
@@ -56,6 +56,14 @@ bool RWPly_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRes
|
|||||||
InternalParameters.FileCS =
|
InternalParameters.FileCS =
|
||||||
(RWMesh_CoordinateSystem)(theResource->IntegerVal("file.cs", (int)InternalParameters.SystemCS, aScope) % 2);
|
(RWMesh_CoordinateSystem)(theResource->IntegerVal("file.cs", (int)InternalParameters.SystemCS, aScope) % 2);
|
||||||
|
|
||||||
|
InternalParameters.WritePntSet =
|
||||||
|
theResource->BooleanVal("write.pnt.set", InternalParameters.WritePntSet, aScope);
|
||||||
|
InternalParameters.WriteDistance =
|
||||||
|
theResource->RealVal("write.distance", InternalParameters.WriteDistance, aScope);
|
||||||
|
InternalParameters.WriteDensity =
|
||||||
|
theResource->RealVal("write.density", InternalParameters.WriteDensity, aScope);
|
||||||
|
InternalParameters.WriteTolerance =
|
||||||
|
theResource->RealVal("write.tolerance", InternalParameters.WriteTolerance, aScope);
|
||||||
InternalParameters.WriteNormals =
|
InternalParameters.WriteNormals =
|
||||||
theResource->BooleanVal("write.normals", InternalParameters.WriteNormals, aScope);
|
theResource->BooleanVal("write.normals", InternalParameters.WriteNormals, aScope);
|
||||||
InternalParameters.WriteColors =
|
InternalParameters.WriteColors =
|
||||||
@@ -110,6 +118,30 @@ TCollection_AsciiString RWPly_ConfigurationNode::Save() const
|
|||||||
aResult += "!Write parameters:\n";
|
aResult += "!Write parameters:\n";
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
|
|
||||||
|
aResult += "!\n";
|
||||||
|
aResult += "!Flag for write point cloud instead without triangulation indices\n";
|
||||||
|
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
|
||||||
|
aResult += aScope + "write.pnt.set :\t " + InternalParameters.WritePntSet + "\n";
|
||||||
|
aResult += "!\n";
|
||||||
|
|
||||||
|
aResult += "!\n";
|
||||||
|
aResult += "!Distance from shape into the range [0, Value]\n";
|
||||||
|
aResult += "!Default value: 0. Available values: [0, Value]\n";
|
||||||
|
aResult += aScope + "write.distance :\t " + InternalParameters.WriteDistance + "\n";
|
||||||
|
aResult += "!\n";
|
||||||
|
|
||||||
|
aResult += "!\n";
|
||||||
|
aResult += "!Density of points to generate randomly on surface\n";
|
||||||
|
aResult += "!Default value: 2.e+100. Available values: [0, inf]\n";
|
||||||
|
aResult += aScope + "write.density :\t " + InternalParameters.WriteDensity + "\n";
|
||||||
|
aResult += "!\n";
|
||||||
|
|
||||||
|
aResult += "!\n";
|
||||||
|
aResult += "!Internal tolerance\n";
|
||||||
|
aResult += "!Default value: 1.e-7. Available values: [0, inf]\n";
|
||||||
|
aResult += aScope + "write.tolerance :\t " + InternalParameters.WriteTolerance + "\n";
|
||||||
|
aResult += "!\n";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Flag for write normals\n";
|
aResult += "!Flag for write normals\n";
|
||||||
aResult += "!Default value: 1(true). Available values: 0(false), 1(true)\n";
|
aResult += "!Default value: 1(true). Available values: 0(false), 1(true)\n";
|
||||||
|
@@ -94,6 +94,10 @@ public:
|
|||||||
RWMesh_CoordinateSystem SystemCS = RWMesh_CoordinateSystem_Zup; //!< System origin coordinate system to perform conversion into during read
|
RWMesh_CoordinateSystem SystemCS = RWMesh_CoordinateSystem_Zup; //!< System origin coordinate system to perform conversion into during read
|
||||||
RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read
|
RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read
|
||||||
// Writing
|
// Writing
|
||||||
|
bool WritePntSet = false; //!< Flag for write point cloud instead without triangulation indices
|
||||||
|
double WriteDistance = 0.0; //!< Distance from shape into the range [0, Value]
|
||||||
|
double WriteDensity = Precision::Infinite(); //!< Density of points to generate randomly on surface
|
||||||
|
double WriteTolerance = Precision::Confusion(); //!< Internal tolerance
|
||||||
bool WriteNormals = true; //!< Flag for write normals
|
bool WriteNormals = true; //!< Flag for write normals
|
||||||
bool WriteColors = true; //!< Flag for write colors
|
bool WriteColors = true; //!< Flag for write colors
|
||||||
bool WriteTexCoords = false; //!< Flag for write UV / texture coordinates
|
bool WriteTexCoords = false; //!< Flag for write UV / texture coordinates
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include <RWPly_Provider.hxx>
|
#include <RWPly_Provider.hxx>
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <BRepLib_PointCloudShape.hxx>
|
||||||
#include <DE_Wrapper.hxx>
|
#include <DE_Wrapper.hxx>
|
||||||
#include <Message.hxx>
|
#include <Message.hxx>
|
||||||
#include <RWPly_ConfigurationNode.hxx>
|
#include <RWPly_ConfigurationNode.hxx>
|
||||||
@@ -79,6 +80,94 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aNode->InternalParameters.WritePntSet)
|
||||||
|
{
|
||||||
|
class PointCloudPlyWriter : public BRepLib_PointCloudShape, public RWPly_PlyWriterContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PointCloudPlyWriter(Standard_Real theTol)
|
||||||
|
: BRepLib_PointCloudShape(TopoDS_Shape(), theTol)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void AddFaceColor(const TopoDS_Shape& theFace, const Graphic3d_Vec4ub& theColor)
|
||||||
|
{
|
||||||
|
myFaceColor.Bind(theFace, theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void addPoint(const gp_Pnt& thePoint,
|
||||||
|
const gp_Vec& theNorm,
|
||||||
|
const gp_Pnt2d& theUV,
|
||||||
|
const TopoDS_Shape& theFace)
|
||||||
|
{
|
||||||
|
Graphic3d_Vec4ub aColor;
|
||||||
|
myFaceColor.Find(theFace, aColor);
|
||||||
|
RWPly_PlyWriterContext::WriteVertex(thePoint,
|
||||||
|
Graphic3d_Vec3((float)theNorm.X(), (float)theNorm.Y(), (float)theNorm.Z()),
|
||||||
|
Graphic3d_Vec2((float)theUV.X(), (float)theUV.Y()),
|
||||||
|
aColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
NCollection_DataMap<TopoDS_Shape, Graphic3d_Vec4ub> myFaceColor;
|
||||||
|
};
|
||||||
|
|
||||||
|
PointCloudPlyWriter aPlyCtx(aNode->InternalParameters.WriteTolerance);
|
||||||
|
aPlyCtx.SetNormals(aNode->InternalParameters.WriteNormals);
|
||||||
|
aPlyCtx.SetColors(aNode->InternalParameters.WriteColors);
|
||||||
|
aPlyCtx.SetTexCoords(aNode->InternalParameters.WriteTexCoords);
|
||||||
|
|
||||||
|
TopoDS_Compound aComp;
|
||||||
|
BRep_Builder().MakeCompound(aComp);
|
||||||
|
for (XCAFPrs_DocumentExplorer aDocExplorer(theDocument, aRootLabels, XCAFPrs_DocumentExplorerFlags_OnlyLeafNodes);
|
||||||
|
aDocExplorer.More(); aDocExplorer.Next())
|
||||||
|
{
|
||||||
|
const XCAFPrs_DocumentNode& aDocNode = aDocExplorer.Current();
|
||||||
|
for (RWMesh_FaceIterator aFaceIter(aDocNode.RefLabel, aDocNode.Location, true, aDocNode.Style); aFaceIter.More(); aFaceIter.Next())
|
||||||
|
{
|
||||||
|
BRep_Builder().Add(aComp, aFaceIter.Face());
|
||||||
|
Graphic3d_Vec4ub aColorVec(255);
|
||||||
|
if (aFaceIter.HasFaceColor())
|
||||||
|
{
|
||||||
|
Graphic3d_Vec4 aColorF = aFaceIter.FaceColor();
|
||||||
|
aColorVec.SetValues((unsigned char)int(aColorF.r() * 255.0f),
|
||||||
|
(unsigned char)int(aColorF.g() * 255.0f),
|
||||||
|
(unsigned char)int(aColorF.b() * 255.0f),
|
||||||
|
(unsigned char)int(aColorF.a() * 255.0f));
|
||||||
|
}
|
||||||
|
aPlyCtx.AddFaceColor(aFaceIter.Face(), aColorVec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aPlyCtx.SetShape(aComp);
|
||||||
|
Standard_Integer aNbPoints = aNode->InternalParameters.WriteDensity > 0
|
||||||
|
? aPlyCtx.NbPointsByDensity(aNode->InternalParameters.WriteDensity)
|
||||||
|
: aPlyCtx.NbPointsByTriangulation();
|
||||||
|
if (aNbPoints <= 0)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error in the RWPly_Provider during writing the file " <<
|
||||||
|
thePath << "\t: Incorrect number of points";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aPlyCtx.Open(thePath)
|
||||||
|
|| !aPlyCtx.WriteHeader(aNbPoints, 0, TColStd_IndexedDataMapOfStringString()))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error in the RWPly_Provider during writing the file " << thePath;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Boolean isDone = aNode->InternalParameters.WriteDensity > 0
|
||||||
|
? aPlyCtx.GeneratePointsByDensity(aNode->InternalParameters.WriteDensity)
|
||||||
|
: aPlyCtx.GeneratePointsByTriangulation();
|
||||||
|
if (!isDone)
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error in the RWPly_Provider during writing the file "
|
||||||
|
<< thePath << "\t: Error during generating point process";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
TColStd_IndexedDataMapOfStringString aFileInfo;
|
TColStd_IndexedDataMapOfStringString aFileInfo;
|
||||||
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
|
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -106,7 +195,7 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
<< thePath << "\t: Cannot perform the document";
|
<< thePath << "\t: Cannot perform the document";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,42 +99,11 @@ namespace
|
|||||||
return aPoly;
|
return aPoly;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
myNodes.Clear();
|
|
||||||
myTriangles.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NCollection_Vector<gp_XYZ> myNodes;
|
NCollection_Vector<gp_XYZ> myNodes;
|
||||||
NCollection_Vector<Poly_Triangle> myTriangles;
|
NCollection_Vector<Poly_Triangle> myTriangles;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MultiDomainReader : public Reader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! Add new solid
|
|
||||||
//! Add triangulation to triangulation list for multi-domain case
|
|
||||||
virtual void AddSolid() Standard_OVERRIDE
|
|
||||||
{
|
|
||||||
if (Handle(Poly_Triangulation) aCurrentTri = GetTriangulation())
|
|
||||||
{
|
|
||||||
myTriangulationList.Append(aCurrentTri);
|
|
||||||
}
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns triangulation list for multi-domain case
|
|
||||||
NCollection_Sequence<Handle(Poly_Triangulation)>& ChangeTriangulationList()
|
|
||||||
{
|
|
||||||
return myTriangulationList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
NCollection_Sequence<Handle(Poly_Triangulation)> myTriangulationList;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@@ -153,22 +122,6 @@ Handle(Poly_Triangulation) RWStl::ReadFile (const Standard_CString theFile,
|
|||||||
return aReader.GetTriangulation();
|
return aReader.GetTriangulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//function : ReadFile
|
|
||||||
//purpose :
|
|
||||||
//=============================================================================
|
|
||||||
void RWStl::ReadFile(const Standard_CString theFile,
|
|
||||||
const Standard_Real theMergeAngle,
|
|
||||||
NCollection_Sequence<Handle(Poly_Triangulation)>& theTriangList,
|
|
||||||
const Message_ProgressRange& theProgress)
|
|
||||||
{
|
|
||||||
MultiDomainReader aReader;
|
|
||||||
aReader.SetMergeAngle (theMergeAngle);
|
|
||||||
aReader.Read (theFile, theProgress);
|
|
||||||
theTriangList.Clear();
|
|
||||||
theTriangList.Append (aReader.ChangeTriangulationList());
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : ReadFile
|
//function : ReadFile
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <Standard_Macro.hxx>
|
#include <Standard_Macro.hxx>
|
||||||
#include <Message_ProgressScope.hxx>
|
#include <Message_ProgressScope.hxx>
|
||||||
#include <NCollection_Sequence.hxx>
|
|
||||||
|
|
||||||
//! This class provides methods to read and write triangulation from / to the STL files.
|
//! This class provides methods to read and write triangulation from / to the STL files.
|
||||||
class RWStl
|
class RWStl
|
||||||
@@ -63,16 +62,6 @@ public:
|
|||||||
const Standard_Real theMergeAngle,
|
const Standard_Real theMergeAngle,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||||
|
|
||||||
//! Read specified STL file and fills triangulation list for multi-domain case.
|
|
||||||
//! @param[in] theFile file path to read
|
|
||||||
//! @param[in] theMergeAngle maximum angle in radians between triangles to merge equal nodes; M_PI/2 means ignore angle
|
|
||||||
//! @param[out] theTriangList triangulation list for multi-domain case
|
|
||||||
//! @param[in] theProgress progress indicator
|
|
||||||
Standard_EXPORT static void ReadFile(const Standard_CString theFile,
|
|
||||||
const Standard_Real theMergeAngle,
|
|
||||||
NCollection_Sequence<Handle(Poly_Triangulation)>& theTriangList,
|
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
|
||||||
|
|
||||||
//! Read triangulation from a binary STL file
|
//! Read triangulation from a binary STL file
|
||||||
//! In case of error, returns Null handle.
|
//! In case of error, returns Null handle.
|
||||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadBinary (const OSD_Path& thePath,
|
Standard_EXPORT static Handle(Poly_Triangulation) ReadBinary (const OSD_Path& thePath,
|
||||||
|
@@ -19,14 +19,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(RWStl_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(RWStl_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : STEPCAFControl_ConfigurationNode
|
// function : STEPCAFControl_ConfigurationNode
|
||||||
@@ -55,7 +48,7 @@ RWStl_ConfigurationNode::RWStl_ConfigurationNode(const Handle(RWStl_Configuratio
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RWStl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool RWStl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
|
|
||||||
InternalParameters.ReadMergeAngle =
|
InternalParameters.ReadMergeAngle =
|
||||||
theResource->RealVal("read.merge.angle", InternalParameters.ReadMergeAngle, aScope);
|
theResource->RealVal("read.merge.angle", InternalParameters.ReadMergeAngle, aScope);
|
||||||
@@ -75,7 +68,7 @@ TCollection_AsciiString RWStl_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Read parameters:\n";
|
aResult += "!Read parameters:\n";
|
||||||
|
@@ -180,7 +180,6 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*aStream >> std::ws; // skip any white spaces
|
*aStream >> std::ws; // skip any white spaces
|
||||||
AddSolid();
|
|
||||||
}
|
}
|
||||||
return ! aStream->fail();
|
return ! aStream->fail();
|
||||||
}
|
}
|
||||||
@@ -301,11 +300,6 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
|
|||||||
|
|
||||||
// skip header "solid ..."
|
// skip header "solid ..."
|
||||||
aLine = theBuffer.ReadLine (theStream, aLineLen);
|
aLine = theBuffer.ReadLine (theStream, aLineLen);
|
||||||
// skip empty lines
|
|
||||||
while (aLine && !*aLine)
|
|
||||||
{
|
|
||||||
aLine = theBuffer.ReadLine (theStream, aLineLen);
|
|
||||||
}
|
|
||||||
if (aLine == NULL)
|
if (aLine == NULL)
|
||||||
{
|
{
|
||||||
Message::SendFail ("Error: premature end of file");
|
Message::SendFail ("Error: premature end of file");
|
||||||
|
@@ -39,8 +39,7 @@ public:
|
|||||||
Standard_EXPORT RWStl_Reader();
|
Standard_EXPORT RWStl_Reader();
|
||||||
|
|
||||||
//! Reads data from STL file (either binary or Ascii).
|
//! Reads data from STL file (either binary or Ascii).
|
||||||
//! This function supports reading multi-domain STL files formed by concatenation
|
//! This function supports reading multi-domain STL files formed by concatenation of several "plain" files.
|
||||||
//! of several "plain" files.
|
|
||||||
//! The mesh nodes are not merged between domains.
|
//! The mesh nodes are not merged between domains.
|
||||||
//! Unicode paths can be given in UTF-8 encoding.
|
//! Unicode paths can be given in UTF-8 encoding.
|
||||||
//! Format is recognized automatically by analysis of the file header.
|
//! Format is recognized automatically by analysis of the file header.
|
||||||
@@ -85,9 +84,6 @@ public:
|
|||||||
//! Should create new triangle built on specified nodes in the target model.
|
//! Should create new triangle built on specified nodes in the target model.
|
||||||
virtual void AddTriangle (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3) = 0;
|
virtual void AddTriangle (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3) = 0;
|
||||||
|
|
||||||
//! Callback function to be implemented in descendant.
|
|
||||||
//! Should create a new triangulation for a solid in multi-domain case.
|
|
||||||
virtual void AddSolid() {}
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Return merge tolerance; M_PI/2 by default - all nodes are merged regardless angle between triangles.
|
//! Return merge tolerance; M_PI/2 by default - all nodes are merged regardless angle between triangles.
|
||||||
|
@@ -19,14 +19,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ConfigurationNode)
|
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ConfigurationNode)
|
||||||
|
|
||||||
namespace
|
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||||
{
|
|
||||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
|
||||||
{
|
|
||||||
static const TCollection_AsciiString aScope = "provider";
|
|
||||||
return aScope;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : STEPCAFControl_ConfigurationNode
|
// function : STEPCAFControl_ConfigurationNode
|
||||||
@@ -55,7 +48,7 @@ STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode(const Handle(
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||||
|
|
||||||
InternalParameters.ReadBSplineContinuity = (ReadMode_BSplineContinuity)
|
InternalParameters.ReadBSplineContinuity = (ReadMode_BSplineContinuity)
|
||||||
theResource->IntegerVal("read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope);
|
theResource->IntegerVal("read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope);
|
||||||
@@ -164,7 +157,7 @@ TCollection_AsciiString STEPCAFControl_ConfigurationNode::Save() const
|
|||||||
TCollection_AsciiString aResult;
|
TCollection_AsciiString aResult;
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||||
|
|
||||||
aResult += "!\n";
|
aResult += "!\n";
|
||||||
aResult += "!Common parameters:\n";
|
aResult += "!Common parameters:\n";
|
||||||
|
@@ -3365,17 +3365,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
if (anUnit.IsNull()) continue;
|
if (anUnit.IsNull()) continue;
|
||||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
STEPConstruct_UnitContext anUnitCtxUpperBound;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
anUnitCtxUpperBound.ComputeFactors(NU);
|
anUnitCtx.ComputeFactors(NU);
|
||||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
|
||||||
{
|
|
||||||
convertAngleValue(anUnitCtxUpperBound, aVal);
|
|
||||||
}
|
|
||||||
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxUpperBound.LengthFactor() > 0.) ||
|
|
||||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||||
{
|
{
|
||||||
aVal = aVal * anUnitCtxUpperBound.LengthFactor();
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
|
}
|
||||||
|
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||||
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||||
|
{
|
||||||
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
}
|
}
|
||||||
aDim3 = aVal;
|
aDim3 = aVal;
|
||||||
|
|
||||||
@@ -3401,17 +3401,16 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
if (anUnit.IsNull()) continue;
|
if (anUnit.IsNull()) continue;
|
||||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||||
NU = anUnit.NamedUnit();
|
NU = anUnit.NamedUnit();
|
||||||
STEPConstruct_UnitContext anUnitCtxLowerBound;
|
anUnitCtx.ComputeFactors(NU);
|
||||||
anUnitCtxLowerBound.ComputeFactors(NU);
|
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
|
||||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
|
||||||
{
|
|
||||||
convertAngleValue(anUnitCtxLowerBound, aVal);
|
|
||||||
}
|
|
||||||
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxLowerBound.LengthFactor() > 0.) ||
|
|
||||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||||
{
|
{
|
||||||
aVal = aVal * anUnitCtxLowerBound.LengthFactor();
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
|
}
|
||||||
|
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||||
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||||
|
{
|
||||||
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
}
|
}
|
||||||
aDim2 = Abs(aVal);
|
aDim2 = Abs(aVal);
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,8 @@
|
|||||||
#include <IFSelect_SelectModelEntities.hxx>
|
#include <IFSelect_SelectModelEntities.hxx>
|
||||||
#include <IFSelect_SelectModelRoots.hxx>
|
#include <IFSelect_SelectModelRoots.hxx>
|
||||||
#include <IFSelect_SelectSignature.hxx>
|
#include <IFSelect_SelectSignature.hxx>
|
||||||
|
#include <IFSelect_Signature.hxx>
|
||||||
|
#include <Interface_Protocol.hxx>
|
||||||
#include <StepAP214.hxx>
|
#include <StepAP214.hxx>
|
||||||
#include <StepAP214_Protocol.hxx>
|
#include <StepAP214_Protocol.hxx>
|
||||||
#include <StepData_StepModel.hxx>
|
#include <StepData_StepModel.hxx>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user