mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028630: Visualization, StdPrs_ShadedShape - do not create Poly_Connect without need
This commit is contained in:
parent
4fecc3651c
commit
450c83adcf
@ -13,7 +13,6 @@ Poly_CoherentTriPtr.cxx
|
|||||||
Poly_CoherentTriPtr.hxx
|
Poly_CoherentTriPtr.hxx
|
||||||
Poly_Connect.cxx
|
Poly_Connect.cxx
|
||||||
Poly_Connect.hxx
|
Poly_Connect.hxx
|
||||||
Poly_Connect.lxx
|
|
||||||
Poly_HArray1OfTriangle.hxx
|
Poly_HArray1OfTriangle.hxx
|
||||||
Poly_ListOfTriangulation.hxx
|
Poly_ListOfTriangulation.hxx
|
||||||
Poly_MakeLoops.cxx
|
Poly_MakeLoops.cxx
|
||||||
|
@ -14,42 +14,89 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
|
||||||
#include <Poly_Connect.hxx>
|
#include <Poly_Connect.hxx>
|
||||||
|
|
||||||
#include <Poly_Triangle.hxx>
|
#include <Poly_Triangle.hxx>
|
||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <Standard.hxx>
|
|
||||||
|
// this structure records one of the edges starting from a node
|
||||||
|
struct polyedge
|
||||||
|
{
|
||||||
|
polyedge* next; // the next edge in the list
|
||||||
|
Standard_Integer nd; // the second node of the edge
|
||||||
|
Standard_Integer nt[2]; // the two adjacent triangles
|
||||||
|
Standard_Integer nn[2]; // the two adjacent nodes
|
||||||
|
DEFINE_STANDARD_ALLOC
|
||||||
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Poly_Connect
|
//function : Poly_Connect
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// this structure records one of the edges starting from a node
|
Poly_Connect::Poly_Connect()
|
||||||
//typedef struct polyedge {
|
: mytr (0),
|
||||||
struct polyedge {
|
myfirst (0),
|
||||||
polyedge* next; // the next edge in the list
|
mynode (0),
|
||||||
Standard_Integer nd; // the second node of the edge
|
myothernode (0),
|
||||||
Standard_Integer nt[2]; // the two adjacent triangles
|
mysense (false),
|
||||||
Standard_Integer nn[2]; // the two adjacent nodes
|
mymore (false)
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
};
|
|
||||||
|
|
||||||
Poly_Connect::Poly_Connect(const Handle(Poly_Triangulation)& T) :
|
|
||||||
myTriangulation(T),
|
|
||||||
myTriangles(1,T->NbNodes()),
|
|
||||||
myAdjacents(1,6*T->NbTriangles())
|
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Poly_Connect
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Poly_Connect::Poly_Connect(const Handle(Poly_Triangulation)& theTriangulation)
|
||||||
|
: myTriangulation (theTriangulation),
|
||||||
|
myTriangles (1, theTriangulation->NbNodes()),
|
||||||
|
myAdjacents (1, 6 * theTriangulation->NbTriangles()),
|
||||||
|
mytr (0),
|
||||||
|
myfirst (0),
|
||||||
|
mynode (0),
|
||||||
|
myothernode (0),
|
||||||
|
mysense (false),
|
||||||
|
mymore (false)
|
||||||
|
{
|
||||||
|
Load (theTriangulation);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Load
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void Poly_Connect::Load (const Handle(Poly_Triangulation)& theTriangulation)
|
||||||
|
{
|
||||||
|
myTriangulation = theTriangulation;
|
||||||
|
mytr = 0;
|
||||||
|
myfirst = 0;
|
||||||
|
mynode = 0;
|
||||||
|
myothernode = 0;
|
||||||
|
mysense = false;
|
||||||
|
mymore = false;
|
||||||
|
|
||||||
|
const Standard_Integer nbNodes = myTriangulation->NbNodes();
|
||||||
|
const Standard_Integer nbTriangles = myTriangulation->NbTriangles();
|
||||||
|
{
|
||||||
|
const Standard_Integer aNbAdjs = 6 * nbTriangles;
|
||||||
|
if (myTriangles.Size() != nbNodes)
|
||||||
|
{
|
||||||
|
TColStd_Array1OfInteger aTriArray (1, nbNodes);
|
||||||
|
myTriangles.Move (std::move (aTriArray));
|
||||||
|
}
|
||||||
|
if (myAdjacents.Size() != aNbAdjs)
|
||||||
|
{
|
||||||
|
TColStd_Array1OfInteger anAdjArray (1, aNbAdjs);
|
||||||
|
myAdjacents.Move (std::move (anAdjArray));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
myTriangles.Init(0);
|
myTriangles.Init(0);
|
||||||
myAdjacents.Init(0);
|
myAdjacents.Init(0);
|
||||||
Standard_Integer nbNodes = myTriangulation->NbNodes();
|
|
||||||
Standard_Integer nbTriangles = myTriangulation->NbTriangles();
|
|
||||||
|
|
||||||
// We first build an array of the list of edges connected to the nodes
|
// We first build an array of the list of edges connected to the nodes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create an array to store the edges starting from the vertices
|
// create an array to store the edges starting from the vertices
|
||||||
|
|
||||||
Standard_Integer i;
|
Standard_Integer i;
|
||||||
// the last node is not used because edges are stored at the lower node index
|
// the last node is not used because edges are stored at the lower node index
|
||||||
polyedge** edges = new polyedge*[nbNodes];
|
polyedge** edges = new polyedge*[nbNodes];
|
||||||
@ -164,39 +211,6 @@ Poly_Connect::Poly_Connect(const Handle(Poly_Triangulation)& T) :
|
|||||||
delete [] edges;
|
delete [] edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Triangles
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Poly_Connect::Triangles(const Standard_Integer T,
|
|
||||||
Standard_Integer& t1,
|
|
||||||
Standard_Integer& t2,
|
|
||||||
Standard_Integer& t3) const
|
|
||||||
{
|
|
||||||
Standard_Integer index = 6*(T-1);
|
|
||||||
t1 = myAdjacents(index+1);
|
|
||||||
t2 = myAdjacents(index+2);
|
|
||||||
t3 = myAdjacents(index+3);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Nodes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Poly_Connect::Nodes(const Standard_Integer T,
|
|
||||||
Standard_Integer& n1,
|
|
||||||
Standard_Integer& n2,
|
|
||||||
Standard_Integer& n3) const
|
|
||||||
{
|
|
||||||
Standard_Integer index = 6*(T-1);
|
|
||||||
n1 = myAdjacents(index+4);
|
|
||||||
n2 = myAdjacents(index+5);
|
|
||||||
n3 = myAdjacents(index+6);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Initialize
|
//function : Initialize
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -272,14 +286,3 @@ void Poly_Connect::Next()
|
|||||||
}
|
}
|
||||||
mymore = Standard_False;
|
mymore = Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer Poly_Connect::Value() const
|
|
||||||
{
|
|
||||||
return mytr;
|
|
||||||
}
|
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <Standard_Boolean.hxx>
|
#include <Standard_Boolean.hxx>
|
||||||
class Poly_Triangulation;
|
class Poly_Triangulation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Provides an algorithm to explore, inside a triangulation, the
|
//! Provides an algorithm to explore, inside a triangulation, the
|
||||||
//! adjacency data for a node or a triangle.
|
//! adjacency data for a node or a triangle.
|
||||||
//! Adjacency data for a node consists of triangles which
|
//! Adjacency data for a node consists of triangles which
|
||||||
@ -67,33 +65,53 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
|
//! Constructs an uninitialized algorithm.
|
||||||
|
Standard_EXPORT Poly_Connect();
|
||||||
|
|
||||||
//! Constructs an algorithm to explore the adjacency data of
|
//! Constructs an algorithm to explore the adjacency data of
|
||||||
//! nodes or triangles for the triangulation T.
|
//! nodes or triangles for the triangulation T.
|
||||||
Standard_EXPORT Poly_Connect(const Handle(Poly_Triangulation)& T);
|
Standard_EXPORT Poly_Connect (const Handle(Poly_Triangulation)& theTriangulation);
|
||||||
|
|
||||||
|
//! Initialize the algorithm to explore the adjacency data of
|
||||||
|
//! nodes or triangles for the triangulation theTriangulation.
|
||||||
|
Standard_EXPORT void Load (const Handle(Poly_Triangulation)& theTriangulation);
|
||||||
|
|
||||||
//! Returns the triangulation analyzed by this tool.
|
//! Returns the triangulation analyzed by this tool.
|
||||||
Handle(Poly_Triangulation) Triangulation() const;
|
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||||
|
|
||||||
//! Returns the index of a triangle containing the node at
|
//! Returns the index of a triangle containing the node at
|
||||||
//! index N in the nodes table specific to the triangulation analyzed by this tool
|
//! index N in the nodes table specific to the triangulation analyzed by this tool
|
||||||
Standard_Integer Triangle (const Standard_Integer N) const;
|
Standard_Integer Triangle (const Standard_Integer N) const { return myTriangles (N); }
|
||||||
|
|
||||||
//! Returns in t1, t2 and t3, the indices of the 3 triangles
|
//! Returns in t1, t2 and t3, the indices of the 3 triangles
|
||||||
//! adjacent to the triangle at index T in the triangles table
|
//! adjacent to the triangle at index T in the triangles table
|
||||||
//! specific to the triangulation analyzed by this tool.
|
//! specific to the triangulation analyzed by this tool.
|
||||||
//! Warning
|
//! Warning
|
||||||
//! Null indices are returned when there are fewer than 3
|
//! Null indices are returned when there are fewer than 3
|
||||||
//! adjacent triangles.
|
//! adjacent triangles.
|
||||||
Standard_EXPORT void Triangles (const Standard_Integer T, Standard_Integer& t1, Standard_Integer& t2, Standard_Integer& t3) const;
|
void Triangles (const Standard_Integer T, Standard_Integer& t1, Standard_Integer& t2, Standard_Integer& t3) const
|
||||||
|
{
|
||||||
|
Standard_Integer index = 6*(T-1);
|
||||||
|
t1 = myAdjacents(index+1);
|
||||||
|
t2 = myAdjacents(index+2);
|
||||||
|
t3 = myAdjacents(index+3);
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns, in n1, n2 and n3, the indices of the 3 nodes
|
//! Returns, in n1, n2 and n3, the indices of the 3 nodes
|
||||||
//! adjacent to the triangle referenced at index T in the
|
//! adjacent to the triangle referenced at index T in the
|
||||||
//! triangles table specific to the triangulation analyzed by this tool.
|
//! triangles table specific to the triangulation analyzed by this tool.
|
||||||
//! Warning
|
//! Warning
|
||||||
//! Null indices are returned when there are fewer than 3 adjacent nodes.
|
//! Null indices are returned when there are fewer than 3 adjacent nodes.
|
||||||
Standard_EXPORT void Nodes (const Standard_Integer T, Standard_Integer& n1, Standard_Integer& n2, Standard_Integer& n3) const;
|
void Nodes (const Standard_Integer T, Standard_Integer& n1, Standard_Integer& n2, Standard_Integer& n3) const
|
||||||
|
{
|
||||||
|
Standard_Integer index = 6*(T-1);
|
||||||
|
n1 = myAdjacents(index+4);
|
||||||
|
n2 = myAdjacents(index+5);
|
||||||
|
n3 = myAdjacents(index+6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//! Initializes an iterator to search for all the triangles
|
//! Initializes an iterator to search for all the triangles
|
||||||
//! containing the node referenced at index N in the nodes
|
//! containing the node referenced at index N in the nodes
|
||||||
//! table, for the triangulation analyzed by this tool.
|
//! table, for the triangulation analyzed by this tool.
|
||||||
@ -116,8 +134,8 @@ public:
|
|||||||
//! Returns true if there is another element in the iterator
|
//! Returns true if there is another element in the iterator
|
||||||
//! defined with the function Initialize (i.e. if there is another
|
//! defined with the function Initialize (i.e. if there is another
|
||||||
//! triangle containing the given node).
|
//! triangle containing the given node).
|
||||||
Standard_Boolean More() const;
|
Standard_Boolean More() const { return mymore; }
|
||||||
|
|
||||||
//! Advances the iterator defined with the function Initialize to
|
//! Advances the iterator defined with the function Initialize to
|
||||||
//! access the next triangle.
|
//! access the next triangle.
|
||||||
//! Note: There is no action if the iterator is empty (i.e. if the
|
//! Note: There is no action if the iterator is empty (i.e. if the
|
||||||
@ -128,21 +146,10 @@ public:
|
|||||||
//! iterator, defined with the function Initialize, points. This is
|
//! iterator, defined with the function Initialize, points. This is
|
||||||
//! an index in the triangles table specific to the triangulation
|
//! an index in the triangles table specific to the triangulation
|
||||||
//! analyzed by this tool
|
//! analyzed by this tool
|
||||||
Standard_EXPORT Standard_Integer Value() const;
|
Standard_Integer Value() const { return mytr; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Handle(Poly_Triangulation) myTriangulation;
|
Handle(Poly_Triangulation) myTriangulation;
|
||||||
TColStd_Array1OfInteger myTriangles;
|
TColStd_Array1OfInteger myTriangles;
|
||||||
TColStd_Array1OfInteger myAdjacents;
|
TColStd_Array1OfInteger myAdjacents;
|
||||||
@ -153,14 +160,6 @@ private:
|
|||||||
Standard_Boolean mysense;
|
Standard_Boolean mysense;
|
||||||
Standard_Boolean mymore;
|
Standard_Boolean mymore;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include <Poly_Connect.lxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _Poly_Connect_HeaderFile
|
#endif // _Poly_Connect_HeaderFile
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
// Created on: 1995-03-06
|
|
||||||
// Created by: Laurent PAINNOT
|
|
||||||
// Copyright (c) 1995-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Triangulation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
inline Handle(Poly_Triangulation) Poly_Connect::Triangulation() const
|
|
||||||
{
|
|
||||||
return myTriangulation;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Triangle
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
inline Standard_Integer Poly_Connect::Triangle(const Standard_Integer N) const
|
|
||||||
{
|
|
||||||
return myTriangles(N);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
inline Standard_Boolean Poly_Connect::More() const
|
|
||||||
{
|
|
||||||
return (mymore);
|
|
||||||
}
|
|
@ -186,11 +186,10 @@ namespace
|
|||||||
// Determinant of transform matrix less then 0 means that mirror transform applied.
|
// Determinant of transform matrix less then 0 means that mirror transform applied.
|
||||||
Standard_Boolean isMirrored = aTrsf.VectorialPart().Determinant() < 0;
|
Standard_Boolean isMirrored = aTrsf.VectorialPart().Determinant() < 0;
|
||||||
|
|
||||||
Poly_Connect aPolyConnect (aT);
|
|
||||||
// Extracts vertices & normals from nodes
|
// Extracts vertices & normals from nodes
|
||||||
const TColgp_Array1OfPnt& aNodes = aT->Nodes();
|
const TColgp_Array1OfPnt& aNodes = aT->Nodes();
|
||||||
const TColgp_Array1OfPnt2d& aUVNodes = aT->UVNodes();
|
const TColgp_Array1OfPnt2d& aUVNodes = aT->UVNodes();
|
||||||
StdPrs_ToolTriangulatedShape::Normal (aFace, aPolyConnect);
|
StdPrs_ToolTriangulatedShape::ComputeNormals (aFace, aT);
|
||||||
const TShort_Array1OfShortReal& aNormals = aT->Normals();
|
const TShort_Array1OfShortReal& aNormals = aT->Normals();
|
||||||
const Standard_ShortReal* aNormArr = &aNormals.First();
|
const Standard_ShortReal* aNormArr = &aNormals.First();
|
||||||
|
|
||||||
|
@ -131,15 +131,15 @@ Standard_Boolean StdPrs_ToolTriangulatedShape::IsClosed (const TopoDS_Shape& the
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Normal
|
//function : ComputeNormals
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void StdPrs_ToolTriangulatedShape::Normal (const TopoDS_Face& theFace,
|
void StdPrs_ToolTriangulatedShape::ComputeNormals (const TopoDS_Face& theFace,
|
||||||
Poly_Connect& thePolyConnect)
|
const Handle(Poly_Triangulation)& theTris,
|
||||||
|
Poly_Connect& thePolyConnect)
|
||||||
{
|
{
|
||||||
const Handle(Poly_Triangulation)& aPolyTri = thePolyConnect.Triangulation();
|
if (theTris.IsNull()
|
||||||
if (aPolyTri.IsNull()
|
|| theTris->HasNormals())
|
||||||
|| aPolyTri->HasNormals())
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -148,13 +148,13 @@ void StdPrs_ToolTriangulatedShape::Normal (const TopoDS_Face& theFace,
|
|||||||
const TopoDS_Face aZeroFace = TopoDS::Face (theFace.Located (TopLoc_Location()));
|
const TopoDS_Face aZeroFace = TopoDS::Face (theFace.Located (TopLoc_Location()));
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aZeroFace);
|
Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aZeroFace);
|
||||||
const Standard_Real aTol = Precision::Confusion();
|
const Standard_Real aTol = Precision::Confusion();
|
||||||
Handle(TShort_HArray1OfShortReal) aNormals = new TShort_HArray1OfShortReal (1, aPolyTri->NbNodes() * 3);
|
Handle(TShort_HArray1OfShortReal) aNormals = new TShort_HArray1OfShortReal (1, theTris->NbNodes() * 3);
|
||||||
const Poly_Array1OfTriangle& aTriangles = aPolyTri->Triangles();
|
const Poly_Array1OfTriangle& aTriangles = theTris->Triangles();
|
||||||
const TColgp_Array1OfPnt2d* aNodesUV = aPolyTri->HasUVNodes() && !aSurf.IsNull()
|
const TColgp_Array1OfPnt2d* aNodesUV = theTris->HasUVNodes() && !aSurf.IsNull()
|
||||||
? &aPolyTri->UVNodes()
|
? &theTris->UVNodes()
|
||||||
: NULL;
|
: NULL;
|
||||||
Standard_Integer aTri[3];
|
Standard_Integer aTri[3];
|
||||||
const TColgp_Array1OfPnt& aNodes = aPolyTri->Nodes();
|
const TColgp_Array1OfPnt& aNodes = theTris->Nodes();
|
||||||
gp_Dir aNorm;
|
gp_Dir aNorm;
|
||||||
for (Standard_Integer aNodeIter = aNodes.Lower(); aNodeIter <= aNodes.Upper(); ++aNodeIter)
|
for (Standard_Integer aNodeIter = aNodes.Lower(); aNodeIter <= aNodes.Upper(); ++aNodeIter)
|
||||||
{
|
{
|
||||||
@ -162,6 +162,11 @@ void StdPrs_ToolTriangulatedShape::Normal (const TopoDS_Face& theFace,
|
|||||||
if (aNodesUV == NULL
|
if (aNodesUV == NULL
|
||||||
|| GeomLib::NormEstim (aSurf, aNodesUV->Value (aNodeIter), aTol, aNorm) > 1)
|
|| GeomLib::NormEstim (aSurf, aNodesUV->Value (aNodeIter), aTol, aNorm) > 1)
|
||||||
{
|
{
|
||||||
|
if (thePolyConnect.Triangulation() != theTris)
|
||||||
|
{
|
||||||
|
thePolyConnect.Load (theTris);
|
||||||
|
}
|
||||||
|
|
||||||
// compute flat normals
|
// compute flat normals
|
||||||
gp_XYZ eqPlan (0.0, 0.0, 0.0);
|
gp_XYZ eqPlan (0.0, 0.0, 0.0);
|
||||||
for (thePolyConnect.Initialize (aNodeIter); thePolyConnect.More(); thePolyConnect.Next())
|
for (thePolyConnect.Initialize (aNodeIter); thePolyConnect.More(); thePolyConnect.Next())
|
||||||
@ -185,7 +190,7 @@ void StdPrs_ToolTriangulatedShape::Normal (const TopoDS_Face& theFace,
|
|||||||
aNormals->SetValue (anId + 2, (Standard_ShortReal )aNorm.Y());
|
aNormals->SetValue (anId + 2, (Standard_ShortReal )aNorm.Y());
|
||||||
aNormals->SetValue (anId + 3, (Standard_ShortReal )aNorm.Z());
|
aNormals->SetValue (anId + 3, (Standard_ShortReal )aNorm.Z());
|
||||||
}
|
}
|
||||||
aPolyTri->SetNormals (aNormals);
|
theTris->SetNormals (aNormals);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -199,7 +204,7 @@ void StdPrs_ToolTriangulatedShape::Normal (const TopoDS_Face& theFace,
|
|||||||
const Handle(Poly_Triangulation)& aPolyTri = thePolyConnect.Triangulation();
|
const Handle(Poly_Triangulation)& aPolyTri = thePolyConnect.Triangulation();
|
||||||
if (!aPolyTri->HasNormals())
|
if (!aPolyTri->HasNormals())
|
||||||
{
|
{
|
||||||
Normal (theFace, thePolyConnect);
|
ComputeNormals (theFace, aPolyTri, thePolyConnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TColgp_Array1OfPnt& aNodes = aPolyTri->Nodes();
|
const TColgp_Array1OfPnt& aNodes = aPolyTri->Nodes();
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#ifndef _StdPrs_ToolTriangulatedShape_HeaderFile
|
#ifndef _StdPrs_ToolTriangulatedShape_HeaderFile
|
||||||
#define _StdPrs_ToolTriangulatedShape_HeaderFile
|
#define _StdPrs_ToolTriangulatedShape_HeaderFile
|
||||||
|
|
||||||
|
#include <Poly_Connect.hxx>
|
||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <Prs3d_Drawer.hxx>
|
#include <Prs3d_Drawer.hxx>
|
||||||
#include <Standard.hxx>
|
#include <Standard.hxx>
|
||||||
@ -42,9 +43,22 @@ public:
|
|||||||
//! Computes nodal normals for Poly_Triangulation structure using UV coordinates and surface.
|
//! Computes nodal normals for Poly_Triangulation structure using UV coordinates and surface.
|
||||||
//! Does nothing if triangulation already defines normals.
|
//! Does nothing if triangulation already defines normals.
|
||||||
//! @param theFace [in] the face
|
//! @param theFace [in] the face
|
||||||
//! @param thePolyConnect [in] the definition of a face triangulation
|
//! @param theTris [in] the definition of a face triangulation
|
||||||
Standard_EXPORT static void Normal (const TopoDS_Face& theFace,
|
static void ComputeNormals (const TopoDS_Face& theFace,
|
||||||
Poly_Connect& thePolyConnect);
|
const Handle(Poly_Triangulation)& theTris)
|
||||||
|
{
|
||||||
|
Poly_Connect aPolyConnect;
|
||||||
|
ComputeNormals (theFace, theTris, aPolyConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Computes nodal normals for Poly_Triangulation structure using UV coordinates and surface.
|
||||||
|
//! Does nothing if triangulation already defines normals.
|
||||||
|
//! @param theFace [in] the face
|
||||||
|
//! @param theTris [in] the definition of a face triangulation
|
||||||
|
//! @param thePolyConnect [in,out] optional, initialized tool for exploring triangulation
|
||||||
|
Standard_EXPORT static void ComputeNormals (const TopoDS_Face& theFace,
|
||||||
|
const Handle(Poly_Triangulation)& theTris,
|
||||||
|
Poly_Connect& thePolyConnect);
|
||||||
|
|
||||||
//! Evaluate normals for a triangle of a face.
|
//! Evaluate normals for a triangle of a face.
|
||||||
//! @param theFace [in] the face.
|
//! @param theFace [in] the face.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user